# figure out the new suffix
suffix=$(ecompress --suffix)
-[[ -z ${suffix} ]] && exit 0
+if [[ -z ${suffix} ]] ; then
+ vecho "${0##*/}: unable to figure out compressed suffix"
+ exit 1
+fi
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
vecho "${0##*/}: $(ecompress --bin) ${dir#${D}}"
fi
- find "${dir}" -type f -print0 | xargs -0 ecompress
+ find "${dir}" -type f '!' -name '*'${suffix} -print0 | xargs -0 ecompress
((ret+=$?))
find -L "${dir}" -type l | \
while read brokenlink ; do
olddest=$(readlink "${brokenlink}")
newdest="${olddest}${suffix}"
- if [[ -e ${newdest} ]] ; then
- ln -snf "${newdest}" "${brokenlink}"
- ((ret+=$?))
- else
- vecho "ecompressdir: unknown broken symlink: ${brokenlink}"
- ((++ret))
- fi
+ ln -snf "${newdest}" "${brokenlink}"
+ ((ret+=$?))
done
done
# together with EMERGE_DEFAULT_OPTS (which may vary depending on the
# the value of --config-root).
myaction, myopts, myfiles = parse_opts(sys.argv[1:], silent=True)
+ if "--debug" in myopts:
+ os.environ["PORTAGE_DEBUG"] = "1"
if "--config-root" in myopts:
os.environ["PORTAGE_CONFIGROOT"] = myopts["--config-root"]
ENDCOL=$'\e[A\e['${COLS}'C' # Now, ${ENDCOL} will move us to the end of the
# column; irregardless of character width
-
- [ -z "${GOOD}" ] && GOOD=$'\e[32;01m'
- [ -z "${WARN}" ] && WARN=$'\e[33;01m'
- [ -z "${BAD}" ] && BAD=$'\e[31;01m'
- [ -z "${HILITE}" ] && HILITE=$'\e[36;01m'
- [ -z "${BRACKET}" ] && BRACKET=$'\e[34;01m'
+ if [ -n "${PORTAGE_COLORMAP}" ] ; then
+ eval ${PORTAGE_COLORMAP}
+ else
+ GOOD=$'\e[32;01m'
+ WARN=$'\e[33;01m'
+ BAD=$'\e[31;01m'
+ HILITE=$'\e[36;01m'
+ BRACKET=$'\e[34;01m'
+ fi
NORMAL=$'\e[0m'
}
-export -n GOOD WARN BAD HILITE BRACKET
RC_ENDCOL="yes"
RC_INDENTATION=''
RC_DEFAULT_INDENT=2
fi
fi
- # Check for setid binaries but are not built with BIND_NOW
- f=$(scanelf -qyRF '%b %p' "${ED}")
- if [[ -n ${f} ]] ; then
- vecho -ne '\a\n'
- eqawarn "QA Notice: The following files are setXid, dyn linked, and using lazy bindings"
- eqawarn " This combination is generally discouraged. Try re-emerging the package:"
- eqawarn " LDFLAGS='-Wl,-z,now' emerge ${PN}"
- eqawarn "${f}"
- vecho -ne '\a\n'
- # Do not fail here until we have sorted out the lazy issues with security team
- #die_msg="${die_msg} setXid lazy bindings,"
- sleep 1
- fi
-
# TEXTREL's are baaaaaaaad
# Allow devs to mark things as ignorable ... e.g. things that are
# binary-only and upstream isn't cooperating (nvidia-glx) ... we
@type local_config: Boolean
"""
+ debug = os.environ.get("PORTAGE_DEBUG") == "1"
+
self.already_in_regenerate = 0
self.locked = 0
except SystemExit, e:
raise
except Exception, e:
+ if debug:
+ raise
writemsg("!!! %s\n" % (e), noiselevel=-1)
- writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n", noiselevel=-1)
- writemsg("!!! Errors in this file should be reported on bugs.gentoo.org.\n")
+ if not isinstance(e, EnvironmentError):
+ writemsg("!!! Incorrect multiline literals can cause " + \
+ "this. Do not use them.\n", noiselevel=-1)
sys.exit(1)
self.configlist.append(self.mygcfg)
self.configdict["globals"]=self.configlist[-1]
except SystemExit, e:
raise
except Exception, e:
+ if debug:
+ raise
writemsg("!!! %s\n" % (e), noiselevel=-1)
- writemsg("!!! 'rm -Rf %s/usr/portage/profiles; emerge sync' may fix this. If it does\n" % EPREFIX,
- noiselevel=-1)
- writemsg("!!! not then please report this to bugs.gentoo.org and, if possible, a dev\n",
- noiselevel=-1)
- writemsg("!!! on #gentoo (irc.freenode.org)\n",
- noiselevel=-1)
+ if not isinstance(e, EnvironmentError):
+ writemsg("!!! 'rm -Rf %s/usr/portage/profiles; " + \
+ "emerge sync' may fix this. If it does\n" % EPREFIX,
+ noiselevel=-1)
+ writemsg("!!! not then please report this to " + \
+ "bugs.gentoo.org and, if possible, a dev\n",
+ noiselevel=-1)
+ writemsg("!!! on #gentoo (irc.freenode.org)\n",
+ noiselevel=-1)
sys.exit(1)
self.configlist.append(self.mygcfg)
self.configdict["defaults"]=self.configlist[-1]
except SystemExit, e:
raise
except Exception, e:
+ if debug:
+ raise
writemsg("!!! %s\n" % (e), noiselevel=-1)
- writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n",
- noiselevel=-1)
+ if not isinstance(e, EnvironmentError):
+ writemsg("!!! Incorrect multiline literals can cause " + \
+ "this. Do not use them.\n", noiselevel=-1)
sys.exit(1)
# Allow ROOT setting to come from make.conf if it's not overridden
mysettings["KVERS"]=myso[1]
# Allow color.map to control colors associated with einfo, ewarn, etc...
+ mycolors = []
for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
- mysettings[c] = output.codes[c]
+ mycolors.append("%s=$'%s'" % (c, output.codes[c]))
+ mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
def prepare_build_dirs(myroot, mysettings, cleanup):
import re, string, sys, types
import portage_exception
+from portage_exception import InvalidData
from portage_versions import catpkgsplit, catsplit, pkgcmp, pkgsplit, ververify
def cpvequal(cpv1, cpv2):
return 0
if allow_blockers and atom.startswith("!"):
atom = atom[1:]
- mycpv_cps = catpkgsplit(dep_getcpv(atom))
+ try:
+ mycpv_cps = catpkgsplit(dep_getcpv(atom))
+ except InvalidData:
+ return 0
operator = get_operator(atom)
if operator:
if operator[0] in "<>" and atom[-1] == "*":
for x in candidate_list:
try:
result = pkgcmp(pkgsplit(x), mysplit)
- except SystemExit:
- raise
- except:
+ except ValueError:
writemsg("\nInvalid package name: %s\n" % x, noiselevel=-1)
raise
if result is None:
suffix_value = {"pre": -2, "p": 0, "alpha": -4, "beta": -3, "rc": -1}
endversion_keys = ["pre", "p", "alpha", "beta", "rc"]
+from portage_exception import InvalidData
def ververify(myver, silent=1):
if ver_regexp.match(myver):
# building lists of the version parts before the suffix
# first part is simple
- list1 = [string.atoi(match1.group(2))]
- list2 = [string.atoi(match2.group(2))]
-
+ list1 = [int(match1.group(2))]
+ list2 = [int(match2.group(2))]
+
# this part would greatly benefit from a fixed-length version pattern
if len(match1.group(3)) or len(match2.group(3)):
vlist1 = match1.group(3)[1:].split(".")
pkgcache[mypkg]=None
return None
+_valid_category = re.compile("^\w[\w-]*")
+
catcache={}
def catpkgsplit(mydata,silent=1):
- "returns [cat, pkgname, version, rev ]"
+ """
+ Takes a Category/Package-Version-Rev and returns a list of each.
+
+ @param mydata: Data to split
+ @type mydata: string
+ @param silent: suppress error messages
+ @type silent: Boolean (integer)
+ @rype: list
+ @return:
+ 1. If each exists, it returns [cat, pkgname, version, rev]
+ 2. If cat is not specificed in mydata, cat will be "null"
+ 3. if rev does not exist it will be '-r0'
+ 4. If cat is invalid (specified but has incorrect syntax)
+ an InvalidData Exception will be thrown
+ """
+
+ # Categories may contain a-zA-z0-9+_- but cannot start with -
+ global _valid_category
+ import portage_dep
try:
if not catcache[mydata]:
return None
retval=["null"]
p_split=pkgsplit(mydata,silent=silent)
elif len(mysplit)==2:
+ if portage_dep._dep_check_strict and \
+ not _valid_category.match(mysplit[0]):
+ raise InvalidData("Invalid category in %s" %mydata )
retval=[mysplit[0]]
p_split=pkgsplit(mysplit[1],silent=silent)
if not p_split:
prefix_ops = ["<", ">", "=", "~", "!", "<=",
">=", "!=", "!<", "!>", "!~",""]
+
+ bad_prefix_ops = [ ">~", "<~", "~>", "~<" ]
postfix_ops = [ "*", "" ]
cpvs = ["sys-apps/portage"]
for postfix in postfix_ops:
self.assertEqual( dep_getcpv(
prefix + cpv + postfix ), cpv )
+ for prefix in bad_prefix_ops:
+ for postfix in postfix_ops:
+ self.assertNotEqual( dep_getcpv(
+ prefix + cpv + postfix ), cpv )
atom_type = "valid"
else:
atom_type = "invalid"
-
- self.assertEqual( bool(isvalidatom( test[0] )), test[1] )
+ self.assertEqual( bool(isvalidatom( test[0] )), test[1],
+ msg="isvalidatom(%s) != %s" % ( test[0], test[1] ) )