Init, adding corrade,magnum,magnum-plugins,magnum-integration,magnum-extras, and magnum-examples 2025.47_1
This commit is contained in:
0
common/hooks/pre-pkg/.empty
Normal file
0
common/hooks/pre-pkg/.empty
Normal file
44
common/hooks/pre-pkg/03-rewrite-python-shebang.sh
Normal file
44
common/hooks/pre-pkg/03-rewrite-python-shebang.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
# This hook executes the following tasks:
|
||||
# - rewrites python shebangs with the corresponding python version
|
||||
|
||||
hook() {
|
||||
local pyver= shebang= off=
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
|
||||
pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
|
||||
fi
|
||||
|
||||
if [ -n "$python_version" ]; then
|
||||
pyver="$python_version"
|
||||
fi
|
||||
|
||||
if [ "$python_version" = ignore ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$pyver" ]; then
|
||||
default_shebang="#!/usr/bin/python${pyver%.*}"
|
||||
fi
|
||||
|
||||
grep -rlIZ -m1 '^#!.*python' "${PKGDESTDIR}" |
|
||||
while IFS= read -r -d '' file; do
|
||||
[ ! -s "$file" ] && continue
|
||||
|
||||
pyinterp=$(sed -n -E -e 2q -e 's@^#!(.*([[:space:]]|/))?(python([0-9](\.[0-9]+)?)?)([[:space:]]+.*|$)@\3@p' "$file")
|
||||
[ -z "$pyinterp" ] && continue
|
||||
|
||||
pyver=${pyinterp#python}
|
||||
if [ -n "$pyver" ]; then
|
||||
shebang="#!/usr/bin/python${pyver%.*}"
|
||||
else
|
||||
shebang="$default_shebang"
|
||||
fi
|
||||
|
||||
basefile=${file#$PKGDESTDIR}
|
||||
|
||||
[ -n "$shebang" ] || msg_error "python_version missing in template: unable to convert shebang in $basefile\n"
|
||||
|
||||
echo " Shebang converted to '$shebang': $basefile"
|
||||
sed -i "1s@.*python.*@${shebang}@" -- "$file"
|
||||
done
|
||||
}
|
||||
75
common/hooks/pre-pkg/04-generate-provides.sh
Normal file
75
common/hooks/pre-pkg/04-generate-provides.sh
Normal file
@@ -0,0 +1,75 @@
|
||||
# vim: set ts=4 sw=4 ft=bash et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Generates provides file with provides entries for xbps-create(1)
|
||||
|
||||
get_explicit_provides() {
|
||||
# include explicit values from the template
|
||||
if [ -n "$provides" ]; then
|
||||
printf '%s\n' $provides
|
||||
fi
|
||||
}
|
||||
|
||||
generate_python_provides() {
|
||||
local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3"
|
||||
|
||||
# get the canonical python package names for each python module
|
||||
if [ -z "$nopyprovides" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && [ -x "${py3_bin}" ]; then
|
||||
PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \
|
||||
"${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \
|
||||
-S "${PKGDESTDIR}/${py3_sitelib}" -v "${pkgver}" provides
|
||||
fi
|
||||
}
|
||||
|
||||
generate_pkgconfig_provides() {
|
||||
find "${PKGDESTDIR}/usr/lib/pkgconfig" "${PKGDESTDIR}/usr/share/pkgconfig" -name '*.pc' -type f \
|
||||
-exec pkg-config --print-provides {} \; 2>/dev/null | sed "s/^/pc:/; s/ =.*/-${version}_${revision}/" | sort -u
|
||||
}
|
||||
|
||||
generate_cmd_provides() {
|
||||
find "${PKGDESTDIR}/usr/bin" -maxdepth 1 -type f -printf "cmd:%f-${version}_${revision}\n" 2>/dev/null | sort -u
|
||||
}
|
||||
|
||||
generate_alt_cmd_provides() {
|
||||
local _alt _group _symlink _target _path
|
||||
for _alt in $alternatives; do
|
||||
IFS=':' read -r _group _symlink _target <<< "$_alt"
|
||||
case "$_symlink" in
|
||||
/usr/bin/*)
|
||||
echo "${_symlink##*/}"
|
||||
;;
|
||||
/*)
|
||||
# skip all other absolute paths
|
||||
;;
|
||||
*/*)
|
||||
# relative path, resolve
|
||||
_path="$(realpath -m "$_target/./$_symlink")"
|
||||
if [ "${_path%/*}" = /usr/bin ]; then
|
||||
echo "${_path##*/}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ "${_target%/*}" = /usr/bin ]; then
|
||||
echo "${_symlink}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done | sed "s/^/cmd:/; s/$/-0_1/"
|
||||
}
|
||||
|
||||
hook() {
|
||||
local -a _provides
|
||||
|
||||
mapfile -t _provides < <(
|
||||
get_explicit_provides
|
||||
generate_python_provides
|
||||
generate_pkgconfig_provides
|
||||
generate_cmd_provides
|
||||
generate_alt_cmd_provides
|
||||
)
|
||||
|
||||
if [ "${#_provides[@]}" -gt 0 ]; then
|
||||
echo " ${_provides[*]}"
|
||||
echo "${_provides[*]}" > "${XBPS_STATEDIR}/${pkgname}-provides"
|
||||
fi
|
||||
}
|
||||
171
common/hooks/pre-pkg/04-generate-runtime-deps.sh
Normal file
171
common/hooks/pre-pkg/04-generate-runtime-deps.sh
Normal file
@@ -0,0 +1,171 @@
|
||||
# vim: set ts=4 sw=4 et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Generates rdeps file with run-time dependencies for xbps-create(1)
|
||||
# - Generates shlib-requires file for xbps-create(1)
|
||||
|
||||
add_rundep() {
|
||||
local dep="$1" i= rpkgdep= _depname= found=
|
||||
|
||||
_depname="$($XBPS_UHELPER_CMD getpkgdepname ${dep} 2>/dev/null)"
|
||||
if [ -z "${_depname}" ]; then
|
||||
_depname="$($XBPS_UHELPER_CMD getpkgname ${dep} 2>/dev/null)"
|
||||
fi
|
||||
|
||||
for i in ${run_depends}; do
|
||||
rpkgdep="$($XBPS_UHELPER_CMD getpkgdepname $i 2>/dev/null)"
|
||||
if [ -z "$rpkgdep" ]; then
|
||||
rpkgdep="$($XBPS_UHELPER_CMD getpkgname $i 2>/dev/null)"
|
||||
fi
|
||||
if [ "${rpkgdep}" != "${_depname}" ]; then
|
||||
continue
|
||||
fi
|
||||
$XBPS_UHELPER_CMD cmpver "$i" "$dep"
|
||||
rval=$?
|
||||
if [ $rval -eq 255 ]; then
|
||||
run_depends="${run_depends/${i}/${dep}}"
|
||||
fi
|
||||
found=1
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
run_depends+=" ${dep}"
|
||||
fi
|
||||
}
|
||||
|
||||
store_pkgdestdir_rundeps() {
|
||||
if [ -n "$run_depends" ]; then
|
||||
for f in ${run_depends}; do
|
||||
_curdep="$(echo "$f" | sed -e 's,\(.*\)?.*,\1,')"
|
||||
if [ -z "$($XBPS_UHELPER_CMD getpkgdepname ${_curdep} 2>/dev/null)" -a \
|
||||
-z "$($XBPS_UHELPER_CMD getpkgname ${_curdep} 2>/dev/null)" ]; then
|
||||
_curdep="${_curdep}>=0"
|
||||
fi
|
||||
printf "%s " "${_curdep}"
|
||||
done > "${XBPS_STATEDIR}/${pkgname}-rdeps"
|
||||
fi
|
||||
}
|
||||
|
||||
parse_shlib_needed() {
|
||||
while read -r f; do
|
||||
lf=${f#${PKGDESTDIR}}
|
||||
if [ "${skiprdeps/${lf}/}" != "${skiprdeps}" ]; then
|
||||
msg_normal "Skipping dependency scan for ${lf}\n" >&3
|
||||
continue
|
||||
fi
|
||||
read -n4 elfmagic < "$f"
|
||||
if [ "$elfmagic" = $'\177ELF' ]; then
|
||||
$OBJDUMP -p "$f" |
|
||||
awk '
|
||||
/NEEDED/{print $2;}
|
||||
/Qt_5_PRIVATE_API/{next;}
|
||||
/Qt_[0-9]*_PRIVATE_API/{print $NF;}
|
||||
'
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
hook() {
|
||||
local depsftmp f lf j mapshlibs sorequires _curdep elfmagic broken_shlibs verify_deps
|
||||
local _shlib_dir="${XBPS_STATEDIR}/shlib-provides"
|
||||
local _shlibtmp
|
||||
|
||||
local Qt_6_PRIVATE_API=6.10.0
|
||||
|
||||
# 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
|
||||
fi
|
||||
|
||||
depsftmp=$(mktemp) || exit 1
|
||||
find ${PKGDESTDIR} -type f -perm -u+w > $depsftmp 2>/dev/null
|
||||
|
||||
for f in ${shlib_requires}; do
|
||||
verify_deps+=" ${f}"
|
||||
done
|
||||
|
||||
_shlibtmp=$(mktemp) || exit 1
|
||||
parse_shlib_needed 3>&1 >"$_shlibtmp" <"$depsftmp"
|
||||
rm -f "$depsftmp"
|
||||
verify_deps=$(sort <"$_shlibtmp" | uniq)
|
||||
rm -f "$_shlibtmp"
|
||||
|
||||
#
|
||||
# Add required run time packages by using required shlibs resolved
|
||||
# above, the mapping is done thru the common/shlibs file.
|
||||
#
|
||||
for f in ${verify_deps}; do
|
||||
unset _rdep _pkgname _rdepver
|
||||
|
||||
case "$f" in
|
||||
Qt_*_PRIVATE_API)
|
||||
eval "f=lib${f}.\${$f}"
|
||||
;;
|
||||
esac
|
||||
|
||||
local _findargs="-name"
|
||||
# if SONAME is a path, find should use -wholename
|
||||
if [[ "$f" = */* ]]; then
|
||||
_findargs="-wholename"
|
||||
fi
|
||||
case " $shlib_provides " in
|
||||
*" $f "*)
|
||||
echo " SONAME: $f <-> $pkgname (ignored)"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if [ "$(find "${PKGDESTDIR}" $_findargs "$f")" ]; then
|
||||
# Ignore libs by current pkg
|
||||
echo " SONAME: $f <-> $pkgname (ignored)"
|
||||
continue
|
||||
# If this library is provided by a subpkg of sourcepkg, use that subpkg
|
||||
elif _pkgname="$(cd "$_shlib_dir" && grep -F -l -x "$f" *.soname 2>/dev/null)"; then
|
||||
# If that library has SONAME, add it to shlibs-requires, too.
|
||||
_pkgname=${_pkgname%.soname}
|
||||
_sdep="${_pkgname}>=${version}_${revision}"
|
||||
sorequires+="${f} "
|
||||
elif _pkgname="$(cd "$_shlib_dir" && grep -F -l -x "$f" *.nosoname 2>/dev/null)"; then
|
||||
_pkgname=${_pkgname%.nosoname}
|
||||
_sdep="${_pkgname}>=${version}_${revision}"
|
||||
else
|
||||
_rdep="$(awk -v sl="$f" -v arch="$XBPS_TARGET_MACHINE" '$1 == sl && ($3 == "" || $3 == "ignore" || $3 == arch) { print $2; exit; }' "$mapshlibs")"
|
||||
|
||||
if [ -z "$_rdep" ]; then
|
||||
msg_red_nochroot " SONAME: $f <-> UNKNOWN PKG PLEASE FIX!\n"
|
||||
broken_shlibs=1
|
||||
continue
|
||||
fi
|
||||
_pkgname=$($XBPS_UHELPER_CMD getpkgname "${_rdep}" 2>/dev/null)
|
||||
_rdepver=$($XBPS_UHELPER_CMD getpkgversion "${_rdep}" 2>/dev/null)
|
||||
if [ -z "${_pkgname}" -o -z "${_rdepver}" ]; then
|
||||
msg_red_nochroot " SONAME: $f <-> UNKNOWN PKG PLEASE FIX!\n"
|
||||
broken_shlibs=1
|
||||
continue
|
||||
fi
|
||||
_sdep="${_pkgname}>=${_rdepver}"
|
||||
|
||||
# By this point, SONAME can't be found in current pkg
|
||||
sorequires+="${f} "
|
||||
fi
|
||||
echo " SONAME: $f <-> ${_sdep}"
|
||||
add_rundep "${_sdep}"
|
||||
done
|
||||
#
|
||||
# If pkg uses any unknown SONAME error out.
|
||||
#
|
||||
if [ -n "$broken_shlibs" -a -z "$allow_unknown_shlibs" ]; then
|
||||
msg_error "$pkgver: cannot guess required shlibs, aborting!\n"
|
||||
fi
|
||||
|
||||
store_pkgdestdir_rundeps
|
||||
|
||||
if [ -n "${sorequires}" ]; then
|
||||
echo "${sorequires}" | xargs -n1 | sort | xargs > ${XBPS_STATEDIR}/${pkgname}-shlib-requires
|
||||
fi
|
||||
}
|
||||
87
common/hooks/pre-pkg/05-generate-32bit-runtime-deps.sh
Normal file
87
common/hooks/pre-pkg/05-generate-32bit-runtime-deps.sh
Normal file
@@ -0,0 +1,87 @@
|
||||
hook() {
|
||||
local destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
|
||||
|
||||
# By default always enabled unless "lib32disabled" is set.
|
||||
if [ -n "$lib32disabled" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# This hook will only work when building for x86.
|
||||
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -d ${destdir32} ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the rdeps file exist (runtime deps), copy and then modify it for
|
||||
# 32bit dependencies.
|
||||
trap - ERR
|
||||
|
||||
: > ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
|
||||
if [ -s "${XBPS_STATEDIR}/${pkgname}-rdeps" ]; then
|
||||
if [ -n "$lib32depends" ]; then
|
||||
_deps="${lib32depends}"
|
||||
else
|
||||
_deps="$(<${XBPS_STATEDIR}/${pkgname}-rdeps)"
|
||||
fi
|
||||
for f in ${_deps}; do
|
||||
unset found pkgn pkgv _shprovides
|
||||
|
||||
pkgn="$($XBPS_UHELPER_CMD getpkgdepname $f)"
|
||||
if [ -z "${pkgn}" ]; then
|
||||
pkgn="$($XBPS_UHELPER_CMD getpkgname $f)"
|
||||
if [ -z "${pkgn}" ]; then
|
||||
msg_error "$pkgver: invalid dependency $f\n"
|
||||
fi
|
||||
pkgv="-$($XBPS_UHELPER_CMD getpkgversion ${f})"
|
||||
else
|
||||
pkgv="$($XBPS_UHELPER_CMD getpkgdepversion ${f})"
|
||||
fi
|
||||
# If dependency is a development pkg switch it to 32bit.
|
||||
if [[ $pkgn == *-devel ]]; then
|
||||
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (development)"
|
||||
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
continue
|
||||
fi
|
||||
# If dependency does not have "shlib-provides" do not
|
||||
# change it to 32bit.
|
||||
for x in ${subpackages}; do
|
||||
if [ "$x" = "$pkgn" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
# Dependency is not a subpkg, check shlib-provides
|
||||
# via binpkgs.
|
||||
_shprovides="$($XBPS_QUERY_CMD -R --property=shlib-provides "$pkgn")"
|
||||
if [ -n "${_shprovides}" ]; then
|
||||
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (shlib-provides)"
|
||||
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
else
|
||||
echo " RDEP: $f -> ${pkgn}${pkgv} (no shlib-provides)"
|
||||
printf "${pkgn}${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
fi
|
||||
else
|
||||
if [ -s "${XBPS_STATEDIR}/${pkgn}-shlib-provides" ]; then
|
||||
# Dependency is a subpkg; check if it provides any shlib
|
||||
# and convert to 32bit if true.
|
||||
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (subpkg, shlib-provides)"
|
||||
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
else
|
||||
echo " RDEP: $f -> ${pkgn}${pkgv} (subpkg, no shlib-provides)"
|
||||
printf "${pkgn}${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# If it's a development pkg add a dependency to the 64bit pkg.
|
||||
if [[ $pkgn == *-devel ]]; then
|
||||
echo " RDEP: ${pkgver}"
|
||||
printf "${pkgver} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
fi
|
||||
printf "\n" >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
|
||||
}
|
||||
17
common/hooks/pre-pkg/06-verify-python-deps.sh
Normal file
17
common/hooks/pre-pkg/06-verify-python-deps.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
# vim: set ts=4 sw=4 et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Verifies python module dependencies from dist-info's METADATA and egg-info's PKG-INFO
|
||||
|
||||
hook() {
|
||||
local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3"
|
||||
|
||||
if [ -z "$noverifypydeps" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && [ -x "${py3_bin}" ]; then
|
||||
PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" \
|
||||
"${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \
|
||||
${NOCOLORS:+-C} ${XBPS_STRICT:+-s} -S "${PKGDESTDIR}/${py3_sitelib}" -v "${pkgver}" \
|
||||
depends -e "${python_extras}" \
|
||||
-V <( $XBPS_QUERY_XCMD -R -p provides -s "py3:" ) -D "${XBPS_STATEDIR}/${pkgname}-rdeps" \
|
||||
|| msg_error "$pkgver: failed to verify python module dependencies\n"
|
||||
fi
|
||||
}
|
||||
10
common/hooks/pre-pkg/90-set-timestamps.sh
Normal file
10
common/hooks/pre-pkg/90-set-timestamps.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
# This hook executes the following tasks:
|
||||
# - sets the timestamps in a package to the commit date
|
||||
|
||||
hook() {
|
||||
# If SOURCE_DATE_EPOCH is set, set mtimes to that timestamp.
|
||||
if [ -n "$SOURCE_DATE_EPOCH" ]; then
|
||||
msg_normal "$pkgver: setting mtimes to %s\n" "$(date --date "@$SOURCE_DATE_EPOCH")"
|
||||
find $PKGDESTDIR -print0 | xargs -0 touch -h --date "@$SOURCE_DATE_EPOCH"
|
||||
fi
|
||||
}
|
||||
54
common/hooks/pre-pkg/99-pkglint-subpkgs.sh
Normal file
54
common/hooks/pre-pkg/99-pkglint-subpkgs.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
# vim: set ts=4 sw=4 et:
|
||||
#
|
||||
# This hook executes the following tasks:
|
||||
# - Warns if the main package is in subpackages=
|
||||
# - Warns if a subpackage is unreachable (never appears in subpackages=)
|
||||
|
||||
hook() {
|
||||
local subpkgs matches
|
||||
|
||||
# Run this only against the main package
|
||||
if [ "$pkgname" != "$sourcepkg" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$subpackages" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
subpkgs=$(get_subpkgs)
|
||||
|
||||
# Sort the strings so they can be compare for equality
|
||||
subpkgs="$(printf '%s\n' $subpkgs | sort)"
|
||||
subpackages="$(printf '%s\n' $subpackages | sort)"
|
||||
|
||||
if [ "$subpackages" = "$subpkgs" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# sed supports comment but let's put them here
|
||||
# 1: print everything between pairs of <""> in subpackages[+]?="..."
|
||||
# 2: multiline subpackages="...\n..."
|
||||
# 2.1: For any line in the middle, i.e. no <"> exists, print it
|
||||
# 2.2: For the first line, print everything after <">
|
||||
# 2.3: For last line, print everything before <">
|
||||
matches="$(sed -n -e 's/subpackages.*"\(.*\)"[^"]*$/\1/p' \
|
||||
-e '/subpackages[^"]*"[^"]*$/,/"/{
|
||||
/"/!p
|
||||
/subpackages/s/.*"//p
|
||||
s/".*//p
|
||||
}' $XBPS_SRCPKGDIR/$pkgname/template |
|
||||
tr '\v\t\r\n' ' ')"
|
||||
|
||||
for s in $subpkgs; do
|
||||
case " $matches " in
|
||||
*" $s "*) ;;
|
||||
*) msg_warn "${s}_package() defined but will never be built.\n" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case " $matches " in
|
||||
*" $pkgname "*)
|
||||
msg_warn "$pkgname is sourcepkg but is in subpackages=.\n" ;;
|
||||
esac
|
||||
}
|
||||
239
common/hooks/pre-pkg/99-pkglint.sh
Normal file
239
common/hooks/pre-pkg/99-pkglint.sh
Normal file
@@ -0,0 +1,239 @@
|
||||
# This hook checks for common issues related to void.
|
||||
|
||||
hook() {
|
||||
local error=0 filename= rev= libname= conflictPkg= conflictFile=
|
||||
local conflictRev= ignore= found= mapshlibs=$XBPS_COMMONDIR/shlibs
|
||||
local emptypkg=yes
|
||||
|
||||
set +E
|
||||
|
||||
# Check for forbidden directories that are symlinks in void.
|
||||
for f in lib bin sbin lib64 lib32 usr/sbin usr/lib64; do
|
||||
[ -e "${PKGDESTDIR}/${f}" ] || continue
|
||||
if [ "${pkgname}" = "base-files" ]; then
|
||||
if [ -L "${PKGDESTDIR}/${f}" ]; then
|
||||
continue
|
||||
fi
|
||||
msg_red "${pkgver}: /${f} must be a symlink.\n"
|
||||
error=1
|
||||
else
|
||||
msg_red "${pkgver}: /${f} must not exist.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
for f in var/run usr/local usr/etc; do
|
||||
if [ -d ${PKGDESTDIR}/${f} ]; then
|
||||
msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/lib/libexec ]; then
|
||||
# Add exception for kconfig,
|
||||
# other packages hard-coded path to its files
|
||||
if [ "${pkgname}" != kconfig ]; then
|
||||
msg_red "${pkgver}: /usr/lib/libexec directory is not allowed!\n"
|
||||
error=1
|
||||
fi
|
||||
fi
|
||||
|
||||
for f in "$PKGDESTDIR"/*; do
|
||||
f="${f##*/}"
|
||||
case "$f" in
|
||||
'*') # The filename is exactly '*'
|
||||
if [ -e "${PKGDESTDIR}/*" ]; then
|
||||
msg_red "${pkgver}: File /* is not allowed\n"
|
||||
error=1
|
||||
fi
|
||||
;;
|
||||
lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv)
|
||||
emptypkg=no
|
||||
;;
|
||||
INSTALL|INSTALL.msg|REMOVE|REMOVE.msg|rdeps|shlib-requires|shlib-provides)
|
||||
if [ ! -f "${PKGDESTDIR}/$f" ]; then
|
||||
msg_red "${pkgver}: /${f} is not allowed\n"
|
||||
error=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
|
||||
error=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Forbid empty packages unless metapackage=yes or it is 32bit devel package
|
||||
if [ "$metapackage" != yes ] && [ "$emptypkg" != no ] && [[ ${pkgname} != *-devel-32bit ]]; then
|
||||
msg_red "${pkgver}: PKGDESTDIR is empty and metapackage != yes\n"
|
||||
error=1
|
||||
fi
|
||||
if [ "$metapackage" = yes ] && [ "$emptypkg" = no ]; then
|
||||
msg_red "${pkgver}: PKGDESTDIR of meta package is not empty\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
# Check that configuration files really exist.
|
||||
for f in $(expand_destdir "${conf_files}"); do
|
||||
if [ ! -f "${PKGDESTDIR}/${f}" ]; then
|
||||
msg_red "${pkgver}: '$f' configuration file not in PKGDESTDIR!\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for l10n files in usr/lib/locale
|
||||
if [ -d ${PKGDESTDIR}/usr/lib/locale ]; then
|
||||
local locale_allow=0 ldir
|
||||
local lroot="${PKGDESTDIR}/usr/lib/locale"
|
||||
|
||||
if [ "${pkgname}" = "glibc" ]; then
|
||||
# glibc gets an exception for its included C.utf8 locale
|
||||
locale_allow=1
|
||||
for ldir in "${lroot}"/*; do
|
||||
[ "${ldir}" = "${lroot}/C.utf8" ] && continue
|
||||
locale_allow=0
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${locale_allow}" -ne 1 ]; then
|
||||
msg_red "${pkgver}: /usr/lib/locale is forbidden, use /usr/share/locale!\n"
|
||||
error=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for bash completions in etc/bash_completion.d
|
||||
# should be on usr/share/bash-completion/completions
|
||||
if [ -d ${PKGDESTDIR}/etc/bash_completion.d ]; then
|
||||
msg_red "${pkgver}: /etc/bash_completion.d is forbidden. Use /usr/share/bash-completion/completions.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/share/zsh/vendor-functions ]; then
|
||||
msg_red "${pkgver}: /usr/share/zsh/vendor-functions is forbidden. Use /usr/share/zsh/site-functions.\n"
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/share/zsh/vendor-completions ]; then
|
||||
msg_red "${pkgver}: /usr/share/zsh/vendor-completions is forbidden. Use /usr/share/zsh/site-functions.\n"
|
||||
fi
|
||||
|
||||
# Prevent packages from installing to these paths in etc, they should use
|
||||
# their equivalent in usr/lib
|
||||
for f in udev/{rules.d,hwdb.d} modprobe.d sysctl.d; do
|
||||
if [ -d ${PKGDESTDIR}/etc/${f} ]; then
|
||||
msg_red "${pkgver}: /etc/${f} is forbidden. Use /usr/lib/${f}.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
# Likewise with the comment above but for usr/share
|
||||
for f in X11/xorg.conf.d gconf/schemas; do
|
||||
if [ -d ${PKGDESTDIR}/etc/${f} ]; then
|
||||
msg_red "${pkgver}: /etc/${f} is forbidden. Use /usr/share/${f}.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d ${PKGDESTDIR}/etc/dracut.conf.d ]; then
|
||||
msg_red "${pkgver}: /etc/dracut.conf.d is forbidden. Use /usr/lib/dracut/dracut.conf.d.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/usr ]; then
|
||||
msg_red "${pkgver}: /usr/usr is forbidden, use /usr.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/man ]; then
|
||||
msg_red "${pkgver}: /usr/man is forbidden, use /usr/share/man.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [[ -d ${PKGDESTDIR}/usr/share/man/man ]]; then
|
||||
msg_red "${pkgver}: /usr/share/man/man is forbidden, use /usr/share/man.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/doc ]; then
|
||||
msg_red "${pkgver}: /usr/doc is forbidden. Use /usr/share/doc.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/dict ]; then
|
||||
msg_red "${pkgver}: /usr/dict is forbidden. Use /usr/share/dict.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
if [ -e ${PKGDESTDIR}/usr/share/glib-2.0/schemas/gschemas.compiled ]; then
|
||||
msg_red "${pkgver}: /usr/share/glib-2.0/schemas/gschemas.compiled is forbidden. Delete it.\n"
|
||||
error=1
|
||||
fi
|
||||
|
||||
# Forbid files would be generated by mimedb trigger
|
||||
for f in XMLnamespaces aliases generic-icons globs globs2 icons \
|
||||
magic mime.cache subclasses treemagic types version ; do
|
||||
if [ -f "${PKGDESTDIR}/usr/share/mime/$f" ]; then
|
||||
msg_red "${pkgver}: /usr/share/mime/$f is forbidden. Delete it.\n"
|
||||
error=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $error -gt 0 ]; then
|
||||
msg_error "${pkgver}: cannot continue with installation!\n"
|
||||
fi
|
||||
|
||||
# Check for missing shlibs and SONAME bumps.
|
||||
if [ ! -s "${XBPS_STATEDIR}/${pkgname}-shlib-provides" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
for filename in $(<"${XBPS_STATEDIR}/${pkgname}-shlib-provides"); do
|
||||
rev=${filename#*.so.}
|
||||
libname=${filename%.so*}
|
||||
_shlib=$(echo "$libname"|sed -E 's|\+|\\+|g')
|
||||
_pkgname=$(echo "$pkgname"|sed -E 's|\+|\\+|g')
|
||||
if [ "$rev" = "$filename" ]; then
|
||||
_pattern="^${_shlib}\.so[[:blank:]]+${_pkgname}-[^-]+_[0-9]+"
|
||||
else
|
||||
_pattern="^${_shlib}\.so\.[0-9]+(.*)[[:blank:]]+${_pkgname}-[^-]+_[0-9]+"
|
||||
fi
|
||||
grep -E "${_pattern}" $mapshlibs | { \
|
||||
while read -r conflictFile conflictPkg ignore; do
|
||||
found=1
|
||||
conflictRev=${conflictFile#*.so.}
|
||||
if [ -n "$ignore" -a "$ignore" != "$XBPS_TARGET_MACHINE" ]; then
|
||||
continue
|
||||
elif [ "$rev" = "$conflictRev" ]; then
|
||||
continue
|
||||
elif [[ ${rev}.* =~ $conflictRev ]]; then
|
||||
continue
|
||||
fi
|
||||
msg_red "${pkgver}: SONAME bump detected: ${libname}.so.${conflictRev} -> ${libname}.so.${rev}\n"
|
||||
msg_red "${pkgver}: please update common/shlibs with this line: \"${libname}.so.${rev} ${pkgver}\"\n"
|
||||
msg_red "${pkgver}: all reverse dependencies should also be revbumped to be rebuilt against ${libname}.so.${rev}:\n"
|
||||
_revdeps=$($XBPS_QUERY_XCMD -Rs ${libname}.so -p shlib-requires|cut -d ' ' -f1)
|
||||
for x in ${_revdeps}; do
|
||||
msg_red " ${x%:}\n"
|
||||
done
|
||||
msg_error "${pkgver}: cannot continue with installation!\n"
|
||||
done
|
||||
# Try to match provided shlibs in virtual packages.
|
||||
for f in ${provides}; do
|
||||
_vpkgname="$($XBPS_UHELPER_CMD getpkgname ${f} 2>/dev/null)"
|
||||
_spkgname="$(grep "^${filename}" $mapshlibs | cut -d ' ' -f2)"
|
||||
_libpkgname="$($XBPS_UHELPER_CMD getpkgname ${_spkgname} 2>/dev/null)"
|
||||
if [ -z "${_spkgname}" -o -z "${_libpkgname}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "${_vpkgname}" = "${_libpkgname}" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done;
|
||||
if [ -z "$found" ]; then
|
||||
_myshlib="${libname}.so"
|
||||
[ "${_myshlib}" != "${rev}" ] && _myshlib+=".${rev}"
|
||||
msg_normal "${pkgver}: ${_myshlib} not found in common/shlibs.\n"
|
||||
fi;
|
||||
}
|
||||
done
|
||||
}
|
||||
7
common/hooks/pre-pkg/999-collected-rdeps.sh
Normal file
7
common/hooks/pre-pkg/999-collected-rdeps.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
# This hook displays resolved dependencies for a pkg.
|
||||
|
||||
hook() {
|
||||
if [ -e "${XBPS_STATEDIR}/${pkgname}-rdeps" ]; then
|
||||
echo " $(cat "${XBPS_STATEDIR}/${pkgname}-rdeps")"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user