[Reproducible-commits] [dpkg] 13/63: u-a: Generalize admindir environment variable handling
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Mar 4 17:44:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/buildinfo
in repository dpkg.
commit cb93a53a1da27d7a1286c068b9f79d39b481e8e3
Author: Guillem Jover <guillem at debian.org>
Date: Mon Feb 22 19:43:08 2016 +0100
u-a: Generalize admindir environment variable handling
This variable is currently set by dpkg, but other package managers or
callers might set it with a different name on other downstream projects.
Let's move the variable name to the build system so that third parties
do not have to modify the code going on to remove a dpkg-specific name.
---
debian/changelog | 3 +++
utils/Makefile.am | 4 ++++
utils/update-alternatives.c | 10 ++++++----
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a54784e..a104805 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,9 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
* Add source format backend-specific --help options support to dpkg-source.
* Add MIPS R6 architectures to arch tables. Closes: #807340
Thanks to YunQiang Su <wzssyqa at gmail.com>.
+ * Portability:
+ - Move DPKG_ADMINDIR environment variable name out from update-alternatives
+ code, to make life easier for non-dpkg-based systems.
* Perl modules:
- Add new CTRL_REPO_RELEASE control block type to Dpkg::Control.
- Add new CTRL_COPYRIGHT_HEADER, CTRL_COPYRIGHT_FILES and
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 8a5c902..39c0dab 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -24,6 +24,10 @@ endif
update_alternatives_SOURCES = \
update-alternatives.c
+update_alternatives_CPPFLAGS = \
+ -DADMINDIR_ENVVAR=\"DPKG_ADMINDIR\" \
+ $(AM_CPPFLAGS)
+
update_alternatives_LDADD = \
../lib/compat/libcompat.la \
$(LIBINTL) \
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 0ea5c81..044de92 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -352,11 +352,13 @@ set_action(const char *new_action)
static const char *
admindir_init(void)
{
- const char *basedir, *dpkg_basedir;
+ const char *basedir, *basedir_env;
- dpkg_basedir = getenv("DPKG_ADMINDIR");
- if (dpkg_basedir)
- basedir = dpkg_basedir;
+ /* Try to get the admindir from an environment variable, usually set
+ * by the system package manager. */
+ basedir_env = getenv(ADMINDIR_ENVVAR);
+ if (basedir_env)
+ basedir = basedir_env;
else
basedir = ADMINDIR;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list