[elbe-devel] [PATCH 1/3] pbuilder: allow specification of source directory

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Apr 30 10:20:34 CEST 2024


It's not always convenient to read the sources from the current
directory. Add a --source option.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/commands/pbuilder.py | 3 +++
 elbepack/pbuilderaction.py    | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/elbepack/commands/pbuilder.py b/elbepack/commands/pbuilder.py
index d4db0388f91d..f38485d6130b 100644
--- a/elbepack/commands/pbuilder.py
+++ b/elbepack/commands/pbuilder.py
@@ -32,6 +32,9 @@ def run_command(argv):
         action='append',
         help='upload orig file')
 
+    oparser.add_option('--source', dest='srcdir', default='.',
+                       help='directory containing sources')
+
     oparser.add_option('--output', dest='outdir', default=None,
                        help='directory where to save downloaded Files')
 
diff --git a/elbepack/pbuilderaction.py b/elbepack/pbuilderaction.py
index 7bc60afaafcd..36fcddfa6bd3 100644
--- a/elbepack/pbuilderaction.py
+++ b/elbepack/pbuilderaction.py
@@ -212,7 +212,8 @@ class BuildAction(PBuilderAction):
         print('Packing Source into tmp archive')
         print('')
         try:
-            subprocess.run(['tar', 'cfz', tmp.fname('pdebuild.tar.gz'), '.'], check=True)
+            subprocess.run(['tar', '-C', opt.srcdir, '-czf', tmp.fname('pdebuild.tar.gz'), '.'],
+                           check=True)
         except subprocess.CalledProcessError:
             print('tar Failed', file=sys.stderr)
             print('Giving up', file=sys.stderr)

-- 
2.44.0



More information about the elbe-devel mailing list