New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sys-apps/portage: Install dist-info #35647
sys-apps/portage: Install dist-info #35647
Conversation
Pull Request assignmentSubmitter: @zmedico sys-apps/portage: @gentoo/portage Linked bugsBugs linked: 920330 In order to force reassignment and/or bug reference scan, please append Docs: Code of Conduct ● Copyright policy (expl.) ● Devmanual ● GitHub PRs ● Proxy-maint guide |
928a7fa
to
baed9cc
Compare
Pull request CI reportReport generated at: 2024-03-07 06:17 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As previously mentioned on the linked ticket:
Believe it or not, this was enough to satisfy pip check:
/usr/lib/python3.12/site-packages/portage-3.0.58.dist-info/METADATA
Metadata-Version: 2.1 Name: portage Version: 3.0.58
So we could easily just write that out as part of the regular Portage build with some of the other fields for good measure.
sys-apps/portage/portage-9999.ebuild
Outdated
python_foreach_impl my_src_install | ||
distutils-r1_src_install | ||
# TODO: Add a setup arg to exclude this stuff. | ||
rm -rf "${ED}/usr/"{bin,sbin,etc,lib/portage/bin} || die | ||
# Omit excluded files that begin with ../ from RECORD files. | ||
find "${ED}" -name RECORD | xargs sed -e '/^\.\.\//d' -i || die | ||
BUILD_DIR="${S}-meson" python_foreach_impl my_src_install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like this is trying very hard to hack how distutils works, simply to acquire the *.dist-info/ directory itself.
What is RECORD needed for here, anyways? Other than nothing. It's essentially pip trying to duplicate a vdb CONTENTS except not very well. It's even optional, per the spec -- in fact, all files in there are optional, other than METADATA.
The RECORD file is actually bad to have. It exists solely for pip to know how to uninstall the package using pip uninstall
which obviously must never happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's true. I've changed it to delete both the RECORD and entry_points.txt files (entry_points.txt refers to some entry points that do not all exist in the system-wide context).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like extending a hacky reinvention of
distutils-r1
logic in puremeson
with hacky combination ofdistutils-r1
logic with previous hacky reinvention. Can't you just useDISTUTILS_ARGS
(i.e. effectively meson args), to make meson do what you need it to do in PEP517 mode?
My understanding is that we can't install anything outside of sys.prefix in PEP517 mode (/usr on gentoo), so that would not account for installation of files into /etc. I suppose we could just use basic insinto and doins for /etc files though. How does that sound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That, or just install them as usual and then mv
in ebuild (that's how we deal with it in other packages).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just use basic insinto / doins for a METADATA file.
Actually possibly you could use install_data inside portage's own meson.build for this...
The only trick here is what information to include. There is very little metadata required to register a package with pip
, most stuff -- like keywords and classifiers and license/author info -- is purely informative and intended for display on https://pypi.org
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer Eli's idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also like Eli's idea to generate a METADATA file and install it with install_data, and we can use the path from get_install_dir to generate the install_data install_dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baed9cc
to
f9c8c8c
Compare
Pull request CI reportReport generated at: 2024-03-07 06:32 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
Use distutils-r1 for PEP517 mode to generate dist-info. Use the meson build for system-wide install mode which overwrites files from the PEP517 build (we want at least installation.py to come from the system-wide mode since that controls evaluation of paths in the portage.const module). For now, manually remove redundant files generated by the PEP517 build, and also omit undesirable RECORD and entry_points.txt files from dist-info. Bug: https://bugs.gentoo.org/920330 Signed-off-by: Zac Medico <zmedico@gentoo.org>
f9c8c8c
to
06f8343
Compare
Pull request CI reportReport generated at: 2024-03-07 07:02 UTC There are existing issues already. Please look into the report to make sure none of them affect the packages in question: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like extending a hacky reinvention of distutils-r1
logic in pure meson
with hacky combination of distutils-r1
logic with previous hacky reinvention. Can't you just use DISTUTILS_ARGS
(i.e. effectively meson args), to make meson do what you need it to do in PEP517 mode?
Closed in favor of gentoo/portage#1303. |
Use distutils-r1 for PEP517 mode to generate dist-info.
Use the meson build for system-wide install mode which overwrites files from the PEP517 build (we want at least installation.py to come from the system-wide mode since that controls evaluation of paths in the portage.const module).
For now, manually remove redundant files generated by the PEP517 build, and also omit these excluded files from dist-info RECORD files where a ../ prefix easily identifies them.
Bug: https://bugs.gentoo.org/920330