View previous topic :: View next topic |
Author |
Message |
nagmat84 Guru

Joined: 27 Mar 2007 Posts: 308
|
Posted: Wed Apr 23, 2025 9:13 am Post subject: How to interactively re-run an ebuild after modification? |
|
|
How do I call the install phase of an ebuild after is has been modified without going through the compile phase again?
I am creating a custom ebuild and finally got after the compile phase. Compilation takes quite some time. Now I am debugging the installation phase. I know I can invoke the install phase with "ebuild <path-to-ebuild> istall". But it seems that Portage always uses the (old) version of the ebuild which also has been used to compile the project. How can I force Portage to use the updated version of the ebuild without going through the complete build phase again?
I observed that portage seems to cache a copy of the original ebuild at ${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/${P}/build-info/${PF}.ebuild. But even if I overwrite this copy with the updated version of the ebuild, Portage still uses the original one.
At the moment, the only option which works is to analyze the build problem, completely empty the Portage TMPDIR, fix the ebuild, re-run emerge from scratch and check the next error. This task is very slow for long-running builds. |
|
Back to top |
|
 |
logrusx Advocate


Joined: 22 Feb 2018 Posts: 2942
|
Posted: Wed Apr 23, 2025 9:59 am Post subject: |
|
|
nagmat84 wrote: | How do I call the install phase of an ebuild after is has been modified without going through the compile phase again? |
Code: | ebuild <ebuildfile> merge |
will merge the compiled package into the system.
Code: | ebuild <ebuildfile> install |
is the prior step where the compiled package is installed into a temporary dir named image before being merged into the system.
nagmat84 wrote: | I know I can invoke the install phase with "ebuild <path-to-ebuild> istall". But it seems that Portage always uses the (old) version of the ebuild which also has been used to compile the project. |
What you want to use is merge, not install.
nagmat84 wrote: | I observed that portage seems to cache a copy of the original ebuild at ${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/${P}/build-info/${PF}.ebuild. But even if I overwrite this copy with the updated version of the ebuild, Portage still uses the original one. |
It will cache it only after merge, so you're looking at a prior install.
nagmat84 wrote: | At the moment, the only option which works is to analyze the build problem, completely empty the Portage TMPDIR, fix the ebuild, re-run emerge from scratch and check the next error. This task is very slow for long-running builds. |
Again merge is what you need, not install.
Best Regards,
Georgi |
|
Back to top |
|
 |
nagmat84 Guru

Joined: 27 Mar 2007 Posts: 308
|
Posted: Wed Apr 23, 2025 10:04 am Post subject: |
|
|
logrusx wrote: | nagmat84 wrote: | How do I call the install phase of an ebuild after is has been modified without going through the compile phase again? |
Code: | ebuild <ebuildfile> install |
is the prior step where the compiled package is installed into a temporary dir named image before being merged into the system. |
But this is exactly what I am trying to debug. I am currently working on the ebuild function "src_install" which is expected to copy all necessary files into the directory ${D} and which points to ${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/${P}/image. |
|
Back to top |
|
 |
Anon-E-moose Watchman


Joined: 23 May 2008 Posts: 6262 Location: Dallas area
|
Posted: Wed Apr 23, 2025 10:52 am Post subject: |
|
|
typical steps (that I do) when using ebuild instead of emerge
clean -- if anything already unpacked
configure -- does unpack if not already done
compile
install -- create image of what would be merged
qmerge -- put image into live filesystem
from ebuild man page
Code: | qmerge This function installs all the files in the install directory to the live filesystem. The process
works as follows: first, the pkg_preinst() function (if specified) is run. Then, the files are merged
into the live filesystem, and the installed files' checksums are recorded in /var/db/pkg/${CATE‐
GORY}/${PN}-${PVR}/CONTENTS. After all the files have been merged, the pkg_postinst() function (if
specified) is executed.
merge Normally, to merge an ebuild, you need to fetch, unpack, compile, install and qmerge. If you're sim‐
ply interested in merging the ebuild, you can use this command, which will perform all these steps for
you, stopping along the way if a particular step doesn't complete successfully. |
_________________ UM780, 6.12 zen kernel, gcc 13, openrc, wayland |
|
Back to top |
|
 |
nagmat84 Guru

Joined: 27 Mar 2007 Posts: 308
|
Posted: Wed Apr 23, 2025 11:05 am Post subject: |
|
|
I believe you don't get it. I know the individual commands. THAT IS NOT MY PROBLEM. Here is what I do step-by-step:
- Do some coding in "src_install" of my custom ebuild
- Run "emerge --oneshot <custom package>"
The compile phase succeeds, but emerge bails out in the installation phase, because I did something stupid in the ebuild file
- Do some more coding in "src_install" of my custom ebuild to hopefully fix the problem
- Run "ebuild <path to my custom ebuild> install"
I want to repeat the install phase in order to check whether I have fixed the problem without re-running the compilation phase However, in step 4 Portage still uses the previous version of the ebuild, i.e. the same version which has also been used for step 2 and hence I cannot check whether my potential fix works. The only way how I can check whether the fix works is to completely empty the Portage TMPDIR and start the entire build process from the beginning, although I only want to debug the install phase.
Yes, I can run "ebuild <ebuild file> clean" to remove unpacked stuff, yes, I can run "ebuild <ebuild compile>" to compile again. But this is exactly, what I DO NOT want. I only want to repeat the install phase using the edited ebuild file without repeating every step which comes before that. But somewhere Portage seems to cache the previous version of the ebuild and I do not understand where, because Portage still uses the original version of the ebuild even if I replace the copy of the ebuild at the one location I have already found inside the working dir. |
|
Back to top |
|
 |
logrusx Advocate


Joined: 22 Feb 2018 Posts: 2942
|
Posted: Wed Apr 23, 2025 11:35 am Post subject: |
|
|
nagmat84 wrote: |
But this is exactly what I am trying to debug. I am currently working on the ebuild function "src_install" which is expected to copy all necessary files into the directory ${D} and which points to ${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/${P}/image. |
OK, since install has broader meaning I took it to mean the final product of the emerge process.
No, the ebuild in /var/db/pkg appears only after a successful merge and it's not what's getting executed. What's being executed i the file you pass to ebuild command. The contents of /var/db/pkg are the result of an earlier merge, perhaps one that didn't actually merge any files into the system but only the ebuild into the db.
There are hidden files resembling the names of the phases, for example .configured, .setuped and so on, I believe there should be .installed. Find where they are in the package temp dir. Delete the corresponding one and I think it's not even necessary to delete the image directory, although you might want to make sure it's running clean by deleting it. Maybe try without deleting it and see what is the outcome.
Also you can post the error message, so that we can see it. It would be way easier to help you if we spot something familiar.
Best Regards,
Georgi |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2116
|
Posted: Wed Apr 23, 2025 12:42 pm Post subject: |
|
|
nagmat84 wrote: | How do I call the install phase of an ebuild after is has been modified without going through the compile phase again? |
The short answer is: you can't.
The longer answer is: you can, but it wont be used, so you have to modify the environment file in the build's temp directory with the same change. Portage will only create this once the initial setup occurs to avoid corruption from outside changes to ebuilds and eclasses. |
|
Back to top |
|
 |
Chiitoo Administrator


Joined: 28 Feb 2010 Posts: 2778 Location: Here and Away Again
|
Posted: Wed Apr 23, 2025 5:24 pm Post subject: |
|
|
As a kind-of-a workaround, depending on the the build, 'ccache' might help with making the compile phase at least a bit more tolerable-like.
I suppose one could also cheat by copying previously built sources in before the compile phase... _________________ Kindest of regardses. |
|
Back to top |
|
 |
logrusx Advocate


Joined: 22 Feb 2018 Posts: 2942
|
Posted: Wed Apr 23, 2025 6:55 pm Post subject: |
|
|
grknight wrote: | nagmat84 wrote: | How do I call the install phase of an ebuild after is has been modified without going through the compile phase again? |
The short answer is: you can't.
The longer answer is: you can, but it wont be used, so you have to modify the environment file in the build's temp directory with the same change. Portage will only create this once the initial setup occurs to avoid corruption from outside changes to ebuilds and eclasses. |
Oh, I had forgotten about that. Once upon a time chromium couldn't resume after termination so I had to delete .setuped to make it recreate those and using FEATURES="keepwork" to prevent emerge from cleaning the temp directory.
I'm not sure if that would work, but it's worth a try. I'm also not sure how that would behave when invoked from ebuild command. Even if it works, then complete testing is necessary to confirm the changes to the ebuild actually work as intended.
Chiitoo wrote: | As a kind-of-a workaround, depending on the the build, 'ccache' might help with making the compile phase at least a bit more tolerable-like.
I suppose one could also cheat by copying previously built sources in before the compile phase... |
I had forgotten about that too. Maybe because ccache didn't give good results fro chromium and I dropped it, but my experience with this stuff revolved around salvaging tents of hours CPU time spent on chromium back when I had that ancient Core 2 Duo and there was no binhost.
Best Regards,
Georgi |
|
Back to top |
|
 |
John R. Graham Administrator


Joined: 08 Mar 2005 Posts: 10763 Location: Somewhere over Atlanta, Georgia
|
Posted: Wed Apr 23, 2025 11:58 pm Post subject: |
|
|
grknight wrote: | The short answer is: you can't. | And you shouldn't. The ebuild phase functions leave behind consequences (i.e., changes to the build environment). Tricking Portage into re-running a phase function thus doesn't have the guaranteed outcome you want: repeating the phase function in the exact state left behind by the compile phase.
Much better (and to elaborate just a bit on what Chiitoo said), why don't you run the ebuild up through the compile phase and then archive the /var/tmp/portage/${CATEGORY}/${P} directory? Then you can restore the exact pre-installed state of the build each time you want to re-run subsequent phases.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|