Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 157369 - ebuild (1) doesn't fully clean the temp directories after the .ebuild file is touched
Summary: ebuild (1) doesn't fully clean the temp directories after the .ebuild file is...
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: High normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-06 14:28 UTC by Vlastimil Babka (Caster) (RETIRED)
Modified: 2006-12-17 23:27 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
run dyn_clean instead of just `rm -rf $WORKDIR`, but respect FEATURES=keepwork (really_clean.patch,1001 bytes, patch)
2006-12-07 02:14 UTC, Zac Medico
Details | Diff
clean ${T} in addition to ${WORKDIR}, but respect keepwork and keeptemp (more_clean.patch,1.21 KB, patch)
2006-12-07 21:09 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2006-12-06 14:28:15 UTC
Only workdir is recreated, but e.g temp stays (with saved environment and other temp files potentially afecting the ebuild), distdir symlinks stay (thus SRC_URI change is not taken into account). It should perform a full equivalent of 'ebuild foo.ebuild clean' when .ebuild is touched. Partial cleanup is no good.
As an possible enhancement, there could be a switch that would tell ebuild to ignore ebuild change completely and clean nothing (for small ebuild fixes that don't require full recompile etc).
Comment 1 Zac Medico gentoo-dev 2006-12-07 02:14:52 UTC
Created attachment 103526 [details, diff]
run dyn_clean instead of just `rm -rf $WORKDIR`, but respect FEATURES=keepwork

This patch runs the full dyn_clean() function but allows the ebuild mtime to be ignored if you have FEATURES=keepwork enabled (possibly overridden via the environment).  It passes a parameter to dyn_clean() that causes it to keep ${PORTAGE_BUILDDIR}/distdir intact so that the unpack phase can proceed normally.
Comment 2 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2006-12-07 07:54:47 UTC
It fails to remove stuff from image with "Permission denied" (but explicit ebuild foo clean works), maybe because the privileges are already dropped?
My FEATURES=autoconfig ccache collision-protect cvs distlocks parallel-fetch sandbox sfperms strict stricter userfetch userpriv usersandbox
Comment 3 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2006-12-07 07:59:45 UTC
Also, it doesn't recreate tempdir (which brokes epatch at least) and homedir (which I doesn't know what it's for :)
Comment 4 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-12-07 10:55:26 UTC
(In reply to comment #3)
> Also, it doesn't recreate tempdir (which brokes epatch at least) and homedir
> (which I doesn't know what it's for :)
> 

Afaik homedir is for when an ebuild writes to $HOME, which afaik is remapped during phases to homedir instead of portage's home.
Comment 5 Zac Medico gentoo-dev 2006-12-07 11:17:07 UTC
(In reply to comment #2)
> It fails to remove stuff from image with "Permission denied" (but explicit
> ebuild foo clean works), maybe because the privileges are already dropped?

I guess that code should really run on the python side, prior to the setup phase.  I'll see about migrating it over there.
Comment 6 Zac Medico gentoo-dev 2006-12-07 21:09:29 UTC
Created attachment 103603 [details, diff]
clean ${T} in addition to ${WORKDIR}, but respect keepwork and keeptemp

At the moment, for this particular case, it's not very easy to trigger a full clean phase on the python side for this without doing some significant refactoring or adding some ugly conditional logic.

This new patch will at least clean up ${T} and allow you to edit the ebuild without forcing recreation of WORKDIR if you have FEATURES=keepwork.  After looking at this some more, the whole thing seems a little too automatic to me.  I'm inclined to have the unpack phase die instead of do this automatic cleanup, but I'm no sure how users would feel about that.
Comment 7 Zac Medico gentoo-dev 2006-12-09 12:46:58 UTC
This is in svn r5244.
Comment 8 Zac Medico gentoo-dev 2006-12-09 20:52:19 UTC
This has been released in 2.1.2_rc3-r1.
Comment 9 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2006-12-10 17:09:03 UTC
Still got some problems, see this:

ebuild foo.ebuild compile
touch foo.ebuild
USE=doc ebuild foo.ebuild.compile

The doc flag isn't respected. My guess is that it reads the $T/environment before cleaning $T?
Comment 10 Zac Medico gentoo-dev 2006-12-10 19:20:26 UTC
(In reply to comment #9)
> Still got some problems, see this:
> 
> ebuild foo.ebuild compile
> touch foo.ebuild
> USE=doc ebuild foo.ebuild.compile
> 
> The doc flag isn't respected. My guess is that it reads the $T/environment
> before cleaning $T?
> 

Yes.  I think the best solution is to remove the automatic behavior completely and simply rely on the ${PORTAGE_BUILDDIR}/.unpacked like we do in most phases.  If the user has modified the ebuild, I think it should be their responsibility to run the clean phase if that's what they want.
Comment 11 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2006-12-11 02:49:19 UTC
OK. I've got used to prefix every command with "clean" already :/
Comment 12 Zac Medico gentoo-dev 2006-12-17 23:27:01 UTC
If you'll have to manually run clean anyway then there's nothing left to fix.  I'm sorry that the existing automatic behavior doesn't meet your needs.  Even though it's clearly broken as it is, I'd prefer not support such automatic behavior.