Fix broken file list handling for FEATUES=sign when only the Manifest has changed...
authorZac Medico <zmedico@gentoo.org>
Thu, 22 Feb 2007 13:21:17 +0000 (13:21 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 22 Feb 2007 13:21:17 +0000 (13:21 -0000)
svn path=/main/branches/2.1.2/; revision=6037

bin/repoman

index 67eab93a537eee6b1b59d15c113602f5e53f1164..ca38d4f7c4b99125cd3fe9294abdf5a3435b67d5 100755 (executable)
@@ -1550,6 +1550,7 @@ else:
 
        # Manifests need to be regenerated after all other commits, so don't commit
        # them now even if they have changed.
+       mymanifests = [f for f in mychanged if "Manifest" == os.path.basename(f)]
        mychanged = [f for f in mychanged if "Manifest" != os.path.basename(f)]
        myupdates=mychanged+mynew
        myheaders=[]
@@ -1669,24 +1670,32 @@ else:
                elif repolevel==2: # In a category dir
                        for x in myfiles:
                                xs=x.split("/")
+                               if len(xs) < 4-repolevel:
+                                       continue
                                if xs[0]==".":
                                        xs=xs[1:]
                                if xs[0] in mydone:
                                        continue
                                mydone.append(xs[0])
                                repoman_settings["O"] = os.path.join(startdir, xs[0])
+                               if not os.path.isdir(repoman_settings["O"]):
+                                       continue
                                portage.digestgen([], repoman_settings, manifestonly=1,
                                        myportdb=portdb)
                elif repolevel==1: # repo-cvsroot
                        print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
                        for x in myfiles:
                                xs=x.split("/")
+                               if len(xs) < 4-repolevel:
+                                       continue
                                if xs[0]==".":
                                        xs=xs[1:]
                                if "/".join(xs[:2]) in mydone:
                                        continue
                                mydone.append("/".join(xs[:2]))
                                repoman_settings["O"] = os.path.join(startdir, xs[0], xs[1])
+                               if not os.path.isdir(repoman_settings["O"]):
+                                       continue
                                portage.digestgen([], repoman_settings, manifestonly=1,
                                        myportdb=portdb)
                else:
@@ -1716,6 +1725,7 @@ else:
        signed = False
        if "sign" in repoman_settings.features:
                signed = True
+               myfiles = myupdates + myremoved + mymanifests
                try:
                        if repolevel==3:   # In a package dir
                                repoman_settings["O"] = "."
@@ -1724,24 +1734,32 @@ else:
                                mydone=[]
                                for x in myfiles:
                                        xs=x.split("/")
+                                       if len(xs) < 4-repolevel:
+                                               continue
                                        if xs[0]==".":
                                                xs=xs[1:]
                                        if xs[0] in mydone:
                                                continue
                                        mydone.append(xs[0])
                                        repoman_settings["O"] = os.path.join(".", xs[0])
+                                       if not os.path.isdir(repoman_settings["O"]):
+                                               continue
                                        gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
                        elif repolevel==1: # repo-cvsroot
                                print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
                                mydone=[]
                                for x in myfiles:
                                        xs=x.split("/")
+                                       if len(xs) < 4-repolevel:
+                                               continue
                                        if xs[0]==".":
                                                xs=xs[1:]
                                        if "/".join(xs[:2]) in mydone:
                                                continue
                                        mydone.append("/".join(xs[:2]))
                                        repoman_settings["O"] = os.path.join(".", xs[0], xs[1])
+                                       if not os.path.isdir(repoman_settings["O"]):
+                                               continue
                                        gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
                except portage_exception.PortageException, e:
                        portage.writemsg("!!! %s\n" % str(e))