For bug #169500, detect when the cvs server puts /Attic/ inside the $Header path...
authorZac Medico <zmedico@gentoo.org>
Sat, 21 Jul 2007 11:34:23 +0000 (11:34 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 21 Jul 2007 11:34:23 +0000 (11:34 -0000)
svn path=/main/trunk/; revision=7340

bin/repoman

index 6a617191d4f09c32ed13ba643d5f02e65a258008..b995c4706486cb917d35fd3221401dbc4aa02b94 100755 (executable)
@@ -1792,6 +1792,23 @@ else:
                        else:
                                raise portage.exception.PortageException("!!! gpg exited with '" + str(rValue) + "' status")
 
+       # When files are removed and re-added, the cvs server will put /Attic/
+       # inside the $Header path. This code detects the problem and corrects it
+       # so that the Manifest will generate correctly. See bug #169500.
+       from portage.util import write_atomic
+       cvs_header = re.compile(r'^#\s*\$Header.*\$$')
+       for x in myheaders:
+               f = open(x)
+               mylines = f.readlines()
+               f.close()
+               modified = False
+               for i, line in enumerate(mylines):
+                       if cvs_header.match(line) and "/Attic/" in line:
+                               mylines[i] = line.replace("/Attic/", "/")
+                               modified = True
+               if modified:
+                       write_atomic(x, "".join(mylines))
+
        manifest_commit_required = True
        if myheaders or myupdates or myremoved or mynew:
                myfiles=myheaders+myupdates+myremoved+mynew