debian/bin/genorig.py: repair build orig from repo
authorHans van Kranenburg <hans@knorrie.org>
Wed, 20 Dec 2017 15:02:45 +0000 (16:02 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Thu, 21 Dec 2017 14:20:44 +0000 (15:20 +0100)
By picking up the repo provided to the script and kicking the git
archive process into that direction, we can at least do this now:

   ~/build/xen/debian-xen (master) 6-$ debian/bin/genorig.py ~/src/git/xen
   Generate tarball ../orig/xen_4.9.1.orig.tar.xz

...given that the newest changelog entry is e.g. 4.9.1-1

There's probably more things that can be improved in here, but let's
take one step at a time.

debian/bin/genorig.py

index e9fcd194c8d7dff1939f22c180e134554304b57d..74aacd8fdccd54fe4b24d9a9ed10e53c21da2f1f 100755 (executable)
@@ -17,6 +17,7 @@ class Main(object):
 
     def __init__(self, options, repo):
         self.options = options
+        self.repo = repo
 
         self.changelog_entry = Changelog(version=VersionXen)[0]
         self.source = self.changelog_entry.source
@@ -46,7 +47,8 @@ class Main(object):
         try:
             with open(out, 'wb') as f:
                 tag = self.options.tag or 'HEAD'
-                p1 = subprocess.Popen(('git', 'archive', '--prefix', '%s/' % self.orig_dir, tag), stdout=subprocess.PIPE)
+                _cmd = ('git', 'archive', '--prefix', '%s/' % self.orig_dir, tag)
+                p1 = subprocess.Popen(_cmd, stdout=subprocess.PIPE, cwd=self.repo)
                 subprocess.check_call(('xz', ), stdin=p1.stdout, stdout=f)
                 if p1.wait():
                     raise RuntimeError