From 0fd3df5984ca415ac7fde3d1db12d6b6b4380828 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 21 Jul 2007 16:25:07 +0000 Subject: [PATCH] Move variables automatically modified at build time to a new style perl module. --- ChangeLog | 9 +++++++++ debian/changelog | 2 ++ debian/dpkg.install | 1 + m4/perl.m4 | 2 ++ scripts/Dpkg.pm | 17 +++++++++++++++++ scripts/Makefile.am | 11 +++++++++++ 6 files changed, 42 insertions(+) create mode 100644 scripts/Dpkg.pm diff --git a/ChangeLog b/ChangeLog index eeb89278..f78c72e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-07-21 Guillem Jover + + * m4/perl.m4 (DPKG_PROG_PERL): Add support for user overridable + PERL_LIBDIR variable, autodetected from the system installation. + * scripts/Makefile.am (perllibdir): New variable. + (nobase_dist_perllib_DATA): Likewise. + (install-data-hook): New target. + * scripts/Dpkg.pm: New file. + 2007-07-03 Frank Lichtenheld * configure.ac: Bump version to 1.14.6~. diff --git a/debian/changelog b/debian/changelog index c2f9ec80..735ffe01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,8 @@ dpkg (1.14.6) UNRELEASED; urgency=low and remove leftover string from man page split. - Split option descriptions so that it gets easier to distinguish. - Unify author and copyright information formatting. + * Move variables automatically modified at build time to a new style perl + module. [ Updated scripts translations ] * French (Frédéric Bothamy, Christian Perrier). diff --git a/debian/dpkg.install b/debian/dpkg.install index 08da4b78..478405f7 100644 --- a/debian/dpkg.install +++ b/debian/dpkg.install @@ -35,6 +35,7 @@ usr/share/man/*/*/start-stop-daemon.8 usr/share/man/*/start-stop-daemon.8 usr/share/man/*/*/update-alternatives.8 usr/share/man/*/update-alternatives.8 +usr/share/perl5 var/lib/dpkg/alternatives var/lib/dpkg/info var/lib/dpkg/parts diff --git a/m4/perl.m4 b/m4/perl.m4 index 165f487c..360cda32 100644 --- a/m4/perl.m4 +++ b/m4/perl.m4 @@ -4,4 +4,6 @@ AC_DEFUN([DPKG_PROG_PERL], [AC_ARG_VAR([PERL], [Perl interpreter])dnl AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])dnl +AC_ARG_VAR([PERL_LIBDIR], [Perl library directory])dnl +PERL_LIBDIR=`$PERL -MConfig -e 'print $Config{vendorlib}'`dnl ])# DPKG_PROG_PERL diff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pm new file mode 100644 index 00000000..fc6d8750 --- /dev/null +++ b/scripts/Dpkg.pm @@ -0,0 +1,17 @@ +package Dpkg; + +use strict; +use warnings; + +use base qw(Exporter); +our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir); + +our ($progname) = $0 =~ m:.*/(.*):; + +# The following lines are automatically fixed at install time +our $version = "1.14"; +our $admindir = "/var/lib/dpkg"; +our $dpkglibdir = "."; +our $pkgdatadir = ".."; + +1; diff --git a/scripts/Makefile.am b/scripts/Makefile.am index b8b36435..e83f2aba 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -53,6 +53,9 @@ CLEANFILES = \ $(bin_SCRIPTS) $(sbin_SCRIPTS) $(changelog_SCRIPTS) \ install-info install-info-stamp +perllibdir = $(PERL_LIBDIR) +nobase_dist_perllib_DATA = \ + Dpkg.pm dist_pkglib_SCRIPTS = \ controllib.pl \ @@ -94,6 +97,14 @@ install-data-local: $(mkdir_p) $(DESTDIR)$(sysconfdir)/alternatives $(INSTALL_DATA) $(srcdir)/README.alternatives $(DESTDIR)$(sysconfdir)/alternatives/README +# Ideally we'd use 'sed -i', but unfortunately that's not portable. +install-data-hook: + cp -p $(DESTDIR)$(perllibdir)/Dpkg.pm \ + $(DESTDIR)$(perllibdir)/Dpkg.pm.tmp + $(do_perl_subst) <$(DESTDIR)$(perllibdir)/Dpkg.pm.tmp \ + >$(DESTDIR)$(perllibdir)/Dpkg.pm + rm $(DESTDIR)$(perllibdir)/Dpkg.pm.tmp + uninstall-local: rm -f $(DESTDIR)$(sysconfdir)/alternatives/README rm -f $(DESTDIR)$(sbindir)/install-info -- 2.39.5