Merged from trunk -r12396:12404
authorFabian Groffen <grobian@gentoo.org>
Sun, 11 Jan 2009 14:24:06 +0000 (14:24 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 11 Jan 2009 14:24:06 +0000 (14:24 -0000)
   | 12397   | Bug #253745 - Note that you need to ensure that neither      |
   | zmedico | protect-owned nor collision-protect are enabled if you want  |
   |         | to disable collision protection completely.                  |

   | 12398   | Bug #253800 - Fix FETCHCOMMAND examples for SRC_URI arrow    |
   | zmedico | compatibility.                                               |

   | 12399   | Bug #253745 - Remove collision-protect from the sample       |
   | zmedico | FEATURES list since protect-owned is enabled by default now. |

   | 12400   | Add some blank lines around the messages that suggest        |
   | zmedico | --without-mask and --include-dev. Thanks to Ryan Hill        |
   |         | <dirtyepic@g.o> for the suggestion.                          |

   | 12401   | Bug #253563 - Replace hardcoded green/red color strings with |
   | zmedico | GOOD/BAD. Thanks to Vsevolod Kozlov <sevakda@gmail.com> for  |
   |         | the initial patch.                                           |

   | 12402   | Make die() to show a message indicating the repository that  |
   | zmedico | an ebuild came from, and do it during any phase for both     |
   |         | ebuilds and binary packages. Now PORTAGE_REPO_NAME is        |
   |         | initialized inside config.setcpv() for both ebuilds and      |
   |         | binary packages, so it's always available inside ebuild.sh.  |

   | 12403   | When merging a package from an overlay, append 'from         |
   | zmedico | $repository' to the '>>> Emerging' message (where            |
   |         | $repository is the repo_name of the source repository).      |
   |         | Thanks to Jeroen Roovers <jer@g.o> for the suggestion.       |

   | 12404   | Don't assume that the package metadata contains a            |
   | zmedico | "repository" key.                                            |

svn path=/main/branches/prefix/; revision=12423

RELEASE-NOTES
bin/isolated-functions.sh
bin/repoman
cnf/make.conf
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/data.py
pym/portage/dbapi/__init__.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py
pym/portage/getbinpkg.py

index 88da034d48ba7e7e66cd263a56cbfd48e66f053c..b68c02d90a32bbbeb71029ff0575af07d103ca10 100644 (file)
@@ -32,7 +32,10 @@ portage-2.1.6
 * File collision protection is now enabled by default via make.globals with
   FEATURES=protect-owned. In order to protect files from be overwritten or
   removed a inappropriate times, it is recommended to leave protect-owned
-  (or the similar collision-protect feature) enabled at all times.
+  (or the similar collision-protect feature) enabled at all times. If you
+  want to disable collision protection completely (not recommended), then
+  you need to ensure that neither protect-owned nor collision-protect are
+  enabled.
 * The python namespace for portage has been sanitized, all portage related code
   is now contained within the portage namespace. External script should be
   updated accordingly, though links exist for backward compability.
index b1a673aabe3b801047c6a97563c68ed98b822d62..e85e094dcc07e62b8c4162d6138941596577c6ce 100755 (executable)
@@ -118,7 +118,19 @@ die() {
                local overlay=${EBUILD%/*}
                overlay=${overlay%/*}
                overlay=${overlay%/*}
-               eerror "This ebuild is from an overlay: '${overlay}/'"
+               if [[ -n $PORTAGE_REPO_NAME ]] ; then
+                       eerror "This ebuild is from an overlay named" \
+                               "'$PORTAGE_REPO_NAME': '${overlay}/'"
+               else
+                       eerror "This ebuild is from an overlay: '${overlay}/'"
+               fi
+       elif [[ -n $PORTAGE_REPO_NAME && -f "$PORTDIR"/profiles/repo_name ]] ; then
+               local portdir_repo_name=$(<"$PORTDIR"/profiles/repo_name)
+               if [[ -n $portdir_repo_name && \
+                       $portdir_repo_name != $PORTAGE_REPO_NAME ]] ; then
+                       eerror "This ebuild is from a repository" \
+                               "named '$PORTAGE_REPO_NAME'"
+               fi
        fi
 
        if [[ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]] ; then
index 94e7275c791444c8b43911822933a5a0fbf464a3..8c253d24f626e19c71ab4ac42123428fd64ca472 100755 (executable)
@@ -1634,13 +1634,24 @@ def grouplist(mylist,seperator="/"):
                        mygroups[xs[0]]+=[seperator.join(xs[1:])]
        return mygroups
 
-if have_pmasked and not (options.without_mask or options.ignore_masked):
-       print bold("Note: use --without-mask to check " + \
-               "KEYWORDS on dependencies of masked packages")
+suggest_ignore_masked = False
+suggest_include_dev = False
 
+if have_pmasked and not (options.without_mask or options.ignore_masked):
+       suggest_ignore_masked = True
 if have_dev_keywords and not options.include_dev:
-       print bold("Note: use --include-dev (-d) to check " + \
-               "dependencies for 'dev' profiles")
+       suggest_include_dev = True
+
+if suggest_ignore_masked or suggest_include_dev:
+       print
+       if suggest_ignore_masked:
+               print bold("Note: use --without-mask to check " + \
+                       "KEYWORDS on dependencies of masked packages")
+
+       if suggest_include_dev:
+               print bold("Note: use --include-dev (-d) to check " + \
+                       "dependencies for 'dev' profiles")
+       print
 
 if options.mode != 'commit':
        if dofull:
index fb4c258d5af737de131900d7357e8b9a0886a2aa..64a8ecff20a825ecc1cb5ef5ba5b6cd68e9596a2 100644 (file)
 #
 # Portage uses wget by default. Here are some settings for some alternate
 # downloaders -- note that you need to merge these programs first before they
-# will be available.
+# will be available. The command should be written to place the fetched file
+# at \${DISTDIR}/\${FILE}.
 #
 # Default fetch command (5 tries, passive ftp for firewall compatibility)
-#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp \${URI} -P \${DISTDIR}"
-#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp \${URI} -P \${DISTDIR}"
+#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
+#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
 #
 # Using wget, ratelimiting downloads
-#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
-#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
+#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -t 5 -T 60 --passive-ftp --limit-rate=200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
+#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/wget -c -t 5 -T 60 --passive-ftp --limit-rate=200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
 #
 # curl groks urls
 #FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/curl -f --connect-timeout 15 -# -o \${DISTDIR}/\${FILE} \${URI}"
 #RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/curl -f --connect-timeout 15 -# -C - -o \${DISTDIR}/\${FILE} \${URI}"
 #
 # Lukemftp (BSD ftp):
-#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/lukemftp -s -a -o \${DISTDIR}/\${FILE} \${URI}"
-#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/lukemftp -s -a -R -o \${DISTDIR}/\${FILE} \${URI}"
+#FETCHCOMMAND="@DOMAIN_PREFIX@/usr/bin/lukemftp -s -a -o \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
+#RESUMECOMMAND="@DOMAIN_PREFIX@/usr/bin/lukemftp -s -a -R -o \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
 #
 # Portage uses GENTOO_MIRRORS to specify mirrors to use for source retrieval.
 # The list is a space separated list which is read left to right. If you use
 # FEATURES defines actions portage takes by default. This is an incremental
 # variable. See the make.conf(5) man page for a complete list of supported
 # values and their respective meanings.
-#FEATURES="ccache collision-protect distcc installsources \
+#FEATURES="ccache distcc installsources \
 # splitdebug test userpriv usersandbox"
 
 # CCACHE_SIZE and CCACHE_DIR are used to control the behavior of ccache, and
index af9cdee6febd2cee7cd7f687660bca2f3d7ae1a7..a95eb995ca568b53258e3c72cc2100e49adc8c29 100644 (file)
@@ -2548,9 +2548,8 @@ class EbuildBuild(CompositeTask):
                tree = "porttree"
                self._tree = tree
                portdb = root_config.trees[tree].dbapi
-               settings["EMERGE_FROM"] = pkg.type_name
-               settings.backup_changes("EMERGE_FROM")
-               settings.reset()
+               settings.setcpv(pkg)
+               settings.configdict["pkg"]["EMERGE_FROM"] = pkg.type_name
                ebuild_path = portdb.findname(self.pkg.cpv)
                self._ebuild_path = ebuild_path
 
@@ -3233,6 +3232,7 @@ class Binpkg(CompositeTask):
                debug = settings.get("PORTAGE_DEBUG") == "1"
                portage.doebuild_environment(self._ebuild_path, "setup",
                        settings["ROOT"], settings, debug, 1, self._bintree.dbapi)
+               settings.configdict["pkg"]["EMERGE_FROM"] = pkg.type_name
 
                # The prefetcher has already completed or it
                # could be running now. If it's running now,
@@ -3776,6 +3776,15 @@ class MergeListItem(CompositeTask):
                        colorize("MERGE_LIST_PROGRESS", str(pkg_count.maxval)),
                        colorize("GOOD", pkg.cpv))
 
+               portdb = pkg.root_config.trees["porttree"].dbapi
+               portdir_repo_name = portdb._repository_map.get(portdb.porttree_root)
+               if portdir_repo_name:
+                       pkg_repo_name = pkg.metadata.get("repository")
+                       if pkg_repo_name != portdir_repo_name:
+                               if not pkg_repo_name:
+                                       pkg_repo_name = "unknown repo"
+                               msg += " from %s" % pkg_repo_name
+
                if pkg.root != "/":
                        msg += " %s %s" % (preposition, pkg.root)
 
index d8ddbccb274123a101e7affaf7aa32180e6a1550..f205a83a34381f3fbf26620d186612b4950b885a 100644 (file)
@@ -918,7 +918,7 @@ class config(object):
        _env_blacklist = [
                "A", "AA", "CATEGORY", "EBUILD_PHASE", "EMERGE_FROM",
                "PF", "PKGUSE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE",
-               "PORTAGE_USE", "ROOT", "EPREFIX", "EROOT"
+               "PORTAGE_REPO_NAME", "PORTAGE_USE", "ROOT", "EPREFIX", "EROOT"
        ]
 
        _environ_whitelist = []
@@ -1936,8 +1936,12 @@ class config(object):
                        else:
                                aux_keys = [k for k in auxdbkeys \
                                        if not k.startswith("UNUSED_")]
+                               aux_keys.append("repository")
                                for k, v in izip(aux_keys, mydb.aux_get(self.mycpv, aux_keys)):
                                        pkg_configdict[k] = v
+                       repository = pkg_configdict.pop("repository", None)
+                       if repository is not None:
+                               pkg_configdict["PORTAGE_REPO_NAME"] = repository
                        for k in pkg_configdict:
                                if k != "USE":
                                        env_configdict.pop(k, None)
@@ -2545,8 +2549,9 @@ class config(object):
 
                                        if x[0]=="+":
                                                # Not legal. People assume too much. Complain.
-                                               writemsg(red("USE flags should not start with a '+': %s\n" % x),
-                                                       noiselevel=-1)
+                                               writemsg(colorize("BAD",
+                                                       "USE flags should not start with a '+': %s" % x) \
+                                                       + "\n", noiselevel=-1)
                                                x=x[1:]
                                                if not x:
                                                        continue
@@ -3442,7 +3447,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
 
        if not os.access(mysettings["DISTDIR"],os.W_OK) and fetch_to_ro:
                if use_locks:
-                       writemsg(red("!!! For fetching to a read-only filesystem, " + \
+                       writemsg(colorize("BAD",
+                               "!!! For fetching to a read-only filesystem, " + \
                                "locking should be turned off.\n"), noiselevel=-1)
                        writemsg("!!! This can be done by adding -distlocks to " + \
                                "FEATURES in /etc/make.conf\n", noiselevel=-1)
@@ -4805,17 +4811,6 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
        mysettings["ROOT"]     = myroot
        mysettings["EROOT"]    = myroot + mysettings["EPREFIX"].lstrip(os.path.sep) + os.path.sep
        mysettings["STARTDIR"] = getcwd()
-
-       mysettings["PORTAGE_REPO_NAME"] = ""
-       # bindbapi has no getRepositories() method
-       if mydbapi and hasattr(mydbapi, "getRepositories"):
-               # do we have a origin repository name for the current package
-               repopath = os.sep.join(pkg_dir.split(os.path.sep)[:-2])
-               for reponame in mydbapi.getRepositories():
-                       if mydbapi.getRepositoryPath(reponame) == repopath:
-                               mysettings["PORTAGE_REPO_NAME"] = reponame
-                               break
-
        mysettings["EBUILD"]   = ebuild_path
        mysettings["O"]        = pkg_dir
        mysettings.configdict["pkg"]["CATEGORY"] = cat
@@ -7299,16 +7294,16 @@ def deprecated_profile_check(settings=None):
        deprecatedfile = open(deprecated_profile_file, "r")
        dcontent = deprecatedfile.readlines()
        deprecatedfile.close()
-       writemsg(red("\n!!! Your current profile is deprecated and not supported anymore.\n"),
-               noiselevel=-1)
+       writemsg(colorize("BAD", "\n!!! Your current profile is " + \
+               "deprecated and not supported anymore.") + "\n", noiselevel=-1)
        if not dcontent:
-               writemsg(red("!!! Please refer to the Gentoo Upgrading Guide.\n"),
-                       noiselevel=-1)
+               writemsg(colorize("BAD","!!! Please refer to the " + \
+                       "Gentoo Upgrading Guide.") + "\n", noiselevel=-1)
                return True
        newprofile = dcontent[0]
-       writemsg(red("!!! Please upgrade to the following profile if possible:\n"),
-               noiselevel=-1)
-       writemsg(8*" "+green(newprofile)+"\n", noiselevel=-1)
+       writemsg(colorize("BAD", "!!! Please upgrade to the " + \
+               "following profile if possible:") + "\n", noiselevel=-1)
+       writemsg(8*" " + colorize("GOOD", newprofile) + "\n", noiselevel=-1)
        if len(dcontent) > 1:
                writemsg("To upgrade do the following steps:\n", noiselevel=-1)
                for myline in dcontent[1:]:
@@ -7388,7 +7383,8 @@ def _global_updates(trees, prev_mtimes):
                timestamps = {}
                for mykey, mystat, mycontent in update_data:
                        writemsg_stdout("\n\n")
-                       writemsg_stdout(green("Performing Global Updates: ")+bold(mykey)+"\n")
+                       writemsg_stdout(colorize("GOOD",
+                               "Performing Global Updates: ")+bold(mykey)+"\n")
                        writemsg_stdout("(Could take a couple of minutes if you have a lot of binary packages.)\n")
                        writemsg_stdout("  " + bold(".") + "='update pass'  " + \
                                bold("*") + "='binary update'  " + bold("#") + \
index 28e3f2eee4e6526beee874f2bd40a3ece4efdbce..c78255d8c1c9c2c7a7911a30cf5e1385213a812f 100644 (file)
@@ -6,7 +6,7 @@
 import os, sys, pwd, grp, platform
 from portage.util import writemsg
 from portage.const import rootuid, portageuser, portagegroup, EPREFIX
-from portage.output import green,red
+from portage.output import colorize
 from portage.output import create_color_func
 bad = create_color_func("BAD")
 
@@ -32,7 +32,8 @@ if not lchown:
                        lchown = missingos.lchown
                except ImportError:
                        def lchown(*pos_args, **key_args):
-                               writemsg(red("!!!") + " It seems that os.lchown does not" + \
+                               writemsg(colorize("BAD", "!!!") + \
+                                       " It seems that os.lchown does not" + \
                                        " exist.  Please rebuild python.\n", noiselevel=-1)
                        lchown()
 
@@ -88,6 +89,16 @@ except KeyError:
        writemsg(  red("         since it means you have thrown away yourself.\n"))
        writemsg(      "         Re-add yourself or re-bootstrap Gentoo Prefix.\n")
        writemsg("\n")
+       writemsg(colorize("BAD",
+               "portage: 'portage' user or group missing.") + "\n", noiselevel=-1)
+       writemsg(
+               "         For the defaults, line 1 goes into passwd, " + \
+               "and 2 into group.\n", noiselevel=-1)
+       writemsg(colorize("GOOD",
+               "         portage:x:250:250:portage:/var/tmp/portage:/bin/false") \
+               + "\n", noiselevel=-1)
+       writemsg(colorize("GOOD", "         portage::250:portage") + "\n",
+               noiselevel=-1)
        portage_group_warning()
 
 userpriv_groups = [portage_gid]
index 435ffebbb941a2dd9f51a6944842ee33ae535505..cdae94573307c5b3abbe2d0bcbf63504ccb80d8e 100644 (file)
@@ -8,7 +8,7 @@ import os
 import re
 from portage.dep import match_from_list
 from portage.locks import unlockfile
-from portage.output import red
+from portage.output import colorize
 from portage.util import writemsg
 from portage import auxdbkeys, dep_expand
 from portage.versions import catpkgsplit, pkgcmp
@@ -196,7 +196,8 @@ class dbapi(object):
                                pass
                elif '/-MERGING-' in mypath:
                        if os.path.exists(mypath):
-                               writemsg(red("INCOMPLETE MERGE:")+" "+mypath+"\n", noiselevel=-1)
+                               writemsg(colorize("BAD","INCOMPLETE MERGE:")+" %s\n" % mypath,
+                                       noiselevel=-1)
                else:
                        writemsg("!!! Invalid db entry: %s\n" % mypath, noiselevel=-1)
 
index 532062e2d7b0d775ba9741f68bfe2fc18ca37756..f80c3f554a23674d1ebc2ecea164901c96b39346 100644 (file)
@@ -9,7 +9,7 @@ from portage.dep import isvalidatom, isjustname, dep_getkey, match_from_list
 from portage.dbapi.virtual import fakedbapi
 from portage.exception import InvalidPackageName, \
        PermissionDenied, PortageException
-from portage.output import green, EOutput
+from portage.output import EOutput, colorize
 from portage.util import ensure_dirs, normalize_path, writemsg, writemsg_stdout
 from portage.versions import best, catpkgsplit, catsplit
 from portage.update import update_dbentries
@@ -747,7 +747,7 @@ class binarytree(object):
                                chunk_size = 3000
                        writemsg_stdout("\n")
                        writemsg_stdout(
-                               green("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)
index 47bc318516d182b1a7689fce99feafed88768592..25f600ddd5489ce32e67204c927675b41e427866 100644 (file)
@@ -17,7 +17,7 @@ from portage.exception import CommandNotFound, \
        InvalidData, InvalidPackageName, \
        FileNotFound, PermissionDenied, UnsupportedAPIException
 from portage.locks import lockdir, unlockdir
-from portage.output import bold, red, green
+from portage.output import bold, colorize
 from portage.update import fixdbentries
 from portage.util import apply_secpass_permissions, ConfigProtect, ensure_dirs, \
        writemsg, writemsg_level, write_atomic, atomic_ofstream, writedict, \
@@ -3349,8 +3349,8 @@ class dblink(object):
                        collisions = []
                        destroot = normalize_path(destroot).rstrip(os.path.sep) + \
                                os.path.sep
-                       showMessage("%s checking %d files for package collisions\n" % \
-                               (green("*"), len(mycontents)))
+                       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)
@@ -3984,7 +3984,6 @@ class dblink(object):
                        showMessage(">>> Original instance of package unmerged safely.\n")
 
                if len(others_in_slot) > 1:
-                       from portage.output import colorize
                        showMessage(colorize("WARN", "WARNING:")
                                + " AUTOCLEAN is disabled.  This can cause serious"
                                + " problems due to overlapping packages.\n",
@@ -4134,18 +4133,7 @@ class dblink(object):
                        # myrealdest is mydest without the $ROOT prefix (makes a difference if ROOT!="/")
                        myrealdest = join(sep, offset, x)
                        # stat file once, test using S_* macros many times (faster that way)
-                       try:
-                               mystat = os.lstat(mysrc)
-                       except OSError, e:
-                               writemsg("\n")
-                               writemsg(red("!!! ERROR: There appears to be ")+bold("FILE SYSTEM CORRUPTION.")+red(" A file that is listed\n"))
-                               writemsg(red("!!!        as existing is not capable of being stat'd. If you are using an\n"))
-                               writemsg(red("!!!        experimental kernel, please boot into a stable one, force an fsck,\n"))
-                               writemsg(red("!!!        and ensure your filesystem is in a sane state. ")+bold("'shutdown -Fr now'\n"))
-                               writemsg(red("!!!        File:  ")+str(mysrc)+"\n", noiselevel=-1)
-                               writemsg(red("!!!        Error: ")+str(e)+"\n", noiselevel=-1)
-                               return 1
-
+                       mystat = os.lstat(mysrc)
                        mymode = mystat[stat.ST_MODE]
                        # handy variables; mydest is the target object on the live filesystems;
                        # mysrc is the source object in the temporary install dir
index f1eff0df328761f2c0b96706ea2358c7169bfee7..6414d0c044765468a01a6085c54e1ccbfbcc705b 100644 (file)
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-from portage.output import red, yellow, green
+from portage.output import colorize
 from portage.cache.mappings import slot_dict_class
 import portage.xpak
 import HTMLParser
@@ -23,12 +23,12 @@ except ImportError:
 try:
        import ftplib
 except ImportError, e:
-       sys.stderr.write(red("!!! CANNOT IMPORT FTPLIB: ")+str(e)+"\n")
+       sys.stderr.write(colorize("BAD","!!! CANNOT IMPORT FTPLIB: ")+str(e)+"\n")
 
 try:
        import httplib
 except ImportError, e:
-       sys.stderr.write(red("!!! CANNOT IMPORT HTTPLIB: ")+str(e)+"\n")
+       sys.stderr.write(colorize("BAD","!!! CANNOT IMPORT HTTPLIB: ")+str(e)+"\n")
 
 def make_metadata_dict(data):
        myid,myglob = data
@@ -140,7 +140,9 @@ def create_conn(baseurl,conn=None):
                        if password:
                                conn.login(username,password)
                        else:
-                               sys.stderr.write(yellow(" * No password provided for username")+" '"+str(username)+"'\n\n")
+                               sys.stderr.write(colorize("WARN",
+                                       " * No password provided for username")+" '%s'" % \
+                                       (username,) + "\n\n")
                                conn.login(username)
                        conn.set_pasv(passive)
                        conn.set_debuglevel(0)
@@ -232,9 +234,12 @@ def make_http_request(conn, address, params={}, headers={}, dest=None):
                                parts = x.split(": ",1)
                                if parts[0] == "Location":
                                        if (rc == 301):
-                                               sys.stderr.write(red("Location has moved: ")+str(parts[1])+"\n")
+                                               sys.stderr.write(colorize("BAD",
+                                                       "Location has moved: ") + str(parts[1]) + "\n")
                                        if (rc == 302):
-                                               sys.stderr.write(red("Location has temporarily moved: ")+str(parts[1])+"\n")
+                                               sys.stderr.write(colorize("BAD",
+                                                       "Location has temporarily moved: ") + \
+                                                       str(parts[1]) + "\n")
                                        address = parts[1]
                                        break
        
@@ -588,8 +593,9 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
                                self.last_update = cur_time
                                self.display()
                def display(self):
-                       self.out.write("\r"+yellow("cache miss: '"+str(self.misses)+"'")+\
-                               " --- "+green("cache hit: '"+str(self.hits)+"'"))
+                       self.out.write("\r"+colorize("WARN",
+                               "cache miss: '"+str(self.misses)+"'") + \
+                               " --- "+colorize("GOOD","cache hit: '"+str(self.hits)+"'"))
                        self.out.flush()
 
        cache_stats = CacheStats(out)
@@ -631,7 +637,8 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
                        if myid and myid[0]:
                                metadata[baseurl]["data"][x] = make_metadata_dict(myid)
                        elif verbose:
-                               sys.stderr.write(red("!!! Failed to retrieve metadata on: ")+str(x)+"\n")
+                               sys.stderr.write(colorize("BAD",
+                                       "!!! Failed to retrieve metadata on: ")+str(x)+"\n")
                                sys.stderr.flush()
                else:
                        cache_stats.hits += 1