[elbe-devel] [PATCH] pbuilder: call origtargz before pbuilder build

Christian Teklenborg chris at linutronix.de
Fri Apr 30 16:14:17 CEST 2021


Add the devscripts package to the default-init.xml that origtargz will
be installed on the initvm. Check if an origfile was passed to
pbuilder. If no origfile is given and the format is 3.0 (quilt)
download it with origtargz.

Signed-off-by: Christian Teklenborg <chris at linutronix.de>
---
 elbepack/elbeproject.py        | 29 +++++++++++++++++++----------
 elbepack/init/default-init.xml |  1 +
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 78a46454..7b16869c 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -15,6 +15,7 @@ import datetime
 import io
 import logging
 import sys
+import glob
 
 from elbepack.shellhelper import CommandError, system, do, chroot
 
@@ -740,16 +741,6 @@ class ElbeProject:
         pbdir = os.path.join(self.builddir, "pdebuilder", "current")
         do('mkdir -p "%s"' % os.path.join(pbdir))
 
-        try:
-            for orig_fname in self.orig_files:
-                ofname = os.path.join(self.builddir, orig_fname)
-                do('mv "%s" "%s"' % (ofname,
-                                     os.path.join(self.builddir,
-                                                  "pdebuilder")))
-        finally:
-            self.orig_fname = None
-            self.orig_files = []
-
         # Untar current_pdebuild.tar.gz into pdebuilder/current
         do('tar xfz "%s" -C "%s"' %
            (os.path.join(self.builddir, "current_pdebuild.tar.gz"), pbdir))
@@ -771,6 +762,24 @@ class ElbeProject:
         profile_list = profile.split(",")
         deb_build_opts = [i for i in profile_list if i=="nodoc" or i=="nocheck"]
 
+        pdebuilder_current = os.path.join(self.builddir, "pdebuilder", "current")
+
+        formatfile = open(os.path.join(pdebuilder_current, "debian", "source", "format"), "r").read()
+        src_pkg_name = open(os.path.join(pdebuilder_current, "debian", "changelog"), "r").readline().split()[0]
+
+        if "3.0 (quilt)" in formatfile and not self.orig_files:
+            do("cd %s; origtargz --download-only --tar-only" % pdebuilder_current)
+            self.orig_files = glob.glob("../%s*.orig.*" % src_pkg_name)
+        try:
+            for orig_fname in self.orig_files:
+                    ofname = os.path.join(self.builddir, orig_fname)
+                    do('mv "%s" "%s"' % (ofname,
+                                         os.path.join(self.builddir,
+                                                      "pdebuilder")))
+        finally:
+            self.orig_fname = None
+            self.orig_files = []
+
         try:
             if cross:
                 do('cd "%s"; dpkg-source -b .; %s '
diff --git a/elbepack/init/default-init.xml b/elbepack/init/default-init.xml
index c9c06279..ce3d92f8 100644
--- a/elbepack/init/default-init.xml
+++ b/elbepack/init/default-init.xml
@@ -53,6 +53,7 @@
 			<pkg>debootstrap</pkg>
 			<pkg>pbuilder</pkg>
 			<pkg>ubuntu-keyring</pkg>
+			<pkg>devscripts</pkg>
 		</pkg-list>
 		<preseed>
 			<conf owner="pbuilder" key="pbuilder/mirrorsite" type="string" value="http://ftp.de.debian.org/debian"/>
-- 
2.20.1



More information about the elbe-devel mailing list