diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | scripts/Dpkg.pm | 2 | ||||
-rw-r--r-- | scripts/Dpkg/BuildFlags.pm | 3 | ||||
-rw-r--r-- | scripts/Dpkg/Control.pm | 2 | ||||
-rw-r--r-- | scripts/Dpkg/Control/Types.pm | 2 | ||||
-rw-r--r-- | scripts/Dpkg/Vendor.pm | 11 | ||||
-rw-r--r-- | scripts/Makefile.am | 1 | ||||
-rwxr-xr-x | scripts/dpkg-shlibdeps.pl | 8 |
9 files changed, 21 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index ab2aaa5a6..767c4d623 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,8 @@ DPKG_BUILD_PROG([start-stop-daemon]) DPKG_BUILD_PROG([update-alternatives]) # Allow alternate directories +DPKG_WITH_DIR([pkgconfdir], [${sysconfdir}/${PACKAGE_NAME}], + [dpkg configuration directory [SYSCONFDIR/dpkg]]) DPKG_WITH_DIR([admindir], [${localstatedir}/lib/${PACKAGE_NAME}], [dpkg database directory [LOCALSTATEDIR/lib/dpkg]]) DPKG_WITH_DIR([logdir], [${localstatedir}/log], diff --git a/debian/changelog b/debian/changelog index 90aedc40a..22bce3db6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -86,6 +86,8 @@ dpkg (1.17.0) UNRELEASED; urgency=low of two scalars. * Add a new Dpkg::Vendor get_vendor_dir() function. * Print correct path to vendor directory on error message in dpkg-vendor. + * Do not hardcode the dpkg system configuration directory in perl scripts, + respect build time setting. [ Updated manpages translations ] * Fix incorrect translation of "fortify" in French manpage for dpkg-buildflags diff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pm index 6fdc78c76..47ad0843e 100644 --- a/scripts/Dpkg.pm +++ b/scripts/Dpkg.pm @@ -19,12 +19,14 @@ use warnings; our $VERSION = '1.00'; use base qw(Exporter); +our @EXPORT_OK = qw($CONFDIR); our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir); our ($progname) = $0 =~ m{(?:.*/)?([^/]*)}; # The following lines are automatically fixed at install time our $version = '1.17.x'; +our $CONFDIR = '/etc/dpkg'; our $admindir = '/var/lib/dpkg'; our $dpkglibdir = '.'; our $pkgdatadir = '..'; diff --git a/scripts/Dpkg/BuildFlags.pm b/scripts/Dpkg/BuildFlags.pm index 689926e71..6fe65781c 100644 --- a/scripts/Dpkg/BuildFlags.pm +++ b/scripts/Dpkg/BuildFlags.pm @@ -20,6 +20,7 @@ use warnings; our $VERSION = '1.03'; +use Dpkg qw(); use Dpkg::Gettext; use Dpkg::BuildEnv; use Dpkg::BuildOptions; @@ -106,7 +107,7 @@ Update flags from the system configuration. sub load_system_config { my ($self) = @_; - $self->update_from_conffile('/etc/dpkg/buildflags.conf', 'system'); + $self->update_from_conffile("$Dpkg::CONFDIR/buildflags.conf", 'system'); } =item $bf->load_user_config() diff --git a/scripts/Dpkg/Control.pm b/scripts/Dpkg/Control.pm index 31149116a..a77914b1f 100644 --- a/scripts/Dpkg/Control.pm +++ b/scripts/Dpkg/Control.pm @@ -89,7 +89,7 @@ Corresponds to a .changes file. =item CTRL_FILE_VENDOR -Corresponds to a vendor file in /etc/dpkg/origins/. +Corresponds to a vendor file in $Dpkg::CONFDIR/origins/. =item CTRL_FILE_STATUS diff --git a/scripts/Dpkg/Control/Types.pm b/scripts/Dpkg/Control/Types.pm index f743f1dd0..7a2ec63be 100644 --- a/scripts/Dpkg/Control/Types.pm +++ b/scripts/Dpkg/Control/Types.pm @@ -46,7 +46,7 @@ use constant { CTRL_PKG_SRC => 16, # .dsc file of source package CTRL_PKG_DEB => 32, # DEBIAN/control in binary packages CTRL_FILE_CHANGES => 64, # .changes file - CTRL_FILE_VENDOR => 128, # File in /etc/dpkg/origins + CTRL_FILE_VENDOR => 128, # File in $Dpkg::CONFDIR/origins CTRL_FILE_STATUS => 256, # /var/lib/dpkg/status CTRL_CHANGELOG => 512, # Output of dpkg-parsechangelog }; diff --git a/scripts/Dpkg/Vendor.pm b/scripts/Dpkg/Vendor.pm index 2b7c5a41a..bccbcb60a 100644 --- a/scripts/Dpkg/Vendor.pm +++ b/scripts/Dpkg/Vendor.pm @@ -20,6 +20,7 @@ use warnings; our $VERSION = '1.01'; +use Dpkg qw(); use Dpkg::ErrorHandling; use Dpkg::Gettext; use Dpkg::BuildEnv; @@ -29,7 +30,7 @@ use base qw(Exporter); our @EXPORT_OK = qw(get_vendor_info get_current_vendor get_vendor_file get_vendor_dir get_vendor_object run_vendor_hook); -my $origins = '/etc/dpkg/origins'; +my $origins = "$Dpkg::CONFDIR/origins"; $origins = $ENV{DPKG_ORIGINS_DIR} if $ENV{DPKG_ORIGINS_DIR}; =encoding utf8 @@ -40,7 +41,7 @@ Dpkg::Vendor - get access to some vendor specific information =head1 DESCRIPTION -The files in /etc/dpkg/origins/ can provide information about various +The files in $Dpkg::CONFDIR/origins/ can provide information about various vendors who are providing Debian packages. Currently those files look like this: @@ -73,8 +74,8 @@ sub get_vendor_dir { =item $fields = Dpkg::Vendor::get_vendor_info($name) Returns a Dpkg::Control object with the information parsed from the -corresponding vendor file in /etc/dpkg/origins/. If $name is omitted, -it will use /etc/dpkg/origins/default which is supposed to be a symlink +corresponding vendor file in $Dpkg::CONFDIR/origins/. If $name is omitted, +it will use $Dpkg::CONFDIR/origins/default which is supposed to be a symlink to the vendor of the currently installed operating system. Returns undef if there's no file for the given vendor. @@ -112,7 +113,7 @@ sub get_vendor_file(;$) { =item $name = Dpkg::Vendor::get_current_vendor() Returns the name of the current vendor. If DEB_VENDOR is set, it uses -that first, otherwise it falls back to parsing /etc/dpkg/origins/default. +that first, otherwise it falls back to parsing $Dpkg::CONFDIR/origins/default. If that file doesn't exist, it returns undef. =cut diff --git a/scripts/Makefile.am b/scripts/Makefile.am index e81f309eb..ee31b1f3a 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -115,6 +115,7 @@ 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:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir='$(pkglibdir)':" \ -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir='$(pkgdatadir)':" \ -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir='$(admindir)':" \ diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index 468203a47..853fb991c 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -55,8 +55,8 @@ my $i = 0; my %depstrength = map { $_ => $i++ } @depfields; textdomain('dpkg-dev'); -my $shlibsoverride = '/etc/dpkg/shlibs.override'; -my $shlibsdefault = '/etc/dpkg/shlibs.default'; +my $shlibsoverride = "$Dpkg::CONFDIR/shlibs.override"; +my $shlibsdefault = "$Dpkg::CONFDIR/shlibs.default"; my $shlibslocal = 'debian/shlibs.local'; my $packagetype = 'deb'; my $dependencyfield = 'Depends'; @@ -726,8 +726,8 @@ sub find_symbols_file { # Fallback to other symbols files but it shouldn't be necessary push @files, @pkg_symbols; } else { - push @files, "/etc/dpkg/symbols/$pkg.symbols.$host_arch", - "/etc/dpkg/symbols/$pkg.symbols"; + push @files, "$Dpkg::CONFDIR/symbols/$pkg.symbols.$host_arch", + "$Dpkg::CONFDIR/symbols/$pkg.symbols"; my $control_file = get_control_path($pkg, 'symbols'); push @files, $control_file if defined $control_file; } |