Skip to content

Conversation

kellyma2
Copy link

This change is derived from some pieces of #17 by refining the interface based on the comments and removing the tar implementation.

This lets us stream the contents as a CPIO archive in lieu of having
to get at the raw io.Reader to do this.

Signed-off-by: Michael Kelly <[email protected]>
This lets us do some simple interactions with the entry payload (read,
copy between streams, see if we have a payload) without needlessly
exposing the internal guts.

Signed-off-by: Michael Kelly <[email protected]>
@kellyma2
Copy link
Author

@mtharp can you take a look?

@mtharp
Copy link
Contributor

mtharp commented Mar 18, 2025

Hi,

Could you please elaborate on what your goal is? I am mostly trying to get away from directly surfacing the cpio implementation in the API, as using it correctly requires metadata from the RPM headers as well. If there is something you are trying to do that cannot be done through PayloadReaderExtended then I'd like to address it there, if possible.

@rmohr
Copy link

rmohr commented Jun 5, 2025

Hm, I have to check to remember, but I think I could not access all the attributes or streams in a way which allowed an easy translation from cpio to tar.

@rmohr
Copy link

rmohr commented Jun 5, 2025

@mtharp just played a little bit again with it. One reason is for instance that the header info exposed by the extended reader is completely different. Mapping the cpio header is very simple:

		tarHeader := &tar.Header{
			Name:       entry.Header.Filename(),
			Size:       entry.Header.Filesize64(),
			Mode:       int64(entry.Header.Mode()),
			Uid:        entry.Header.Uid(),
			Gid:        entry.Header.Gid(),
			ModTime:    time.Unix(int64(entry.Header.Mtime()), 0),
			Devmajor:   int64(entry.Header.Devmajor()),
			Devminor:   int64(entry.Header.Devminor()),
			PAXRecords: pax,
		}

The FileInfo is different. It does for instance collaps device major/minor, I don't know how to figure out if something is a hard link, ...

@rmohr
Copy link

rmohr commented Jun 5, 2025

Remember more now. The RPM header is different than the cpio header. I am not sure it has all info needed for a clean transformation. Like I don't see UID/GID and e.g. link types mentioned there ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants