Fix more broken commitmessagefile handling.
authorZac Medico <zmedico@gentoo.org>
Thu, 22 Feb 2007 12:48:25 +0000 (12:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 22 Feb 2007 12:48:25 +0000 (12:48 -0000)
svn path=/main/trunk/; revision=6033

bin/repoman

index d5218e071b5c63387df0f65af1186a34e1a8f3ea..b599f9111b4c2a46fdf962ef0747685e6aa32f16 100755 (executable)
@@ -1697,13 +1697,18 @@ else:
                # Force an unsigned commit when more than one Manifest needs to be signed.
                if repolevel < 3 and "sign" in repoman_settings.features:
                        if "--pretend" in myoptions:
-                               print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")"
+                               print "(/usr/bin/cvs -q commit -F commitmessagefile)"
                        else:
-                               mymsg=open(commitmessagefile,"w")
+                               fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+                               mymsg = os.fdopen(fd, "w")
                                mymsg.write(commitmessage)
                                mymsg.write("\n (Unsigned Manifest commit)")
                                mymsg.close()
                                retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile)
+                               try:
+                                       os.unlink(commitmessagefile)
+                               except OSError:
+                                       pass
                                if retval:
                                        print "!!! Exiting on cvs (shell) error code:",retval
                                        sys.exit(retval)