From 3d817b06a8a848fae137ffb47c1d8fdb41923505 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 16 Jan 2007 07:40:33 +0000 Subject: [PATCH] Fix broken commitmessagefile handling. svn path=/main/trunk/; revision=5668 --- bin/repoman | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/repoman b/bin/repoman index d609e166d..a9c05c6c1 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1572,7 +1572,7 @@ else: print "myupdates:",myupdates print "myheaders:",myheaders print - unlinkfile=0 + if commitmessagefile: try: f = open(commitmessagefile) @@ -1600,10 +1600,7 @@ else: commitmessage+="\n(Portage version: Unknown)" if myupdates or myremoved: myfiles = myupdates + myremoved - unlinkfile=1 commitmessagefile=tempfile.mktemp(".repoman.msg") - if os.path.exists(commitmessagefile): - os.unlink(commitmessagefile) mymsg=open(commitmessagefile,"w") mymsg.write(commitmessage) mymsg.close() @@ -1623,9 +1620,13 @@ else: retval = spawn(["/usr/bin/cvs", "-q", "commit", "-F", commitmessagefile] + myfiles, env=os.environ) - if retval: - print "!!! Exiting on cvs (shell) error code:",retval - sys.exit(retval) + try: + os.unlink(commitmessagefile) + except OSError: + pass + if retval: + print "!!! Exiting on cvs (shell) error code:",retval + sys.exit(retval) # Setup the GPG commands def gpgsign(filename): @@ -1751,6 +1752,7 @@ else: if "--pretend" in myoptions: print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")" else: + commitmessagefile = tempfile.mktemp(".repoman.msg") mymsg=open(commitmessagefile,"w") mymsg.write(commitmessage) if signed: @@ -1759,12 +1761,14 @@ else: 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) - if unlinkfile: - os.unlink(commitmessagefile) print if isCvs: print "CVS commit complete." -- 2.26.2