cd /
if type -P gsed >/dev/null ; then
- function sed() { gsed "$@"; }
+ sed() { gsed "$@"; }
fi
-function get_config() {
+get_config() {
# the sed here does:
# - strip off comments
# - match lines that set item in question
"${PORTAGE_CONFIGROOT}"etc/etc-update.conf)
}
-function scan() {
+scan() {
echo "Scanning Configuration files..."
rm -rf ${TMP}/files > /dev/null 2>&1
}
-function sel_file() {
+sel_file() {
local -i isfirst=0
until [[ -f ${TMP}/files/${input} ]] || \
[[ ${input} == -1 ]] || \
done
}
-function user_special() {
+user_special() {
if [ -r ${PORTAGE_CONFIGROOT}etc/etc-update.special ]; then
if [ -z "$1" ]; then
echo "ERROR: user_special() called without arguments"
return 1
}
-function read_int() {
+read_int() {
# Read an integer from stdin. Continously loops until a valid integer is
# read. This is a workaround for odd behavior of bash when an attempt is
# made to store a value such as "1y" into an integer-only variable.
echo ${my_input}
}
-function do_file() {
+do_file() {
echo
local -i my_input
local -i fcount=0
count=${count}-1
}
-function do_cfg() {
+do_cfg() {
local file="${1}"
local ofile="${2}"
done
}
-function do_merge() {
+do_merge() {
# make sure we keep the merged file in the secure tempdir
# so we dont leak any information contained in said file
# (think of case where the file has 0600 perms; during the
return 255
}
-function die() {
+die() {
trap "" TERM
trap "" KILL
echo "Exiting: ${1}"
declare -i count=0
declare input=0
-declare title="Gentoolkit's etc-update tool!"
+declare title="Gentoo's etc-update tool!"
scan
"PROVIDE.syntax":"Syntax error in PROVIDE (usually an extra/missing space/parenthesis)",
"RESTRICT.syntax":"Syntax error in RESTRICT (usually an extra/missing space/parenthesis)",
"SRC_URI.syntax":"Syntax error in SRC_URI (usually an extra/missing space/parenthesis)",
- "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error",
+ "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure",
"ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.",
"ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.",
"variable.readonly":"Assigning a readonly variable",
fetchlist_dict = portage.FetchlistDict(checkdir, repoman_settings, portdb)
myfiles_all = []
+ src_uri_error = False
for mykey in fetchlist_dict:
try:
myfiles_all.extend(fetchlist_dict[mykey])
except portage.exception.InvalidDependString, e:
- stats["SRC_URI.syntax"] = stats["SRC_URI.syntax"] + 1
- fails["SRC_URI.syntax"].append(mykey+".ebuild SRC_URI: "+str(e))
+ src_uri_error = True
+ try:
+ portdb.aux_get(mykey, ["SRC_URI"])
+ except KeyError:
+ # This will be reported as an "ebuild.syntax" error.
+ pass
+ else:
+ stats["SRC_URI.syntax"] = stats["SRC_URI.syntax"] + 1
+ fails["SRC_URI.syntax"].append(
+ "%s.ebuild SRC_URI: %s" % (mykey, e))
del fetchlist_dict
- myfiles_all = set(myfiles_all)
- for entry in mydigests:
- if entry not in myfiles_all:
- stats["digestentry.unused"] += 1
- fails["digestentry.unused"].append(checkdir+"::"+entry)
+ if not src_uri_error:
+ # This test can produce false positives if SRC_URI could not
+ # be parsed for one or more ebuilds. There's no point in
+ # producing a false error here since the root cause will
+ # produce a valid error elsewhere, such as "SRC_URI.syntax"
+ # or "ebuild.sytax".
+ myfiles_all = set(myfiles_all)
+ for entry in mydigests:
+ if entry not in myfiles_all:
+ stats["digestentry.unused"] += 1
+ fails["digestentry.unused"].append(checkdir+"::"+entry)
del myfiles_all
if os.path.exists(checkdir+"/files"):
"""Ensure ebuilds have valid quoting around things like D,FILESDIR, etc..."""
repoman_check_name = 'ebuild.minorsyn'
- ignore_line = re.compile(r'(^$)|(^\s*#.*)')
+ ignore_line = re.compile(r'(^$)|(^\s*#.*)|(^\s*\w+=.*)')
var_names = r'(D|S|T|ROOT|FILESDIR|WORKDIR)'
var_reference = re.compile(r'\$({'+var_names+'}|' + \
r'\$' + var_names + '\W)')
missing_quotes = re.compile(r'(\s|^)[^"\s]*\${?' + var_names + \
r'}?[^"\s]*(\s|$)')
- var_assignment = re.compile(r'^\s*\w*=.*')
cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
# get through the missing_quotes regex.
if self.var_reference.search(group) is None:
continue
- if self.var_assignment.search(group) is not None:
- continue
# This is an attempt to avoid false positives without getting
# too complex, while possibly allowing some (hopefully