Open hmaarrfk opened 5 years ago
I guess it would be fair to assume that RPM never have the typical root directory as is common for tarballs. Hence we can special-case the code for RPMs:
- if len(flist) == 1 and os.path.isdir(folder):
+ if not src_path.lower().endswith('.rpm') and len(flist) == 1 and os.path.isdir(folder):
hoist_single_extracted_folder(folder)
.rpm
s in https://github.com/conda/conda-build/blob/3.17.8/conda_build/utils.py#L788.The second suggestion might seem weird since it would create a folder just to remove it afterwards. If there is other code that uses conda_build.utils.tar_xf
and might expect an archive root directory, it might make sense to do the special-casing on a lower level, i.e., tar_xf
.
In the end, the choice of implementation comes down to where it seems more acceptable/maintainable to add ugly special handling stuff. I'll leave a PR for someone else to do as I'm not really experienced with the CDT workflow (and not keen to dig into test cases....).
(cc. @jakirkham, @msarahan, @mingwandroid)
Thanks for raising @hmaarrfk! Also thanks for digging into this, @mbargull.
Sounds like 1 would be better. Though I haven't thought too much about this yet. Let's see what @mingwandroid says.
Sounds like 1 would be better.
Yes, I'm inclined to agree since there is already the .whl
handling a few lines above at https://github.com/conda/conda-build/blob/3.17.8/conda_build/source.py#L153 => having them next to each other means less littering all over the place ^^.
Yeah, that's not good. I always disliked this aspect of CB.
I would rather we had a new metadata variable: source/strip_components
, which defaults to 1, but for CDTs we set explicitly to 0. Pinging @msarahan.
The name was stolen from tar. I think it's a reasonable choice.
I'm definitely in favor of more general solutions akin to a source/strip_components
. Thanks for the suggestion!
The name was stolen from tar. I think it's a reasonable choice.
It's not the clearest of names, however, I agree it's reasonable given packagers are usually familiar with tar
and as such may recognize it.
Hi there, thank you for your contribution!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.
If you would like this issue to remain open please:
NOTE: If this issue was closed prematurely, please leave a comment.
Thanks!
Let's keep this open
If a binary RPM only has one folder at the top level, say
./usr
, then conda build will remove that folder from the structure. But for RPMs, we thus loose the intended folder structure.Is there a way to stop top level folder stripping? Otherwise, maybe we can detect the intended folder structure and autodetect a fix like:
xref: https://github.com/conda-forge/staged-recipes/pull/8739#discussion_r300883633
Output of conda info