diff options
author | Andreas Oberritter <obi@opendreambox.org> | 2018-03-29 19:55:18 +0200 |
---|---|---|
committer | Andreas Oberritter <obi@opendreambox.org> | 2020-07-02 15:10:00 +0200 |
commit | e077d0657c6a99fcabd92a06167ac7f6b9866f0a (patch) | |
tree | addac57a8370a52a4a139d1951f31c19ed83a8de | |
parent | 4f6891a97c9ea123499541e5143a7635d4781e74 (diff) | |
download | openembedded-core-contrib-e077d0657c6a99fcabd92a06167ac7f6b9866f0a.tar.gz |
dpkg: allow overriding alternatives directory from environment
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
-rw-r--r-- | meta/recipes-devtools/dpkg/dpkg/0001-update-alternatives-Allow-to-override-altdir-from-en.patch | 75 | ||||
-rw-r--r-- | meta/recipes-devtools/dpkg/dpkg_1.19.7.bb | 1 |
2 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-devtools/dpkg/dpkg/0001-update-alternatives-Allow-to-override-altdir-from-en.patch b/meta/recipes-devtools/dpkg/dpkg/0001-update-alternatives-Allow-to-override-altdir-from-en.patch new file mode 100644 index 0000000000..7c3f83be62 --- /dev/null +++ b/meta/recipes-devtools/dpkg/dpkg/0001-update-alternatives-Allow-to-override-altdir-from-en.patch @@ -0,0 +1,75 @@ +From e0c050305e68d0b5eb6c4a6c523fe754ec6e91e0 Mon Sep 17 00:00:00 2001 +From: Andreas Oberritter <obi@opendreambox.org> +Date: Thu, 29 Mar 2018 15:17:50 +0200 +Subject: [PATCH] update-alternatives: Allow to override altdir from + environment + +This helps generating SDKs with Yocto, where the natively built +update-alternatives doesn't know about the location of the SDK's +alternatives database. + +Signed-off-by: Andreas Oberritter <obi@opendreambox.org> +--- + utils/Makefile.am | 1 + + utils/update-alternatives.c | 22 +++++++++++++++++++++- + 2 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/utils/Makefile.am b/utils/Makefile.am +index c16a21b1a..2f3efdeb3 100644 +--- a/utils/Makefile.am ++++ b/utils/Makefile.am +@@ -27,6 +27,7 @@ update_alternatives_SOURCES = \ + update_alternatives_CPPFLAGS = \ + -DALT_TMP_EXT=\".dpkg-tmp\" \ + -DADMINDIR_ENVVAR=\"DPKG_ADMINDIR\" \ ++ -DALTDIR_ENVVAR=\"DPKG_ALTDIR\" \ + -DINSTDIR_ENVVAR=\"DPKG_ROOT\" \ + $(AM_CPPFLAGS) + +diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c +index 5b398e3f0..d094ed7ab 100644 +--- a/utils/update-alternatives.c ++++ b/utils/update-alternatives.c +@@ -50,7 +50,7 @@ + + #define PROGNAME "update-alternatives" + +-static const char *altdir = SYSCONFDIR "/alternatives"; ++static const char *altdir; + static const char *instdir; + static const char *admdir; + +@@ -401,6 +401,25 @@ instdir_init(void) + return ""; + } + ++static const char * ++altdir_init(void) ++{ ++ const char *dpkg_altdir; ++ size_t length; ++ ++ dpkg_altdir = getenv(ALTDIR_ENVVAR); ++ if (dpkg_altdir == NULL) ++ dpkg_altdir = SYSCONFDIR "/alternatives"; ++ ++ /* If instdir is set and altdir is below instdir, treat altdir ++ * as relative. */ ++ length = strlen(instdir); ++ if (strncmp(dpkg_altdir, instdir, length) == 0) ++ dpkg_altdir += length; ++ ++ return dpkg_altdir; ++} ++ + static const char * + admindir_init(void) + { +@@ -2647,6 +2666,7 @@ main(int argc, char **argv) + textdomain(PACKAGE); + + instdir = instdir_init(); ++ altdir = altdir_init(); + admdir = admindir_init(); + + if (setvbuf(stdout, NULL, _IONBF, 0)) diff --git a/meta/recipes-devtools/dpkg/dpkg_1.19.7.bb b/meta/recipes-devtools/dpkg/dpkg_1.19.7.bb index 72930c0cf9..971d36cdb5 100644 --- a/meta/recipes-devtools/dpkg/dpkg_1.19.7.bb +++ b/meta/recipes-devtools/dpkg/dpkg_1.19.7.bb @@ -13,6 +13,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/d/${BPN}/${BPN}_${PV}.tar.xz \ file://0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch \ file://0001-dpkg-Support-muslx32-build.patch \ file://0007-update-alternatives-disable-logging.patch \ + file://0001-update-alternatives-Allow-to-override-altdir-from-en.patch \ file://pager.patch \ " SRC_URI_append_class-native = " \ |