瀏覽代碼

build: Do not honor DPKG_DATADIR on the installed Dpkg module

Move the environment variable DPKG_DATADIR override for Dpkg::DATADIR
into the first assignment, so that the new replacement logic can make it
disappear at installation time.

This simplifies the code and reduces the exposure of this internal
purpose machinery.
Guillem Jover 9 年之前
父節點
當前提交
c3a9a82fcf
共有 3 個文件被更改,包括 7 次插入7 次删除
  1. 1 0
      debian/changelog
  2. 1 2
      scripts/Dpkg.pm
  3. 5 5
      scripts/Makefile.am

+ 1 - 0
debian/changelog

@@ -149,6 +149,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     - Use cp with -R instead of -r (the former is more portable and not
       marked as deprecated by POSIX).
     - Print an actual newline instead of a literal \n in lcov output.
+    - Do not honor DPKG_DATADIR on the installed Dpkg module.
 
   [ Updated man pages translations ]
   * German (Helge Kreutzmann).

+ 1 - 2
scripts/Dpkg.pm

@@ -87,8 +87,7 @@ our $PROGVERSION = '1.18.x';
 our $CONFDIR = '/etc/dpkg';
 our $ADMINDIR = '/var/lib/dpkg';
 our $LIBDIR = '.';
-our $DATADIR = '..';
-$DATADIR = $ENV{DPKG_DATADIR} if defined $ENV{DPKG_DATADIR};
+our $DATADIR = $ENV{DPKG_DATADIR} // '..';
 
 # XXX: Backwards compatibility, to be removed on VERSION 2.00.
 ## no critic (Variables::ProhibitPackageVars)

+ 5 - 5
scripts/Makefile.am

@@ -123,11 +123,11 @@ man3_MANS =
 
 do_perl_subst = $(AM_V_GEN) sed \
 	-e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
-	-e "s:\$$CONFDIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$CONFDIR='$(pkgconfdir)':" \
-	-e "s:\$$ADMINDIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$ADMINDIR='$(admindir)':" \
-	-e "s:\$$LIBDIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$LIBDIR='$(pkglibdir)':" \
-	-e "s:\$$DATADIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$DATADIR='$(pkgdatadir)':" \
-	-e "s:\$$PROGVERSION[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:\$$PROGVERSION='$(PACKAGE_VERSION)':"
+	-e "s:\$$CONFDIR = .*;:\$$CONFDIR = '$(pkgconfdir)';:" \
+	-e "s:\$$ADMINDIR = .*;:\$$ADMINDIR = '$(admindir)';:" \
+	-e "s:\$$LIBDIR = .*;:\$$LIBDIR = '$(pkglibdir)';:" \
+	-e "s:\$$DATADIR = .*;:\$$DATADIR = '$(pkgdatadir)';:" \
+	-e "s:\$$PROGVERSION = .*;:\$$PROGVERSION = '$(PACKAGE_VERSION)';:"
 
 do_shell_subst = $(AM_V_GEN) sed \
 	-e "s:^version[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":"