/[ascend]/trunk/tools/dtar/dtar
ViewVC logotype

Diff of /trunk/tools/dtar/dtar

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2368 by jpye, Thu Dec 23 11:04:44 2010 UTC revision 2369 by jpye, Mon Jan 31 09:00:44 2011 UTC
# Line 270  try: Line 270  try:
270            
271      assert(os.path.exists(os.path.join(head,"debian/control")))      assert(os.path.exists(os.path.join(head,"debian/control")))
272    
273        # apply patches so that dpkg-buildpackage can come and detect them
274    
275        print "LOOKING FOR PATCHES"
276        os.chdir(os.path.join(maindir,head))
277        if os.path.exists("debian/patches"):
278            print "PATCH DIR FOUND"
279            patches = glob.glob("debian/patches/*.patch")
280            for p in patches:
281                print "PATCH %s" % p
282                pf = open(p,"r")
283                po = subprocess.Popen(["patch","-p1"],stdin = pf,executable="/usr/bin/patch")
284                po.communicate()
285                pf.close()
286                if 0==po.returncode:
287                    print "PATCH %s APPLIED OK" % p
288                    os.unlink(p)
289                else:
290                    raise RuntimeError("Error applying patch '%s': is it in 'patch -p1' format?" % p)
291            os.rmdir("debian/patches")
292        os.chdir(maindir)
293    
294      # copy original tarball (recompressing to .gz/reheading if required?)      # copy original tarball (recompressing to .gz/reheading if required?)
295    
296      unzip = None      unzip = None
# Line 305  try: Line 326  try:
326          tar.close()          tar.close()
327          assert(os.path.exists(temptz))          assert(os.path.exists(temptz))
328    
329      elif ext != "gz":      elif ext != "gz" and ext != "bz2":
330          print "Source tarball needs to be re-zipped to gzip format."          print "Source tarball needs to be re-zipped to gzip format."
331          temptar = "%s_%s.orig.tar" % (control['Source'],changes.upstream_version)          temptar = "%s_%s.orig.tar" % (control['Source'],changes.upstream_version)
332          temptz = "%s.%s"%(temptar,ext)          temptz = "%s.%s"%(temptar,ext)
# Line 318  try: Line 339  try:
339          subprocess.call(['gzip',temptar])          subprocess.call(['gzip',temptar])
340                    
341      else:      else:
342          origname = "%s_%s.orig.tar.gz" % (control['Source'],changes.upstream_version)          origname = "%s_%s.orig.tar.%s" % (control['Source'],changes.upstream_version,ext)
343          print "Original tarball is in gzip format"          print "Original tarball is in %s format" % unzip[0]
344          shutil.copyfile(ffull, origname)          shutil.copyfile(ffull, origname)
345    
346      print "Checking for correct original tarball name..."      print "Checking for correct original tarball name..."
347      origname = "%s_%s.orig.tar.gz" % (control['Source'],changes.upstream_version)      origname = "%s_%s.orig.tar.%s" % (control['Source'],changes.upstream_version,ext)
348      assert(os.path.exists(origname))      assert(os.path.exists(origname))
349    
350      t1 = t      t1 = t
# Line 340  try: Line 361  try:
361      os.chdir(debianname)      os.chdir(debianname)
362      if buildsource:      if buildsource:
363          print "Building source package..."          print "Building source package..."
364          _cmd = ["dpkg-buildpackage","-S","-rfakeroot","-sa"]          _cmd = ["dpkg-buildpackage","-i","-S","-rfakeroot","-sa"]
365          res = subprocess.call(_cmd)          res = subprocess.call(_cmd)
366      else:      else:
367          print "Building binary package..."          print "Building binary package..."
368          _cmd = ["dpkg-buildpackage","-rfakeroot","-sa"]          _cmd = ["dpkg-buildpackage","-i","-rfakeroot","-sa"]
369          if parallel:          if parallel:
370              _cmd += [parallel]              _cmd += [parallel]
371          res = subprocess.call(_cmd)          res = subprocess.call(_cmd)
# Line 353  try: Line 374  try:
374          raise RuntimeError("dpkg-buildpackage returned error code %s" % res)          raise RuntimeError("dpkg-buildpackage returned error code %s" % res)
375    
376  except Exception, e:  except Exception, e:
377      print "ERROR DURING DPKG-BUILDPACKAGE: %s"% str(e)      print "ERROR IN DTAR: %s"% str(e)
378      print "Temporary files can be inspected in %s" % maindir      print "Temporary files can be inspected in %s" % maindir
379      sys.exit(1)      sys.exit(1)
380    

Legend:
Removed from v.2368  
changed lines
  Added in v.2369

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22