[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#983412: libc-bin: please add support for DPKG_ROOT to the postinst



Hi,

Quoting Johannes 'josch' Schauer (2021-02-23 20:30:41)
> this is a followup on
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910685

we can now verify that with this patch it is possible to create a Debian chroot
that is bit-by-bit identical to one created the normal way:

https://salsa.debian.org/helmutg/dpkg-root-demo/-/jobs

Currently, half the time in our CI job is spent building glibc. It would be
great if this patch can be applied, so that we do not have to build a patched
glibc anymore.

I opened a merge request here:

https://salsa.debian.org/glibc-team/glibc/-/merge_requests/4

And attached the git-format-patch.

Thanks!

cheers, josch
>From 64e9212385a7cf75a206481e539ca1779a075b5e Mon Sep 17 00:00:00 2001
From: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
Date: Fri, 20 Aug 2021 11:37:16 +0200
Subject: [PATCH] More support for DPKG_ROOT (closes: #983412)

 - this partially reverts 9e77b114 because debconf is patched to support
   DPKG_ROOT
---
 debian/changelog                      | 4 ++++
 debian/debhelper.in/libc-bin.postinst | 6 +++---
 debian/debhelper.in/libc.postinst     | 2 +-
 debian/debhelper.in/libc.preinst      | 6 +++---
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f9175ced..e6b256d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,11 @@
 glibc (2.31-17) UNRELEASED; urgency=medium
 
+  [ Samuel Thibault ]
   * debian/testsuite-xfail-debian.mk: Update tests.
 
+  [ Johannes Schauer Marin Rodrigues ]
+  * additional bits to support DPKG_ROOT (closes: #983412)
+
  -- Samuel Thibault <sthibault@debian.org>  Wed, 18 Aug 2021 23:04:08 +0200
 
 glibc (2.31-16) unstable; urgency=medium
diff --git a/debian/debhelper.in/libc-bin.postinst b/debian/debhelper.in/libc-bin.postinst
index 802a3ad0..7fc320c5 100644
--- a/debian/debhelper.in/libc-bin.postinst
+++ b/debian/debhelper.in/libc-bin.postinst
@@ -40,15 +40,15 @@ update_to_current_default() {
 }
 
 if [ "$1" = "configure" ] && [ "$2" = "" ] ; then
-  install_from_default /usr/share/libc-bin/nsswitch.conf /etc/nsswitch.conf
+  install_from_default "$DPKG_ROOT/usr/share/libc-bin/nsswitch.conf" "$DPKG_ROOT/etc/nsswitch.conf"
 fi
 
 if [ "$1" = "configure" ] && [ "$2" != "" ]; then
-  update_to_current_default /usr/share/libc-bin/nsswitch.conf /etc/nsswitch.conf
+  update_to_current_default "$DPKG_ROOT/usr/share/libc-bin/nsswitch.conf" "$DPKG_ROOT/etc/nsswitch.conf"
 fi
 
 if [ "$1" = "triggered" ] || [ "$1" = "configure" ]; then
-  ldconfig || ldconfig --verbose
+  ldconfig -r "$DPKG_ROOT/" || ldconfig --verbose -r "$DPKG_ROOT/"
   exit 0
 fi
 
diff --git a/debian/debhelper.in/libc.postinst b/debian/debhelper.in/libc.postinst
index 687ebc4c..d58771ed 100644
--- a/debian/debhelper.in/libc.postinst
+++ b/debian/debhelper.in/libc.postinst
@@ -20,7 +20,7 @@ then
     __NOHWCAP__
 fi
 
-if [ "$type" = configure -a -z "$DPKG_ROOT" ]
+if [ "$type" = configure ]
 then
     # Load debconf module if available
     if [ -f /usr/share/debconf/confmodule ] ; then
diff --git a/debian/debhelper.in/libc.preinst b/debian/debhelper.in/libc.preinst
index 9a857c9c..75519bca 100644
--- a/debian/debhelper.in/libc.preinst
+++ b/debian/debhelper.in/libc.preinst
@@ -12,7 +12,7 @@ kernel_compare_versions () {
     test $verA -$2 $verB
 }
 
-if [ "$type" != abort-upgrade -a -z "$DPKG_ROOT" ]
+if [ "$type" != abort-upgrade ]
 then
     # Load debconf module if available and usable
     if [ -f /usr/share/debconf/confmodule ]; then
@@ -159,7 +159,7 @@ then
     fi
 fi
 
-if [ "$type" = upgrade -a -z "$DPKG_ROOT" ]
+if [ "$type" = upgrade ]
 then
     if [ -n "$preversion" ] && [ -x "$(command -v ischroot)" ] && ! ischroot; then
 	# NSS authentication trouble guard
@@ -247,7 +247,7 @@ then
 
     # This will keep us from using hwcap libs (optimized) during an
     # upgrade.
-    touch /etc/ld.so.nohwcap
+    touch "$DPKG_ROOT/etc/ld.so.nohwcap"
 fi
 
 #DEBHELPER#
-- 
2.30.2

Attachment: signature.asc
Description: signature


Reply to: