integrate III
This commit is contained in:
parent
84167444c4
commit
8f66c7f0d9
2 changed files with 122 additions and 110 deletions
|
@ -42,11 +42,11 @@ else
|
||||||
setup_workdir
|
setup_workdir
|
||||||
|
|
||||||
case ${script_mode} in
|
case ${script_mode} in
|
||||||
deps) bsdtar -C $WORKDIR -xf "$1";;
|
deps) bsdtar -C $TMPDIR -xf "$1";;
|
||||||
provides) bsdtar -C $WORKDIR -xf "$1" --include="*.so*";;
|
provides) bsdtar -C $TMPDIR -xf "$1" --include="*.so*";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
pushd $WORKDIR >/dev/null
|
pushd $TMPDIR >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $script_mode in
|
case $script_mode in
|
||||||
|
@ -70,11 +70,11 @@ find . -type f $find_args | while read filename; do
|
||||||
# get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1
|
# get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1
|
||||||
sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
|
sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
|
||||||
[[ -z $sofile ]] && sofile="${filename##*/}"
|
[[ -z $sofile ]] && sofile="${filename##*/}"
|
||||||
process_sofile
|
process_sofile "${sofile}" "${soarch}"
|
||||||
elif [[ $script_mode = "deps" ]]; then
|
elif [[ $script_mode = "deps" ]]; then
|
||||||
# process all libraries needed by the binary
|
# process all libraries needed by the binary
|
||||||
for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do
|
for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do
|
||||||
process_sofile
|
process_sofile "${sofile}" "${soarch}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
222
lib/functions.sh
222
lib/functions.sh
|
@ -10,55 +10,14 @@
|
||||||
|
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
declare -A pseudofs_types=([anon_inodefs]=1
|
|
||||||
[autofs]=1
|
|
||||||
[bdev]=1
|
|
||||||
[binfmt_misc]=1
|
|
||||||
[cgroup]=1
|
|
||||||
[configfs]=1
|
|
||||||
[cpuset]=1
|
|
||||||
[debugfs]=1
|
|
||||||
[devfs]=1
|
|
||||||
[devpts]=1
|
|
||||||
[devtmpfs]=1
|
|
||||||
[dlmfs]=1
|
|
||||||
[fuse.gvfs-fuse-daemon]=1
|
|
||||||
[fusectl]=1
|
|
||||||
[hugetlbfs]=1
|
|
||||||
[mqueue]=1
|
|
||||||
[nfsd]=1
|
|
||||||
[none]=1
|
|
||||||
[pipefs]=1
|
|
||||||
[proc]=1
|
|
||||||
[pstore]=1
|
|
||||||
[ramfs]=1
|
|
||||||
[rootfs]=1
|
|
||||||
[rpc_pipefs]=1
|
|
||||||
[securityfs]=1
|
|
||||||
[sockfs]=1
|
|
||||||
[spufs]=1
|
|
||||||
[sysfs]=1
|
|
||||||
[tmpfs]=1)
|
|
||||||
|
|
||||||
declare -A fsck_types=([cramfs]=1
|
|
||||||
[exfat]=1
|
|
||||||
[ext2]=1
|
|
||||||
[ext3]=1
|
|
||||||
[ext4]=1
|
|
||||||
[ext4dev]=1
|
|
||||||
[jfs]=1
|
|
||||||
[minix]=1
|
|
||||||
[msdos]=1
|
|
||||||
[reiserfs]=1
|
|
||||||
[vfat]=1
|
|
||||||
[xfs]=1)
|
|
||||||
|
|
||||||
# out() { printf "$1 $2\n" "${@:3}"; }
|
# out() { printf "$1 $2\n" "${@:3}"; }
|
||||||
# error() { out "==> ERROR:" "$@"; } >&2
|
# error() { out "==> ERROR:" "$@"; } >&2
|
||||||
# msg() { out "==>" "$@"; }
|
# msg() { out "==>" "$@"; }
|
||||||
# msg2() { out " ->" "$@";}
|
# msg2() { out " ->" "$@";}
|
||||||
# die() { error "$@"; exit 1; }
|
# die() { error "$@"; exit 1; }
|
||||||
|
|
||||||
|
###############################################messages##########################################################
|
||||||
|
|
||||||
# check if messages are to be printed using color
|
# check if messages are to be printed using color
|
||||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||||
if [[ -t 2 ]]; then
|
if [[ -t 2 ]]; then
|
||||||
|
@ -147,13 +106,109 @@ die() {
|
||||||
trap 'trap_abort' INT QUIT TERM HUP
|
trap 'trap_abort' INT QUIT TERM HUP
|
||||||
trap 'trap_exit' EXIT
|
trap 'trap_exit' EXIT
|
||||||
|
|
||||||
|
###############################################misc############################################################
|
||||||
|
|
||||||
ignore_error() {
|
ignore_error() {
|
||||||
"$@" 2>/dev/null
|
"$@" 2>/dev/null
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# in_array() {
|
||||||
|
# local i
|
||||||
|
# for i in "${@:2}"; do
|
||||||
|
# [[ $1 = "$i" ]] && return
|
||||||
|
# done
|
||||||
|
# }
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage : in_array( $needle, $haystack )
|
||||||
|
# return : 0 - found
|
||||||
|
# 1 - not found
|
||||||
|
##
|
||||||
|
in_array() {
|
||||||
|
local needle=$1; shift
|
||||||
|
local item
|
||||||
|
for item in "$@"; do
|
||||||
|
[[ $item = $needle ]] && return 0 # Found
|
||||||
|
done
|
||||||
|
return 1 # Not Found
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################checkpkg##########################################################
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage : get_full_version( [$pkgname] )
|
||||||
|
# return : full version spec, including epoch (if necessary), pkgver, pkgrel
|
||||||
|
##
|
||||||
|
get_full_version() {
|
||||||
|
# set defaults if they weren't specified in buildfile
|
||||||
|
pkgbase=${pkgbase:-${pkgname[0]}}
|
||||||
|
epoch=${epoch:-0}
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
if [[ $epoch ]] && (( ! $epoch )); then
|
||||||
|
echo $pkgver-$pkgrel
|
||||||
|
else
|
||||||
|
echo $epoch:$pkgver-$pkgrel
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
for i in pkgver pkgrel epoch; do
|
||||||
|
local indirect="${i}_override"
|
||||||
|
eval $(declare -f package_$1 | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")
|
||||||
|
[[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\"
|
||||||
|
done
|
||||||
|
if (( ! $epoch_override )); then
|
||||||
|
echo $pkgver_override-$pkgrel_override
|
||||||
|
else
|
||||||
|
echo $epoch_override:$pkgver_override-$pkgrel_override
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################mounting##########################################################
|
||||||
|
|
||||||
|
declare -A pseudofs_types=([anon_inodefs]=1
|
||||||
|
[autofs]=1
|
||||||
|
[bdev]=1
|
||||||
|
[binfmt_misc]=1
|
||||||
|
[cgroup]=1
|
||||||
|
[configfs]=1
|
||||||
|
[cpuset]=1
|
||||||
|
[debugfs]=1
|
||||||
|
[devfs]=1
|
||||||
|
[devpts]=1
|
||||||
|
[devtmpfs]=1
|
||||||
|
[dlmfs]=1
|
||||||
|
[fuse.gvfs-fuse-daemon]=1
|
||||||
|
[fusectl]=1
|
||||||
|
[hugetlbfs]=1
|
||||||
|
[mqueue]=1
|
||||||
|
[nfsd]=1
|
||||||
|
[none]=1
|
||||||
|
[pipefs]=1
|
||||||
|
[proc]=1
|
||||||
|
[pstore]=1
|
||||||
|
[ramfs]=1
|
||||||
|
[rootfs]=1
|
||||||
|
[rpc_pipefs]=1
|
||||||
|
[securityfs]=1
|
||||||
|
[sockfs]=1
|
||||||
|
[spufs]=1
|
||||||
|
[sysfs]=1
|
||||||
|
[tmpfs]=1)
|
||||||
|
|
||||||
|
declare -A fsck_types=([cramfs]=1
|
||||||
|
[exfat]=1
|
||||||
|
[ext2]=1
|
||||||
|
[ext3]=1
|
||||||
|
[ext4]=1
|
||||||
|
[ext4dev]=1
|
||||||
|
[jfs]=1
|
||||||
|
[minix]=1
|
||||||
|
[msdos]=1
|
||||||
|
[reiserfs]=1
|
||||||
|
[vfat]=1
|
||||||
|
[xfs]=1)
|
||||||
|
|
||||||
track_mount() {
|
track_mount() {
|
||||||
if [[ -z $CHROOT_ACTIVE_MOUNTS ]]; then
|
if [[ -z $CHROOT_ACTIVE_MOUNTS ]]; then
|
||||||
CHROOT_ACTIVE_MOUNTS=()
|
CHROOT_ACTIVE_MOUNTS=()
|
||||||
|
@ -195,27 +250,6 @@ fstype_has_fsck() {
|
||||||
(( fsck_types["$1"] ))
|
(( fsck_types["$1"] ))
|
||||||
}
|
}
|
||||||
|
|
||||||
# in_array() {
|
|
||||||
# local i
|
|
||||||
# for i in "${@:2}"; do
|
|
||||||
# [[ $1 = "$i" ]] && return
|
|
||||||
# done
|
|
||||||
# }
|
|
||||||
|
|
||||||
##
|
|
||||||
# usage : in_array( $needle, $haystack )
|
|
||||||
# return : 0 - found
|
|
||||||
# 1 - not found
|
|
||||||
##
|
|
||||||
in_array() {
|
|
||||||
local needle=$1; shift
|
|
||||||
local item
|
|
||||||
for item in "$@"; do
|
|
||||||
[[ $item = $needle ]] && return 0 # Found
|
|
||||||
done
|
|
||||||
return 1 # Not Found
|
|
||||||
}
|
|
||||||
|
|
||||||
valid_number_of_base() {
|
valid_number_of_base() {
|
||||||
local base=$1 len=${#2} i=
|
local base=$1 len=${#2} i=
|
||||||
|
|
||||||
|
@ -279,48 +313,26 @@ dm_name_for_devnode() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
###############################################find-libdeps#######################################################
|
||||||
# usage : get_full_version( [$pkgname] )
|
|
||||||
# return : full version spec, including epoch (if necessary), pkgver, pkgrel
|
# $1: sofile
|
||||||
##
|
# $2: soarch
|
||||||
get_full_version() {
|
process_sofile() {
|
||||||
# set defaults if they weren't specified in buildfile
|
# extract the library name: libfoo.so
|
||||||
pkgbase=${pkgbase:-${pkgname[0]}}
|
local soname="${1%.so?(+(.+([0-9])))}".so
|
||||||
epoch=${epoch:-0}
|
# extract the major version: 1
|
||||||
if [[ -z $1 ]]; then
|
soversion="${1##*\.so\.}"
|
||||||
if [[ $epoch ]] && (( ! $epoch )); then
|
if [[ "$soversion" = "$1" ]] && (($IGNORE_INTERNAL)); then
|
||||||
echo $pkgver-$pkgrel
|
continue
|
||||||
else
|
fi
|
||||||
echo $epoch:$pkgver-$pkgrel
|
if ! in_array "${soname}=${soversion}-$2" ${soobjects[@]}; then
|
||||||
fi
|
# libfoo.so=1-64
|
||||||
else
|
msg "${soname}=${soversion}-$2"
|
||||||
for i in pkgver pkgrel epoch; do
|
soobjects=(${soobjects[@]} "${soname}=${soversion}-$2")
|
||||||
local indirect="${i}_override"
|
|
||||||
eval $(declare -f package_$1 | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")
|
|
||||||
[[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\"
|
|
||||||
done
|
|
||||||
if (( ! $epoch_override )); then
|
|
||||||
echo $pkgver_override-$pkgrel_override
|
|
||||||
else
|
|
||||||
echo $epoch_override:$pkgver_override-$pkgrel_override
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
process_sofile() {
|
###############################################build-set##########################################################
|
||||||
# extract the library name: libfoo.so
|
|
||||||
soname="${sofile%.so?(+(.+([0-9])))}".so
|
|
||||||
# extract the major version: 1
|
|
||||||
soversion="${sofile##*\.so\.}"
|
|
||||||
if [[ "$soversion" = "$sofile" ]] && (($IGNORE_INTERNAL)); then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if ! in_array "${soname}=${soversion}-${soarch}" ${soobjects[@]}; then
|
|
||||||
# libfoo.so=1-64
|
|
||||||
echo "${soname}=${soversion}-${soarch}"
|
|
||||||
soobjects=(${soobjects[@]} "${soname}=${soversion}-${soarch}")
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_profiles(){
|
get_profiles(){
|
||||||
local prof= temp=
|
local prof= temp=
|
||||||
|
@ -398,7 +410,7 @@ chroot_build_set(){
|
||||||
else
|
else
|
||||||
temp=$pkgdir/$pkg
|
temp=$pkgdir/$pkg
|
||||||
fi
|
fi
|
||||||
pacman -U $temp*${ARCH}*pkg*z -r ${chrootdir}/$(get_user) --noconfirm
|
pacman -U $temp*${arch}*pkg*z -r ${chrootdir}/$(get_user) --noconfirm
|
||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue