From 1c2b103b08e021b2a302fb58985d45dae5ca44c4 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Tue, 25 Mar 2008 20:33:41 +0000 Subject: [PATCH] Merged from trunk 9501:9507 | 9502 | Check is os.statvfs() is implemented before trying to us it. | | zmedico | (branches/prefix r9500) | | 9503 | Bug #214499 - When compiler flags are unset, many packages | | zmedico | will substitute their own implicit flags. For uniformity, | | | use an empty string as the default. | | 9504 | Bug #211294 - Make repoman bail out if arch.list contains | | zmedico | unrecognized lines since we don't want people to commit with | | | old versions of portage that don't support the current | | | arch.list format. | | 9505 | Bug #212152 - Account pre-existing files when calculating | | zmedico | whether there is enough space for a download. | | 9506 | Fix typo. | | zmedico | | | 9507 | Bug #212621 - Make the EbuildQuote check do quoting | | zmedico | validation for misc variables from games.eclass. | svn path=/main/branches/prefix/; revision=9508 --- bin/ebuild.sh | 6 ++++++ bin/repoman | 15 ++++++++++++--- pym/portage/__init__.py | 10 +++++++++- pym/repoman/checks.py | 9 ++++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 471743ce0..5251f7951 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -273,6 +273,12 @@ export LIBOPTIONS="-m0644" export DIROPTIONS="-m0755" export MOPREFIX=${PN} +# When compiler flags are unset, many packages will substitute their own +# implicit flags. For uniformity, use an empty string as the default. +[ "${CFLAGS-unset}" == "unset" ] && export CFLAGS="" +[ "${CXXFLAGS-unset}" == "unset" ] && export CXXFLAGS="" +[ "${LDFLAGS-unset}" == "unset" ] && export LDFLAGS="" + check_KV() { if [ -z "${KV}" ]; then eerror "" diff --git a/bin/repoman b/bin/repoman index da0cfc4f7..7ffabda08 100755 --- a/bin/repoman +++ b/bin/repoman @@ -571,15 +571,24 @@ scanlist.sort() logging.debug("Found the following packages to scan:\n%s" % '\n'.join(scanlist)) profiles={} +valid_profile_types = frozenset(["dev", "exp", "stable"]) descfile=portdir+"/profiles/profiles.desc" if os.path.exists(descfile): - for x in portage.grabfile(descfile): + for i, x in enumerate(open(descfile, 'rb')): if x[0]=="#": continue arch=x.split() - if len(arch)!=3: - print "wrong format: \""+red(x)+"\" in "+descfile + if len(arch) == 0: continue + if len(arch)!=3: + err("wrong format: \"" + bad(x.strip()) + "\" in " + \ + descfile + " line %d" % (i+1, )) + elif arch[0] not in kwlist: + err("invalid arch: \"" + bad(arch[0]) + "\" in " + \ + descfile + " line %d" % (i+1, )) + elif arch[2] not in valid_profile_types: + err("invalid profile type: \"" + bad(arch[2]) + "\" in " + \ + descfile + " line %d" % (i+1, )) if not os.path.isdir(portdir+"/profiles/"+arch[1]): print "Invalid "+arch[2]+" profile ("+arch[1]+") for arch "+arch[0] continue diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 7c4ca5fb1..3ebb253a9 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3265,8 +3265,16 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", # overestimate the filesize so we aren't bitten by FS overhead if hasattr(os, "statvfs"): vfs_stat = os.statvfs(mysettings["DISTDIR"]) + try: + mysize = os.stat(myfile_path).st_size + except OSError, e: + if e.errno != errno.ENOENT: + raise + del e + mysize = 0 if myfile in mydigests \ - and (mydigests[myfile]["size"] + vfs_stat.f_bsize) >= (vfs_stat.f_bsize * vfs_stat.f_bavail): + and (mydigests[myfile]["size"] - mysize + vfs_stat.f_bsize) >= \ + (vfs_stat.f_bsize * vfs_stat.f_bavail): writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1) has_space = False diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index ea76f6a01..aa5bf1845 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -77,7 +77,14 @@ class EbuildQuote(LineCheck): repoman_check_name = 'ebuild.minorsyn' ignore_line = re.compile(r'(^$)|(^\s*#.*)|(^\s*\w+=.*)|(^\s*(local|export)\s+)') - var_names = r'(D|DISTDIR|FILESDIR|S|T|ROOT|WORKDIR)' + var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"] + + # variables for games.eclass + var_names += ["Ddir", "dir", "GAMES_PREFIX_OPT", "GAMES_DATADIR", + "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR", + "GAMES_LOGDIR", "GAMES_BINDIR"] + + var_names = "(%s)" % "|".join(var_names) var_reference = re.compile(r'\$(\{'+var_names+'\}|' + \ var_names + '\W)') missing_quotes = re.compile(r'(\s|^)[^"\'\s]*\$\{?' + var_names + \ -- 2.26.2