Open JanZerebecki opened 4 days ago
The file I import is cockpit-316-2.1.src.rpm
, which has the following content:
< test_data/cockpit-316-2.1.src.rpm bsdtar -c @- | tar tv
The reason most of these are not picked up is because .tgz
is currently not recognized:
The .src.rpm doesn't seem to contain a .obscpio
.
(I'm happy to take patches for this, there's also code that recognizes .tgz
at a different file):
I'd also happily take code that is able to detect compression from the magic bytes of a byte stream instead of guessing based on file extensions.
Ah! Forgot that there is a transformation step after the source to what is in the .src.rpm. So in this case the .obscpio becomes a tar without any compression.
There was a quick fix for that: https://github.com/kpcyrd/what-the-src/pull/30
But it still skips a lot of files, it should probably instead still record the file and its hash, even if it can not extract it. Some are just not to be extracted, but still recorded instead of skipped, like package-lock.json and .patch files from the above list.
https://github.com/kpcyrd/what-the-src/issues/6#issue-2248797272 indicated there might be a problem with some cpio. But if not it could be solved similarly with bsdtar. Might still be used in some files in other packages.
Thanks, I've merged and deployed the patch.
For package-lock.json
you can have a look at the code over here:
Although failure to parse the package-lock.json
shouldn't cause the tar import to stop/fail.
For patch files there's currently no way to track them.
That is unwieldy, a package-version.src.rpm as an artifact to contain them is better similar to what was said in https://github.com/kpcyrd/what-the-src/pull/31#issuecomment-2206352691 .
It is also a bug in that package source, it is not supposed to put the extracted npm module source archives there in addition to into the vendor.tar.
Which brings us to: We need recursion for archives.
.obscpio is sometimes used in openSUSE sources. E.g. https://whatsrc.org/search?q=cockpit does not list cockpit-316.obscpio from https://build.opensuse.org/package/show/openSUSE:Factory/cockpit