From: Fabian Groffen Date: Sun, 14 Jun 2009 08:33:46 +0000 (-0000) Subject: Merged from trunk -r13629:13639 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=32e9327086f7d778a91700344429343139e81e43;p=portage.git Merged from trunk -r13629:13639 | 13630 | Bug #272063 - Use elements inside elements. | | zmedico | | | 13631 | Remove element in invalid location. | | zmedico | | | 13632 | Fix non-empty elements. | | zmedico | | | 13633 | Bug #272063 - Remove elements that don't validate. | | zmedico | | | 13634 | Fix more elements to contain elements. | | zmedico | | | 13635 | propset svn:rev ON | | zmedico | | | 13636 | Remove unused newdepend(), newrdepend(), newpdepend(), and | | zmedico | do_newdepend() functions. Thanks to ABCD for reporting. | | 13637 | Bug #273020 - Document FEATURES=multilib-strict. Thanks to | | zmedico | Samuli Suominen for the patch. | | 13638 | Document FEATURES=python-trace. | | zmedico | | | 13639 | Prepare 117 messages to localization. | | arfrever | | svn path=/main/branches/prefix/; revision=13640 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 91a0ae51f..d81b6efd6 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1309,68 +1309,6 @@ EXPORT_FUNCTIONS() { eval $__export_funcs_var+=\" $*\" } -# adds all parameters to E_DEPEND and E_RDEPEND, which get added to DEPEND -# and RDEPEND after the ebuild has been processed. This is important to -# allow users to use DEPEND="foo" without frying dependencies added by an -# earlier inherit. It also allows RDEPEND to work properly, since a lot -# of ebuilds assume that an unset RDEPEND gets its value from DEPEND. -# Without eclasses, this is true. But with them, the eclass may set -# RDEPEND itself (or at least used to) which would prevent RDEPEND from -# getting its value from DEPEND. This is a side-effect that made eclasses -# have unreliable dependencies. - -newdepend() { - debug-print-function newdepend $* - debug-print "newdepend: E_DEPEND=$E_DEPEND E_RDEPEND=$E_RDEPEND" - - while [ -n "$1" ]; do - case $1 in - "/autotools") - do_newdepend DEPEND sys-devel/autoconf sys-devel/automake sys-devel/make - ;; - "/c") - do_newdepend DEPEND sys-devel/gcc virtual/libc - do_newdepend RDEPEND virtual/libc - ;; - *) - do_newdepend DEPEND $1 - ;; - esac - shift - done -} - -newrdepend() { - debug-print-function newrdepend $* - do_newdepend RDEPEND $1 -} - -newpdepend() { - debug-print-function newpdepend $* - do_newdepend PDEPEND $1 -} - -do_newdepend() { - # This function does a generic change determining whether we're in an - # eclass or not. If we are, we change the E_* variables for deps. - debug-print-function do_newdepend $* - [ -z "$1" ] && die "do_newdepend without arguments" - - # Grab what we're affecting... Figure out if we're affecting eclasses. - [[ ${ECLASS_DEPTH} > 0 ]] && TARGET="E_$1" - [[ ${ECLASS_DEPTH} > 0 ]] || TARGET="$1" - shift # $1 was a variable name. - - while [ -n "$1" ]; do - # This bit of evil takes TARGET and uses it to evaluate down to a - # variable. This is a sneaky way to make this infinately expandable. - # The normal translation of this would look something like this: - # E_DEPEND="${E_DEPEND} $1" :::::: Cool, huh? :) - eval export ${TARGET}=\"\${${TARGET}} \$1\" - shift - done -} - # this is a function for removing any directory matching a passed in pattern from # PATH remove_path_entry() { diff --git a/doc/config/sets.docbook b/doc/config/sets.docbook index dc26b1a0c..e50c85cc9 100644 --- a/doc/config/sets.docbook +++ b/doc/config/sets.docbook @@ -50,19 +50,21 @@ handler might be changed in future versions.. That option defines which handler class should be used to create the set. Other universal options available for single sets are: + - name (which is usually not needed as the name + name (which is usually not needed as the name of the set is generated from the section name if name - is missing) - world-candidate, which determines if - given package should be added to the world set - extend to include the contents of other package sets + is missing) + world-candidate, which determines if + given package should be added to the world set + extend to include the contents of other package sets - remove to remove the contents of other package sets + remove to remove the contents of other package sets - intersect to only include packages that are also - included in one or more other package sets + intersect to only include packages that are also + included in one or more other package sets + Some handler classes might require additional options for their configuration, these will be covered later in this chapter. @@ -150,7 +152,7 @@ For descriptive purposes the file can be accompanied by a file with the same name plus a .metadata suffix which can contain metadata sections for description, author, location and so on. Each section - has the form key: value where value + has the form key: value where value can contain multiple lines. Therefore sections have to be separated by blank lines. For example: @@ -168,36 +170,36 @@ Single Set Configuration In a single set configuration this class supports the following options: + - filename: Required. Specifies the path to the file - that should be used for the package set. - greedy: Optional, defaults to false. + filename: Required. Specifies the path to the file + that should be used for the package set. + greedy: Optional, defaults to false. Determines if atoms in the package should include all installed slots (when set to true) or if no slot expansion is wanted (when set to false). This option only affects packages that have multiple - slots available (e.g. sys-kernel/gentoo-sources). + slots available (e.g. sys-kernel/gentoo-sources). - Multi Set Configuration In a multi set configuration this class supports the following options: + - directory: Optional, defaults to + directory: Optional, defaults to /etc/portage/sets. Specifies the path to a directory containing package set files. For each file (excluding metadata files) in - that location a separate package set is created. + that location a separate package set is created. - name_pattern: Optional, defaults to + name_pattern: Optional, defaults to $name. This describes the naming pattern to be used for creating the sets. It must contain either $name or ${name}, which - will be replaced by the filename (without any directory components). + will be replaced by the filename (without any directory components). - @@ -216,35 +218,35 @@ Single Set Configuration In a single set configuration this class supports the following options: + - filename: See - StaticFileSet + filename: See + StaticFileSet - Multi Set Configuration In a multi set configuration this class supports the following options: + - directory: Optional, defaults to + directory: Optional, defaults to /etc/portage. Specifies the path to a directory containing one or more of the following portage configuration files: package.use, package.keywords, package.mask or package.unmask. - No other files in that directory will be used. + No other files in that directory will be used. - name_pattern: Optional, defaults to + name_pattern: Optional, defaults to package_$suffix. This describes the naming pattern to be used for creating the sets. It must contain either $suffix or ${suffix}, which will be replaced by the file suffix (e.g. - use or mask). + use or mask). - @@ -296,25 +298,25 @@ Single Set Configuration In single set configurations this class supports the following options: + - use_emerge_resolver: Optional, defaults to + use_emerge_resolver: Optional, defaults to false. This option determines which resolver strategy should be used for the set atoms. When set to true, it will use the default emerge algorithm and use the highest visible version that matches the GLSA. If set to false it will use the default glsa-check algorithm and use the lowest version that matches the GLSA and is - higher than the currently installed version (least change policy). + higher than the currently installed version (least change policy). - portage.sets.security.NewGlsaSet - Like SecuritySet, + Like SecuritySet, but ignores all GLSAs that were already applied or injected previously. @@ -323,8 +325,8 @@ In single set configurations this class supports the following options: - use_emerge_resolver: See - SecuritySet + use_emerge_resolver: See + SecuritySet @@ -334,7 +336,7 @@ portage.sets.security.NewAffectedSet - Like SecuritySet, + Like SecuritySet, but ignores all GLSAs that were already applied or injected previously, and all GLSAs that don't affect the current system. Practically there should be no difference to NewGlsaSet though. @@ -344,19 +346,19 @@ Single Set Configuration In single set configurations this class supports the following options: + - use_emerge_resolver: See - SecuritySet + use_emerge_resolver: See + SecuritySet - portage.sets.security.AffectedSet - Like SecuritySet, + Like SecuritySet, but ignores all GLSAs that don't affect the current system. Practically there should be no difference to SecuritySet though. @@ -365,12 +367,12 @@ Single Set Configuration In single set configurations this class supports the following options: + - use_emerge_resolver: See - SecuritySet + use_emerge_resolver: See + SecuritySet - @@ -386,14 +388,14 @@ Single Set Configuration In single set configurations this class supports the following options: + - command: Required. Specifies the command + command: Required. Specifies the command that should be executed to generate the package set. It should output a newline separated list of simple and/or versioned atoms - on stdout. + on stdout. - @@ -408,18 +410,18 @@ Single Set Configuration In single set configurations this class supports the following options: + - age: Optional, defaults to 7. Specifies - the number of days passed since installation to use as cut-off point. + age: Optional, defaults to 7. Specifies + the number of days passed since installation to use as cut-off point. - mode: Optional, defaults to "older". Must + mode: Optional, defaults to "older". Must be either "older" or "newer" to select packages installed either before resp. after the cut-off-date given by age. E.g. the defaults will select all installed packages that have been - installed more than one week ago. + installed more than one week ago. - @@ -433,39 +435,39 @@ Single Set Configuration In single set configurations this class supports the following options: + - category: Required. The name of an existing ebuild - category which should be used to create the package set. + category: Required. The name of an existing ebuild + category which should be used to create the package set. - only_visible: Optional, defaults to true. + only_visible: Optional, defaults to true. When set to true the set will only include visible packages, when set to false it will also include masked packages. It's currently only effective in combination with the porttree - repository. + repository. - Multi Set Configuration In multi set configurations this class supports the following options: + - categories: Optional, defaults to all categories. + categories: Optional, defaults to all categories. If set it must be a space separated list of existing ebuild categories for - which package sets should be created. + which package sets should be created. - repository: See previous section. - only_visible: See previous section. - name_pattern: Optional, defaults to + repository: See previous section. + only_visible: See previous section. + name_pattern: Optional, defaults to $category/*. This describes the naming pattern to be used for creating the sets. It must contain either $category or ${category}, which - will be replaced by the category name. + will be replaced by the category name. - @@ -491,12 +493,12 @@ Package set which contains all packages that own one or more files. This class supports the following options: + - files: Required. A list of file paths - that should be used to create the package set. + files: Required. A list of file paths + that should be used to create the package set. - portage.sets.dbapi.VariableSet @@ -504,23 +506,23 @@ Package set which contains all packages that match specified values of specified variable. This class supports the following options: + - variable: The name of - the specified variable whose values are checked. + variable: The name of + the specified variable whose values are checked. - includes: A list of + includes: A list of values that must be contained within the specified - variable. + variable. - excludes: A list of + excludes: A list of values that must not be contained within the specified - variable. + variable. - metadata-source: Optional, defaults to + metadata-source: Optional, defaults to "vartree". Specifies the repository to use for getting the metadata - to check. + to check. - portage.sets.dbapi.UnavailableSet @@ -529,12 +531,12 @@ packages for which there are no visible ebuilds corresponding to the same $CATEGORY/$PN:$SLOT. This class supports the following options: + - metadata-source: Optional, defaults to + metadata-source: Optional, defaults to "porttree". Specifies the repository to use for getting the metadata - to check. + to check. - portage.sets.dbapi.DowngradeSet @@ -556,12 +558,12 @@ Single Set Configuration This class supports the following option: + - debug: Generate extra output useful to figure out why - certain packages are included in the set, as it's not always obvious. + debug: Generate extra output useful to figure out why + certain packages are included in the set, as it's not always obvious. - @@ -576,20 +578,20 @@ The default sets are: + - system: uses PackagesSystemSet - world: uses WorldSet - security: uses NewAffectedSet with default options - installed: uses EverythingSet - preserved-rebuild: uses PreservedLibraryConsumerSet - live-rebuild: uses VariableSet - module-rebuild: uses OwnerSet - downgrade: uses DowngradeSet - unavailable: uses UnavailableSet + system: uses PackagesSystemSet + world: uses WorldSet + security: uses NewAffectedSet with default options + installed: uses EverythingSet + preserved-rebuild: uses PreservedLibraryConsumerSet + live-rebuild: uses VariableSet + module-rebuild: uses OwnerSet + downgrade: uses DowngradeSet + unavailable: uses UnavailableSet - Additionally the default configuration includes a multi set section based on + Additionally the default configuration includes a multi set section based on the StaticFileSet defaults that creates a set for each - file in /etc/portage/sets for convenience. - + file in /etc/portage/sets for convenience. diff --git a/doc/dependency_resolution/decision_making.docbook b/doc/dependency_resolution/decision_making.docbook index 5bcf84388..ffb1a4ab2 100644 --- a/doc/dependency_resolution/decision_making.docbook +++ b/doc/dependency_resolution/decision_making.docbook @@ -18,18 +18,18 @@ to satisfy constraints and minimize cost. The following package states influence the cost calculation for a given combination: + - installed + installed - selected (for installation) + selected (for installation) - not selected (for installation) + not selected (for installation) - In cost calculations, virtual packages by themselves are considered to cost nothing since they do not directly install anything. diff --git a/doc/dependency_resolution/package_modeling.docbook b/doc/dependency_resolution/package_modeling.docbook index 37cdb6008..beada903e 100644 --- a/doc/dependency_resolution/package_modeling.docbook +++ b/doc/dependency_resolution/package_modeling.docbook @@ -8,41 +8,41 @@ Dependency resolution involves satisfaction of many constraints: + - Persistent configuration parameters, like those that come from - make.profile, make.conf, and the /etc/portage directory. + Persistent configuration parameters, like those that come from + make.profile, make.conf, and the /etc/portage directory. - Current command parameters, which may include options, atoms, or sets. + Current command parameters, which may include options, atoms, or sets. - - Package Dependencies + + Package Dependencies - Package Dependencies Common types of package dependencies: + - Files required for building or installing. Downloads may - be necessary to satisfy these. + Files required for building or installing. Downloads may + be necessary to satisfy these. - Other packages required to be installed for - buildtime or runtime. + Other packages required to be installed for + buildtime or runtime. - Blockers that prevent conflicting packages from being installed - simultaneously. + Blockers that prevent conflicting packages from being installed + simultaneously. - diff --git a/doc/dependency_resolution/task_scheduling.docbook b/doc/dependency_resolution/task_scheduling.docbook index c8e3608d1..8180e56da 100644 --- a/doc/dependency_resolution/task_scheduling.docbook +++ b/doc/dependency_resolution/task_scheduling.docbook @@ -24,28 +24,28 @@ rather than replaced. The following constraints protect inappropriate packages from being chosen for automatic uninstallation: + - Installed packages that have been pulled into the current dependency + Installed packages that have been pulled into the current dependency graph will not be uninstalled. Due to dependency neglection and special properties of packages in the "system" set, other checks may be necessary in order - to protect inappropriate packages from being uninstalled. + to protect inappropriate packages from being uninstalled. - An installed package that is matched by a dependency atom from the + An installed package that is matched by a dependency atom from the "system" set will not be uninstalled in advance since it might not - be safe. Such a package will only be uninstalled through replacement. + be safe. Such a package will only be uninstalled through replacement. - An installed package that is matched by a dependency atom from the + An installed package that is matched by a dependency atom from the "world" set will not be uninstalled if the dependency graph does not contain a replacement package that is matched by the same dependency - atom. + atom. - In order to ensure that package files remain installed in a usable state whenever possible, uninstallation operations are not executed diff --git a/doc/package/ebuild/phases.docbook b/doc/package/ebuild/phases.docbook index 2cb1b4447..f3e8359ef 100644 --- a/doc/package/ebuild/phases.docbook +++ b/doc/package/ebuild/phases.docbook @@ -10,36 +10,36 @@ The function names for the ebuild phases, listed in order of execution: + - pkg_setup + pkg_setup - src_unpack + src_unpack - src_compile + src_compile - src_test + src_test - src_install + src_install - pkg_preinst + pkg_preinst - pkg_postinst + pkg_postinst - pkg_prerm + pkg_prerm - pkg_postrm + pkg_postrm -
Interaction with previous installed version @@ -48,22 +48,20 @@
Upgrade/downgrade order used by versions less than 2.1.5 (deprecated) - - pkg_preinst + pkg_preinst - pkg_postinst + pkg_postinst - pkg_prerm + pkg_prerm - pkg_postrm + pkg_postrm -
Upgrade/downgrade order starting with version 2.1.5 @@ -71,22 +69,20 @@ The new order for upgrades and downgrades is identical to the order used for reinstall operations: - - pkg_preinst + pkg_preinst - pkg_prerm + pkg_prerm - pkg_postrm + pkg_postrm - pkg_postinst + pkg_postinst - Now that pkg_postinst is called after all other phases, it's not possible to call has_version in pkg_postinst to detect whether the current install diff --git a/doc/qa.docbook b/doc/qa.docbook index 6f0d45dc2..e121e6a95 100644 --- a/doc/qa.docbook +++ b/doc/qa.docbook @@ -163,7 +163,7 @@ version when linking. The system linker will find the static library first and not bother searching for a dynamic version. To overcome this, you need to use the gen_usr_ldscript function found in the - toolchain-funcs.eclass. Refer to the + toolchain-funcs.eclass. Refer to the man page for information on how to use it. See this bug report for some history on this issue. @@ -200,7 +200,7 @@ You may be able to cheat and use the elibtoolize function - in the libtool.eclass. However, if + in the libtool.eclass. However, if that does not help, you will probably need to regenerate all of the autotool files. diff --git a/man/make.conf.5 b/man/make.conf.5 index 92189fe7f..ef5913a85 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -243,6 +243,13 @@ validation mechanism to work correctly. Fetch everything in \fBSRC_URI\fR regardless of \fBUSE\fR settings, except do not fetch anything when \fImirror\fR is in \fBRESTRICT\fR. .TP +.B multilib\-strict +Many Makefiles assume that their libraries should go to /usr/lib, or +$(prefix)/lib. This assumption can cause a serious mess if /usr/lib +isn't a symlink to /usr/lib64. To find the bad packages, we have a +portage feature called \fImultilib\-strict\fR. It will prevent emerge +from putting 64bit libraries into anything other than (/usr)/lib64. +.TP .B noauto When utilizing \fBebuild\fR(1), only run the function requested. .TP @@ -297,6 +304,10 @@ overwritten or uninstalled at inappropriate times. If \fIcollision\-protect\fR is enabled then it takes precedence over \fIprotect\-owned\fR. .TP +.B python\-trace +Output a verbose trace of python execution to stderr when a command's +\-\-debug option is enabled. +.TP .B sandbox Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild\fR(1). .TP diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py index 8d94d6a7c..ea77391c7 100644 --- a/pym/portage/cache/sqlite.py +++ b/pym/portage/cache/sqlite.py @@ -8,6 +8,7 @@ import os from portage.cache.template import reconstruct_eclasses from portage.util import writemsg, apply_secpass_permissions from portage.data import portage_gid +from portage.localization import _ try: import sqlite3 as db_module # sqlite3 is optional with >=python-2.5 except ImportError: @@ -101,7 +102,7 @@ class database(fs_template.FsBased): if self._db_table_exists(v["table_name"]): create_statement = self._db_table_get_create(v["table_name"]) if create_statement != v["create"]: - writemsg("sqlite: dropping old table: %s\n" % v["table_name"]) + writemsg(_("sqlite: dropping old table: %s\n") % v["table_name"]) cursor.execute("DROP TABLE %s" % v["table_name"]) cursor.execute(v["create"]) else: diff --git a/pym/portage/cache/util.py b/pym/portage/cache/util.py index bdee52ddc..57d328ced 100644 --- a/pym/portage/cache/util.py +++ b/pym/portage/cache/util.py @@ -7,6 +7,7 @@ __all__ = ["mirror_cache", "non_quiet_mirroring", "quiet_mirroring"] from itertools import chain from portage.cache import cache_errors +from portage.localization import _ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, verbose_instance=None): @@ -48,7 +49,7 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, eapi_supported = eapi_is_supported(eapi) if not eapi_supported: if not _validate_cache_for_unsupported_eapis: - noise.misc(x, "unable to validate cache for EAPI='%s'" % eapi) + noise.misc(x, _("unable to validate cache for EAPI='%s'") % eapi) continue write_it = True diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index 9956d0999..db6e36fcd 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -17,6 +17,7 @@ portage.proxy.lazyimport.lazyimport(globals(), ) from portage import auxdbkeys, dep_expand +from portage.localization import _ class dbapi(object): _category_re = re.compile(r'^\w[-.+\w]*$') @@ -190,14 +191,14 @@ class dbapi(object): def invalidentry(self, mypath): if mypath.endswith('portage_lockfile'): if "PORTAGE_MASTER_PID" not in os.environ: - writemsg("Lockfile removed: %s\n" % mypath, 1) + writemsg(_("Lockfile removed: %s\n") % mypath, 1) unlockfile((mypath, None, None)) else: # Nothing we can do about it. We're probably sandboxed. pass elif '/-MERGING-' in mypath: if os.path.exists(mypath): - writemsg(colorize("BAD","INCOMPLETE MERGE:")+" %s\n" % mypath, + writemsg(colorize("BAD", _("INCOMPLETE MERGE:"))+" %s\n" % mypath, noiselevel=-1) else: writemsg("!!! Invalid db entry: %s\n" % mypath, noiselevel=-1) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index b5cfcb7d1..a9abaf309 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -18,6 +18,7 @@ from portage.dbapi.virtual import fakedbapi from portage.exception import InvalidPackageName, \ PermissionDenied, PortageException from portage.const import EAPI +from portage.localization import _ from portage import dep_expand, listdir, _check_distfile, _movefile @@ -229,14 +230,14 @@ class binarytree(object): mynewpkg = mynewcpv.split("/")[1] if (mynewpkg != myoldpkg) and os.path.exists(self.getname(mynewcpv)): - writemsg("!!! Cannot update binary: Destination exists.\n", + writemsg(_("!!! Cannot update binary: Destination exists.\n"), noiselevel=-1) writemsg("!!! "+mycpv+" -> "+mynewcpv+"\n", noiselevel=-1) continue tbz2path = self.getname(mycpv) if os.path.exists(tbz2path) and not os.access(tbz2path,os.W_OK): - writemsg("!!! Cannot update readonly binary: "+mycpv+"\n", + writemsg(_("!!! Cannot update readonly binary: %s\n") % mycpv, noiselevel=-1) continue @@ -517,8 +518,8 @@ class binarytree(object): self.dbapi._aux_cache[mycpv] = aux_cache continue if not os.access(full_path, os.R_OK): - writemsg("!!! Permission denied to read " + \ - "binary package: '%s'\n" % full_path, + writemsg(_("!!! Permission denied to read " \ + "binary package: '%s'\n") % full_path, noiselevel=-1) self.invalids.append(myfile[:-5]) continue @@ -530,7 +531,7 @@ class binarytree(object): mypkg = myfile[:-5] if not mycat or not mypf or not slot: #old-style or corrupt package - writemsg("\n!!! Invalid binary package: '%s'\n" % full_path, + writemsg(_("\n!!! Invalid binary package: '%s'\n") % full_path, noiselevel=-1) missing_keys = [] if not mycat: @@ -542,10 +543,10 @@ class binarytree(object): msg = [] if missing_keys: missing_keys.sort() - msg.append("Missing metadata key(s): %s." % \ + msg.append(_("Missing metadata key(s): %s.") % \ ", ".join(missing_keys)) - msg.append(" This binary package is not " + \ - "recoverable and should be deleted.") + msg.append(_(" This binary package is not " \ + "recoverable and should be deleted.")) from textwrap import wrap for line in wrap("".join(msg), 72): writemsg("!!! %s\n" % line, noiselevel=-1) @@ -562,10 +563,10 @@ class binarytree(object): # All is first, so it's preferred. continue if not self.dbapi._category_re.match(mycat): - writemsg(("!!! Binary package has an " + \ + writemsg(_("!!! Binary package has an " \ "unrecognized category: '%s'\n") % full_path, noiselevel=-1) - writemsg(("!!! '%s' has a category that is not" + \ + writemsg(_("!!! '%s' has a category that is not" \ " listed in %setc/portage/categories\n") % \ (mycpv, self.settings["PORTAGE_CONFIGROOT"]), noiselevel=-1) @@ -597,7 +598,7 @@ class binarytree(object): try: self._eval_use_flags(mycpv, d) except portage.exception.InvalidDependString: - writemsg("!!! Invalid binary package: '%s'\n" % \ + writemsg(_("!!! Invalid binary package: '%s'\n") % \ self.getname(mycpv), noiselevel=-1) self.dbapi.cpv_remove(mycpv) del pkg_paths[mycpv] @@ -633,7 +634,7 @@ class binarytree(object): f.close() if getbinpkgs and not self.settings["PORTAGE_BINHOST"]: - writemsg("!!! PORTAGE_BINHOST unset, but use is requested.\n", + writemsg(_("!!! PORTAGE_BINHOST unset, but use is requested.\n"), noiselevel=-1) if getbinpkgs and \ @@ -672,8 +673,8 @@ class binarytree(object): pkgindex = None else: if not self._pkgindex_version_supported(rmt_idx): - writemsg("\n\n!!! Binhost package index version" + \ - " is not supported: '%s'\n" % \ + writemsg(_("\n\n!!! Binhost package index version" \ + " is not supported: '%s'\n") % \ rmt_idx.header.get("VERSION"), noiselevel=-1) pkgindex = None elif local_timestamp != remote_timestamp: @@ -682,8 +683,8 @@ class binarytree(object): finally: f.close() except EnvironmentError, e: - writemsg("\n\n!!! Error fetching binhost package" + \ - " info from '%s'\n" % base_url) + writemsg(_("\n\n!!! Error fetching binhost package" \ + " info from '%s'\n") % base_url) writemsg("!!! %s\n\n" % str(e)) del e pkgindex = None @@ -745,7 +746,7 @@ class binarytree(object): chunk_size = 3000 writemsg_stdout("\n") writemsg_stdout( - colorize("GOOD", "Fetching bininfo from ") + \ + colorize("GOOD", _("Fetching bininfo from ")) + \ re.sub(r'//(.+):.+@(.+)/', r'//\1:*password*@\2/', base_url) + "\n") self.remotepkgs = portage.getbinpkg.dir_get_metadata( self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size) @@ -754,7 +755,7 @@ class binarytree(object): for mypkg in self.remotepkgs.keys(): if "CATEGORY" not in self.remotepkgs[mypkg]: #old-style or corrupt package - writemsg("!!! Invalid remote binary package: "+mypkg+"\n", + writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg, noiselevel=-1) del self.remotepkgs[mypkg] continue @@ -768,10 +769,10 @@ class binarytree(object): continue if not self.dbapi._category_re.match(mycat): - writemsg(("!!! Remote binary package has an " + \ + writemsg(_("!!! Remote binary package has an " \ "unrecognized category: '%s'\n") % fullpkg, noiselevel=-1) - writemsg(("!!! '%s' has a category that is not" + \ + writemsg(_("!!! '%s' has a category that is not" \ " listed in %setc/portage/categories\n") % \ (fullpkg, self.settings["PORTAGE_CONFIGROOT"]), noiselevel=-1) @@ -789,7 +790,7 @@ class binarytree(object): except SystemExit, e: raise except: - writemsg("!!! Failed to inject remote binary package:"+str(fullpkg)+"\n", + writemsg(_("!!! Failed to inject remote binary package: %s\n") % fullpkg, noiselevel=-1) del self.remotepkgs[mypkg] continue @@ -818,13 +819,13 @@ class binarytree(object): if e.errno != errno.ENOENT: raise del e - writemsg("!!! Binary package does not exist: '%s'\n" % full_path, + writemsg(_("!!! Binary package does not exist: '%s'\n") % full_path, noiselevel=-1) return mytbz2 = portage.xpak.tbz2(full_path) slot = mytbz2.getfile("SLOT") if slot is None: - writemsg("!!! Invalid binary package: '%s'\n" % full_path, + writemsg(_("!!! Invalid binary package: '%s'\n") % full_path, noiselevel=-1) return slot = slot.strip() @@ -862,7 +863,7 @@ class binarytree(object): try: d = self._pkgindex_entry(cpv) except portage.exception.InvalidDependString: - writemsg("!!! Invalid binary package: '%s'\n" % \ + writemsg(_("!!! Invalid binary package: '%s'\n") % \ self.getname(cpv), noiselevel=-1) self.dbapi.cpv_remove(cpv) del self._pkg_paths[cpv] @@ -1057,7 +1058,7 @@ class binarytree(object): return else: resume = True - writemsg("Resuming download of this tbz2, but it is possible that it is corrupt.\n", + writemsg(_("Resuming download of this tbz2, but it is possible that it is corrupt.\n"), noiselevel=-1) mydest = os.path.dirname(self.getname(pkgname)) @@ -1136,8 +1137,8 @@ class binarytree(object): try: digests["size"] = int(metadata["SIZE"]) except ValueError: - writemsg("!!! Malformed SIZE attribute in remote " + \ - "metadata for '%s'\n" % cpv) + writemsg(_("!!! Malformed SIZE attribute in remote " \ + "metadata for '%s'\n") % cpv) if not digests: return False diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 3b160a2c4..0cdb36591 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -20,6 +20,7 @@ from portage.data import portage_gid, secpass from portage.dbapi import dbapi from portage.exception import PortageException, \ FileNotFound, InvalidDependString, InvalidPackageName +from portage.localization import _ from portage.manifest import Manifest from portage import eclass_cache, auxdbkeys, doebuild, flatten, \ @@ -208,9 +209,9 @@ class portdbapi(dbapi): for alias in loc_repo_conf.aliases: overridden_alias = repo_aliases.get(alias) if overridden_alias is not None: - writemsg_level(("!!! Alias '%s' " + \ - "created for '%s' overrides " + \ - "'%s' alias in " + \ + writemsg_level(_("!!! Alias '%s' " \ + "created for '%s' overrides " \ + "'%s' alias in " \ "'%s'\n") % (alias, repo_name, overridden_alias, self.mysettings._local_repo_conf_path), @@ -246,7 +247,7 @@ class portdbapi(dbapi): master_name = repo_aliases.get(master_name, master_name) master_path = self.treemap.get(master_name) if master_path is None: - writemsg_level(("Unavailable repository '%s' " + \ + writemsg_level(_("Unavailable repository '%s' " \ "referenced by masters entry in '%s'\n") % \ (master_name, layout_filename), level=logging.ERROR, noiselevel=-1) @@ -269,8 +270,8 @@ class portdbapi(dbapi): for other_name in loc_repo_conf.eclass_overrides: other_path = self.treemap.get(other_name) if other_path is None: - writemsg_level(("Unavailable repository '%s' " + \ - "referenced by eclass-overrides entry in " + \ + writemsg_level(_("Unavailable repository '%s' " \ + "referenced by eclass-overrides entry in " \ "'%s'\n") % (other_name, self.mysettings._local_repo_conf_path), level=logging.ERROR, noiselevel=-1) @@ -493,8 +494,8 @@ class portdbapi(dbapi): st = os.stat(ebuild_path) emtime = st[stat.ST_MTIME] except OSError: - writemsg("!!! aux_get(): ebuild for " + \ - "'%s' does not exist at:\n" % (cpv,), noiselevel=-1) + writemsg(_("!!! aux_get(): ebuild for " \ + "'%s' does not exist at:\n") % (cpv,), noiselevel=-1) writemsg("!!! %s\n" % ebuild_path, noiselevel=-1) raise KeyError(cpv) @@ -558,7 +559,7 @@ class portdbapi(dbapi): myebuild, mylocation = self.findname2(mycpv, mytree) if not myebuild: - writemsg("!!! aux_get(): ebuild path for '%(cpv)s' not specified:\n" % {"cpv":mycpv}, + writemsg(_("!!! aux_get(): ebuild path for '%s' not specified:\n") % mycpv, noiselevel=1) writemsg("!!! %s\n" % myebuild, noiselevel=1) raise KeyError(mycpv) @@ -566,7 +567,7 @@ class portdbapi(dbapi): mydata, st, emtime = self._pull_valid_cache(mycpv, myebuild, mylocation) doregen = mydata is None - writemsg("auxdb is valid: "+str(not doregen)+" "+str(pkg)+"\n", 2) + writemsg(_("auxdb is valid: ")+str(not doregen)+" "+str(pkg)+"\n", 2) if doregen: if myebuild in self._broken_ebuilds: @@ -574,7 +575,7 @@ class portdbapi(dbapi): if not self._have_root_eclass_dir: raise KeyError(mycpv) writemsg("doregen: %s %s\n" % (doregen, mycpv), 2) - writemsg("Generating cache entry(0) for: "+str(myebuild)+"\n", 1) + writemsg(_("Generating cache entry(0) for: ")+str(myebuild)+"\n", 1) self.doebuild_settings.setcpv(mycpv) mydata = {} @@ -746,7 +747,7 @@ class portdbapi(dbapi): for myfile in myfiles: if myfile not in checksums: if debug: - writemsg("[bad digest]: missing %s for %s\n" % (myfile, mypkg)) + writemsg(_("[bad digest]: missing %(file)s for %(pkg)s\n") % {"file":myfile, "pkg":mypkg}) continue file_path = os.path.join(self.mysettings["DISTDIR"], myfile) mystat = None @@ -783,14 +784,14 @@ class portdbapi(dbapi): for x in myfiles: if not mysums or x not in mysums: ok = False - reason = "digest missing" + reason = _("digest missing") else: try: ok, reason = portage.checksum.verify_all( os.path.join(self.mysettings["DISTDIR"], x), mysums[x]) except FileNotFound, e: ok = False - reason = "File Not Found: '%s'" % str(e) + reason = _("File Not Found: '%s'") % str(e) if not ok: failures[x] = reason if failures: @@ -858,21 +859,21 @@ class portdbapi(dbapi): if pf is not None: ps = pkgsplit(pf) if not ps: - writemsg("\nInvalid ebuild name: %s\n" % \ + writemsg(_("\nInvalid ebuild name: %s\n") % \ os.path.join(oroot, mycp, x), noiselevel=-1) continue if ps[0] != mysplit[1]: - writemsg("\nInvalid ebuild name: %s\n" % \ + writemsg(_("\nInvalid ebuild name: %s\n") % \ os.path.join(oroot, mycp, x), noiselevel=-1) continue ver_match = ver_regexp.match("-".join(ps[1:])) if ver_match is None or not ver_match.groups(): - writemsg("\nInvalid ebuild version: %s\n" % \ + writemsg(_("\nInvalid ebuild version: %s\n") % \ os.path.join(oroot, mycp, x), noiselevel=-1) continue d[mysplit[0]+"/"+pf] = None if invalid_category and d: - writemsg(("\n!!! '%s' has a category that is not listed in " + \ + writemsg(_("\n!!! '%s' has a category that is not listed in " \ "%setc/portage/categories\n") % \ (mycp, self.mysettings["PORTAGE_CONFIGROOT"]), noiselevel=-1) mylist = [] diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 006a58c67..b1c6c086e 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -29,6 +29,7 @@ from portage.dbapi import dbapi from portage.exception import CommandNotFound, \ InvalidData, InvalidPackageName, \ FileNotFound, PermissionDenied, UnsupportedAPIException +from portage.localization import _ from portage import listdir, dep_expand, digraph, flatten, key_expand, \ doebuild_environment, doebuild, env_update, prepare_build_dirs, \ @@ -66,7 +67,7 @@ class PreservedLibsRegistry(object): try: self._data = pickle.load(open(self._filename, 'rb')) except (ValueError, pickle.UnpicklingError), e: - writemsg_level("!!! Error loading '%s': %s\n" % \ + writemsg_level(_("!!! Error loading '%s': %s\n") % \ (self._filename, e), level=logging.ERROR, noiselevel=-1) except (EOFError, IOError), e: if isinstance(e, EOFError) or e.errno == errno.ENOENT: @@ -307,8 +308,8 @@ class LinkageMap(object): continue fields = l.split(";") if len(fields) < 5: - writemsg_level("\nWrong number of fields " + \ - "returned from scanelf: %s\n\n" % (l,), + writemsg_level(_("\nWrong number of fields " \ + "returned from scanelf: %s\n\n") % (l,), level=logging.ERROR, noiselevel=-1) continue fields[1] = fields[1][root_len:] @@ -321,8 +322,8 @@ class LinkageMap(object): continue fields = l.split(";") if len(fields) < 5: - writemsg_level("\nWrong number of fields " + \ - "in %s: %s\n\n" % (self._needed_aux_key, l), + writemsg_level(_("\nWrong number of fields " \ + "in %s: %s\n\n") % (self._needed_aux_key, l), level=logging.ERROR, noiselevel=-1) continue arch = fields[0] @@ -463,7 +464,7 @@ class LinkageMap(object): # XXX This is most often due to soname symlinks not in # a library's directory. We could catalog symlinks in # LinkageMap to avoid checking for this edge case here. - print "Found provider outside of findProviders:", \ + print _("Found provider outside of findProviders:"), \ os.path.join(directory, soname), "->", \ self._obj_properties[cachedKey][4], libraries # A valid library has been found, so there is no need to @@ -471,10 +472,11 @@ class LinkageMap(object): break if debug and cachedArch == arch and \ cachedKey in self._obj_properties: - print "Broken symlink or missing/bad soname:", \ - os.path.join(directory, soname), '->', \ - self._obj_properties[cachedKey], "with soname", \ - cachedSoname, "but expecting", soname + print _("Broken symlink or missing/bad soname: %(dir_soname)s -> %(cachedKey)s " + "with soname %(cachedSoname)s but expecting %(soname)s") % \ + {"dir_soname":os.path.join(directory, soname), + "cachedKey": self._obj_properties[cachedKey], + "cachedSoname": cachedSoname, "soname":soname} # This conditional checks if there are no libraries to satisfy the # soname (empty set). if not validLibraries: @@ -490,9 +492,9 @@ class LinkageMap(object): rValue.setdefault(lib, set()).add(soname) if debug: if not os.path.isfile(lib): - print "Missing library:", lib + print _("Missing library:"), lib else: - print "Possibly missing symlink:", \ + print _("Possibly missing symlink:"), \ os.path.join(os.path.dirname(lib), soname) return rValue @@ -1310,7 +1312,7 @@ class vardbapi(dbapi): return long(self.aux_get(mycpv, ["COUNTER"])[0]) except (KeyError, ValueError): pass - writemsg_level(("portage: COUNTER for %s was corrupted; " + \ + writemsg_level(_("portage: COUNTER for %s was corrupted; " \ "resetting to value of 0\n") % (mycpv,), level=logging.ERROR, noiselevel=-1) return 0 @@ -1606,7 +1608,7 @@ class vardbapi(dbapi): del f except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError), e: if isinstance(e, pickle.UnpicklingError): - writemsg("!!! Error loading '%s': %s\n" % \ + writemsg(_("!!! Error loading '%s': %s\n") % \ (self._aux_cache_filename, str(e)), noiselevel=-1) del e @@ -1808,7 +1810,7 @@ class vardbapi(dbapi): except EnvironmentError, e: new_vdb = not bool(self.cpv_all()) if not new_vdb: - writemsg("!!! Unable to read COUNTER file: '%s'\n" % \ + writemsg(_("!!! Unable to read COUNTER file: '%s'\n") % \ self._counter_path, noiselevel=-1) writemsg("!!! %s\n" % str(e), noiselevel=-1) del e @@ -1819,7 +1821,7 @@ class vardbapi(dbapi): finally: cfile.close() except (OverflowError, ValueError), e: - writemsg("!!! COUNTER file is corrupt: '%s'\n" % \ + writemsg(_("!!! COUNTER file is corrupt: '%s'\n") % \ self._counter_path, noiselevel=-1) writemsg("!!! %s\n" % str(e), noiselevel=-1) del e @@ -1836,8 +1838,8 @@ class vardbapi(dbapi): max_counter = counter if counter < 0 and not new_vdb: - writemsg("!!! Initializing COUNTER to " + \ - "value of %d\n" % max_counter, noiselevel=-1) + writemsg(_("!!! Initializing COUNTER to " \ + "value of %d\n") % max_counter, noiselevel=-1) return max_counter + 1 @@ -2125,12 +2127,12 @@ class vartree(object): raise except Exception, e: mydir = os.path.join(self.root, VDB_PATH, mycpv) - writemsg("\nParse Error reading PROVIDE and USE in '%s'\n" % mydir, + writemsg(_("\nParse Error reading PROVIDE and USE in '%s'\n") % mydir, noiselevel=-1) if mylines: - writemsg("Possibly Invalid: '%s'\n" % str(mylines), + writemsg(_("Possibly Invalid: '%s'\n") % str(mylines), noiselevel=-1) - writemsg("Exception: %s\n\n" % str(e), noiselevel=-1) + writemsg(_("Exception: %s\n\n") % str(e), noiselevel=-1) return [] def get_all_provides(self): @@ -2346,7 +2348,7 @@ class dblink(object): # Check validity of self.dbdir before attempting to remove it. if not self.dbdir.startswith(self.dbroot): - writemsg("portage.dblink.delete(): invalid dbdir: %s\n" % \ + writemsg(_("portage.dblink.delete(): invalid dbdir: %s\n") % \ self.dbdir, noiselevel=-1) return @@ -2394,7 +2396,7 @@ class dblink(object): for pos, line in enumerate(mylines): if null_byte in line: # Null bytes are a common indication of corruption. - errors.append((pos + 1, "Null byte found in CONTENTS entry")) + errors.append((pos + 1, _("Null byte found in CONTENTS entry"))) continue line = line.rstrip("\n") # Split on " " so that even file paths that @@ -2411,7 +2413,7 @@ class dblink(object): try: splitter = mydat.index("->", 2, len(mydat) - 2) except ValueError: - errors.append((pos + 1, "Unrecognized CONTENTS entry")) + errors.append((pos + 1, _("Unrecognized CONTENTS entry"))) continue spaces_in_path = splitter - 2 spaces_in_target = spaces_total - spaces_in_path @@ -2451,13 +2453,13 @@ class dblink(object): #format: type pkgfiles[mydat[1]] = [mydat[0]] else: - errors.append((pos + 1, "Unrecognized CONTENTS entry")) + errors.append((pos + 1, _("Unrecognized CONTENTS entry"))) except (KeyError, IndexError): - errors.append((pos + 1, "Unrecognized CONTENTS entry")) + errors.append((pos + 1, _("Unrecognized CONTENTS entry"))) if errors: - writemsg("!!! Parse error in '%s'\n" % contents_file, noiselevel=-1) + writemsg(_("!!! Parse error in '%s'\n") % contents_file, noiselevel=-1) for pos, e in errors: - writemsg("!!! line %d: %s\n" % (pos, e), noiselevel=-1) + writemsg(_("!!! line %d: %s\n") % (pos, e), noiselevel=-1) self.contentscache = pkgfiles return pkgfiles @@ -2535,7 +2537,7 @@ class dblink(object): self.settings, 0, 0, self.vartree.dbapi) except UnsupportedAPIException, e: # Sometimes this happens due to corruption of the EAPI file. - writemsg("!!! FAILED prerm: %s\n" % \ + writemsg(_("!!! FAILED prerm: %s\n") % \ os.path.join(self.dbdir, "EAPI"), noiselevel=-1) writemsg("%s\n" % str(e), noiselevel=-1) myebuildpath = None @@ -2575,7 +2577,7 @@ class dblink(object): # XXX: Decide how to handle failures here. if retval != os.EX_OK: - writemsg("!!! FAILED prerm: %s\n" % retval, noiselevel=-1) + writemsg(_("!!! FAILED prerm: %s\n") % retval, noiselevel=-1) self._unmerge_pkgfiles(pkgfiles, others_in_slot) self._clear_contents_cache() @@ -2597,7 +2599,7 @@ class dblink(object): # XXX: Decide how to handle failures here. if retval != os.EX_OK: - writemsg("!!! FAILED postrm: %s\n" % retval, noiselevel=-1) + writemsg(_("!!! FAILED postrm: %s\n") % retval, noiselevel=-1) # Skip this if another package in the same slot has just been # merged on top of this package, since the other package has @@ -2632,36 +2634,38 @@ class dblink(object): if myebuildpath: if retval != os.EX_OK: msg_lines = [] - msg = ("The '%s' " % ebuild_phase) + \ - ("phase of the '%s' package " % self.mycpv) + \ - ("has failed with exit value %s." % retval) + msg = _("The '%(ebuild_phase)s' " + "phase of the '%(cpv)s' package " + "has failed with exit value %(retval)s.") % \ + {"ebuild_phase":ebuild_phase, "cpv":self.mycpv, + "retval":retval} from textwrap import wrap msg_lines.extend(wrap(msg, 72)) msg_lines.append("") ebuild_name = os.path.basename(myebuildpath) ebuild_dir = os.path.dirname(myebuildpath) - msg = "The problem occurred while executing " + \ - ("the ebuild file named '%s' " % ebuild_name) + \ - ("located in the '%s' directory. " \ - % ebuild_dir) + \ - "If necessary, manually remove " + \ - "the environment.bz2 file and/or the " + \ - "ebuild file located in that directory." + msg = _("The problem occurred while executing " + "the ebuild file named '%(ebuild_name)s' " + "located in the '%(ebuild_dir)s' directory. " + "If necessary, manually remove " + "the environment.bz2 file and/or the " + "ebuild file located in that directory.") % \ + {"ebuild_name":ebuild_name, "ebuild_dir":ebuild_dir} msg_lines.extend(wrap(msg, 72)) msg_lines.append("") - msg = "Removal " + \ - "of the environment.bz2 file is " + \ - "preferred since it may allow the " + \ - "removal phases to execute successfully. " + \ - "The ebuild will be " + \ - "sourced and the eclasses " + \ - "from the current portage tree will be used " + \ - "when necessary. Removal of " + \ - "the ebuild file will cause the " + \ - "pkg_prerm() and pkg_postrm() removal " + \ - "phases to be skipped entirely." + msg = _("Removal " + "of the environment.bz2 file is " + "preferred since it may allow the " + "removal phases to execute successfully. " + "The ebuild will be " + "sourced and the eclasses " + "from the current portage tree will be used " + "when necessary. Removal of " + "the ebuild file will cause the " + "pkg_prerm() and pkg_postrm() removal " + "phases to be skipped entirely.") msg_lines.extend(wrap(msg, 72)) self._eerror(ebuild_phase, msg_lines) @@ -2736,7 +2740,7 @@ class dblink(object): scheduler = self._scheduler if not pkgfiles: - showMessage("No package files given... Grabbing a set.\n") + showMessage(_("No package files given... Grabbing a set.\n")) pkgfiles = self.getcontents() if others_in_slot is None: @@ -2802,6 +2806,19 @@ class dblink(object): def show_unmerge(zing, desc, file_type, file_name): showMessage("%s %s %s %s\n" % \ (zing, desc.ljust(8), file_type, file_name)) + + unmerge_desc = {} + unmerge_desc["cfgpro"] = _("cfgpro") + unmerge_desc["replaced"] = _("replaced") + unmerge_desc["!dir"] = _("!dir") + unmerge_desc["!empty"] = _("!empty") + unmerge_desc["!fif"] = _("!fif") + unmerge_desc["!found"] = _("!found") + unmerge_desc["!md5"] = _("!md5") + unmerge_desc["!mtime"] = _("!mtime") + unmerge_desc["!obj"] = _("!obj") + unmerge_desc["!sym"] = _("!sym") + for i, objkey in enumerate(mykeys): if scheduler is not None and \ @@ -2823,7 +2840,7 @@ class dblink(object): pass islink = lstatobj is not None and stat.S_ISLNK(lstatobj.st_mode) if lstatobj is None: - show_unmerge("---", "!found", file_type, obj) + show_unmerge("---", unmerge_desc["!found"], file_type, obj) continue if obj.startswith(dest_root): relative_path = obj[dest_root_len:] @@ -2835,7 +2852,7 @@ class dblink(object): if is_owned: # A new instance of this package claims the file, so # don't unmerge it. - show_unmerge("---", "replaced", file_type, obj) + show_unmerge("---", unmerge_desc["replaced"], file_type, obj) continue elif relative_path in cfgfiledict: stale_confmem.append(relative_path) @@ -2845,7 +2862,7 @@ class dblink(object): # functionality for /lib/modules. For portage-ng both capabilities # should be able to be independently specified. if obj.startswith(modprotect): - show_unmerge("---", "cfgpro", file_type, obj) + show_unmerge("---", unmerge_desc["cfgpro"], file_type, obj) continue # Don't unlink symlinks to directories here since that can @@ -2865,17 +2882,17 @@ class dblink(object): lmtime = str(lstatobj[stat.ST_MTIME]) if (pkgfiles[objkey][0] not in ("dir", "fif", "dev")) and (lmtime != pkgfiles[objkey][1]): - show_unmerge("---", "!mtime", file_type, obj) + show_unmerge("---", unmerge_desc["!mtime"], file_type, obj) continue if pkgfiles[objkey][0] == "dir": if statobj is None or not stat.S_ISDIR(statobj.st_mode): - show_unmerge("---", "!dir", file_type, obj) + show_unmerge("---", unmerge_desc["!dir"], file_type, obj) continue mydirs.append(obj) elif pkgfiles[objkey][0] == "sym": if not islink: - show_unmerge("---", "!sym", file_type, obj) + show_unmerge("---", unmerge_desc["!sym"], file_type, obj) continue # Go ahead and unlink symlinks to directories here when # they're actually recorded as symlinks in the contents. @@ -2894,20 +2911,20 @@ class dblink(object): show_unmerge("!!!", "", file_type, obj) elif pkgfiles[objkey][0] == "obj": if statobj is None or not stat.S_ISREG(statobj.st_mode): - show_unmerge("---", "!obj", file_type, obj) + show_unmerge("---", unmerge_desc["!obj"], file_type, obj) continue mymd5 = None try: mymd5 = perform_md5(obj, calc_prelink=1) except FileNotFound, e: # the file has disappeared between now and our stat call - show_unmerge("---", "!obj", file_type, obj) + show_unmerge("---", unmerge_desc["!obj"], file_type, obj) continue # string.lower is needed because db entries used to be in upper-case. The # string.lower allows for backwards compatibility. if mymd5 != pkgfiles[objkey][2].lower(): - show_unmerge("---", "!md5", file_type, obj) + show_unmerge("---", unmerge_desc["!md5"], file_type, obj) continue try: unlink(obj, lstatobj) @@ -2918,7 +2935,7 @@ class dblink(object): show_unmerge("<<<", "", file_type, obj) elif pkgfiles[objkey][0] == "fif": if not stat.S_ISFIFO(lstatobj[stat.ST_MODE]): - show_unmerge("---", "!fif", file_type, obj) + show_unmerge("---", unmerge_desc["!fif"], file_type, obj) continue show_unmerge("---", "", file_type, obj) elif pkgfiles[objkey][0] == "dev": @@ -2953,7 +2970,7 @@ class dblink(object): if e.errno not in ignored_rmdir_errnos: raise if e.errno != errno.ENOENT: - show_unmerge("---", "!empty", "dir", obj) + show_unmerge("---", unmerge_desc["!empty"], "dir", obj) del e # Remove stale entries from config memory. @@ -3063,8 +3080,8 @@ class dblink(object): self.vartree.dbapi.linkmap.rebuild(**kwargs) except CommandNotFound, e: self._linkmap_broken = True - self._display_merge("!!! Disabling preserve-libs " + \ - "due to error: Command Not Found: %s\n" % (e,), + self._display_merge(_("!!! Disabling preserve-libs " \ + "due to error: Command Not Found: %s\n") % (e,), level=logging.ERROR, noiselevel=-1) def _find_libs_to_preserve(self): @@ -3187,14 +3204,14 @@ class dblink(object): # that should be preserved yet the path is not listed in the # contents. Such a path might belong to some other package, so # it shouldn't be preserved here. - showMessage(("!!! File '%s' will not be preserved " + \ + showMessage(_("!!! File '%s' will not be preserved " "due to missing contents entry\n") % (f_abs,), level=logging.ERROR, noiselevel=-1) preserve_paths.remove(f) continue new_contents[f_abs] = contents_entry obj_type = contents_entry[0] - showMessage(">>> needed %s %s\n" % (obj_type, f_abs), + showMessage(_(">>> needed %s %s\n") % (obj_type, f_abs), noiselevel=-1) # Add parent directories to contents if necessary. parent_dir = os.path.dirname(f_abs) @@ -3303,8 +3320,8 @@ class dblink(object): if cpv is None: # This means that a symlink is in the preserved libs # registry, but the actual lib it points to is not. - self._display_merge("!!! symlink to lib is preserved, " + \ - "but not the lib itself:\n!!! '%s'\n" % (obj,), + self._display_merge(_("!!! symlink to lib is preserved, " + "but not the lib itself:\n!!! '%s'\n") % (obj,), level=logging.ERROR, noiselevel=-1) continue removed = cpv_lib_map.get(cpv) @@ -3332,9 +3349,9 @@ class dblink(object): obj = os.path.join(root, obj.lstrip(os.sep)) parent_dirs.add(os.path.dirname(obj)) if os.path.islink(obj): - obj_type = "sym" + obj_type = _("sym") else: - obj_type = "obj" + obj_type = _("obj") try: os.unlink(obj) except OSError, e: @@ -3342,7 +3359,7 @@ class dblink(object): raise del e else: - showMessage("<<< !needed %s %s\n" % (obj_type, obj), + showMessage(_("<<< !needed %s %s\n") % (obj_type, obj), noiselevel=-1) # Remove empty parent directories if possible. @@ -3382,11 +3399,11 @@ class dblink(object): collisions = [] destroot = normalize_path(destroot).rstrip(os.path.sep) + \ os.path.sep - showMessage(" %s checking %d files for package collisions\n" % \ + showMessage(_(" %s checking %d files for package collisions\n") % \ (colorize("GOOD", "*"), len(mycontents))) for i, f in enumerate(mycontents): if i % 1000 == 0 and i != 0: - showMessage("%d files checked ...\n" % i) + showMessage(_("%d files checked ...\n") % i) if scheduler is not None and \ 0 == i % self._file_merge_yield_interval: @@ -3536,15 +3553,15 @@ class dblink(object): return 0 msg = [] - msg.append("suid/sgid file(s) " + \ - "with suspicious hardlink(s):") + msg.append(_("suid/sgid file(s) " + "with suspicious hardlink(s):")) msg.append("") for path_list in suspicious_hardlinks: for path, s in path_list: msg.append("\t%s" % path) msg.append("") - msg.append("See the Gentoo Security Handbook " + \ - "guide for advice on how to proceed.") + msg.append(_("See the Gentoo Security Handbook " + "guide for advice on how to proceed.")) self._eerror("preinst", msg) @@ -3611,7 +3628,7 @@ class dblink(object): destroot = normalize_path(destroot).rstrip(os.path.sep) + os.path.sep if not os.path.isdir(srcroot): - showMessage("!!! Directory Not Found: D='%s'\n" % srcroot, + showMessage(_("!!! Directory Not Found: D='%s'\n") % srcroot, level=logging.ERROR, noiselevel=-1) return 1 @@ -3631,15 +3648,15 @@ class dblink(object): if not slot.strip(): slot = self.settings.get(var_name, '') if not slot.strip(): - showMessage("!!! SLOT is undefined\n", + showMessage(_("!!! SLOT is undefined\n"), level=logging.ERROR, noiselevel=-1) return 1 write_atomic(os.path.join(inforoot, var_name), slot + '\n') if val != self.settings.get(var_name, ''): self._eqawarn('preinst', - ["QA Notice: Expected %s='%s', got '%s'\n" % \ - (var_name, self.settings.get(var_name, ''), val)]) + [_("QA Notice: Expected %(var_name)s='%(expected_value)s', got '%(actual_value)s'\n") % \ + {"var_name":var_name, "expected_value":self.settings.get(var_name, ''), "actual_value":val}]) def eerror(lines): self._eerror("preinst", lines) @@ -3713,14 +3730,13 @@ class dblink(object): if paths_with_newlines: msg = [] - msg.append("This package installs one or more files containing") - msg.append("a newline (\\n) character:") + msg.append(_("This package installs one or more files containing a newline (\\n) character:")) msg.append("") paths_with_newlines.sort() for f in paths_with_newlines: msg.append("\t/%s" % (f.replace("\n", "\\n"))) msg.append("") - msg.append("package %s NOT merged" % self.mycpv) + msg.append(_("package %s NOT merged") % self.mycpv) msg.append("") eerror(msg) return 1 @@ -3737,25 +3753,24 @@ class dblink(object): from textwrap import wrap wrap_width = 72 msg = [] - d = ( - self.mycpv, - other_dblink.mycpv - ) - msg.extend(wrap(("The '%s' package will not install " + \ - "any files, but the currently installed '%s'" + \ + d = { + "new_cpv":self.mycpv, + "old_cpv":other_dblink.mycpv + } + msg.extend(wrap(_("The '%(new_cpv)s' package will not install " + "any files, but the currently installed '%(old_cpv)s'" " package has the following files: ") % d, wrap_width)) msg.append("") msg.extend(sorted(installed_files)) msg.append("") - msg.append("package %s NOT merged" % self.mycpv) + msg.append(_("package %s NOT merged") % self.mycpv) msg.append("") msg.extend(wrap( - ("Manually run `emerge --unmerge =%s` " % \ - other_dblink.mycpv) + "if you really want to " + \ - "remove the above files. Set " + \ - "PORTAGE_PACKAGE_EMPTY_ABORT=\"0\" in " + \ - "/etc/make.conf if you do not want to " + \ - "abort in cases like this.", + _("Manually run `emerge --unmerge =%s` if you " + "really want to remove the above files. Set " + "PORTAGE_PACKAGE_EMPTY_ABORT=\"0\" in " + "/etc/make.conf if you do not want to " + "abort in cases like this.") % other_dblink.mycpv, wrap_width)) eerror(msg) if installed_files: @@ -3784,40 +3799,40 @@ class dblink(object): if collisions: collision_protect = "collision-protect" in self.settings.features protect_owned = "protect-owned" in self.settings.features - msg = "This package will overwrite one or more files that" + \ - " may belong to other packages (see list below)." + msg = _("This package will overwrite one or more files that" + " may belong to other packages (see list below).") if not (collision_protect or protect_owned): - msg += " Add either \"collision-protect\" or" + \ - " \"protect-owned\" to FEATURES in" + \ - " make.conf if you would like the merge to abort" + \ - " in cases like this. See the make.conf man page for" + \ - " more information about these features." + msg += _(" Add either \"collision-protect\" or" + " \"protect-owned\" to FEATURES in" + " make.conf if you would like the merge to abort" + " in cases like this. See the make.conf man page for" + " more information about these features.") if self.settings.get("PORTAGE_QUIET") != "1": - msg += " You can use a command such as" + \ - " `portageq owners / ` to identify the" + \ - " installed package that owns a file. If portageq" + \ - " reports that only one package owns a file then do NOT" + \ - " file a bug report. A bug report is only useful if it" + \ - " identifies at least two or more packages that are known" + \ - " to install the same file(s)." + \ - " If a collision occurs and you" + \ - " can not explain where the file came from then you" + \ - " should simply ignore the collision since there is not" + \ - " enough information to determine if a real problem" + \ - " exists. Please do NOT file a bug report at" + \ - " http://bugs.gentoo.org unless you report exactly which" + \ - " two packages install the same file(s). Once again," + \ - " please do NOT file a bug report unless you have" + \ - " completely understood the above message." + msg += _(" You can use a command such as" + " `portageq owners / ` to identify the" + " installed package that owns a file. If portageq" + " reports that only one package owns a file then do NOT" + " file a bug report. A bug report is only useful if it" + " identifies at least two or more packages that are known" + " to install the same file(s)." + " If a collision occurs and you" + " can not explain where the file came from then you" + " should simply ignore the collision since there is not" + " enough information to determine if a real problem" + " exists. Please do NOT file a bug report at" + " http://bugs.gentoo.org unless you report exactly which" + " two packages install the same file(s). Once again," + " please do NOT file a bug report unless you have" + " completely understood the above message.") self.settings["EBUILD_PHASE"] = "preinst" from textwrap import wrap msg = wrap(msg, 70) if collision_protect: msg.append("") - msg.append("package %s NOT merged" % self.settings.mycpv) + msg.append(_("package %s NOT merged") % self.settings.mycpv) msg.append("") - msg.append("Detected file collision(s):") + msg.append(_("Detected file collision(s):")) msg.append("") for f in collisions: @@ -3828,10 +3843,10 @@ class dblink(object): msg = [] msg.append("") - msg.append("Searching all installed" + \ - " packages for file collisions...") + msg.append(_("Searching all installed" + " packages for file collisions...")) msg.append("") - msg.append("Press Ctrl-C to Stop") + msg.append(_("Press Ctrl-C to Stop")) msg.append("") eerror(msg) @@ -3849,24 +3864,24 @@ class dblink(object): eerror(msg) if not owners: - eerror(["None of the installed" + \ - " packages claim the file(s).", ""]) + eerror([_("None of the installed" + " packages claim the file(s)."), ""]) # The explanation about the collision and how to solve # it may not be visible via a scrollback buffer, especially # if the number of file collisions is large. Therefore, # show a summary at the end. if collision_protect: - msg = "Package '%s' NOT merged due to file collisions." % \ + msg = _("Package '%s' NOT merged due to file collisions.") % \ self.settings.mycpv elif protect_owned and owners: - msg = "Package '%s' NOT merged due to file collisions." % \ + msg = _("Package '%s' NOT merged due to file collisions.") % \ self.settings.mycpv else: - msg = "Package '%s' merged despite file collisions." % \ + msg = _("Package '%s' merged despite file collisions.") % \ self.settings.mycpv - msg += " If necessary, refer to your elog " + \ - "messages for the whole content of the above message." + msg += _(" If necessary, refer to your elog " + "messages for the whole content of the above message.") eerror(wrap(msg, 70)) if collision_protect or (protect_owned and owners): @@ -3888,7 +3903,7 @@ class dblink(object): # run preinst script if scheduler is None: - showMessage(">>> Merging %s to %s\n" % (self.mycpv, destroot)) + showMessage(_(">>> Merging %(cpv)s to %(destroot)s\n") % {"cpv":self.mycpv, "destroot":destroot}) a = doebuild(myebuild, "preinst", destroot, self.settings, use_cache=0, tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree) @@ -3898,7 +3913,7 @@ class dblink(object): # XXX: Decide how to handle failures here. if a != os.EX_OK: - showMessage("!!! FAILED preinst: "+str(a)+"\n", + showMessage(_("!!! FAILED preinst: ")+str(a)+"\n", level=logging.ERROR, noiselevel=-1) return a @@ -4026,7 +4041,7 @@ class dblink(object): autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes" if autoclean: - emerge_log(" >>> AUTOCLEAN: %s" % (slot_atom,)) + emerge_log(_(" >>> AUTOCLEAN: %s") % (slot_atom,)) others_in_slot.append(self) # self has just been merged for dblnk in list(others_in_slot): @@ -4034,26 +4049,26 @@ class dblink(object): continue if not (autoclean or dblnk.mycpv == self.mycpv or reinstall_self): continue - showMessage(">>> Safely unmerging already-installed instance...\n") - emerge_log(" === Unmerging... (%s)" % (dblnk.mycpv,)) + showMessage(_(">>> Safely unmerging already-installed instance...\n")) + emerge_log(_(" === Unmerging... (%s)") % (dblnk.mycpv,)) others_in_slot.remove(dblnk) # dblnk will unmerge itself now dblnk._linkmap_broken = self._linkmap_broken unmerge_rval = dblnk.unmerge(trimworld=0, ldpath_mtimes=prev_mtimes, others_in_slot=others_in_slot) if unmerge_rval == os.EX_OK: - emerge_log(" >>> unmerge success: %s" % (dblnk.mycpv,)) + emerge_log(_(" >>> unmerge success: %s") % (dblnk.mycpv,)) else: - emerge_log(" !!! unmerge FAILURE: %s" % (dblnk.mycpv,)) + emerge_log(_(" !!! unmerge FAILURE: %s") % (dblnk.mycpv,)) # TODO: Check status and abort if necessary. dblnk.delete() - showMessage(">>> Original instance of package unmerged safely.\n") + showMessage(_(">>> Original instance of package unmerged safely.\n")) if len(others_in_slot) > 1: - showMessage(colorize("WARN", "WARNING:") - + " AUTOCLEAN is disabled. This can cause serious" - + " problems due to overlapping packages.\n", + showMessage(colorize("WARN", _("WARNING:")) + + _(" AUTOCLEAN is disabled. This can cause serious" + " problems due to overlapping packages.\n"), level=logging.WARN, noiselevel=-1) # We hold both directory locks. @@ -4107,7 +4122,7 @@ class dblink(object): use_cache=0, tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree) if a == os.EX_OK: - showMessage(">>> %s %s\n" % (self.mycpv, "merged.")) + showMessage(_(">>> %s merged.\n") % self.mycpv) else: a = scheduler.dblinkEbuildPhase( self, mydbapi, myebuild, "postinst") @@ -4116,7 +4131,7 @@ class dblink(object): # XXX: Decide how to handle failures here. if a != os.EX_OK: - showMessage("!!! FAILED postinst: "+str(a)+"\n", + showMessage(_("!!! FAILED postinst: ")+str(a)+"\n", level=logging.ERROR, noiselevel=-1) return a @@ -4264,7 +4279,7 @@ class dblink(object): showMessage(">>> %s -> %s\n" % (mydest, myto)) outfile.write("sym "+myrealdest+" -> "+myto+" "+str(mymtime)+"\n") else: - showMessage("!!! Failed to move file.\n", + showMessage(_("!!! Failed to move file.\n"), level=logging.ERROR, noiselevel=-1) showMessage("!!! %s -> %s\n" % (mydest, myto), level=logging.ERROR, noiselevel=-1) @@ -4282,11 +4297,11 @@ class dblink(object): if not os.access(mydest, os.W_OK): pkgstuff = pkgsplit(self.pkg) - writemsg("\n!!! Cannot write to '"+mydest+"'.\n", noiselevel=-1) - writemsg("!!! Please check permissions and directories for broken symlinks.\n") - writemsg("!!! You may start the merge process again by using ebuild:\n") + writemsg(_("\n!!! Cannot write to '%s'.\n") % mydest, noiselevel=-1) + writemsg(_("!!! Please check permissions and directories for broken symlinks.\n")) + writemsg(_("!!! You may start the merge process again by using ebuild:\n")) writemsg("!!! ebuild "+self.settings["PORTDIR"]+"/"+self.cat+"/"+pkgstuff[0]+"/"+self.pkg+".ebuild merge\n") - writemsg("!!! And finish by running this: env-update\n\n") + writemsg(_("!!! And finish by running this: env-update\n\n")) return 1 if stat.S_ISDIR(mydmode) or \ @@ -4299,7 +4314,7 @@ class dblink(object): # a non-directory and non-symlink-to-directory. Won't work for us. Move out of the way. if movefile(mydest, mydest+".backup", mysettings=self.settings) is None: return 1 - showMessage("bak %s %s.backup\n" % (mydest, mydest), + showMessage(_("bak %s %s.backup\n") % (mydest, mydest), level=logging.ERROR, noiselevel=-1) #now create our directory if self.settings.selinux_enabled():