Bug #190406 - Filter the myheaders list so that it doesn't include binary
authorZac Medico <zmedico@gentoo.org>
Thu, 6 Sep 2007 17:41:01 +0000 (17:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 6 Sep 2007 17:41:01 +0000 (17:41 -0000)
              blobs added to cvs with the -kb option. (trunk r7705)

svn path=/main/branches/2.1.2/; revision=7736

bin/repoman
pym/cvstree.py

index 20899baf9268ff256f9c91da4d9b3efaf3cc2725..df0d5e440822efaf5634b8aaa0de032cbc48e726 100755 (executable)
@@ -1617,11 +1617,14 @@ else:
                print
                sys.exit(1)
 
-       if isCvs:
+       if True:
                mycvstree=cvstree.getentries("./",recursive=1)
                mychanged=cvstree.findchanged(mycvstree,recursive=1,basedir="./")
                mynew=cvstree.findnew(mycvstree,recursive=1,basedir="./")
                myremoved=cvstree.findremoved(mycvstree,recursive=1,basedir="./")
+               bin_blob_pattern = re.compile("^-kb$")
+               bin_blobs = set(cvstree.findoption(mycvstree,
+                       bin_blob_pattern, recursive=1, basedir="./"))
                if not (mychanged or mynew or myremoved):
                        print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\""
                        print
@@ -1639,6 +1642,8 @@ else:
        headerstring="'\$(Header|Id)"
        headerstring+=".*\$'"
        for myfile in myupdates:
+               if myfile in bin_blobs:
+                       continue
                myout=getstatusoutput("egrep -q "+headerstring+" "+myfile)
                if myout[0]==0:
                        myheaders.append(myfile)
index ca94d3512433c4268b87c92fd4f8b9e73041e7aa..f74ecd4acdca2f16ff651220923be8f7a8628fb1 100644 (file)
@@ -72,7 +72,24 @@ def findnew(entries,recursive=0,basedir=""):
                for mydir in entries["dirs"]:
                        mylist+=findnew(entries["dirs"][mydir],recursive,basedir+mydir)
        return mylist
-                                       
+
+def findoption(entries, pattern, recursive=0, basedir=""):
+       """(entries, pattern, recursive=0, basedir="")
+       Iterate over paths of cvs entries for which the pattern.search() method
+       finds a match. Returns a list of paths, optionally prepended with a
+       basedir."""
+       if not basedir.endswith("/"):
+               basedir += "/"
+       for myfile, mydata in entries["files"].iteritems():
+               if "cvs" in mydata["status"]:
+                       if pattern.search(mydata["flags"]):
+                               yield basedir+myfile
+       if recursive:
+               for mydir, mydata in entries["dirs"].iteritems():
+                       for x in findoption(mydata, pattern,
+                               recursive, basedir+mydir):
+                               yield x
+
 def findchanged(entries,recursive=0,basedir=""):
        """(entries,recursive=0,basedir="")
        Recurses the entries tree to find all elements that exist in the cvs tree