1 |
Author: zmedico |
2 |
Date: 2009-03-23 00:44:23 +0000 (Mon, 23 Mar 2009) |
3 |
New Revision: 13148 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/ebuild |
7 |
main/trunk/bin/ebuild.sh |
8 |
Log: |
9 |
Make ebuild(1) detect ebuild/eclass changes and automatically source the |
10 |
ebuild atain in this case (even though $T/environment may already exist). |
11 |
This should help avoid confusion by ensuring that the latest changes to |
12 |
the ebuild/eclasses are reflected in the environment. |
13 |
|
14 |
|
15 |
Modified: main/trunk/bin/ebuild |
16 |
=================================================================== |
17 |
--- main/trunk/bin/ebuild 2009-03-22 23:54:49 UTC (rev 13147) |
18 |
+++ main/trunk/bin/ebuild 2009-03-23 00:44:23 UTC (rev 13148) |
19 |
@@ -195,13 +195,20 @@ |
20 |
tmpsettings.backup_changes("EBUILD_SKIP_MANIFEST") |
21 |
portage._doebuild_manifest_exempt_depend += 1 |
22 |
|
23 |
+# If the current metadata is invalid then force the ebuild to be |
24 |
+# sourced again even if $T/environment already exists. |
25 |
+ebuild_changed = False |
26 |
+metadata, st, emtime = \ |
27 |
+ portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir) |
28 |
+if metadata is None: |
29 |
+ ebuild_changed = True |
30 |
+ |
31 |
build_dir_phases = set(["setup", "unpack", "prepare", "configure", "compile", |
32 |
"test", "install", "package", "rpm"]) |
33 |
|
34 |
def stale_env_warning(): |
35 |
if "clean" not in pargs and \ |
36 |
"noauto" not in tmpsettings.features and \ |
37 |
- tmpsettings.get("PORTAGE_QUIET") != "1" and \ |
38 |
build_dir_phases.intersection(pargs): |
39 |
portage.doebuild_environment(ebuild, "setup", portage.root, |
40 |
tmpsettings, debug, 1, portage.portdb) |
41 |
@@ -215,6 +222,10 @@ |
42 |
for x in msg: |
43 |
portage.writemsg(">>> %s\n" % x) |
44 |
|
45 |
+ if ebuild_changed: |
46 |
+ open(os.path.join(tmpsettings['PORTAGE_BUILDDIR'], |
47 |
+ '.ebuild_changed'), 'w') |
48 |
+ |
49 |
from portage.exception import PermissionDenied, \ |
50 |
PortagePackageException, UnsupportedAPIException |
51 |
checked_for_stale_env = False |
52 |
|
53 |
Modified: main/trunk/bin/ebuild.sh |
54 |
=================================================================== |
55 |
--- main/trunk/bin/ebuild.sh 2009-03-22 23:54:49 UTC (rev 13147) |
56 |
+++ main/trunk/bin/ebuild.sh 2009-03-23 00:44:23 UTC (rev 13148) |
57 |
@@ -714,7 +714,7 @@ |
58 |
fi |
59 |
|
60 |
if [[ $EMERGE_FROM = binary ]] || ! hasq keepwork $FEATURES; then |
61 |
- rm -f "$PORTAGE_BUILDDIR"/.{exit_status,logid,unpacked,prepared} \ |
62 |
+ rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,exit_status,logid,unpacked,prepared} \ |
63 |
"$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} |
64 |
|
65 |
rm -rf "${PORTAGE_BUILDDIR}/build-info" |
66 |
@@ -1865,7 +1865,7 @@ |
67 |
if ! hasq "$EBUILD_PHASE" clean cleanrm && \ |
68 |
( |
69 |
hasq ${EBUILD_PHASE} depend || \ |
70 |
- [ ! -f "${T}"/environment ] || \ |
71 |
+ [[ ! -f $T/environment || -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \ |
72 |
hasq noauto ${FEATURES} |
73 |
) ; then |
74 |
# The bashrcs get an opportunity here to set aliases that will be expanded |
75 |
@@ -1881,6 +1881,8 @@ |
76 |
|
77 |
if [ "${EBUILD_PHASE}" != "depend" ] ; then |
78 |
RESTRICT=${PORTAGE_RESTRICT} |
79 |
+ [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \ |
80 |
+ rm "$PORTAGE_BUILDDIR/.ebuild_changed" |
81 |
fi |
82 |
|
83 |
# This next line is not the same as export RDEPEND=${RDEPEND:-${DEPEND}} |