From d7465a1d22eb9c5ae688c3a2c3cea8d269dd5c1f Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 27 Sep 2008 16:14:37 +0000 Subject: [PATCH] Merged from trunk -r11544:11564 | 11545 | Use echo -e when splitting lines in e* functions, for | | zmedico | compatibility with previous behavior wrt \e escape codes | | | such as `elog "\e[31m***\e[0m"` for example. Thanks to | | | Arfrever for finding this solution. | | 11546 | Fix message: s/One or packages/One or more packages/. Thanks | | zmedico | to Marijn Schouten for reporting. | | 11547 | Ensure that cache modules always return a dict containing | | zmedico | the _eclasses_ key. | | 11548 | Fix mirror_cache() so it won't silently swallow a KeyError | | zmedico | if _mtime_ or _eclass_ happens to be missing from the cache | | | data for some reason. | | 11549 | Add PROPERTIES to portage.auxdbkeys since it's been approved | | zmedico | by the council. | | 11550 | Bump to EAPI 2. | | zmedico | | | 11551 | Rename the EAPI 2 docs and to indicate that they are no | | zmedico | longer a draft, and remove the EAPI 2_pre* docs. | | 11552 | Make flat_hash write keys in alphabetical order. | | zmedico | | | 11553 | Fix a potential IndexError inside display_preserved_libs(). | | zmedico | | | 11554 | Direct EOutput.eerror() and ewarn() output to stderr. | | zmedico | | | 11555 | Handle possible CacheError inside mirror_cache(). | | zmedico | | | 11556 | Add back code removed in r11553 and fix logic to avoid | | zmedico | IndexError. | | 11558 | Bug #238766 - Revert the fetch() mirror:// behavior change | | zmedico | from r11537 since it wasn't actually needed to comply with | | | PMS 9.2.8, and the change actuall caused incorrect mirror | | | fetching behavior. | | 11560 | Update hardcoded auxdbkey_order attributes to include | | zmedico | PROPERTIES. | | 11561 | Add PROPERTIES to all of the metadata caches. | | zmedico | | | 11562 | Add PROPERTIES to the list of USE evaluated keys for the | | zmedico | Packages index. | | 11563 | Make $PWD default to $PORTAGE_BUILDDIR since $WORKDIR is | | zmedico | sometimes created later. | | 11564 | In the --depclean docs, there's no need to advise the user | | zmedico | to use --oneshot when updating @system @world since @system | | | now has world-candidate set to False by default. | svn path=/main/branches/prefix/; revision=11572 --- bin/ebuild.sh | 10 +- bin/isolated-functions.sh | 12 +- bin/repoman | 5 +- doc/package/ebuild/eapi/2.docbook | 317 ++---------------------------- man/emerge.1 | 2 +- pym/_emerge/__init__.py | 16 +- pym/_emerge/help.py | 2 +- pym/portage/__init__.py | 12 +- pym/portage/cache/flat_hash.py | 19 +- pym/portage/cache/flat_list.py | 2 +- pym/portage/cache/metadata.py | 4 +- pym/portage/cache/sql_template.py | 4 + pym/portage/cache/sqlite.py | 2 + pym/portage/cache/template.py | 2 + pym/portage/cache/util.py | 14 +- pym/portage/const.py | 2 +- pym/portage/dbapi/bintree.py | 10 +- pym/portage/dbapi/porttree.py | 3 +- pym/portage/dbapi/vartree.py | 2 +- pym/portage/output.py | 4 +- 20 files changed, 92 insertions(+), 352 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index c40e9fc5d..27f579d01 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -272,8 +272,8 @@ register_die_hook() { export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} $*" } -# Ensure that $CWD is sane whenever possible. -cd "$WORKDIR" 2>/dev/null +# Ensure that $PWD is sane whenever possible. +cd "$PORTAGE_BUILDDIR" 2>/dev/null #if no perms are specified, dirs/files will have decent defaults #(not secretive, but not stupid) @@ -1031,7 +1031,7 @@ dyn_install() { for f in ASFLAGS CATEGORY CBUILD CC CFLAGS CHOST CTARGET CXX \ CXXFLAGS DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS \ - LICENSE PDEPEND PF PKGUSE PROVIDE RDEPEND RESTRICT SLOT \ + LICENSE PDEPEND PF PKGUSE PROPERTIES PROVIDE RDEPEND RESTRICT SLOT \ KEYWORDS HOMEPAGE SRC_URI DESCRIPTION; do [ -n "${!f}" ] && echo $(echo "${!f}" | \ tr '\n,\r,\t' ' , , ' | sed s/' \+'/' '/g) > ${f} @@ -2071,8 +2071,8 @@ ebuild_main() { auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE DESCRIPTION KEYWORDS INHERITED IUSE CDEPEND PDEPEND PROVIDE EAPI - UNUSED_01 UNUSED_02 UNUSED_03 UNUSED_04 UNUSED_05 UNUSED_06 - UNUSED_07" + PROPERTIES UNUSED_06 UNUSED_05 UNUSED_04 + UNUSED_03 UNUSED_02 UNUSED_01" #the extra $(echo) commands remove newlines unset CDEPEND diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 317e4360f..b222d5a4b 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -181,7 +181,7 @@ elog_base() { # not entirely safe to use it as a delimiter in the log file since # there can still be escaped newlines that will be expanded due to # the echo -e parameter. - echo "$@" | while read line ; do + echo -e "$@" | while read line ; do echo -ne "${messagetype} ${line}\n\0" >> \ "${T}/logging/${EBUILD_PHASE:-other}" done @@ -191,7 +191,7 @@ elog_base() { eqawarn() { elog_base QA "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo "$@" | while read line ; do + echo -e "$@" | while read line ; do vecho -e " ${WARN}*${NORMAL} ${line}" >&2 done LAST_E_CMD="eqawarn" @@ -201,7 +201,7 @@ eqawarn() { elog() { elog_base LOG "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo "$@" | while read line ; do + echo -e "$@" | while read line ; do echo -e " ${GOOD}*${NORMAL} ${line}" done LAST_E_CMD="elog" @@ -231,7 +231,7 @@ esyslog() { einfo() { elog_base INFO "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo "$@" | while read line ; do + echo -e "$@" | while read line ; do echo -e " ${GOOD}*${NORMAL} ${line}" done LAST_E_CMD="einfo" @@ -249,7 +249,7 @@ einfon() { ewarn() { elog_base WARN "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo "$@" | while read line ; do + echo -e "$@" | while read line ; do echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}${line}" >&2 done LAST_E_CMD="ewarn" @@ -259,7 +259,7 @@ ewarn() { eerror() { elog_base ERROR "$*" [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo - echo "$@" | while read line ; do + echo -e "$@" | while read line ; do echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}${line}" >&2 done LAST_E_CMD="eerror" diff --git a/bin/repoman b/bin/repoman index 6c7b80374..a567a2455 100755 --- a/bin/repoman +++ b/bin/repoman @@ -533,9 +533,8 @@ setconfig = load_default_config(repoman_settings, trees["/"]) root_config = RootConfig(repoman_settings, trees["/"], setconfig) # We really only need to cache the metadata that's necessary for visibility # filtering. Anything else can be discarded to reduce memory consumption. -for k in ("DEPEND", "LICENCE", "PDEPEND", - "PROVIDE", "RDEPEND", "RESTRICT", "repository"): - portdb._aux_cache_keys.discard(k) +portdb._aux_cache_keys.clear() +portdb._aux_cache_keys.update(["EAPI", "KEYWORDS", "SLOT"]) # dep_zapdeps looks at the vardbapi, but it shouldn't for repoman. del trees["/"]["vartree"] diff --git a/doc/package/ebuild/eapi/2.docbook b/doc/package/ebuild/eapi/2.docbook index ef1038b40..849d29857 100644 --- a/doc/package/ebuild/eapi/2.docbook +++ b/doc/package/ebuild/eapi/2.docbook @@ -1,289 +1,10 @@ -
- EAPI 2_pre1 +
+ EAPI 2
Helpers
doman - - Language codes in file names are now used for path translation. - - Man Page Path Translation - - - - - - Source - Destination - - - - - foo.1 - /usr/share/man/man1/foo.1 - - - foo.lang.1 - /usr/share/man/lang/man1/foo.1 - - - -
-
-
-
- USE Dependencies -
- Unconditional USE Dependencies - Syntax Examples - - - - - - Example - Meaning - - - - - foo[bar] - foo must have bar enabled - - - foo[bar,baz] - foo must have both bar and baz enabled - - - foo[-bar,baz] - foo must have bar disabled and baz enabled - - - -
-
-
- Conditional USE Dependencies - Syntax Examples - - - - - - Compact Form - Equivalent Expanded Form - - - - - foo[bar?] - bar? ( foo[bar] ) !bar? ( foo ) - - - foo[!bar?] - bar? ( foo ) !bar? ( foo[-bar] ) - - - foo[bar=] - bar? ( foo[bar] ) !bar? ( foo[-bar] ) - - - foo[!bar=] - bar? ( foo[-bar] ) !bar? ( foo[bar] ) - - - -
-
-
-
-
- EAPI 2_pre2 -
- Phases -
- New src_configure Phase Function - - The configure portion of the src_compile function has been - split into a separate function which is named src_configure. The - src_configure function is called in-between the src_unpack and - src_compile functions. - - -src_configure() { - if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then - econf - fi -} - -src_compile() { - if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ] ; then - emake || die "emake failed" - fi -} - - Execution Order of Phase Functions - - - - - Phase Function Name - - - - - pkg_setup - - - src_unpack - - - src_configure - - - src_compile - - - src_test - - - src_install - - - pkg_preinst - - - pkg_postinst - - - pkg_prerm - - - pkg_postrm - - - -
-
-
- Default Phase Functions - - The default pkg_nofetch and src_* phase functions are now - accessible via a function having a name - that begins with default_ and - ends with the respective phase function name. For example, - a call to a function with the name default_src_compile is - equivalent to a call to the default src_compile - implementation. - - Default Phase Functions - - - - - Function Name - - - - - default_pkg_nofetch - - - default_src_unpack - - - default_src_configure - - - default_src_compile - - - default_src_test - - - -
-
-
- Default Phase Function Alias - - A function named "default" is redefined for each phase so that it - will call the default_* function corresponding to the current phase. - For example, a call to the function named "default" during the - src_compile phase is equivalent to a call to the function named - default_src_compile. - -
-
-
-
- EAPI 2_pre3 -
- Metadata -
- Dependencies -
- Blocker Atoms -
- New Meaning for Old Syntax - - Blocker atoms which use the previously existing !atom syntax now have - a slightly different meaning. These blocker atoms indicate that - conflicting packages may be temporarily installed simultaneously. When - temporary simultaneous installation of conflicting packages occurs, the - installation of a newer package may overwrite any colliding files that - belong to an older package which is explicitly blocked. When such file - collisions occur, the colliding files cease to belong to the older - package, and they remain installed after the older package is - eventually uninstalled. The older package is uninstalled only after - any newer blocking packages have been merged on top of it. - -
-
- New !!atom Syntax - - A new !!atom syntax is now supported, for use in special cases for which - temporary simultaneous installation of conflicting packages should not be - allowed. If a given package happens to be blocked my a mixture of atoms - consisting of both the !atom and !!atom syntaxes, the !!atom syntax takes - precedence over the !atom syntax. - -
-
-
-
- SRC_URI -
- Customization of Output File Names - - A new syntax is supported which allows customization of the output - file name for a given URI. In order to customize the output file - name, a given URI should be followed by a "->" operator which, - in turn, should be followed by the desired output file name. As - usual, all tokens, including the operator and output file name, - should be separated by whitespace. - -
-
-
-
- Phases -
- New src_prepare Phase Function - - A new src_prepare function is called after the src_unpack - function, with cwd initially set to $S. - -
-
-
-
- EAPI 2 Draft -
- Helpers -
- doman -
+
Recognition of Language Codes in File Names Language codes in file names are now used for path translation. @@ -313,13 +34,13 @@ src_compile() {
-
+
Metadata -
+
Dependencies -
+
Blocker Atoms -
+
New Meaning for Old Syntax Blocker atoms which use the previously existing !atom syntax now have @@ -334,7 +55,7 @@ src_compile() { any newer blocking packages have been merged on top of it.
-
+
New !!atom Syntax A new !!atom syntax is now supported, for use in special cases for which @@ -345,9 +66,9 @@ src_compile() {
-
+
USE Dependencies -
+
Unconditional USE Dependencies Syntax Examples @@ -376,7 +97,7 @@ src_compile() {
-
+
Conditional USE Dependencies Syntax Examples @@ -411,9 +132,9 @@ src_compile() { -
+
SRC_URI -
+
Customization of Output File Names A new syntax is supported which allows customization of the output @@ -426,16 +147,16 @@ src_compile() {
-
+
Phases -
+
New src_prepare Phase Function A new src_prepare function is called after the src_unpack function, with cwd initially set to $S.
-
+
New src_configure Phase Function The configure portion of the src_compile function has been @@ -457,7 +178,7 @@ src_compile() { }
-
+
Execution Order of Phase Functions
Execution Order of Phase Functions @@ -505,7 +226,7 @@ src_compile() {
-
+
Default Phase Functions The default pkg_nofetch and src_* phase functions are now @@ -547,7 +268,7 @@ src_compile() {
-
+
Default Phase Function Alias A function named "default" is redefined for each phase so that it diff --git a/man/emerge.1 b/man/emerge.1 index a14cc615c..3da39a620 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -114,7 +114,7 @@ always be kept. They can be manually added to this set with \fIemerge \-\-noreplace \fR. As a safety measure, depclean will not remove any packages unless *all* required dependencies have been resolved. As a consequence, it is often necessary to run \fIemerge \-\-update \-\-newuse -\-\-deep \-\-oneshot @system @world\fR prior to depclean. +\-\-deep @system @world\fR prior to depclean. \fBWARNING:\fR Inexperienced users are advised to use \fB\-\-pretend\fR with this diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 081bd7e2a..947954967 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -1439,7 +1439,7 @@ class Package(Task): "CHOST", "COUNTER", "DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND", - "repository", "RESTRICT", "SLOT", "USE", "_mtime_", "EPREFIX" ] + "repository", "PROPERTIES", "RESTRICT", "SLOT", "USE", "_mtime_", "EPREFIX" ] def __init__(self, **kwargs): Task.__init__(self, **kwargs) @@ -10086,7 +10086,7 @@ class Scheduler(PollScheduler): if e is not None: mydepgraph.display_problems() out = portage.output.EOutput() - out.eerror("One or packages are either masked or " + \ + out.eerror("One or more packages are either masked or " + \ "have missing dependencies:") out.eerror("") indent = " " @@ -10935,10 +10935,12 @@ def display_preserved_libs(vardbapi): owners = vardbapi._owners.getFileOwnerMap(consumers[:MAX_DISPLAY+2]) for c in consumers[:MAX_DISPLAY]: print colorize("WARN", " * ") + " used by %s (%s)" % (c, ", ".join([x.mycpv for x in owners[c]])) - if len(consumers) > MAX_DISPLAY + 1: + if len(consumers) == MAX_DISPLAY + 1: + print colorize("WARN", " * ") + " used by %s (%s)" % \ + (consumers[MAX_DISPLAY], ", ".join( + x.mycpv for x in owners[consumers[MAX_DISPLAY]])) + elif len(consumers) > MAX_DISPLAY: print colorize("WARN", " * ") + " used by %d other files" % (len(consumers) - MAX_DISPLAY) - else: - print colorize("WARN", " * ") + " used by %s (%s)" % (consumers[MAX_DISPLAY], ", ".join([x.mycpv for x in owners[consumers[MAX_DISPLAY]]])) print "Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries" @@ -11997,7 +11999,7 @@ def action_depclean(settings, trees, ldpath_mtimes, msg.append("unless *all* required dependencies have been resolved. As a\n") msg.append("consequence, it is often necessary to run %s\n" % \ good("`emerge --update")) - msg.append(good("--newuse --deep --oneshot @system @world`") + \ + msg.append(good("--newuse --deep @system @world`") + \ " prior to depclean.\n") if action == "depclean" and "--quiet" not in myopts and not myfiles: @@ -12805,7 +12807,7 @@ def action_build(settings, trees, mtimedb, out.eerror("") if isinstance(e, depgraph.UnsatisfiedResumeDep): - out.eerror("One or packages are either masked or " + \ + out.eerror("One or more packages are either masked or " + \ "have missing dependencies:") out.eerror("") indent = " " diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 5c7b0d6e6..05a9803c9 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -79,7 +79,7 @@ def help(myaction,myopts,havecolor=1): "emerge --noreplace . As a safety measure, depclean " + \ "will not remove any packages unless *all* required dependencies " + \ "have been resolved. As a consequence, it is often necessary to " + \ - "run emerge --update --newuse --deep --oneshot @system @world " + \ + "run emerge --update --newuse --deep @system @world " + \ "prior to depclean." for line in wrap(paragraph, desc_width): diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 3a002179b..51a8cb668 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3528,13 +3528,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", eidx = myuri.find("/", 9) if eidx != -1: mirrorname = myuri[9:eidx] - if myfile != os.path.basename(myuri): - # If a SRC_URI arrow is used together with - # mirror://, preserve the remote path that's - # specified within the uri. - path = myuri[eidx+1:] - else: - path = myfile + path = myuri[eidx+1:] # Try user-defined mirrors first if mirrorname in custommirrors: @@ -6891,8 +6885,8 @@ auxdbkeys=[ 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'KEYWORDS', 'INHERITED', 'IUSE', 'CDEPEND', 'PDEPEND', 'PROVIDE', 'EAPI', - 'UNUSED_01', 'UNUSED_02', 'UNUSED_03', 'UNUSED_04', - 'UNUSED_05', 'UNUSED_06', 'UNUSED_07', + 'PROPERTIES', 'UNUSED_06', 'UNUSED_05', 'UNUSED_04', + 'UNUSED_03', 'UNUSED_02', 'UNUSED_01', ] auxdbkeylen=len(auxdbkeys) diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index ed1eebd12..219a4a22d 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -16,7 +16,9 @@ class database(fs_template.FsBased): super(database,self).__init__(*args, **config) self.location = os.path.join(self.location, self.label.lstrip(os.path.sep).rstrip(os.path.sep)) - + write_keys = set(self._known_keys) + write_keys.add("_eclasses_") + self._write_keys = sorted(write_keys) if not self.readonly and not os.path.exists(self.location): self._ensure_dirs() @@ -46,6 +48,8 @@ class database(fs_template.FsBased): raise cache_errors.CacheCorruption(cpv, e) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} return d for x in self._known_keys: @@ -71,13 +75,14 @@ class database(fs_template.FsBased): else: raise cache_errors.CacheCorruption(cpv, e) - for k, v in values.iteritems(): - if not v: - continue - if k != "_mtime_" and (k == "_eclasses_" or k in self._known_keys): + try: + for k in self._write_keys: + v = values.get(k) + if not v: + continue myf.write("%s=%s\n" % (k, v)) - - myf.close() + finally: + myf.close() self._ensure_access(fp, mtime=values["_mtime_"]) #update written. now we move it. diff --git a/pym/portage/cache/flat_list.py b/pym/portage/cache/flat_list.py index d3e480f96..65983393f 100644 --- a/pym/portage/cache/flat_list.py +++ b/pym/portage/cache/flat_list.py @@ -11,7 +11,7 @@ class database(fs_template.FsBased): auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI', 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'KEYWORDS', 'IUSE', 'CDEPEND', - 'PDEPEND', 'PROVIDE','_eclasses_') + 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES') def __init__(self, label, auxdbkeys, **config): super(database,self).__init__(label, auxdbkeys, **config) diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py index c32cffe57..521d71ac1 100644 --- a/pym/portage/cache/metadata.py +++ b/pym/portage/cache/metadata.py @@ -18,7 +18,7 @@ class database(flat_hash.database): auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI', 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'KEYWORDS', 'INHERITED', 'IUSE', 'CDEPEND', - 'PDEPEND', 'PROVIDE', 'EAPI') + 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES') autocommits = True @@ -66,6 +66,8 @@ class database(flat_hash.database): if "INHERITED" in d: d["_eclasses_"] = self.ec.get_eclass_data(d["INHERITED"].split(), from_master_only=True) del d["INHERITED"] + else: + d["_eclasses_"] = {} elif isinstance(d["_eclasses_"], basestring): # We skip this if flat_hash.database._parse_data() was called above # because it calls reconstruct_eclasses() internally. diff --git a/pym/portage/cache/sql_template.py b/pym/portage/cache/sql_template.py index 196039c74..fe873c3ea 100644 --- a/pym/portage/cache/sql_template.py +++ b/pym/portage/cache/sql_template.py @@ -238,6 +238,8 @@ class SQLDatabase(template.database): d = dict(l) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} yield cpv, d l.clear() oldcpv = x @@ -246,6 +248,8 @@ class SQLDatabase(template.database): d = dict(l) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} yield cpv, d def commit(self): diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py index dae9d4c1d..a53e8172a 100644 --- a/pym/portage/cache/sqlite.py +++ b/pym/portage/cache/sqlite.py @@ -170,6 +170,8 @@ class database(fs_template.FsBased): pass #writemsg("%s: %s\n" % (cpv, str(e))) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} for x in self._known_keys: d.setdefault(x,'') return d diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py index 891a5821f..3cf8309dd 100644 --- a/pym/portage/cache/template.py +++ b/pym/portage/cache/template.py @@ -37,6 +37,8 @@ class database(object): d=self._getitem(cpv) if self.serialize_eclasses and "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"]) + elif "_eclasses_" not in d: + d["_eclasses_"] = {} return d def _getitem(self, cpv): diff --git a/pym/portage/cache/util.py b/pym/portage/cache/util.py index f256be76f..dafaed094 100644 --- a/pym/portage/cache/util.py +++ b/pym/portage/cache/util.py @@ -39,12 +39,16 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, trg = None try: trg = trg_cache[x] - if long(trg["_mtime_"]) == long(entry["_mtime_"]) and \ - eclass_cache.is_eclass_data_valid(trg["_eclasses_"]) and \ - set(trg["_eclasses_"]) == set(entry["_eclasses_"]): - write_it = False - except (cache_errors.CacheError, KeyError): + except (KeyError, cache_errors.CacheError): pass + else: + try: + if long(trg["_mtime_"]) == long(entry["_mtime_"]) and \ + eclass_cache.is_eclass_data_valid(trg["_eclasses_"]) and \ + set(trg["_eclasses_"]) == set(entry["_eclasses_"]): + write_it = False + except cache_errors.CacheError: + pass if trg and not write_it: """ We don't want to skip the write unless we're really sure that diff --git a/pym/portage/const.py b/pym/portage/const.py index d04ab0f4e..dcc23e792 100644 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@ -84,7 +84,7 @@ EBUILD_PHASES = ["setup", "unpack", "prepare", "configure", "package", "preinst", "postinst","prerm", "postrm", "nofetch", "config", "info", "other"] -EAPI = 1 +EAPI = 2 HASHING_BLOCKSIZE = 32768 MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"] diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index f926f9441..a9121ed79 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -33,7 +33,7 @@ class bindbapi(fakedbapi): # Selectively cache metadata in order to optimize dep matching. self._aux_cache_keys = set( ["CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS", - "LICENSE", "PDEPEND", "PROVIDE", + "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "EPREFIX"]) self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys) @@ -156,10 +156,13 @@ class binarytree(object): self._pkgindex_keys.update(["CPV", "MTIME", "SIZE"]) self._pkgindex_aux_keys = \ ["CHOST", "DEPEND", "DESCRIPTION", "EAPI", - "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", + "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "EPREFIX"] self._pkgindex_aux_keys = list(self._pkgindex_aux_keys) + self._pkgindex_use_evaluated_keys = \ + ("LICENSE", "RDEPEND", "DEPEND", + "PDEPEND", "PROPERTIES", "PROVIDE") self._pkgindex_header_keys = set(["ACCEPT_KEYWORDS", "CBUILD", "CHOST", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "FEATURES", "GENTOO_MIRRORS", "INSTALL_MASK", "SYNC", "USE", "EAPI", "EPREFIX"]) @@ -175,6 +178,7 @@ class binarytree(object): "LICENSE" : "", "PATH" : "", "PDEPEND" : "", + "PROPERTIES" : "", "PROVIDE" : "", "RDEPEND" : "", "RESTRICT": "", @@ -913,7 +917,7 @@ class binarytree(object): metadata["USE"] = " ".join(use) from portage.dep import paren_reduce, use_reduce, \ paren_normalize, paren_enclose - for k in "LICENSE", "RDEPEND", "DEPEND", "PDEPEND", "PROVIDE": + for k in self._pkgindex_use_evaluated_keys: try: deps = paren_reduce(metadata[k]) deps = use_reduce(deps, uselist=raw_use) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 33c8b52f2..8d3700741 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -172,6 +172,7 @@ class portdbapi(dbapi): # XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys # ~harring filtered_auxdbkeys = filter(lambda x: not x.startswith("UNUSED_0"), auxdbkeys) + filtered_auxdbkeys.sort() if secpass < 1: from portage.cache import metadata_overlay, volatile for x in self.porttrees: @@ -194,7 +195,7 @@ class portdbapi(dbapi): # Selectively cache metadata in order to optimize dep matching. self._aux_cache_keys = set( ["DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE", - "PDEPEND", "PROVIDE", "RDEPEND", "repository", + "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "RESTRICT", "SLOT"]) # Repoman modifies _aux_cache_keys, so delay _aux_cache_slot_dict diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 18a22bab7..3cade30f9 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1072,7 +1072,7 @@ class vardbapi(dbapi): self._aux_cache_keys = set( ["CHOST", "COUNTER", "DEPEND", "DESCRIPTION", "EAPI", "HOMEPAGE", "IUSE", "KEYWORDS", - "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND", + "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "RESTRICT" , "SLOT", "USE"]) self._aux_cache_obj = None self._aux_cache_filename = os.path.join(self.root, diff --git a/pym/portage/output.py b/pym/portage/output.py index 72ef34a25..d52063e25 100644 --- a/pym/portage/output.py +++ b/pym/portage/output.py @@ -503,7 +503,7 @@ class EOutput(object): @param msg: A very brief (shorter than one line) error message. @type msg: StringType """ - out = sys.stdout + out = sys.stderr if not self.quiet: if self.__last_e_cmd == "ebegin": out.write("\n") @@ -548,7 +548,7 @@ class EOutput(object): @param msg: A very brief (shorter than one line) warning message. @type msg: StringType """ - out = sys.stdout + out = sys.stderr if not self.quiet: if self.__last_e_cmd == "ebegin": out.write("\n") -- 2.26.2