From 798e46a8d85493411163e7c1c7b6d2e3515b9191 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 25 Mar 2008 03:18:28 +0000 Subject: [PATCH] Bug #211294 - Make repoman bail out if arch.list contains unrecognized lines since we don't want people to commit with old versions of portage that don't support the current arch.list format. svn path=/main/trunk/; revision=9504 --- bin/repoman | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/repoman b/bin/repoman index 8d31e6661..165c66c00 100755 --- a/bin/repoman +++ b/bin/repoman @@ -569,15 +569,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 -- 2.26.2