aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-03-18 13:44:00 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2014-03-18 13:44:00 +0100
commit44ec45ae09b613ecf55ede0964ea6bdb10e24bf2 (patch)
treef77ce7828ba230a7bd595016e3c6ba6597dfdeec /main
parent07e38a82a96baf243a7c46af88d17316ef3c61d5 (diff)
downloadaports-44ec45ae09b613ecf55ede0964ea6bdb10e24bf2.tar.bz2
aports-44ec45ae09b613ecf55ede0964ea6bdb10e24bf2.tar.xz
main/pax-utils: port lddtree to busybox shell and make as subpackage
Diffstat (limited to 'main')
-rw-r--r--main/pax-utils/APKBUILD37
-rw-r--r--main/pax-utils/lddtree-sh.patch209
2 files changed, 238 insertions, 8 deletions
diff --git a/main/pax-utils/APKBUILD b/main/pax-utils/APKBUILD
index 663e20816a..ac101aaff8 100644
--- a/main/pax-utils/APKBUILD
+++ b/main/pax-utils/APKBUILD
@@ -1,23 +1,33 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pax-utils
pkgver=0.7
-pkgrel=2
+pkgrel=3
pkgdesc="ELF related utils for ELF 32/64 binaries"
url="http://hardened.gentoo.org/pax-utils.xml"
arch="all"
license='GPL-2'
depends="scanelf"
makedepends=
-source="http://dev.gentoo.org/~vapier/dist/pax-utils-$pkgver.tar.xz"
-subpackages="$pkgname-doc scanelf:_scanelf"
+source="http://dev.gentoo.org/~vapier/dist/pax-utils-$pkgver.tar.xz
+ lddtree-sh.patch"
+subpackages="$pkgname-doc scanelf:_scanelf lddtree:_lddtree"
+_builddir="$srcdir"/pax-utils-$pkgver
+prepare() {
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
build() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "$_builddir"
make || return 1
}
package() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "$_builddir"
make DESTDIR="$pkgdir/" install
}
@@ -29,6 +39,17 @@ _scanelf() {
mv "$pkgdir"/usr/bin/scanelf "$subpkgdir"/usr/bin/
}
-md5sums="8ae7743ad11500f7604f2e817221d877 pax-utils-0.7.tar.xz"
-sha256sums="1ac4cee9a9ca97a723505eb29a25e50adeccffba3f0f0ef4f035cf082caf3b84 pax-utils-0.7.tar.xz"
-sha512sums="d99f325b1d3ffc4955bc09aedcbeabea2d87a9647da31db1518de9daa55fbe0e5dd09feedd8dbcd8c4b53825a788ae7c9b904a927abc9ae995385dfd00d44f4a pax-utils-0.7.tar.xz"
+_lddtree() {
+ pkgdesc="List dynamic dependencies as a tree"
+ depends="scanelf"
+ replaces="pax-utils"
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/lddtree "$subpkgdir"/usr/bin/
+}
+
+md5sums="8ae7743ad11500f7604f2e817221d877 pax-utils-0.7.tar.xz
+3003d6e880fac021a36c2bc2657cdcde lddtree-sh.patch"
+sha256sums="1ac4cee9a9ca97a723505eb29a25e50adeccffba3f0f0ef4f035cf082caf3b84 pax-utils-0.7.tar.xz
+0ea9b861193d29a163e2abf6a243182626cd123fd70a323a66088399c8c6c0e5 lddtree-sh.patch"
+sha512sums="d99f325b1d3ffc4955bc09aedcbeabea2d87a9647da31db1518de9daa55fbe0e5dd09feedd8dbcd8c4b53825a788ae7c9b904a927abc9ae995385dfd00d44f4a pax-utils-0.7.tar.xz
+3a18d6aa7d13cdff415681e7a11056e05183a7a16c41186ade2505f73e6bb3a90f3c533fb270e3c565d6408b12fb281ac0d1c27a727b87e3820ae13a77b3c149 lddtree-sh.patch"
diff --git a/main/pax-utils/lddtree-sh.patch b/main/pax-utils/lddtree-sh.patch
new file mode 100644
index 0000000000..6967df81c6
--- /dev/null
+++ b/main/pax-utils/lddtree-sh.patch
@@ -0,0 +1,209 @@
+--- ./lddtree.sh.orig 2014-03-18 13:38:57.284756931 +0100
++++ ./lddtree.sh 2014-03-18 13:22:47.296407170 +0100
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # Copyright 2007-2013 Gentoo Foundation
+ # Copyright 2007-2013 Mike Frysinger <vapier@gentoo.org>
+ # Distributed under the terms of the GNU General Public License v2
+@@ -7,8 +7,9 @@
+ argv0=${0##*/}
+
+ : ${ROOT:=/}
+-[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
+-[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
++
++[ "${ROOT}" = "${ROOT%/}" ] && ROOT="${ROOT}/"
++[ "${ROOT}" = "${ROOT#/}" ] && ROOT="${PWD}/${ROOT}"
+
+ usage() {
+ cat <<-EOF
+@@ -54,7 +55,7 @@
+ _find_elf=''
+
+ local elf=$1 needed_by=$2
+- if [[ ${elf} == */* ]] && [[ -e ${elf} ]] ; then
++ if [ "${elf}" != "${elf##*/}" ] && [ -e "${elf}" ] ; then
+ _find_elf=${elf}
+ return 0
+ else
+@@ -63,8 +64,8 @@
+ local path pe
+ for path ; do
+ pe="${path%/}/${elf#/}"
+- if [[ -e ${pe} ]] ; then
+- if [[ $(elf_specs "${pe}") == "${elf_specs}" ]] ; then
++ if [ -e "${pe}" ] ; then
++ if [ "$(elf_specs "${pe}")" = "${elf_specs}" ] ; then
+ _find_elf=${pe}
+ return 0
+ fi
+@@ -73,52 +74,53 @@
+ return 1
+ }
+
+- if [[ ${c_last_needed_by} != ${needed_by} ]] ; then
+- c_last_needed_by=${needed_by}
++ if [ "${c_last_needed_by}" != "${needed_by}" ] ; then
++ c_last_needed_by="${needed_by}"
+ c_last_needed_by_rpaths=$(scanelf -qF '#F%r' "${needed_by}" | \
+ sed -e 's|:| |g' -e "s:[$]ORIGIN:${needed_by%/*}:")
+ fi
+ check_paths "${elf}" ${c_last_needed_by_rpaths} && return 0
+
+- if [[ -n ${LD_LIBRARY_PATH} ]] ; then
++ if [ -n "${LD_LIBRARY_PATH}" ] ; then
+ # Need to handle empty paths as $PWD,
+ # and handle spaces in between the colons
+ local p path=${LD_LIBRARY_PATH}
+ while : ; do
+ p=${path%%:*}
+ check_paths "${elf}" "${p:-${PWD}}" && return 0
+- [[ ${path} == *:* ]] || break
++ [ "${path}" = "${path#*:}" ] && break
+ path=${path#*:}
+ done
+ fi
+
+ if ! ${c_ldso_paths_loaded} ; then
+ c_ldso_paths_loaded='true'
+- c_ldso_paths=()
+- if [[ -r ${ROOT}etc/ld.so.conf ]] ; then
++ c_ldso_paths=
++ if [ -r ${ROOT}etc/ld.so.conf ] ; then
+ read_ldso_conf() {
+ local line p
+ for p ; do
+ # if the glob didnt match anything #360041,
+ # or the files arent readable, skip it
+- [[ -r ${p} ]] || continue
++ [ -r "${p}" ] || continue
+ while read line ; do
+ case ${line} in
+ "#"*) ;;
+ "include "*) read_ldso_conf ${line#* } ;;
+- *) c_ldso_paths+=( "${ROOT}${line#/}" ) ;;
++ *) c_ldso_paths="$c_ldso_paths:${ROOT}${line#/}";;
+ esac
+ done <"${p}"
+ done
+ }
+ # the 'include' command is relative
+- pushd "${ROOT}"etc >/dev/null
++ local _oldpwd="$PWD"
++ cd "$ROOT"etc >/dev/null
+ read_ldso_conf "${ROOT}"etc/ld.so.conf
+- popd >/dev/null
++ cd "$_oldpwd"
+ fi
+ fi
+- if [[ ${#c_ldso_paths[@]} -gt 0 ]] ; then
+- check_paths "${elf}" "${c_ldso_paths[@]}" && return 0
++ if [ -n "${c_ldso_paths}" ] ; then
++ check_paths "${elf}" ${c_ldso_paths//:/ } && return 0
+ fi
+
+ check_paths "${elf}" ${lib_paths_ldso:-${lib_paths_fallback}} && return 0
+@@ -135,27 +137,29 @@
+ elf=${elf##*/}
+
+ ${LIST} || printf "%${indent}s%s => " "" "${elf}"
+- if [[ ,${parent_elfs}, == *,${elf},* ]] ; then
++ case ",${parent_elfs}," in
++ *,${elf},*)
+ ${LIST} || printf "!!! circular loop !!!\n" ""
+ return
+- fi
++ ;;
++ esac
+ parent_elfs="${parent_elfs},${elf}"
+ if ${LIST} ; then
+ echo "${resolved:-$1}"
+ else
+ printf "${resolved:-not found}"
+ fi
+- if [[ ${indent} -eq 0 ]] ; then
++ if [ ${indent} -eq 0 ] ; then
+ elf_specs=$(elf_specs "${resolved}")
+ interp=$(scanelf -qF '#F%i' "${resolved}")
+- [[ -n ${interp} ]] && interp="${ROOT}${interp#/}"
++ [ -n "${interp}" ] && interp="${ROOT}${interp#/}"
+
+ if ${LIST} ; then
+- [[ -n ${interp} ]] && echo "${interp}"
++ [ -n "${interp}" ] && echo "${interp}"
+ else
+ printf " (interpreter => ${interp:-none})"
+ fi
+- if [[ -r ${interp} ]] ; then
++ if [ -r "${interp}" ] ; then
+ # Extract the default lib paths out of the ldso.
+ lib_paths_ldso=$(
+ strings "${interp}" | \
+@@ -166,7 +170,7 @@
+ fi
+ ${LIST} || printf "\n"
+
+- [[ -z ${resolved} ]] && return
++ [ -z "${resolved}" ] && return
+
+ libs=$(scanelf -qF '#F%n' "${resolved}")
+
+@@ -178,16 +182,15 @@
+
+ for lib in ${libs//,/ } ; do
+ lib=${lib##*/}
+- [[ ,${my_allhits}, == *,${lib},* ]] && continue
++ case ",${my_allhits}," in
++ *,${lib},*) continue;;
++ esac
+ find_elf "${lib}" "${resolved}"
+ rlib=${_find_elf}
+ show_elf "${rlib:-${lib}}" $((indent + 4)) "${parent_elfs}"
+ done
+ }
+
+-# XXX: internal hack
+-if [[ $1 != "/../..source.lddtree" ]] ; then
+-
+ SHOW_ALL=false
+ SET_X=false
+ LIST=false
+@@ -210,8 +213,8 @@
+ ?) usage 1;;
+ esac
+ done
+-shift $((OPTIND - 1))
+-[[ -z $1 ]] && usage 1
++shift $(( $OPTIND - 1))
++[ -z "$1" ] && usage 1
+
+ ${SET_X} && set -x
+
+@@ -219,21 +222,20 @@
+ for elf ; do
+ unset lib_paths_ldso
+ unset c_last_needed_by
+- if ${AUTO_ROOT} && [[ ${elf} == /* ]] ; then
++ if ${AUTO_ROOT} && [ -z "${elf##/*}" ] ; then
+ elf="${ROOT}${elf#/}"
+ fi
+- if [[ ! -e ${elf} ]] ; then
++ if [ ! -e "${elf}" ] ; then
+ error "${elf}: file does not exist"
+- elif [[ ! -r ${elf} ]] ; then
++ elif [ ! -r "${elf}" ] ; then
+ error "${elf}: file is not readable"
+- elif [[ -d ${elf} ]] ; then
++ elif [ -d "${elf}" ] ; then
+ error "${elf}: is a directory"
+ else
+ allhits=""
+- [[ ${elf} != */* ]] && elf="./${elf}"
++ [ "${elf##*/*}" = "${elf}" ] && elf="./${elf}"
+ show_elf "${elf}" 0 ""
+ fi
+ done
+ exit ${ret}
+
+-fi