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

Christian Teklenborg chris at linutronix.de
Fri May 7 12:24:10 CEST 2021


Add the devscripts package to the dependencies of the
python3-elbe-buildenv package 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>
---
 debian/control          |  3 ++-
 elbepack/elbeproject.py | 33 +++++++++++++++++++++++----------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/debian/control b/debian/control
index 949f161f..54d3a514 100644
--- a/debian/control
+++ b/debian/control
@@ -140,7 +140,8 @@ Depends: ${misc:Depends},
   git,
   ca-certificates,
   subversion,
-  haveged
+  haveged,
+  devscripts
 Description: Embedded Linux Build Environment Server Component
  This package is typically installed in a virtual machine (that can be created
  with the 'elbe initvm create' command from the 'elbe' package). Several
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 78a46454..f4021ef3 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,28 @@ 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 = ""
+
+        if os.path.exists(os.path.join(pdebuilder_current, "debian", "source", "format")):
+            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/../%s*.orig.*" % (pdebuilder_current, 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 '
-- 
2.20.1



More information about the elbe-devel mailing list