Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
aports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alpine
aports
Merge requests
!75167
main/abuild: parse $ORIGIN in rpaths correctly
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
main/abuild: parse $ORIGIN in rpaths correctly
sertonix/aports:abuild-rpath
into
master
Overview
5
Commits
1
Pipelines
3
Changes
2
All threads resolved!
Hide all comments
Merged
Sertonix
requested to merge
sertonix/aports:abuild-rpath
into
master
3 months ago
Overview
5
Commits
1
Pipelines
3
Changes
2
All threads resolved!
Hide all comments
Expand
Ref
abuild!339 (merged)
0
0
Merge request reports
Compare
master
version 1
7c2d463d
3 months ago
master (base)
and
latest version
latest version
2a70c66a
1 commit,
3 months ago
version 1
7c2d463d
1 commit,
3 months ago
2 files
+
115
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
main/abuild/0001-abuild-parse-ORIGIN-in-rpaths-correctly.patch
0 → 100644
+
112
−
0
Options
From ed79001072ac39da6dd24fe934a7cc51a27fd599 Mon Sep 17 00:00:00 2001
From: Sertonix <sertonix@posteo.net>
Date: Thu, 24 Oct 2024 20:00:29 +0200
Subject: [PATCH] abuild: parse $ORIGIN in rpaths correctly
---
abuild.in | 18 ++++++++++++++----
tests/abuild_test | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/abuild.in b/abuild.in
index b834e73..1202a95 100644
--- a/abuild.in
+++ b/abuild.in
@@ -1244,15 +1244,25 @@
prepare_metafiles() {
}
prepare_trace_rpaths() {
- local dir=${subpkgdir:-$pkgdir}
local etype= soname= file= sover=
[ "${subpkgarch:-$pkgarch}" = "noarch" ] && return 0
options_has "!tracedeps" && return 0
# lets tell all the places we should look for .so files - all rpaths
- scanelf --quiet --recursive --rpath "$dir" \
- | sed -e 's/[[:space:]].*//' -e 's/:/\n/' | sort -u \
- >"$controldir"/.rpaths
+ (
+ cd "${subpkgdir:-$pkgdir}"
+ scanelf --quiet --recursive --rpath .
+ ) | awk -F '[:[:space:]]+' '{
+ sub(/^\./, "", $NF);
+ sub("/[^/]*$", "", $NF);
+ for (i = 1; i < NF; i++) {
+ # $ORIGIN means relative to the binary
+ gsub("\\$ORIGIN", $NF, $i);
+ gsub("\\${ORIGIN}", $NF, $i);
+ printf("%s\n", $i);
+ }
+ }' | sort -u >"$controldir"/.rpaths
if grep -q -x '/usr/lib' "$controldir"/.rpaths; then
+ # FIXME silence warning when $ORIGIN was used
warning "Redundant /usr/lib in rpath found"
fi
if grep '^/home/' "$controldir"/.rpaths; then
diff --git a/tests/abuild_test b/tests/abuild_test
index e87c65a..6c315b3 100755
--- a/tests/abuild_test
+++ b/tests/abuild_test
@@ -18,6 +18,7 @@
init_tests \
abuild_py_providers_creation \
abuild_py_dependency_scan \
abuild_py_dependency_scan_conflict \
+ abuild_rpaths \
abuild_reject_init_with_improper_shebang \
abuild_valid_pkgnames \
abuild_invalid_pkgnames \
@@ -394,6 +395,52 @@
abuild_py_dependency_scan_conflict_body() {
abuild rootpkg
}
+abuild_rpaths_body() {
+ init_keys
+
+ mkdir -p bin
+ cat > bin/scanelf <<-EOF
+ #!/bin/sh
+ for i; do
+ [ "\$i" = --rpath ] || continue
+ echo "\$ABUILD_RPATH" /usr/lib/pkg/base.so
+ break
+ done
+ EOF
+ chmod +x bin/scanelf
+ PATH="$PWD/bin:$PATH"
+
+ mkdir -p testrepo/pkg
+ cd testrepo/pkg
+ cat > APKBUILD <<-EOF
+ maintainer="Natanael Copa <ncopa@alpinelinux.org>"
+ pkgname="pkg"
+ pkgver=1.0
+ pkgrel=0
+ pkgdesc="Dummy test package"
+ url="https://gitlab.alpinelinux.org/alpine/aports"
+ arch="all"
+ license="MIT"
+ options="!check !strip !textrels !archcheck"
+
+ package() {
+ mkdir -p "\$pkgdir"/usr/lib
+ touch "\$pkgdir"/usr/lib/libfoo.so.1
+ }
+ EOF
+ ABUILD_RPATH='/usr/lib/foo' abuild rootpkg || atf_fail "abuild failed"
+ atf_check -s exit:0 \
+ -o match:"/usr/lib/foo" \
+ cat pkg/.control.pkg/.rpaths
+ ABUILD_RPATH='$ORIGIN/bar:${ORIGIN}/../baf' pkgbasedir=$PWD/pkg abuild rootpkg || atf_fail "abuild failed"
+ atf_check -s exit:0 \
+ -o match:"/usr/lib/pkg/bar" \
+ -o match:"/usr/lib/pkg/../baf" \
+ cat pkg/.control.pkg/.rpaths
+ ABUILD_RPATH='/home/builder' atf_check -s exit:1 -o ignore \
+ -e match:"ERROR:.*: Has /home/... in rpath" abuild rootpkg
+}
+
abuild_reject_init_with_improper_shebang_body() {
mkdir invalid-initd
cd invalid-initd
--
2.47.0
Loading