Github messages for voidlinux
 help / color / mirror / Atom feed
From: paper42 <paper42@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] [NOMERGE] [POC] common/hooks: move shlibs from common/shlibs to individual templates
Date: Tue, 22 Nov 2022 19:51:18 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40698@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

There is a new pull request by paper42 against master on the void-packages repository

https://github.com/paper42/void-packages decentralize-shlibs
https://github.com/void-linux/void-packages/pull/40698

[NOMERGE] [POC] common/hooks: move shlibs from common/shlibs to individual templates
shlibs are now in individual packages and not in a centralized
common/shlibs file.

The third optional column was used to restrict the shlib to a specific
arch which is now not required, the shlibs list can be easily modified
with shell code just like any other variable.

## TODO
* how much slower is this? xbps-query -o is slow when a lot of packages
  are installed
* adjust pkglint rules
* add a pkglint rule that checks that an shlib actually exists in the
  pkg
* currently every shlib has to be on its own line which can easily break
  with += and there can not be a whitespace at the beginning of the line
* one limitation is that the package template can not be fully sourced,
  so it's not possible to for example have different shlibs when an
  option is enabled, but that was not possible now either

This is currently just an experiment, building opendoas is known to work with these changes.

A patch file from https://github.com/void-linux/void-packages/pull/40698.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-decentralize-shlibs-40698.patch --]
[-- Type: text/x-diff, Size: 6378 bytes --]

From c0cab241feecc73dad191fe1b49c476ee32bf13b Mon Sep 17 00:00:00 2001
From: Michal Vasilek <michal@vasilek.cz>
Date: Tue, 22 Nov 2022 19:33:18 +0100
Subject: [PATCH 1/4] common/hooks: move provided shlibs to templates

shlibs are now in individual packages and not in a centralized
common/shlibs file.

The third optional column was used to restrict the shlib to a specific
arch which is now not required, the shlibs list can be easily modified
with shell code just like any other variable.

TODO:
* how much slower is this? xbps-query -o is slow when a lot of packages
  are installed
* adjust pkglint rules
* add a pkglint rule that checks that an shlib actually exists in the
  pkg
* currently every shlib has to be on its own line which can easily break
  with += and there can not be a whitespace at the beginning of the line
* one limitation is that the package template can not be fully sourced,
  so it's not possible to for example have different shlibs when an
  option is enabled, but that was not possible now either
---
 .../hooks/pre-pkg/04-generate-runtime-deps.sh | 25 ++++++++++++++-----
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/common/hooks/pre-pkg/04-generate-runtime-deps.sh b/common/hooks/pre-pkg/04-generate-runtime-deps.sh
index eb19ebfe7081..b42bb862f797 100644
--- a/common/hooks/pre-pkg/04-generate-runtime-deps.sh
+++ b/common/hooks/pre-pkg/04-generate-runtime-deps.sh
@@ -46,15 +46,13 @@ store_pkgdestdir_rundeps() {
 }
 
 hook() {
-    local depsftmp f lf j mapshlibs sorequires _curdep elfmagic
+    local depsftmp f lf j sorequires _curdep elfmagic
 
     # Disable trap on ERR, xbps-uhelper cmd might return error... but not something
     # to be worried about because if there are broken shlibs this hook returns
     # error via msg_error().
     trap - ERR
 
-    mapshlibs=$XBPS_COMMONDIR/shlibs
-
     if [ -n "$noverifyrdeps" ]; then
         store_pkgdestdir_rundeps
         return 0
@@ -91,10 +89,25 @@ hook() {
     # above, the mapping is done thru the common/shlibs file.
     #
     for f in ${verify_deps}; do
-        unset _f j rdep _rdep rdepcnt soname _pkgname _rdepver found
+        unset _f j rdep rdepver _rdep rdepcurrent rdepcnt soname _pkgname _rdepver found
         _f=$(echo "$f"|sed -E 's|\+|\\+|g')
-        rdep="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2)"
-        rdepcnt="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2|wc -l)"
+        # get rdep pkgname in current version
+        rdepcurrent="$(xbps-query -o "/usr/lib/${_f}" | cut -d: -f1)"
+        # extract just pkgname
+        rdepname="$($XBPS_UHELPER_CMD getpkgname "$rdepcurrent")"
+        # look into the template of the rdep to figure out which version
+        # should be used for the shlib dependency
+        shlibs=$(
+            shlibs=
+            source_file $XBPS_SRCPKGDIR/$rdepname/template
+            if type ${rdepname}_package >/dev/null 2>&1; then
+                ${rdepname}_package
+            fi
+            echo "$shlibs"
+        );
+        rdepver="$(echo $shlibs | grep -E "^${_f}[[:blank:]]+.*$" | cut -d ' ' -f2)"
+        rdep="${rdepname}-${rdepver}"
+        rdepcnt=1 # FIXME
         if [ -z "$rdep" ]; then
             # Ignore libs by current pkg
             soname=$(find ${PKGDESTDIR} -name "$f")

From cd1c5c4712fe6f04d5f28cd8f399ad14963b1226 Mon Sep 17 00:00:00 2001
From: Michal Vasilek <michal@vasilek.cz>
Date: Tue, 22 Nov 2022 19:41:41 +0100
Subject: [PATCH 2/4] glibc: add shlibs to the package

---
 srcpkgs/glibc/template | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/srcpkgs/glibc/template b/srcpkgs/glibc/template
index c62a4d2aedf1..43a55a9955c6 100644
--- a/srcpkgs/glibc/template
+++ b/srcpkgs/glibc/template
@@ -56,6 +56,42 @@ lib32symlinks="ld-linux.so.2"
 archs="~*-musl"
 nopie=yes
 
+shlibs="
+libc.so.6 ${version}_1
+libm.so.6 ${version}_1
+libpthread.so.0 ${version}_1
+librt.so.1 ${version}_1
+libdl.so.2 ${version}_1
+ld-linux-armhf.so.3 ${version}_1
+libresolv.so.2 ${version}_1
+libanl.so.1 ${version}_1
+libthread_db.so.1 ${version}_1
+libutil.so.1 ${version}_1
+libnsl.so.1 ${version}_1
+libnss_db.so.2 ${version}_1
+libnss_files.so.2 ${version}_1
+libnss_compat.so.2 ${version}_1
+libnss_dns.so.2 ${version}_1
+libnss_hesiod.so.2 ${version}_1
+libcrypt.so.1 ${version}_1
+libBrokenLocale.so.1 ${version}_1
+libmemusage.so ${version}_1
+libSegFault.so ${version}_1
+libpcprofile.so ${version}_1
+libcidn.so.1 ${version}_1
+libmvec.so.1 ${version}_1
+"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64) shlibs+="ld-linux-x86-64.so.2 ${version}_1" ;;
+	i686) shlibs+="ld-linux.so.2 ${version}_1" ;;
+	armv5tel) shlibs+="ld-linux.so.3 ${version}_1" ;;
+	aarch64) shlibs+="ld-linux-aarch64.so.1 ${version}_1" ;;
+	ppc64) shlibs+="ld64.so.2 ${version}_1" ;;
+	mips) shlibs+="ld.so.1 ${version}_1" ;;
+	ppc) shlibs+="ld.so.1 ${version}_1" ;;
+esac
+
 do_configure() {
 	mkdir build
 	cd build

From 429048e563cd274c17430646e99161ecedb965b6 Mon Sep 17 00:00:00 2001
From: Michal Vasilek <michal@vasilek.cz>
Date: Tue, 22 Nov 2022 19:41:57 +0100
Subject: [PATCH 3/4] musl: add shlibs to the package

---
 srcpkgs/musl/template | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/srcpkgs/musl/template b/srcpkgs/musl/template
index 34e6ed4fba6e..7ad671d170c5 100644
--- a/srcpkgs/musl/template
+++ b/srcpkgs/musl/template
@@ -17,6 +17,8 @@ checksum=1370c9a812b2cf2a7d92802510cca0058cc37e66a7bedd70051f0a34015022a3
 nostrip_files="libc.so"
 shlib_provides="libc.so"
 
+shlibs="libc.so 1.1.24_7"
+
 post_build() {
 	$CC $CFLAGS $LDFLAGS -fpie ${FILESDIR}/getent.c -o getent
 	$CC $CFLAGS $LDFLAGS -fpie ${FILESDIR}/getconf.c -o getconf

From 09d49300d71ef94441c3e5eafcf7e622b1dd921f Mon Sep 17 00:00:00 2001
From: Michal Vasilek <michal@vasilek.cz>
Date: Tue, 22 Nov 2022 19:42:09 +0100
Subject: [PATCH 4/4] pam: add shlibs to the package

---
 srcpkgs/pam/template | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/srcpkgs/pam/template b/srcpkgs/pam/template
index 70d87f00af90..a1a91e60e55b 100644
--- a/srcpkgs/pam/template
+++ b/srcpkgs/pam/template
@@ -56,6 +56,9 @@ pam-devel_package() {
 	}
 }
 pam-libs_package() {
+	shlibs="libpam.so.0 1.1.6_3
+	 libpamc.so.0 1.1.6_3
+	 libpam_misc.so.0 1.1.6_3"
 	short_desc+=" - runtime libraries"
 	pkg_install() {
 		vmove "usr/lib/*.so.*"

             reply	other threads:[~2022-11-22 18:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 18:51 paper42 [this message]
2022-11-22 20:01 ` Duncaen
2022-11-23  0:27 ` classabbyamp
2022-11-23  0:29 ` classabbyamp
2022-11-23  0:32 ` classabbyamp
2022-12-30 17:23 ` [PR PATCH] [Updated] " paper42
2023-03-31  1:55 ` github-actions

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40698@inbox.vuxu.org \
    --to=paper42@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).