-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Allow staging installs to an alternate directory #1351
Comments
I don't like the clutter of the new option.
you're using If so, you're builder is supplying PATH (and knows the sys.prefix it's using to build with), so it has enough information to understand the absolute script paths in RECORD, and adjust them during the install. right? |
marking for v1.5 to agree on a solution. |
@bkabrda Could we handle this as a post-processing step on RECORD while still in the buildroot? That is, trawl through the installed RECORD file and strip the RPM_BUILD_ROOT prefix from the filenames? I guess the disadvantage is that it means we wouldn't be relying solely on pip as the build system at that point - we'd be relying on pip + the script that strips the prefixes, thus missing out on the decoupling benefit that Toshio and I were talking about at Flock. Perhaps, rather than a So for an RPM build, we'd use something like That approach would then cover any situation where the build/unpack location differed from the final installation location, rather than being limited to the specific case of a building a system wide install somewhere else and then moving it into place later the way RPM does. |
So to answer all the questions in one comment:
|
So this'll make things similar to --prefix and DESTDIR in a Makefile I suppose? |
It occurs to me that
I think that accurately reflects want we want to be able to do for RPM builds: tell pip to do the install in a particular location as normal, but also tell it to record the details in the metadata as if it was being done somewhere else. |
to be clear, what ends up in RECORD for a
i.e. buildroot + sys.prefix + bin/script and if we used --recorded-root=/recordroot, what I guess we want, is this?
if so, that seems fine I guess, but during the RPM build, you know where it's going to be installed for sure? question becomes whether this option should apply to |
|
One slight correction to @qwcode's comment. If the path in the build root is this:
Then with
Removing the "/usr/local/ part from the installation path within the build root is a separate question and already supported through --install-options - the proposed new option is solely about telling pip "yes, I'm telling you to install it here for now, but I'm going to move it somewhere else before I consider it fully installed". So to get the RECORD file entry from Marcus's comment, we'd have this:
|
If you're curious why RPM works this way, it's to make it easy to build on one machine and deploy on another - on the build machine, you really don't want to be installing into the system directories, but you want to be generating metadata as if you were, since that's where everything will end up on the target system. It's a step beyond the way wheels work - we include all the "install time" generated files in the archive as well. Explaining that actually made me realise something, though: the same |
I tried fiddling with various combinations of |
@ncoghlan I don't think that |
I think this should be bumped until 1.6, It's not really related to getting PEP453 implemented and it's a new feature in the RC. |
Yeah, with the rc already published, I agree this has missed the deadline |
Hey guys, just wanted to bump this. Unfortunately I have no time to provide a better patch for this, so I wanted to ask whether someone's planning to work on this for version 1.6. Thanks! |
related issue: #1716 |
I'm surprised these aren't all relative paths from the location of RECORD? Also in this case the RECORD file is not that useful. It would be helping you to pip-uninstall an rpm-installed package. |
Chiming back in on this since I want to get it in for pip 6.0. Our I think this is nicer than needing two flags, one to put it into a different directory, and another one to tell it that you really didn't mean to put it in that other directory. |
Oh, to be clear, I plan on implementing that tomorrow (Sunday). |
yes, make has DESTDIR, which is the functionality we want here, but I hesitate to take on that name, since people will chronically think its something that it's not, i.e. a way to just install to another location. Also, in case it's not clear, I'd expect |
+1 from me for "stagedir" or something along those lines - that's precisely the concept of the RPM buildroot, in that we're not installing on the current machine, just using it as a staging system to create the installed layout for inclusion in the built RPM. |
Yea I like the name |
This is probably not going to make it into 6.0, though it can probably make it into the one after that. I didn't have time to make the Sadly that means that @bkabrda will need to carry a patch for awhile longer.. Sorry about that! |
No problem @dstufft... and I actually like the --stage-dir idea better, too. So let's just go on with that! |
Could the title on this issue be updated to reflect the --stage-dir idea? |
Done. |
@dstufft Should I add this to the 10.0 milestone? |
I've labelled this issue as an "deferred till PR". This label is essentially for indicating that further discussion related to this issue should be deferred until someone comes around to make a PR. This does not mean that the said PR would be accepted - it has not been determined whether this is a useful change to pip and that decision has been deferred until the PR is made. |
Just a note: We (Fedora) still carry a patch for |
Hi, building: installing: resultant RECORD: |
From Fedora perspective, feel free to close this. As @PatrikKopkan says, the paths are relative. |
Thanks @hroncok. I'll leave this open to track ensuring there's a test covering this case and optionally identifying the commit introducing the behavior change. |
Great! |
Hi,
as noted in #991 (comment), I'm currently trying to adapt pip to be acceptable as a tool used to install wheels during RPM build. Apart from the mentioned issue, I also have one more problem:
During RPM build, we install the wheel into /somepath/BUILDROOT/package-1.2.3-1/. This turns out to be problematic with, since for entry_points/console_scripts, the whole path gets into wheel RECORD, e.g. /somepath/BUILDROOT/package-1.2.3-1/usr/bin/somebin. This is of course problem, since when the RPM gets installed, the file is in standard /usr/bin directory. Therefore I created a patch that adds "--strip-file-prefix " option to "pip install", that allows specifying arbitrary prefix path that will get strip from script paths. It's at my fork at https://github.com/bkabrda/pip/commit/aefacbb76661520415a1c35028f2984e70cfe0bf. Would this be acceptable for you? If not, is there a way to make it acceptable?
Thanks!
Edit: Later on in this thread we've settled on using --stage-dir to stage installations to a different directory.
The text was updated successfully, but these errors were encountered: