Explorar o código

Dpkg::Vendor::Debian: Support getting the build path from the environment

Having dpkg-buildflags change its output depending on its current
working directory is not very friendly. We add a new environment
variable to be able to specify it so that we can control the output.

And use it from the test suite so make sure we always use the same
path regardless of where we execute the makefile snippets from.
Guillem Jover %!s(int64=10) %!d(string=hai) anos
pai
achega
5d2873e1f6
Modificáronse 4 ficheiros con 11 adicións e 1 borrados
  1. 2 0
      debian/changelog
  2. 5 0
      man/dpkg-buildflags.1
  3. 2 1
      scripts/Dpkg/Vendor/Debian.pm
  4. 2 0
      scripts/t/mk.t

+ 2 - 0
debian/changelog

@@ -67,6 +67,8 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
       Dpkg::Index to support these.
       Dpkg::Index to support these.
     - Fix Dpkg::Deps so that architecture qualifiers only imply one another
     - Fix Dpkg::Deps so that architecture qualifiers only imply one another
       if they are the same. Closes: #745366, #827628
       if they are the same. Closes: #745366, #827628
+    - Add support for new environment variable DEB_BUILD_PATH to be able to
+      control the path in the fixdebugpath feature in Dpkg::Vendor::Debian.
   * Test suite:
   * Test suite:
     - Bump perlcritic ValuesAndExpressions::RequireNumberSeparators minimum
     - Bump perlcritic ValuesAndExpressions::RequireNumberSeparators minimum
       to 99999.
       to 99999.

+ 5 - 0
man/dpkg-buildflags.1

@@ -465,6 +465,11 @@ See the \fBFEATURE AREAS\fP section for details.
 This setting defines the current vendor.
 This setting defines the current vendor.
 If not set, it will discover the current vendor by reading
 If not set, it will discover the current vendor by reading
 \fB\%/etc/dpkg/origins/default\fP.
 \fB\%/etc/dpkg/origins/default\fP.
+.TP
+.B DEB_BUILD_PATH
+This variable sets the build path (since dpkg 1.18.8) to use in features
+such as \fBfixdebugpath\fP so that they can be controlled by the caller.
+This variable is currently Debian and derivatives-specific.
 .
 .
 .SH FILES
 .SH FILES
 .SS Configuration files
 .SS Configuration files

+ 2 - 1
scripts/Dpkg/Vendor/Debian.pm

@@ -172,7 +172,8 @@ sub _add_reproducible_flags {
     # Avoid storing the build path in the debug symbols.
     # Avoid storing the build path in the debug symbols.
     if ($use_feature{fixdebugpath}) {
     if ($use_feature{fixdebugpath}) {
         require Cwd;
         require Cwd;
-        my $map = '-fdebug-prefix-map=' . Cwd::cwd() . '=.';
+        my $build_path = $ENV{DEB_BUILD_PATH} || Cwd::cwd();
+        my $map = '-fdebug-prefix-map=' . $build_path . '=.';
         $flags->append('CFLAGS', $map);
         $flags->append('CFLAGS', $map);
         $flags->append('CXXFLAGS', $map);
         $flags->append('CXXFLAGS', $map);
         $flags->append('OBJCFLAGS', $map);
         $flags->append('OBJCFLAGS', $map);

+ 2 - 0
scripts/t/mk.t

@@ -33,6 +33,8 @@ $ENV{$_} = rel2abs($ENV{$_}) foreach qw(srcdir DPKG_DATADIR DPKG_ORIGINS_DIR);
 # Delete variables that can affect the tests.
 # Delete variables that can affect the tests.
 delete $ENV{$_} foreach grep { m/^DEB_/ } keys %ENV;
 delete $ENV{$_} foreach grep { m/^DEB_/ } keys %ENV;
 
 
+$ENV{DEB_BUILD_PATH} = rel2abs($datadir);
+
 sub test_makefile {
 sub test_makefile {
     my $makefile = shift;
     my $makefile = shift;