[config-package-dev] [PATCH] transform: let users pick local files as source

Luca Boccassi luca.boccassi at gmail.com
Sun Jun 11 11:35:20 EDT 2017


I have a use case where I would like to transform and displace a file
shipped from the same upstream source, so that 2 binary packages (that
conflict with each other) can be built from the same repository without
having to keep local copies.

The first check, dpkg-divert --truename, immediately fails if the path
is not absolute. A simple patch is attached.

Kind regards,
Luca Boccassi


From 15864748b3170217ed0665e3cc2716c1fdf6754c Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi at gmail.com>
Date: Sun, 11 Jun 2017 16:29:49 +0100
Subject: [PATCH] transform: let users pick local files as source

In some case it's desirable to use a local file as the source of the
transform operation. For example, an upstream file from the same
repository that could be sourced at built time.
Skip dpkg checks on the source file if it does not start with /
---
 dh_configpackage | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dh_configpackage b/dh_configpackage
index 942766f..e76048c 100755
--- a/dh_configpackage
+++ b/dh_configpackage
@@ -369,9 +369,13 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
         my $file = shift @$line;
         $file =~ s|^/?|/|;
         my $source;
+        my $source_is_local = 0;
         if (@$line[0] =~ /^</) {
             $source = shift @$line;
             $source =~ s/^<//;
+            if ($source !~ m!^/!) {
+                $source_is_local = 1;
+            }
         } else {
             $source = displace_files_replace_name($package, $file, "");
             if ($source eq $file) {
@@ -386,7 +390,10 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
         #    chmod 0755, $rest;
         #}
 
-        $source = check_file($source);
+        # Let users use local files as input
+        if (! $source_is_local) {
+            $source = check_file($source);
+        }
         my $destdir = dirname("$tmp/$file");
         if (! -d $destdir) {
             doit("install", "-d", $destdir);
-- 
2.11.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
Url : http://mailman.mit.edu/pipermail/config-package-dev/attachments/20170611/a074cb4a/attachment.bin


More information about the config-package-dev mailing list