Revert "xbps-src: multiple performance improvements."
This reverts commit 2a4e178e35
.
This commit is contained in:
parent
3dc3a61144
commit
17ba00b095
|
@ -7,4 +7,3 @@ masterdir*
|
||||||
hostdir*
|
hostdir*
|
||||||
etc/conf
|
etc/conf
|
||||||
etc/virtual
|
etc/virtual
|
||||||
.xbps-checkvers.plist
|
|
||||||
|
|
|
@ -32,16 +32,16 @@ genpkg() {
|
||||||
|
|
||||||
_preserve=${preserve:+-p}
|
_preserve=${preserve:+-p}
|
||||||
if [ -s ${PKGDESTDIR}/rdeps ]; then
|
if [ -s ${PKGDESTDIR}/rdeps ]; then
|
||||||
_deps="$(<${PKGDESTDIR}/rdeps)"
|
_deps="$(cat ${PKGDESTDIR}/rdeps)"
|
||||||
fi
|
fi
|
||||||
if [ -s ${PKGDESTDIR}/shlib-provides ]; then
|
if [ -s ${PKGDESTDIR}/shlib-provides ]; then
|
||||||
_shprovides="$(<${PKGDESTDIR}/shlib-provides)"
|
_shprovides="$(cat ${PKGDESTDIR}/shlib-provides)"
|
||||||
fi
|
fi
|
||||||
if [ -s ${PKGDESTDIR}/shlib-requires ]; then
|
if [ -s ${PKGDESTDIR}/shlib-requires ]; then
|
||||||
_shrequires="$(<${PKGDESTDIR}/shlib-requires)"
|
_shrequires="$(cat ${PKGDESTDIR}/shlib-requires)"
|
||||||
fi
|
fi
|
||||||
if [ -s ${XBPS_STATEDIR}/gitrev ]; then
|
if [ -s ${XBPS_STATEDIR}/gitrev ]; then
|
||||||
_gitrevs="$(<${XBPS_STATEDIR}/gitrev)"
|
_gitrevs="$(cat ${XBPS_STATEDIR}/gitrev)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stripping whitespaces
|
# Stripping whitespaces
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# - Generates shlib-requires file for xbps-create(1)
|
# - Generates shlib-requires file for xbps-create(1)
|
||||||
|
|
||||||
add_rundep() {
|
add_rundep() {
|
||||||
local dep="$1" i= rpkgdep= _depname= found=
|
local dep="$1" i= rpkgdep= _depname= _rdeps= found=
|
||||||
|
|
||||||
_depname="$($XBPS_UHELPER_CMD getpkgdepname ${dep} 2>/dev/null)"
|
_depname="$($XBPS_UHELPER_CMD getpkgdepname ${dep} 2>/dev/null)"
|
||||||
if [ -z "${_depname}" ]; then
|
if [ -z "${_depname}" ]; then
|
||||||
|
@ -68,19 +68,26 @@ hook() {
|
||||||
exec < $depsftmp
|
exec < $depsftmp
|
||||||
while read f; do
|
while read f; do
|
||||||
lf=${f#${PKGDESTDIR}}
|
lf=${f#${PKGDESTDIR}}
|
||||||
if [ "${skiprdeps/${lf}/}" != "${skiprdeps}" ]; then
|
if [ "${skiprdeps/${lf}/}" != "${skiprdeps}" ]; then
|
||||||
msg_normal "Skipping dependency scan for ${lf}\n"
|
msg_normal "Skipping dependency scan for ${lf}\n"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
case "$(file -bi "$f")" in
|
case "$(file -bi "$f")" in
|
||||||
application/x-*executable*|application/x-sharedlib*)
|
application/x-*executable*|application/x-sharedlib*)
|
||||||
for nlib in $($OBJDUMP -p "$f"|grep NEEDED|awk '{print $2}'); do
|
for nlib in $($OBJDUMP -p "$f"|grep NEEDED|awk '{print $2}'); do
|
||||||
[ -z "$verify_deps" ] && verify_deps="$nlib" && continue
|
if [ -z "$verify_deps" ]; then
|
||||||
found=0
|
verify_deps="$nlib"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
for j in ${verify_deps}; do
|
for j in ${verify_deps}; do
|
||||||
[[ $j == $nlib ]] && found=1 && break
|
[ "$j" != "$nlib" ] && continue
|
||||||
|
found_dup=1
|
||||||
|
break
|
||||||
done
|
done
|
||||||
[[ $found -eq 0 ]] && verify_deps="$verify_deps $nlib"
|
if [ -z "$found_dup" ]; then
|
||||||
|
verify_deps="$verify_deps $nlib"
|
||||||
|
fi
|
||||||
|
unset found_dup
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -90,13 +97,13 @@ hook() {
|
||||||
|
|
||||||
#
|
#
|
||||||
# Add required run time packages by using required shlibs resolved
|
# Add required run time packages by using required shlibs resolved
|
||||||
# above, the mapping is done thru the common/shlibs file.
|
# above, the mapping is done thru the mapping_shlib_binpkg.txt file.
|
||||||
#
|
#
|
||||||
for f in ${verify_deps}; do
|
for f in ${verify_deps}; do
|
||||||
unset _f j rdep _rdep rdepcnt soname _pkgname _rdepver found
|
unset _f j rdep _rdep rdepcnt soname _pkgname _rdepver found
|
||||||
_f=$(echo "$f"|sed -E 's|\+|\\+|g')
|
_f=$(echo "$f"|sed -E 's|\+|\\+|g')
|
||||||
rdep="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2)"
|
rdep="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|awk '{print $2}')"
|
||||||
rdepcnt="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2|wc -l)"
|
rdepcnt="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|awk '{print $2}'|wc -l)"
|
||||||
if [ -z "$rdep" ]; then
|
if [ -z "$rdep" ]; then
|
||||||
# Ignore libs by current pkg
|
# Ignore libs by current pkg
|
||||||
soname=$(find ${PKGDESTDIR} -name "$f")
|
soname=$(find ${PKGDESTDIR} -name "$f")
|
||||||
|
@ -114,9 +121,15 @@ hook() {
|
||||||
_pkgname=$($XBPS_UHELPER_CMD getpkgname "$j")
|
_pkgname=$($XBPS_UHELPER_CMD getpkgname "$j")
|
||||||
# if there's a SONAME matching pkgname, use it.
|
# if there's a SONAME matching pkgname, use it.
|
||||||
for x in ${pkgname} ${subpackages}; do
|
for x in ${pkgname} ${subpackages}; do
|
||||||
[[ $_pkgname == $x ]] && found=1 && break
|
if [ "${_pkgname}" = "${x}" ]; then
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
[[ $found ]] && _rdep=$j && break
|
if [ -n "$found" ]; then
|
||||||
|
_rdep=$j
|
||||||
|
break
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
if [ -z "${_rdep}" ]; then
|
if [ -z "${_rdep}" ]; then
|
||||||
# otherwise pick up the first one.
|
# otherwise pick up the first one.
|
||||||
|
|
|
@ -119,7 +119,7 @@ hook() {
|
||||||
msg_red "${pkgver}: SONAME bump detected: ${libname}.so.${conflictRev} -> ${libname}.so.${rev}\n"
|
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}: 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"
|
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)
|
_revdeps=$($XBPS_QUERY_XCMD -Rs ${libname}.so -p shlib-requires|awk '{print $1}')
|
||||||
for x in ${_revdeps}; do
|
for x in ${_revdeps}; do
|
||||||
msg_red " ${x%:}\n"
|
msg_red " ${x%:}\n"
|
||||||
done
|
done
|
||||||
|
@ -128,7 +128,7 @@ hook() {
|
||||||
# Try to match provided shlibs in virtual packages.
|
# Try to match provided shlibs in virtual packages.
|
||||||
for f in ${provides}; do
|
for f in ${provides}; do
|
||||||
_vpkgname="$($XBPS_UHELPER_CMD getpkgname ${f} 2>/dev/null)"
|
_vpkgname="$($XBPS_UHELPER_CMD getpkgname ${f} 2>/dev/null)"
|
||||||
_spkgname="$(grep "^${filename}" $mapshlibs | cut -d ' ' -f2)"
|
_spkgname="$(grep "^${filename}" $mapshlibs | awk '{print $2}')"
|
||||||
_libpkgname="$($XBPS_UHELPER_CMD getpkgname ${_spkgname} 2>/dev/null)"
|
_libpkgname="$($XBPS_UHELPER_CMD getpkgname ${_spkgname} 2>/dev/null)"
|
||||||
if [ -z "${_spkgname}" -o -z "${_libpkgname}" ]; then
|
if [ -z "${_spkgname}" -o -z "${_libpkgname}" ]; then
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -43,6 +43,10 @@ if [ "$PKGNAME" != "$XBPS_TARGET_PKG" -o -z "$XBPS_SKIP_DEPS" ]; then
|
||||||
install_pkg_deps $PKGNAME $XBPS_TARGET_PKG pkg $XBPS_CROSS_BUILD $XBPS_CROSS_PREPARE || exit $?
|
install_pkg_deps $PKGNAME $XBPS_TARGET_PKG pkg $XBPS_CROSS_BUILD $XBPS_CROSS_PREPARE || exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$XBPS_CROSS_PREPARE" ]; then
|
||||||
|
install_cross_pkg $XBPS_CROSS_BUILD || exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
# Fetch distfiles after installing required dependencies,
|
# Fetch distfiles after installing required dependencies,
|
||||||
# because some of them might be required for do_fetch().
|
# because some of them might be required for do_fetch().
|
||||||
$XBPS_LIBEXECDIR/xbps-src-dofetch.sh $SOURCEPKG $XBPS_CROSS_BUILD || exit 1
|
$XBPS_LIBEXECDIR/xbps-src-dofetch.sh $SOURCEPKG $XBPS_CROSS_BUILD || exit 1
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# vim: set ts=4 sw=4 et:
|
# vim: set ts=4 sw=4 et:
|
||||||
#
|
#
|
||||||
setup_pkg_depends() {
|
setup_pkg_depends() {
|
||||||
local pkg="$1" out="$2" j _rpkgname _depname foo _deps
|
local pkg="$1" j _pkgdepname _pkgdep _rpkgname _depname _depver _replacement
|
||||||
|
|
||||||
if [[ $pkg ]]; then
|
if [ -n "$pkg" ]; then
|
||||||
# subpkg
|
# subpkg
|
||||||
if declare -f ${pkg}_package >/dev/null; then
|
if declare -f ${pkg}_package >/dev/null; then
|
||||||
${pkg}_package
|
${pkg}_package
|
||||||
|
@ -13,65 +13,85 @@ setup_pkg_depends() {
|
||||||
for j in ${depends}; do
|
for j in ${depends}; do
|
||||||
_rpkgname="${j%\?*}"
|
_rpkgname="${j%\?*}"
|
||||||
_depname="${j#*\?}"
|
_depname="${j#*\?}"
|
||||||
if [[ ${_rpkgname} == virtual ]]; then
|
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
|
||||||
if [ -s ${XBPS_DISTDIR}/etc/virtual ]; then
|
if [ -z "${_pkgdepname}" ]; then
|
||||||
foo=$(egrep "^${_depname}[[:blank:]]" ${XBPS_DISTDIR}/etc/virtual|cut -d ' ' -f2)
|
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
|
||||||
elif [ -s ${XBPS_DISTDIR}/etc/defaults.virtual ]; then
|
fi
|
||||||
foo=$(egrep "^${_depname}[[:blank:]]" ${XBPS_DISTDIR}/etc/defaults.virtual|cut -d ' ' -f2)
|
if [ -s ${XBPS_DISTDIR}/etc/virtual ]; then
|
||||||
fi
|
_replacement=$(egrep "^${_pkgdepname:-${_depname}}[[:blank:]]" ${XBPS_DISTDIR}/etc/virtual|cut -d ' ' -f2)
|
||||||
if [ -z "$foo" ]; then
|
elif [ -s ${XBPS_DISTDIR}/etc/defaults.virtual ]; then
|
||||||
|
_replacement=$(egrep "^${_pkgdepname:-${_depname}}[[:blank:]]" ${XBPS_DISTDIR}/etc/defaults.virtual|cut -d ' ' -f2)
|
||||||
|
fi
|
||||||
|
if [ "${_rpkgname}" = "virtual" ]; then
|
||||||
|
if [ -z "${_replacement}" ]; then
|
||||||
msg_error "$pkgver: failed to resolve virtual dependency for '$j' (missing from etc/virtual)\n"
|
msg_error "$pkgver: failed to resolve virtual dependency for '$j' (missing from etc/virtual)\n"
|
||||||
fi
|
fi
|
||||||
_deps+="$foo "
|
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_replacement} 2>/dev/null)"
|
||||||
else
|
if [ -z "${_pkgdepname}" ]; then
|
||||||
foo="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
|
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_replacement} 2>/dev/null)"
|
||||||
if [ -z "$foo" ]; then
|
|
||||||
foo="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
|
|
||||||
[ -z "$foo" ] && foo="${_depname}"
|
|
||||||
fi
|
fi
|
||||||
_deps+="$foo "
|
if [ -z "${_pkgdepname}" ]; then
|
||||||
|
_pkgdepname="${_replacement}>=0"
|
||||||
|
fi
|
||||||
|
run_depends+=" ${_depname}?${_pkgdepname}"
|
||||||
|
#echo "Adding dependency virtual: ${_depname}?${_pkgdepname}"
|
||||||
|
else
|
||||||
|
if [ -z "${_pkgdepname}" ]; then
|
||||||
|
_pkgdep="${_depname}>=0"
|
||||||
|
else
|
||||||
|
_pkgdep="${_depname}"
|
||||||
|
fi
|
||||||
|
run_depends+=" ${_pkgdep}"
|
||||||
fi
|
fi
|
||||||
run_depends+="${_depname} "
|
|
||||||
done
|
done
|
||||||
|
for j in ${hostmakedepends}; do
|
||||||
[[ $out && $_deps ]] && echo "$_deps"
|
_depname="${j%\?*}"
|
||||||
return 0
|
_depver=$(srcpkg_get_version ${_depname}) || exit $?
|
||||||
|
host_build_depends+=" ${_depname}-${_depver}"
|
||||||
|
done
|
||||||
|
if [ -n "$XBPS_CHECK_PKGS" ]; then
|
||||||
|
for j in ${checkdepends}; do
|
||||||
|
_depname="${j%\?*}"
|
||||||
|
_depver=$(srcpkg_get_version ${_depname}) || exit $?
|
||||||
|
host_check_depends+=" ${_depname}-${_depver}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
for j in ${makedepends}; do
|
||||||
|
_depname="${j%\?*}"
|
||||||
|
_depver=$(srcpkg_get_version ${_depname}) || exit $?
|
||||||
|
build_depends+=" ${_depname}-${_depver}"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Install a required package dependency, like:
|
||||||
#
|
#
|
||||||
# Install required package dependencies, like:
|
# xbps-install -IAy <pkgname>
|
||||||
#
|
|
||||||
# xbps-install -AIy <pkgs>
|
|
||||||
#
|
|
||||||
# -A automatic mode
|
|
||||||
# -I to ignore file conflicts
|
|
||||||
# -y yes
|
|
||||||
#
|
#
|
||||||
# Returns 0 if package already installed or installed successfully.
|
# Returns 0 if package already installed or installed successfully.
|
||||||
# Any other error number otherwise.
|
# Any other error number otherwise.
|
||||||
#
|
#
|
||||||
# SUCCESS (0): package installed successfully.
|
|
||||||
# ENOENT (2): package missing in repositories.
|
|
||||||
# ENXIO (6): package depends on invalid dependencies.
|
|
||||||
# EAGAIN (11): package conflicts.
|
|
||||||
# EEXIST (17): file conflicts in transaction (XBPS_FLAG_IGNORE_FILE_CONFLICTS unset)
|
|
||||||
# ENODEV (19): package depends on missing dependencies.
|
|
||||||
# ENOTSUP (95): no repositories registered.
|
|
||||||
#
|
|
||||||
install_pkg_from_repos() {
|
install_pkg_from_repos() {
|
||||||
local cross="$1" rval tmplogf cmd
|
local pkg="$1" cross="$2" rval= tmplogf=
|
||||||
shift
|
|
||||||
|
|
||||||
[ $# -eq 0 ] && return 0
|
|
||||||
|
|
||||||
mkdir -p $XBPS_STATEDIR
|
mkdir -p $XBPS_STATEDIR
|
||||||
tmplogf=${XBPS_STATEDIR}/xbps_${XBPS_TARGET_MACHINE}_bdep_${pkg}.log
|
tmplogf=${XBPS_STATEDIR}/xbps_${XBPS_TARGET_MACHINE}_bdep_${pkg}.log
|
||||||
|
|
||||||
cmd=$XBPS_INSTALL_CMD
|
if [ -n "$cross" ]; then
|
||||||
[[ $cross ]] && cmd=$XBPS_INSTALL_XCMD
|
$XBPS_INSTALL_XCMD -IAy "$pkg" >$tmplogf 2>&1
|
||||||
$cmd ${XBPS_SKIP_REMOTEREPOS:+-i} -AIy "$@" >$tmplogf 2>&1
|
else
|
||||||
|
$XBPS_INSTALL_CMD -IAy "$pkg" >$tmplogf 2>&1
|
||||||
|
fi
|
||||||
rval=$?
|
rval=$?
|
||||||
|
# xbps-install can return:
|
||||||
|
#
|
||||||
|
# SUCCESS (0): package installed successfully.
|
||||||
|
# ENOENT (2): package missing in repositories.
|
||||||
|
# ENXIO (6): package depends on invalid dependencies.
|
||||||
|
# EAGAIN (11): package conflicts.
|
||||||
|
# EEXIST (17): file conflicts in transaction (XBPS_FLAG_IGNORE_FILE_CONFLICTS unset)
|
||||||
|
# ENODEV (19): package depends on missing dependencies.
|
||||||
|
# ENOTSUP (95): no repositories registered.
|
||||||
|
#
|
||||||
case "$rval" in
|
case "$rval" in
|
||||||
0) # success, check if there are errors.
|
0) # success, check if there are errors.
|
||||||
errortmpf=$(mktemp) || exit 1
|
errortmpf=$(mktemp) || exit 1
|
||||||
|
@ -91,6 +111,39 @@ install_pkg_from_repos() {
|
||||||
return $rval
|
return $rval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Returns 0 if pkgpattern in $1 is matched against current installed
|
||||||
|
# package, 1 if no match and 2 if not installed.
|
||||||
|
#
|
||||||
|
check_pkgdep_matched() {
|
||||||
|
local pkg="$1" checkver="$2" cross="$3" uhelper= pkgn= iver=
|
||||||
|
|
||||||
|
[ "$build_style" = "meta" ] && return 2
|
||||||
|
[ -z "$pkg" ] && return 255
|
||||||
|
|
||||||
|
pkgn="$($XBPS_UHELPER_CMD getpkgdepname ${pkg} 2>/dev/null)"
|
||||||
|
if [ -z "$pkgn" ]; then
|
||||||
|
pkgn="$($XBPS_UHELPER_CMD getpkgname ${pkg} 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
[ -z "$pkgn" ] && return 255
|
||||||
|
|
||||||
|
if [ -n "$cross" ]; then
|
||||||
|
uhelper="$XBPS_UHELPER_XCMD"
|
||||||
|
else
|
||||||
|
uhelper="$XBPS_UHELPER_CMD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
iver="$($uhelper $checkver $pkgn)"
|
||||||
|
if [ $? -eq 0 -a -n "$iver" ]; then
|
||||||
|
$XBPS_UHELPER_CMD pkgmatch "${pkgn}-${iver}" "${pkg}"
|
||||||
|
[ $? -eq 1 ] && return 0
|
||||||
|
else
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns 0 if pkgpattern in $1 is installed and greater than current
|
# Returns 0 if pkgpattern in $1 is installed and greater than current
|
||||||
# installed package, otherwise 1.
|
# installed package, otherwise 1.
|
||||||
|
@ -103,8 +156,12 @@ check_installed_pkg() {
|
||||||
pkgn="$($XBPS_UHELPER_CMD getpkgname ${pkg})"
|
pkgn="$($XBPS_UHELPER_CMD getpkgname ${pkg})"
|
||||||
[ -z "$pkgn" ] && return 2
|
[ -z "$pkgn" ] && return 2
|
||||||
|
|
||||||
uhelper=$XBPS_UHELPER_CMD
|
if [ -n "$cross" ]; then
|
||||||
[[ $cross ]] && uhelper=$XBPS_UHELPER_XCMD
|
uhelper="$XBPS_UHELPER_XCMD"
|
||||||
|
else
|
||||||
|
uhelper="$XBPS_UHELPER_CMD"
|
||||||
|
fi
|
||||||
|
|
||||||
iver="$($uhelper version $pkgn)"
|
iver="$($uhelper version $pkgn)"
|
||||||
if [ $? -eq 0 -a -n "$iver" ]; then
|
if [ $? -eq 0 -a -n "$iver" ]; then
|
||||||
$XBPS_CMPVER_CMD "${pkgn}-${iver}" "${pkg}"
|
$XBPS_CMPVER_CMD "${pkgn}-${iver}" "${pkg}"
|
||||||
|
@ -114,20 +171,42 @@ check_installed_pkg() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srcpkg_get_version() {
|
||||||
|
local pkg="$1"
|
||||||
|
# Run this in a sub-shell to avoid polluting our env.
|
||||||
|
(
|
||||||
|
unset XBPS_BINPKG_EXISTS
|
||||||
|
setup_pkg $pkg || exit $?
|
||||||
|
echo "${version}_${revision}"
|
||||||
|
) || msg_error "$pkgver: failed to transform dependency $pkg\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
srcpkg_get_pkgver() {
|
||||||
|
local pkg="$1"
|
||||||
|
# Run this in a sub-shell to avoid polluting our env.
|
||||||
|
(
|
||||||
|
unset XBPS_BINPKG_EXISTS
|
||||||
|
setup_pkg $pkg || exit $?
|
||||||
|
echo "${sourcepkg}-${version}_${revision}"
|
||||||
|
) || msg_error "$pkgver: failed to transform dependency $pkg\n"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build all dependencies required to build and run.
|
# Installs all dependencies required by a package.
|
||||||
#
|
#
|
||||||
install_pkg_deps() {
|
install_pkg_deps() {
|
||||||
local pkg="$1" targetpkg="$2" target="$3" cross="$4" cross_prepare="$5"
|
local pkg="$1" targetpkg="$2" target="$3" cross="$4" cross_prepare="$5"
|
||||||
local _vpkg curpkgdepname
|
local rval _realpkg _vpkg _curpkg curpkgdepname pkgn iver
|
||||||
local i j found style
|
local i j found rundep repo style
|
||||||
|
|
||||||
local -a host_binpkg_deps binpkg_deps
|
local -a host_binpkg_deps check_binpkg_deps binpkg_deps
|
||||||
local -a host_missing_deps missing_deps missing_rdeps
|
local -a host_missing_deps check_missing_deps missing_deps missing_rdeps
|
||||||
|
|
||||||
[ -z "$pkgname" ] && return 2
|
[ -z "$pkgname" ] && return 2
|
||||||
[ -z "$XBPS_CHECK_PKGS" ] && unset checkdepends
|
|
||||||
[[ $build_style ]] && style=" [$build_style]"
|
setup_pkg_depends
|
||||||
|
|
||||||
|
[ -n "$build_style" ] && style=" [$build_style]"
|
||||||
|
|
||||||
for s in $build_helper; do
|
for s in $build_helper; do
|
||||||
style+=" [$s]"
|
style+=" [$s]"
|
||||||
|
@ -139,151 +218,197 @@ install_pkg_deps() {
|
||||||
msg_normal "$pkgver: building${style} ...\n"
|
msg_normal "$pkgver: building${style} ...\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$build_depends" -a -z "$host_build_depends" -a -z "$host_check_depends" -a -z "$run_depends" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Host build dependencies.
|
# Host build dependencies.
|
||||||
#
|
#
|
||||||
if [[ ${hostmakedepends} ]]; then
|
for i in ${host_build_depends}; do
|
||||||
while read -r _depname _deprepover _depver _subpkg _repourl; do
|
_realpkg=$($XBPS_UHELPER_CMD getpkgname "$i" 2>/dev/null)
|
||||||
_vpkg=${_subpkg}-${_depver}
|
check_pkgdep_matched "$i" version
|
||||||
# binary package found in a repo
|
local rval=$?
|
||||||
if [[ ${_depver} == ${_deprepover} ]]; then
|
if [ $rval -eq 0 ]; then
|
||||||
echo " [host] ${_vpkg}: found (${_repourl})"
|
echo " [host] ${i}: installed."
|
||||||
host_binpkg_deps+=("${_vpkg}")
|
continue
|
||||||
|
elif [ $rval -eq 1 ]; then
|
||||||
|
iver=$($XBPS_UHELPER_CMD version ${_realpkg})
|
||||||
|
if [ $? -eq 0 -a -n "$iver" ]; then
|
||||||
|
echo " [host] ${i}: installed $iver (virtualpkg)."
|
||||||
continue
|
continue
|
||||||
fi
|
|
||||||
# binary package not found
|
|
||||||
if [[ $_depname != $_subpkg ]]; then
|
|
||||||
# subpkg, check if it's a subpkg of itself
|
|
||||||
found=0
|
|
||||||
for f in ${subpackages}; do
|
|
||||||
if [[ ${_subpkg} == ${f} ]]; then
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ $found -eq 1 ]]; then
|
|
||||||
echo " [host] ${_vpkg}: not found (subpkg, ignored)"
|
|
||||||
else
|
|
||||||
echo " [host] ${_vpkg}: not found"
|
|
||||||
host_missing_deps+=("$_vpkg")
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo " [host] ${_vpkg}: not found"
|
echo " [host] ${i}: unresolved build dependency!"
|
||||||
host_missing_deps+=("$_vpkg")
|
return 1
|
||||||
fi
|
fi
|
||||||
done < <($XBPS_CHECKVERS_CMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm ${hostmakedepends})
|
else
|
||||||
fi
|
repo=$($XBPS_QUERY_CMD -R -prepository ${i} 2>/dev/null)
|
||||||
|
if [ -n "${repo}" ]; then
|
||||||
|
echo " [host] ${i}: found ($repo)"
|
||||||
|
host_binpkg_deps+=("${i}")
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
echo " [host] ${i}: not found."
|
||||||
|
if [ -z "$cross" ]; then
|
||||||
|
if [ "${_realpkg}" = "$targetpkg" ]; then
|
||||||
|
msg_error "${pkg}: [host] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]\n"
|
||||||
|
elif [ "${_realpkg}" = "$pkg" ]; then
|
||||||
|
msg_error "${pkg}: [host] build loop detected: $pkg <-> ${_realpkg}\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
host_missing_deps+=("${i}")
|
||||||
|
done
|
||||||
|
|
||||||
#
|
#
|
||||||
# Host check dependencies.
|
# Host check dependencies.
|
||||||
#
|
#
|
||||||
if [[ ${checkdepends} ]] && [[ $XBPS_CHECK_PKGS ]]; then
|
for i in ${host_check_depends}; do
|
||||||
while read -r _depname _deprepover _depver _subpkg _repourl; do
|
_realpkg="$($XBPS_UHELPER_CMD getpkgname $i 2>/dev/null)"
|
||||||
_vpkg=${_subpkg}-${_depver}
|
check_pkgdep_matched "$i" version
|
||||||
# binary package found in a repo
|
local rval=$?
|
||||||
if [[ ${_depver} == ${_deprepover} ]]; then
|
if [ $rval -eq 0 ]; then
|
||||||
echo " [check] ${_vpkg}: found (${_repourl})"
|
echo " [check] ${i}: installed."
|
||||||
host_binpkg_deps+=("${_vpkg}")
|
continue
|
||||||
|
elif [ $rval -eq 1 ]; then
|
||||||
|
iver=$($XBPS_UHELPER_CMD version ${_realpkg})
|
||||||
|
if [ $? -eq 0 -a -n "$iver" ]; then
|
||||||
|
echo " [check] ${i}: installed $iver (virtualpkg)."
|
||||||
continue
|
continue
|
||||||
fi
|
|
||||||
# binary package not found
|
|
||||||
if [[ $_depname != $_subpkg ]]; then
|
|
||||||
# subpkg, check if it's a subpkg of itself
|
|
||||||
found=0
|
|
||||||
for f in ${subpackages}; do
|
|
||||||
if [[ ${_subpkg} == ${f} ]]; then
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ $found -eq 1 ]]; then
|
|
||||||
echo " [check] ${_vpkg}: not found (subpkg, ignored)"
|
|
||||||
else
|
|
||||||
echo " [check] ${_vpkg}: not found"
|
|
||||||
host_missing_deps+=("$_vpkg")
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo " [check] ${_vpkg}: not found"
|
echo " [check] ${i}: unresolved check dependency!"
|
||||||
host_missing_deps+=("$_vpkg")
|
return 1
|
||||||
fi
|
fi
|
||||||
done < <($XBPS_CHECKVERS_CMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm ${checkdepends})
|
else
|
||||||
fi
|
repo=$($XBPS_QUERY_CMD -R -prepository ${i} 2>/dev/null)
|
||||||
|
if [ -n "${repo}" ]; then
|
||||||
|
echo " [check] ${i}: found ($repo)"
|
||||||
|
check_binpkg_deps+=("${i}")
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
echo " [check] ${i}: not found."
|
||||||
|
if [ "${_realpkg}" = "$targetpkg" ]; then
|
||||||
|
msg_error "${pkg}: [check] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]!\n"
|
||||||
|
elif [ "${_realpkg}" = "$pkg" ]; then
|
||||||
|
msg_error "${pkg}: [check] build loop detected: $pkg <-> ${_realpkg}\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
check_missing_deps+=("${i}")
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target build dependencies.
|
# Target build dependencies.
|
||||||
#
|
#
|
||||||
if [[ ${makedepends} ]]; then
|
for i in ${build_depends}; do
|
||||||
while read -r _depname _deprepover _depver _subpkg _repourl; do
|
_realpkg="$($XBPS_UHELPER_CMD getpkgname $i 2>/dev/null)"
|
||||||
_vpkg=${_subpkg}-${_depver}
|
# Check if dependency is a subpkg, if it is, ignore it.
|
||||||
# binary package found in a repo
|
unset found
|
||||||
if [[ ${_depver} == ${_deprepover} ]]; then
|
for j in ${subpackages}; do
|
||||||
echo " [target] ${_vpkg}: found (${_repourl})"
|
[ "$j" = "${_realpkg}" ] && found=1 && break
|
||||||
binpkg_deps+=("${_vpkg}")
|
done
|
||||||
|
[ -n "$found" ] && continue
|
||||||
|
check_pkgdep_matched "${i}" version $cross
|
||||||
|
local rval=$?
|
||||||
|
if [ $rval -eq 0 ]; then
|
||||||
|
echo " [target] ${i}: installed."
|
||||||
|
continue
|
||||||
|
elif [ $rval -eq 1 ]; then
|
||||||
|
iver=$($XBPS_UHELPER_XCMD version ${_realpkg})
|
||||||
|
if [ $? -eq 0 -a -n "$iver" ]; then
|
||||||
|
echo " [target] ${i}: installed $iver (virtualpkg)."
|
||||||
continue
|
continue
|
||||||
fi
|
|
||||||
# binary package not found
|
|
||||||
if [[ $_depname != $_subpkg ]]; then
|
|
||||||
# subpkg, check if it's a subpkg of itself
|
|
||||||
found=0
|
|
||||||
for f in ${subpackages}; do
|
|
||||||
if [[ ${_subpkg} == ${f} ]]; then
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ $found -eq 1 ]]; then
|
|
||||||
echo " [target] ${_vpkg}: not found (subpkg, ignored)"
|
|
||||||
else
|
|
||||||
echo " [target] ${_vpkg}: not found"
|
|
||||||
missing_deps+=("$_vpkg")
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo " [target] ${_vpkg}: not found"
|
echo " [target] ${i}: unresolved build dependency!"
|
||||||
missing_deps+=("$_vpkg")
|
return 1
|
||||||
fi
|
fi
|
||||||
done < <($XBPS_CHECKVERS_XCMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm ${makedepends})
|
else
|
||||||
fi
|
repo=$($XBPS_QUERY_XCMD -R -prepository ${i} 2>/dev/null)
|
||||||
|
if [ -n "${repo}" ]; then
|
||||||
|
echo " [target] ${i}: found ($repo)"
|
||||||
|
binpkg_deps+=("${i}")
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
echo " [target] ${i}: not found."
|
||||||
|
if [ "${_realpkg}" = "$targetpkg" ]; then
|
||||||
|
msg_error "${pkg}: [target] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]\n"
|
||||||
|
elif [ "${_realpkg}" = "$pkg" ]; then
|
||||||
|
msg_error "${pkg}: [target] build loop detected: $pkg <-> ${_realpkg}\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
missing_deps+=("${i}")
|
||||||
|
done
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target run time dependencies
|
# Target run time dependencies
|
||||||
#
|
#
|
||||||
if [[ ${depends} ]]; then
|
for i in ${run_depends}; do
|
||||||
_deps=$(setup_pkg_depends "" 1)
|
_realpkg="${i%\?*}"
|
||||||
while read -r _depname _deprepover _depver _subpkg _repourl; do
|
_curpkg="${_realpkg}"
|
||||||
_vpkg=${_subpkg}-${_depver}
|
_vpkg="${i#*\?}"
|
||||||
# binary package found in a repo
|
if [ "${_realpkg}" != "${_vpkg}" ]; then
|
||||||
if [[ ${_depver} == ${_deprepover} ]]; then
|
_realpkg="${_vpkg}"
|
||||||
echo " [runtime] ${_vpkg}: found (${_repourl})"
|
else
|
||||||
continue
|
unset _curpkg
|
||||||
|
fi
|
||||||
|
pkgn=$($XBPS_UHELPER_CMD getpkgdepname "${_realpkg}")
|
||||||
|
if [ -z "$pkgn" ]; then
|
||||||
|
pkgn=$($XBPS_UHELPER_CMD getpkgname "${_realpkg}")
|
||||||
|
if [ -z "$pkgn" ]; then
|
||||||
|
msg_error "$pkgver: invalid runtime dependency: ${_realpkg}\n"
|
||||||
fi
|
fi
|
||||||
# binary package not found
|
fi
|
||||||
if [[ $_depname != $_subpkg ]]; then
|
# Check if dependency is a subpkg, if it is, ignore it.
|
||||||
# subpkg, check if it's a subpkg of itself
|
unset found
|
||||||
found=0
|
for j in ${subpackages}; do
|
||||||
for f in ${subpackages}; do
|
[ "$j" = "${pkgn}" ] && found=1 && break
|
||||||
if [[ ${_subpkg} == ${f} ]]; then
|
done
|
||||||
found=1
|
[ -n "$found" ] && continue
|
||||||
break
|
_props=$($XBPS_QUERY_XCMD -R -ppkgver,repository ${_realpkg} 2>/dev/null)
|
||||||
fi
|
if [ -n "${_props}" ]; then
|
||||||
done
|
set -- ${_props}
|
||||||
if [[ $found -eq 1 ]]; then
|
$XBPS_UHELPER_CMD pkgmatch ${1} "${_realpkg}"
|
||||||
echo " [runtime] ${_vpkg}: not found (subpkg, ignored)"
|
if [ $? -eq 1 ]; then
|
||||||
|
if [ -n "${_curpkg}" ]; then
|
||||||
|
echo " [runtime] ${_curpkg}:${_realpkg} (virtual dependency): found $1 ($2)"
|
||||||
else
|
else
|
||||||
echo " [runtime] ${_vpkg}: not found"
|
echo " [runtime] ${_realpkg}: found $1 ($2)"
|
||||||
missing_rdeps+=("$_vpkg")
|
|
||||||
fi
|
fi
|
||||||
|
shift 2
|
||||||
|
continue
|
||||||
else
|
else
|
||||||
echo " [runtime] ${_vpkg}: not found"
|
if [ -n "${_curpkg}" ]; then
|
||||||
missing_rdeps+=("$_vpkg")
|
echo " [runtime] ${_curpkg}:${_realpkg} (virtual dependency): not found."
|
||||||
|
else
|
||||||
|
echo " [runtime] ${_realpkg}: not found."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done < <($XBPS_CHECKVERS_XCMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm $_deps)
|
shift 2
|
||||||
unset _deps
|
else
|
||||||
fi
|
if [ -n "${_curpkg}" ]; then
|
||||||
|
echo " [runtime] ${_curpkg}:${_realpkg} (virtual dependency): not found."
|
||||||
|
else
|
||||||
|
echo " [runtime] ${_realpkg}: not found."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "${_realpkg}" = "$targetpkg" ]; then
|
||||||
|
msg_error "${pkg}: [run] build loop detected: ${_realpkg} <-> ${targetpkg} [depends on itself]\n"
|
||||||
|
elif [ "${_realpkg}" = "$pkg" ]; then
|
||||||
|
msg_error "${pkg}: [run] build loop detected: $pkg <-> ${_realpkg}\n"
|
||||||
|
fi
|
||||||
|
missing_rdeps+=("${_realpkg}")
|
||||||
|
done
|
||||||
|
|
||||||
if [ -n "$XBPS_BUILD_ONLY_ONE_PKG" ]; then
|
if [ -n "$XBPS_BUILD_ONLY_ONE_PKG" ]; then
|
||||||
for i in ${host_missing_deps[@]}; do
|
for i in ${host_missing_deps[@]}; do
|
||||||
msg_error "dep ${i} not found: -1 passed: instructed not to build\n"
|
msg_error "dep ${i} not found: -1 passed: instructed not to build\n"
|
||||||
done
|
done
|
||||||
|
for i in ${check_missing_deps[@]}; do
|
||||||
|
msg_error "dep ${i} not found: -1 passed: instructed not to build\n"
|
||||||
|
done
|
||||||
for i in ${missing_rdeps[@]}; do
|
for i in ${missing_rdeps[@]}; do
|
||||||
msg_error "dep ${i} not found: -1 passed: instructed not to build\n"
|
msg_error "dep ${i} not found: -1 passed: instructed not to build\n"
|
||||||
done
|
done
|
||||||
|
@ -304,6 +429,18 @@ install_pkg_deps() {
|
||||||
host_binpkg_deps+=("$i")
|
host_binpkg_deps+=("$i")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Missing check dependencies, build from srcpkgs.
|
||||||
|
for i in ${check_missing_deps[@]}; do
|
||||||
|
# packages not found in repos, install from source.
|
||||||
|
(
|
||||||
|
curpkgdepname=$($XBPS_UHELPER_CMD getpkgname "$i" 2>/dev/null)
|
||||||
|
setup_pkg $curpkgdepname
|
||||||
|
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \
|
||||||
|
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target || exit $?
|
||||||
|
) || exit $?
|
||||||
|
check_binpkg_deps+=("$i")
|
||||||
|
done
|
||||||
|
|
||||||
# Missing target dependencies, build from srcpkgs.
|
# Missing target dependencies, build from srcpkgs.
|
||||||
for i in ${missing_deps[@]}; do
|
for i in ${missing_deps[@]}; do
|
||||||
# packages not found in repos, install from source.
|
# packages not found in repos, install from source.
|
||||||
|
@ -334,25 +471,22 @@ install_pkg_deps() {
|
||||||
) || exit $?
|
) || exit $?
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${host_binpkg_deps} ]]; then
|
if [ "$pkg" != "$targetpkg" ]; then
|
||||||
if [ -z "$XBPS_QUIET" ]; then
|
msg_normal "$pkg: building${style} (dependency of $targetpkg) ...\n"
|
||||||
# normal messages in bold
|
|
||||||
[[ $NOCOLORS ]] || printf "\033[1m"
|
|
||||||
echo "=> $pkgver: installing host dependencies: ${host_binpkg_deps[@]} ..."
|
|
||||||
[[ $NOCOLORS ]] || printf "\033[m"
|
|
||||||
fi
|
|
||||||
install_pkg_from_repos "" "${host_binpkg_deps[@]}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${binpkg_deps} ]]; then
|
for i in ${host_binpkg_deps[@]}; do
|
||||||
if [ -z "$XBPS_QUIET" ]; then
|
msg_normal "$pkgver: installing host dependency '$i' ...\n"
|
||||||
# normal messages in bold
|
install_pkg_from_repos "${i}"
|
||||||
[[ $NOCOLORS ]] || printf "\033[1m"
|
done
|
||||||
echo "=> $pkgver: installing target dependencies: ${binpkg_deps[@]} ..."
|
|
||||||
[[ $NOCOLORS ]] || printf "\033[m"
|
|
||||||
fi
|
|
||||||
install_pkg_from_repos "$cross" "${binpkg_deps[@]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
for i in ${check_binpkg_deps[@]}; do
|
||||||
|
msg_normal "$pkgver: installing check dependency '$i' ...\n"
|
||||||
|
install_pkg_from_repos "${i}"
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in ${binpkg_deps[@]}; do
|
||||||
|
msg_normal "$pkgver: installing target dependency '$i' ...\n"
|
||||||
|
install_pkg_from_repos "$i" $cross
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,36 @@
|
||||||
# vim: set ts=4 sw=4 et:
|
# vim: set ts=4 sw=4 et:
|
||||||
|
|
||||||
|
bulk_getlink() {
|
||||||
|
local p="${1##*/}"
|
||||||
|
local target="$(readlink $XBPS_SRCPKGDIR/$p)"
|
||||||
|
|
||||||
|
if [ $? -eq 0 -a -n "$target" ]; then
|
||||||
|
p=$target
|
||||||
|
fi
|
||||||
|
echo $p
|
||||||
|
}
|
||||||
|
|
||||||
bulk_sortdeps() {
|
bulk_sortdeps() {
|
||||||
local _pkgs _pkg pkgs pkg found f x tmpf
|
local _pkgs _pkg pkgs pkg found f x tmpf
|
||||||
|
|
||||||
pkgs="$@"
|
_pkgs="$@"
|
||||||
tmpf=$(mktemp) || exit 1
|
# Iterate over the list and make sure that only real pkgs are
|
||||||
|
# added to our pkglist.
|
||||||
|
for pkg in ${_pkgs}; do
|
||||||
|
found=0
|
||||||
|
f=$(bulk_getlink $pkg)
|
||||||
|
for x in ${pkgs}; do
|
||||||
|
if [ "$x" = "${f}" ]; then
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $found -eq 0 ]; then
|
||||||
|
pkgs+="${f} "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
tmpf=$(mktemp) || exit 1
|
||||||
# Now make the real dependency graph of all pkgs to build.
|
# Now make the real dependency graph of all pkgs to build.
|
||||||
# Perform a topological sort of all pkgs but only with build dependencies
|
# Perform a topological sort of all pkgs but only with build dependencies
|
||||||
# that are found in previous step.
|
# that are found in previous step.
|
||||||
|
@ -13,11 +38,16 @@ bulk_sortdeps() {
|
||||||
_pkgs="$(./xbps-src show-build-deps $pkg 2>/dev/null)"
|
_pkgs="$(./xbps-src show-build-deps $pkg 2>/dev/null)"
|
||||||
found=0
|
found=0
|
||||||
for x in ${_pkgs}; do
|
for x in ${_pkgs}; do
|
||||||
|
_pkg=$(bulk_getlink $x)
|
||||||
for f in ${pkgs}; do
|
for f in ${pkgs}; do
|
||||||
[[ $f == $x ]] && found=1 && echo "${pkg} ${f}" >> $tmpf
|
if [ "${f}" != "${_pkg}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
found=1
|
||||||
|
echo "${pkg} ${f}" >> $tmpf
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
[[ $found -eq 0 ]] && echo "${pkg} ${pkg}" >> $tmpf
|
[ $found -eq 0 ] && echo "${pkg} ${pkg}" >> $tmpf
|
||||||
done
|
done
|
||||||
tsort $tmpf|tac
|
tsort $tmpf|tac
|
||||||
rm -f $tmpf
|
rm -f $tmpf
|
||||||
|
@ -33,7 +63,7 @@ bulk_build() {
|
||||||
msg_error "xbps-src: cannot find xbps-checkvers(8) command!\n"
|
msg_error "xbps-src: cannot find xbps-checkvers(8) command!\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bulk_sortdeps "$(xbps-checkvers -f '%n' ${1} --distdir=$XBPS_DISTDIR)"
|
bulk_sortdeps "$(xbps-checkvers ${1} --distdir=$XBPS_DISTDIR | awk '{print $2}')"
|
||||||
}
|
}
|
||||||
|
|
||||||
bulk_update() {
|
bulk_update() {
|
||||||
|
|
|
@ -169,7 +169,7 @@ chroot_handler() {
|
||||||
[ -z "$action" -a -z "$pkg" ] && return 1
|
[ -z "$action" -a -z "$pkg" ] && return 1
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
fetch|extract|patch|configure|build|check|install|pkg|bootstrap-update|chroot)
|
fetch|extract|patch|build|check|configure|install|install-destdir|pkg|build-pkg|bootstrap-update|chroot)
|
||||||
chroot_prepare || return $?
|
chroot_prepare || return $?
|
||||||
chroot_init || return $?
|
chroot_init || return $?
|
||||||
chroot_sync_repos || return $?
|
chroot_sync_repos || return $?
|
||||||
|
@ -181,13 +181,30 @@ chroot_handler() {
|
||||||
$XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" /bin/xbps-shell
|
$XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" /bin/xbps-shell
|
||||||
rv=$?
|
rv=$?
|
||||||
else
|
else
|
||||||
|
[ -n "$XBPS_CROSS_BUILD" ] && arg="$arg -a $XBPS_CROSS_BUILD"
|
||||||
|
[ -n "$XBPS_KEEP_ALL" ] && arg="$arg -C"
|
||||||
|
[ -n "$NOCOLORS" ] && arg="$arg -L"
|
||||||
|
[ -n "$XBPS_BUILD_FORCEMODE" ] && arg="$arg -f"
|
||||||
|
[ -n "$XBPS_MAKEJOBS" ] && arg="$arg -j$XBPS_MAKEJOBS"
|
||||||
|
[ -n "$XBPS_DEBUG_PKGS" ] && arg="$arg -g"
|
||||||
|
[ -n "$XBPS_CHECK_PKGS" ] && arg="$arg -Q"
|
||||||
|
[ -n "$XBPS_BUILD_ONLY_ONE_PKG" ] && arg="$arg -1"
|
||||||
|
[ -n "$XBPS_QUIET" ] && arg="$arg -q"
|
||||||
|
[ -n "$XBPS_SKIP_DEPS" ] && arg="$arg -I"
|
||||||
|
[ -n "$XBPS_ALT_REPOSITORY" ] && arg="$arg -r $XBPS_ALT_REPOSITORY"
|
||||||
|
[ -n "$XBPS_USE_GIT_REVS" ] && arg="$arg -G"
|
||||||
|
[ -n "$XBPS_PKG_OPTIONS" ] && arg="$arg -o $XBPS_PKG_OPTIONS"
|
||||||
|
[ -n "$XBPS_TEMP_MASTERDIR" ] && arg="$arg -t -C"
|
||||||
|
[ -n "$XBPS_BINPKG_EXISTS" ] && arg="$arg -E"
|
||||||
|
|
||||||
|
action="$arg $action"
|
||||||
env -i -- PATH="/usr/bin" SHELL=/bin/sh \
|
env -i -- PATH="/usr/bin" SHELL=/bin/sh \
|
||||||
HOME=/tmp IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
|
HOME=/tmp IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
|
||||||
SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||||
XBPS_ALLOW_CHROOT_BREAKOUT="$XBPS_ALLOW_CHROOT_BREAKOUT" \
|
XBPS_ALLOW_CHROOT_BREAKOUT="$XBPS_ALLOW_CHROOT_BREAKOUT" \
|
||||||
$XBPS_COMMONDIR/chroot-style/${XBPS_CHROOT_CMD:=uunshare}.sh \
|
$XBPS_COMMONDIR/chroot-style/${XBPS_CHROOT_CMD:=uunshare}.sh \
|
||||||
$XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" \
|
$XBPS_MASTERDIR $XBPS_DISTDIR "$XBPS_HOSTDIR" "$XBPS_CHROOT_CMD_ARGS" \
|
||||||
/void-packages/xbps-src $XBPS_OPTIONS $action $pkg
|
/void-packages/xbps-src $action $pkg
|
||||||
rv=$?
|
rv=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ setup_pkg() {
|
||||||
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_REMOVE_CMD -r $XBPS_CROSS_BASE"
|
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_REMOVE_CMD -r $XBPS_CROSS_BASE"
|
||||||
XBPS_RINDEX_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_RINDEX_CMD"
|
XBPS_RINDEX_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_RINDEX_CMD"
|
||||||
XBPS_UHELPER_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-uhelper -r $XBPS_CROSS_BASE"
|
XBPS_UHELPER_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-uhelper -r $XBPS_CROSS_BASE"
|
||||||
XBPS_CHECKVERS_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-checkvers --repository=$XBPS_REPOSITORY"
|
|
||||||
else
|
else
|
||||||
export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE}
|
export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE}
|
||||||
unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS XBPS_CROSS_FFLAGS
|
unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS XBPS_CROSS_FFLAGS
|
||||||
|
@ -307,7 +307,7 @@ setup_pkg() {
|
||||||
XBPS_REMOVE_XCMD="$XBPS_REMOVE_CMD"
|
XBPS_REMOVE_XCMD="$XBPS_REMOVE_CMD"
|
||||||
XBPS_RINDEX_XCMD="$XBPS_RINDEX_CMD"
|
XBPS_RINDEX_XCMD="$XBPS_RINDEX_CMD"
|
||||||
XBPS_UHELPER_XCMD="$XBPS_UHELPER_CMD"
|
XBPS_UHELPER_XCMD="$XBPS_UHELPER_CMD"
|
||||||
XBPS_CHECKVERS_XCMD="$XBPS_CHECKVERS_CMD"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export XBPS_INSTALL_XCMD XBPS_QUERY_XCMD XBPS_RECONFIGURE_XCMD \
|
export XBPS_INSTALL_XCMD XBPS_QUERY_XCMD XBPS_RECONFIGURE_XCMD \
|
||||||
|
@ -402,7 +402,7 @@ setup_pkg() {
|
||||||
arch="$XBPS_TARGET_MACHINE"
|
arch="$XBPS_TARGET_MACHINE"
|
||||||
fi
|
fi
|
||||||
if [ -n "$XBPS_BINPKG_EXISTS" ]; then
|
if [ -n "$XBPS_BINPKG_EXISTS" ]; then
|
||||||
if [ "$($XBPS_QUERY_XCMD -i -R -ppkgver $pkgver 2>/dev/null)" = "$pkgver" ]; then
|
if [ "$($XBPS_QUERY_XCMD -R -ppkgver $pkgver 2>/dev/null)" = "$pkgver" ]; then
|
||||||
exit_and_cleanup
|
exit_and_cleanup
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -556,17 +556,17 @@ setup_pkg() {
|
||||||
wrksrc="$XBPS_BUILDDIR/$wrksrc"
|
wrksrc="$XBPS_BUILDDIR/$wrksrc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$cross" -a "$nocross" -a "$show_problems" != "ignore-problems" ]; then
|
if [ "$cross" -a "$nocross" -a "z$show_problems" != "zignore-problems" ]; then
|
||||||
msg_red "$pkgver: cannot be cross compiled, exiting...\n"
|
msg_red "$pkgver: cannot be cross compiled, exiting...\n"
|
||||||
msg_red "$pkgver: $nocross\n"
|
msg_red "$pkgver: $nocross\n"
|
||||||
exit 2
|
exit 2
|
||||||
elif [ "$broken" -a "$show_problems" != "ignore-problems" ]; then
|
elif [ "$broken" -a "z$show_problems" != "zignore-problems" ]; then
|
||||||
msg_red "$pkgver: cannot be built, it's currently broken; see the build log:\n"
|
msg_red "$pkgver: cannot be built, it's currently broken; see the build log:\n"
|
||||||
msg_red "$pkgver: $broken\n"
|
msg_red "$pkgver: $broken\n"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$restricted" -a -z "$XBPS_ALLOW_RESTRICTED" -a "$show_problems" != "ignore-problems" ]; then
|
if [ -n "$restricted" -a -z "$XBPS_ALLOW_RESTRICTED" -a "z$show_problems" != "zignore-problems" ]; then
|
||||||
msg_red "$pkgver: does not allow redistribution of sources/binaries (restricted license).\n"
|
msg_red "$pkgver: does not allow redistribution of sources/binaries (restricted license).\n"
|
||||||
msg_red "If you really need this software, run 'echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf'\n"
|
msg_red "If you really need this software, run 'echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf'\n"
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -575,7 +575,9 @@ setup_pkg() {
|
||||||
export XBPS_STATEDIR="${XBPS_BUILDDIR}/.xbps-${sourcepkg}"
|
export XBPS_STATEDIR="${XBPS_BUILDDIR}/.xbps-${sourcepkg}"
|
||||||
export XBPS_WRAPPERDIR="${XBPS_STATEDIR}/wrappers"
|
export XBPS_WRAPPERDIR="${XBPS_STATEDIR}/wrappers"
|
||||||
|
|
||||||
mkdir -p $XBPS_STATEDIR $XBPS_WRAPPERDIR
|
if [ -n "$bootstrap" -a -z "$CHROOT_READY" -o -n "$IN_CHROOT" ]; then
|
||||||
|
mkdir -p $XBPS_WRAPPERDIR
|
||||||
|
fi
|
||||||
|
|
||||||
source_file $XBPS_COMMONDIR/environment/build-style/${build_style}.sh
|
source_file $XBPS_COMMONDIR/environment/build-style/${build_style}.sh
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,11 @@ remove_pkg_cross_deps() {
|
||||||
|
|
||||||
prepare_cross_sysroot() {
|
prepare_cross_sysroot() {
|
||||||
local cross="$1"
|
local cross="$1"
|
||||||
local statefile="$XBPS_MASTERDIR/.xbps-${cross}-done"
|
|
||||||
|
|
||||||
[ -z "$cross" -o "$cross" = "" -o -f $statefile ] && return 0
|
[ -z "$cross" -o "$cross" = "" ] && return 0
|
||||||
|
|
||||||
# Check for cross-vpkg-dummy available for the target arch, otherwise build it.
|
# Check for cross-vpkg-dummy available for the target arch, otherwise build it.
|
||||||
pkg_available 'cross-vpkg-dummy>=0.31_1' $cross
|
pkg_available 'cross-vpkg-dummy>=0.30_1' $cross
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
$XBPS_LIBEXECDIR/build.sh cross-vpkg-dummy cross-vpkg-dummy pkg $cross init || return $?
|
$XBPS_LIBEXECDIR/build.sh cross-vpkg-dummy cross-vpkg-dummy pkg $cross init || return $?
|
||||||
fi
|
fi
|
||||||
|
@ -41,7 +40,7 @@ prepare_cross_sysroot() {
|
||||||
errlog=$(mktemp) || exit 1
|
errlog=$(mktemp) || exit 1
|
||||||
$XBPS_INSTALL_XCMD -Syfd cross-vpkg-dummy &>$errlog
|
$XBPS_INSTALL_XCMD -Syfd cross-vpkg-dummy &>$errlog
|
||||||
rval=$?
|
rval=$?
|
||||||
if [ $rval -ne 0 ]; then
|
if [ $rval -ne 0 -a $rval -ne 17 ]; then
|
||||||
msg_red "failed to install cross-vpkg-dummy (error $rval)\n"
|
msg_red "failed to install cross-vpkg-dummy (error $rval)\n"
|
||||||
cat $errlog
|
cat $errlog
|
||||||
rm -f $errlog
|
rm -f $errlog
|
||||||
|
@ -49,15 +48,11 @@ prepare_cross_sysroot() {
|
||||||
fi
|
fi
|
||||||
rm -f $errlog
|
rm -f $errlog
|
||||||
# Create top level symlinks in sysroot.
|
# Create top level symlinks in sysroot.
|
||||||
XBPS_ARCH=$XBPS_TARGET_MACHINE xbps-reconfigure -r $XBPS_CROSS_BASE -f base-files &>/dev/null
|
XBPS_ARCH=$XBPS_TARGET_MACHINE xbps-reconfigure -r $XBPS_CROSS_BASE -f base-directories base-files &>/dev/null
|
||||||
# Create a sysroot/include and sysroot/lib symlink just in case.
|
# Create a sysroot/include and sysroot/lib symlink just in case.
|
||||||
ln -s usr/include ${XBPS_CROSS_BASE}/include
|
ln -s usr/include ${XBPS_CROSS_BASE}/include
|
||||||
ln -s usr/lib ${XBPS_CROSS_BASE}/lib
|
ln -s usr/lib ${XBPS_CROSS_BASE}/lib
|
||||||
|
|
||||||
install_cross_pkg $cross || return 1
|
|
||||||
|
|
||||||
touch -f $statefile
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,6 @@ remove_pkg_autodeps() {
|
||||||
$XBPS_RECONFIGURE_CMD -a >> $tmplogf 2>&1
|
$XBPS_RECONFIGURE_CMD -a >> $tmplogf 2>&1
|
||||||
echo yes | $XBPS_REMOVE_CMD -Ryod >> $tmplogf 2>&1
|
echo yes | $XBPS_REMOVE_CMD -Ryod >> $tmplogf 2>&1
|
||||||
rval=$?
|
rval=$?
|
||||||
if [ $rval -eq 0 ]; then
|
|
||||||
echo yes | $XBPS_REMOVE_CMD -Ryod >> $tmplogf 2>&1
|
|
||||||
rval=$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $rval -ne 0 ]; then
|
if [ $rval -ne 0 ]; then
|
||||||
msg_red "${pkgver:-xbps-src}: failed to remove autodeps: (returned $rval)\n"
|
msg_red "${pkgver:-xbps-src}: failed to remove autodeps: (returned $rval)\n"
|
||||||
|
|
|
@ -61,22 +61,44 @@ show_avail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
show_pkg_build_depends() {
|
show_pkg_build_depends() {
|
||||||
local f x _pkgname _srcpkg found result
|
local f x _pkgname _srcpkg _dep found result
|
||||||
local _deps="$1"
|
local _deps="$1"
|
||||||
|
|
||||||
result=$(mktemp) || exit 1
|
result=$(mktemp) || exit 1
|
||||||
|
|
||||||
# build time deps
|
# build time deps
|
||||||
for f in ${_deps}; do
|
for f in ${_deps}; do
|
||||||
|
# ignore virtual deps
|
||||||
|
local _rpkg="${f%\?*}"
|
||||||
|
local _vpkg="${f#*\?}"
|
||||||
|
|
||||||
# ignore virtual dependencies
|
# ignore virtual dependencies
|
||||||
[[ ${f%\?*} != ${f#*\?} ]] && f=${f#*\?}
|
if [ "${_rpkg}" != "${_vpkg}" ]; then
|
||||||
|
f="${_vpkg}"
|
||||||
|
fi
|
||||||
unset found
|
unset found
|
||||||
# check for subpkgs
|
# check for subpkgs
|
||||||
for x in ${subpackages}; do
|
for x in ${subpackages}; do
|
||||||
[[ $f == $x ]] && found=1 && break
|
_pkgname="$($XBPS_UHELPER_CMD getpkgdepname $f 2>/dev/null)"
|
||||||
|
if [ -z "${_pkgname}" ]; then
|
||||||
|
_pkgname="$($XBPS_UHELPER_CMD getpkgname $f 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
if [ "${_pkgname}" = "$x" ]; then
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
[[ $found ]] && continue
|
if [ -n "$found" ]; then
|
||||||
_pkgname=${f/-32bit}
|
continue
|
||||||
|
fi
|
||||||
|
_pkgname="$($XBPS_UHELPER_CMD getpkgdepname $f 2>/dev/null)"
|
||||||
|
if [ -z "${_pkgname}" ]; then
|
||||||
|
_pkgname="$($XBPS_UHELPER_CMD getpkgname $f 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
if [ -z "${_pkgname}" ]; then
|
||||||
|
_pkgname="$f"
|
||||||
|
fi
|
||||||
|
_pkgname=${_pkgname/-32bit}
|
||||||
_srcpkg=$(readlink -f ${XBPS_SRCPKGDIR}/${_pkgname})
|
_srcpkg=$(readlink -f ${XBPS_SRCPKGDIR}/${_pkgname})
|
||||||
_srcpkg=${_srcpkg##*/}
|
_srcpkg=${_srcpkg##*/}
|
||||||
echo "${_srcpkg}" >> $result
|
echo "${_srcpkg}" >> $result
|
||||||
|
@ -86,15 +108,18 @@ show_pkg_build_depends() {
|
||||||
}
|
}
|
||||||
|
|
||||||
show_pkg_build_deps() {
|
show_pkg_build_deps() {
|
||||||
show_pkg_build_depends "${hostmakedepends} ${makedepends} $(setup_pkg_depends '' 1)"
|
setup_pkg_depends
|
||||||
|
show_pkg_build_depends "${host_build_depends} ${build_depends} ${run_depends}"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_pkg_hostmakedepends() {
|
show_pkg_hostmakedepends() {
|
||||||
show_pkg_build_depends "${hostmakedepends}"
|
setup_pkg_depends
|
||||||
|
show_pkg_build_depends "${host_build_depends}"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_pkg_makedepends() {
|
show_pkg_makedepends() {
|
||||||
show_pkg_build_depends "${makedepends}"
|
setup_pkg_depends
|
||||||
|
show_pkg_build_depends "${build_depends}"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_pkg_build_options() {
|
show_pkg_build_options() {
|
||||||
|
|
326
xbps-src
326
xbps-src
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# vim: set ts=4 sw=4 et:
|
# vim: set ts=4 sw=4 et:
|
||||||
|
|
||||||
|
readonly PROGNAME="${0##*/}"
|
||||||
|
|
||||||
print_cross_targets() {
|
print_cross_targets() {
|
||||||
local f
|
local f
|
||||||
for f in common/cross-profiles/*.sh; do
|
for f in common/cross-profiles/*.sh; do
|
||||||
|
@ -208,7 +210,7 @@ _EOF
|
||||||
check_reqhost_utils() {
|
check_reqhost_utils() {
|
||||||
local broken
|
local broken
|
||||||
|
|
||||||
[ "$IN_CHROOT" ] && return 0
|
[ -n "$IN_CHROOT" ] && return 0
|
||||||
|
|
||||||
for f in ${REQHOST_UTILS}; do
|
for f in ${REQHOST_UTILS}; do
|
||||||
if ! command -v ${f} &>/dev/null; then
|
if ! command -v ${f} &>/dev/null; then
|
||||||
|
@ -216,7 +218,7 @@ check_reqhost_utils() {
|
||||||
broken=1
|
broken=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ "$broken" ] && exit 1
|
[ -n "$broken" ] && exit 1
|
||||||
[ -z "$1" ] && return 0
|
[ -z "$1" ] && return 0
|
||||||
|
|
||||||
for f in ${REQHOST_UTILS_BOOTSTRAP}; do
|
for f in ${REQHOST_UTILS_BOOTSTRAP}; do
|
||||||
|
@ -225,7 +227,24 @@ check_reqhost_utils() {
|
||||||
broken=1
|
broken=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ "$broken" ] && exit 1
|
[ -n "$broken" ] && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_config_vars() {
|
||||||
|
if [ -s "$XBPS_CONFIG_FILE" ]; then
|
||||||
|
. $XBPS_CONFIG_FILE &>/dev/null
|
||||||
|
fi
|
||||||
|
if [ -z "$XBPS_MASTERDIR" ]; then
|
||||||
|
export XBPS_MASTERDIR="${XBPS_DISTDIR}/masterdir"
|
||||||
|
fi
|
||||||
|
if [ -z "$XBPS_HOSTDIR" ]; then
|
||||||
|
export XBPS_HOSTDIR="${XBPS_DISTDIR}/hostdir"
|
||||||
|
[ ! -d $XBPS_HOSTDIR ] && mkdir -p $XBPS_HOSTDIR
|
||||||
|
fi
|
||||||
|
if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
|
||||||
|
echo "ERROR: not enough perms for masterdir $XBPS_MASTERDIR."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_build_requirements() {
|
check_build_requirements() {
|
||||||
|
@ -245,42 +264,20 @@ check_build_requirements() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
chroot_check() {
|
|
||||||
if [ -f $XBPS_MASTERDIR/.xbps_chroot_init -o "$XBPS_CHROOT_CMD" = "ethereal" ]; then
|
|
||||||
export CHROOT_READY=1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_native_arch() {
|
|
||||||
if [ "$CHROOT_READY" ]; then
|
|
||||||
if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
|
||||||
export XBPS_ARCH=$(<$XBPS_MASTERDIR/.xbps_chroot_init)
|
|
||||||
else
|
|
||||||
export XBPS_ARCH=$(xbps-uhelper arch)
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
LDD=$(ldd --version 2>&1|head -1)
|
|
||||||
if [[ $LDD == *musl* ]]; then
|
|
||||||
export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
|
|
||||||
else
|
|
||||||
# XBPS_ARCH == $(uname -m)
|
|
||||||
export XBPS_ARCH=$(uname -m)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_bbootstrap() {
|
install_bbootstrap() {
|
||||||
[ "$CHROOT_READY" ] && return
|
[ -n "$CHROOT_READY" ] && return
|
||||||
if [ "$1" = "bootstrap" ]; then
|
if [ "$1" = "bootstrap" ]; then
|
||||||
unset XBPS_TARGET_PKG XBPS_INSTALL_ARGS
|
unset XBPS_TARGET_PKG XBPS_INSTALL_ARGS
|
||||||
else
|
else
|
||||||
XBPS_TARGET_PKG="$1"
|
XBPS_TARGET_PKG="$1"
|
||||||
fi
|
fi
|
||||||
[ "$XBPS_SKIP_REMOTEREPOS" ] && unset XBPS_INSTALL_ARGS
|
if [ -n "$XBPS_SKIP_REMOTEREPOS" ]; then
|
||||||
|
unset XBPS_INSTALL_ARGS
|
||||||
|
fi
|
||||||
# binary bootstrap
|
# binary bootstrap
|
||||||
msg_normal "Installing bootstrap from binary package repositories...\n"
|
msg_normal "Installing bootstrap from binary package repositories...\n"
|
||||||
# XBPS_TARGET_PKG == arch
|
# XBPS_TARGET_PKG == arch
|
||||||
if [ "$XBPS_TARGET_PKG" ]; then
|
if [ -n "$XBPS_TARGET_PKG" ]; then
|
||||||
_bootstrap_arch="env XBPS_TARGET_ARCH=$XBPS_TARGET_PKG"
|
_bootstrap_arch="env XBPS_TARGET_ARCH=$XBPS_TARGET_PKG"
|
||||||
if [ "${XBPS_TARGET_PKG}" != "${XBPS_TARGET_PKG#*-}" ]; then
|
if [ "${XBPS_TARGET_PKG}" != "${XBPS_TARGET_PKG#*-}" ]; then
|
||||||
_subarch="-${XBPS_TARGET_PKG#*-}"
|
_subarch="-${XBPS_TARGET_PKG#*-}"
|
||||||
|
@ -311,15 +308,17 @@ reconfigure_bootstrap_pkgs() {
|
||||||
# Reconfigure ca-certificates.
|
# Reconfigure ca-certificates.
|
||||||
msg_normal "Reconfiguring bootstrap packages...\n"
|
msg_normal "Reconfiguring bootstrap packages...\n"
|
||||||
for f in ${pkgs}; do
|
for f in ${pkgs}; do
|
||||||
if $XBPS_QUERY_CMD $f &>/dev/null; then
|
if xbps-query $f &>/dev/null; then
|
||||||
$XBPS_RECONFIGURE_CMD -f $f
|
xbps-reconfigure -f $f
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
touch -f $statefile
|
touch -f $statefile
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap_update() {
|
bootstrap_update() {
|
||||||
[ -z "$CHROOT_READY" ] && return
|
if [ -z "$CHROOT_READY" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
remove_pkg_autodeps
|
remove_pkg_autodeps
|
||||||
msg_normal "xbps-src: cleaning up masterdir...\n"
|
msg_normal "xbps-src: cleaning up masterdir...\n"
|
||||||
rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
|
rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
|
||||||
|
@ -348,7 +347,7 @@ masterdir_zap() {
|
||||||
|
|
||||||
exit_func() {
|
exit_func() {
|
||||||
wait
|
wait
|
||||||
if [ "$sourcepkg" ]; then
|
if [ -n "$sourcepkg" ]; then
|
||||||
remove_pkg $XBPS_CROSS_BUILD
|
remove_pkg $XBPS_CROSS_BUILD
|
||||||
fi
|
fi
|
||||||
if [ -z "$IN_CHROOT" ]; then
|
if [ -z "$IN_CHROOT" ]; then
|
||||||
|
@ -391,17 +390,14 @@ setup_distfiles_mirror() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly XBPS_VERSION_REQ="0.55"
|
||||||
|
readonly XBPS_VERSION=$(xbps-uhelper -V|awk '{print $2}')
|
||||||
|
readonly XBPS_SRC_VERSION="113"
|
||||||
|
export XBPS_MACHINE=$(xbps-uhelper arch)
|
||||||
|
|
||||||
#
|
#
|
||||||
# main()
|
# main()
|
||||||
#
|
#
|
||||||
readonly PROGNAME="${0##*/}"
|
|
||||||
readonly XBPS_VERSION_REQ="0.55"
|
|
||||||
XBPS_VERSION=$(xbps-uhelper -V)
|
|
||||||
XBPS_VERSION=${XBPS_VERSION%%API*}
|
|
||||||
XBPS_VERSION=${XBPS_VERSION##*:}
|
|
||||||
readonly XBPS_SRC_VERSION="113"
|
|
||||||
export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
|
|
||||||
|
|
||||||
XBPS_OPTIONS=
|
XBPS_OPTIONS=
|
||||||
XBPS_OPTSTRING="1a:CEfgGhH:iIj:Lm:No:qQr:tV"
|
XBPS_OPTSTRING="1a:CEfgGhH:iIj:Lm:No:qQr:tV"
|
||||||
|
|
||||||
|
@ -411,26 +407,26 @@ eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
|
||||||
while getopts "$XBPS_OPTSTRING" opt; do
|
while getopts "$XBPS_OPTSTRING" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
1) export XBPS_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
|
1) export XBPS_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
|
||||||
a) export XBPS_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
|
a) readonly XBPS_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
|
||||||
C) export XBPS_KEEP_ALL=1; XBPS_OPTIONS+=" -C";;
|
C) readonly XBPS_KEEP_ALL=1; XBPS_OPTIONS+=" -C";;
|
||||||
E) export XBPS_BINPKG_EXISTS=1; XBPS_OPTIONS+=" -E";;
|
E) export XBPS_BINPKG_EXISTS=1; XBPS_OPTIONS+=" -E";;
|
||||||
f) export XBPS_BUILD_FORCEMODE=1; XBPS_OPTIONS+=" -f";;
|
f) readonly XBPS_BUILD_FORCEMODE=1; XBPS_OPTIONS+=" -f";;
|
||||||
G) export XBPS_USE_GIT_REVS=1; XBPS_OPTIONS+=" -G";;
|
G) readonly XBPS_USE_GIT_REVS=1; XBPS_OPTIONS+=" -G";;
|
||||||
g) export XBPS_DEBUG_PKGS=1; XBPS_OPTIONS+=" -g";;
|
g) readonly XBPS_DEBUG_PKGS=1; XBPS_OPTIONS+=" -g";;
|
||||||
H) export XBPS_HOSTDIR="$(readlink -f $OPTARG 2>/dev/null)"; XBPS_OPTIONS+=" -H $XBPS_HOSTDIR";;
|
H) readonly XBPS_HOSTDIR="$(readlink -f $OPTARG 2>/dev/null)"; XBPS_OPTIONS+=" -H $XBPS_HOSTDIR";;
|
||||||
h) usage && exit 0;;
|
h) usage && exit 0;;
|
||||||
i) export XBPS_INFORMATIVE_RUN=1; XBPS_OPTIONS+=" -i";;
|
i) export XBPS_INFORMATIVE_RUN=1; XBPS_OPTIONS+=" -i";;
|
||||||
I) export XBPS_SKIP_DEPS=1; XBPS_OPTIONS+=" -I";;
|
I) readonly XBPS_SKIP_DEPS=1; XBPS_OPTIONS+=" -I";;
|
||||||
j) export XBPS_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
|
j) export XBPS_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
|
||||||
L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
|
L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
|
||||||
m) export XBPS_MASTERDIR=$(readlink -f $OPTARG 2>/dev/null); XBPS_OPTIONS+=" -m $XBPS_MASTERDIR";;
|
m) readonly XBPS_MASTERDIR=$(readlink -f $OPTARG 2>/dev/null); XBPS_OPTIONS+=" -m $XBPS_MASTERDIR";;
|
||||||
N) export XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
|
N) readonly XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
|
||||||
o) export XBPS_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
|
o) readonly XBPS_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
|
||||||
q) export XBPS_QUIET=1; XBPS_OPTIONS+=" -q";;
|
q) export XBPS_QUIET=1; XBPS_OPTIONS+=" -q";;
|
||||||
Q) export XBPS_CHECK_PKGS=1; XBPS_OPTIONS+=" -Q";;
|
Q) export XBPS_CHECK_PKGS=1; XBPS_OPTIONS+=" -Q";;
|
||||||
r) export XBPS_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
|
r) readonly XBPS_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
|
||||||
t) export XBPS_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";;
|
t) export XBPS_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";;
|
||||||
V) echo "xbps-src-$XBPS_SRC_VERSION $(xbps-uhelper -V)" && exit 0;;
|
V) echo $XBPS_SRC_VERSION && exit 0;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -441,11 +437,10 @@ shift $(($OPTIND - 1))
|
||||||
# Check if stdout is a tty; if false disable colors.
|
# Check if stdout is a tty; if false disable colors.
|
||||||
test -t 1 || export NOCOLORS=1
|
test -t 1 || export NOCOLORS=1
|
||||||
# http://no-color.org
|
# http://no-color.org
|
||||||
if [ "${NO_COLOR+x}" ]; then
|
if [ -n "${NO_COLOR+x}" ]; then
|
||||||
export NOCOLORS=1
|
export NOCOLORS=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# sane umask
|
|
||||||
umask 022
|
umask 022
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -461,13 +456,22 @@ readonly REQHOST_UTILS="xbps-install xbps-query xbps-rindex xbps-uhelper \
|
||||||
|
|
||||||
check_reqhost_utils
|
check_reqhost_utils
|
||||||
|
|
||||||
#
|
# Try using chroot-git then git from the host system
|
||||||
# Set XBPS_CONFIG_FILE, XBPS_DISTDIR, XBPS_MASTERDIR
|
if command -v chroot-git &>/dev/null; then
|
||||||
# and XBPS_HOSTDIR.
|
XBPS_GIT_CMD=$(command -v chroot-git)
|
||||||
#
|
elif command -v git &>/dev/null; then
|
||||||
if [ "$IN_CHROOT" ]; then
|
XBPS_GIT_CMD=$(command -v git)
|
||||||
|
else
|
||||||
|
echo "neither chroot-git or git are available in your system!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
readonly XBPS_GIT_CMD
|
||||||
|
|
||||||
|
if [ -n "$IN_CHROOT" ]; then
|
||||||
readonly XBPS_CONFIG_FILE=/etc/xbps/xbps-src.conf
|
readonly XBPS_CONFIG_FILE=/etc/xbps/xbps-src.conf
|
||||||
readonly XBPS_DISTDIR=/void-packages
|
readonly XBPS_DISTDIR=/void-packages
|
||||||
|
# needed before call to check_config_vars
|
||||||
readonly XBPS_MASTERDIR=/
|
readonly XBPS_MASTERDIR=/
|
||||||
readonly XBPS_HOSTDIR=/host
|
readonly XBPS_HOSTDIR=/host
|
||||||
else
|
else
|
||||||
|
@ -487,37 +491,18 @@ else
|
||||||
elif [ -s $HOME/.xbps-src.conf ]; then
|
elif [ -s $HOME/.xbps-src.conf ]; then
|
||||||
# ... fallback to ~/.xbps-src.conf otherwise.
|
# ... fallback to ~/.xbps-src.conf otherwise.
|
||||||
readonly XBPS_CONFIG_FILE=$HOME/.xbps-src.conf
|
readonly XBPS_CONFIG_FILE=$HOME/.xbps-src.conf
|
||||||
|
. $XBPS_CONFIG_FILE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Read settings from config file
|
|
||||||
[ -s "$XBPS_CONFIG_FILE" ] && . $XBPS_CONFIG_FILE &>/dev/null
|
|
||||||
|
|
||||||
# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
|
#
|
||||||
: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
|
# Check configuration vars before anyting else, and set defaults vars.
|
||||||
|
#
|
||||||
|
check_config_vars
|
||||||
|
|
||||||
# if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
|
for f in $XBPS_DISTDIR/common/xbps-src/shutils/*.sh; do
|
||||||
: ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
|
[ -r $f ] && . $f
|
||||||
|
done
|
||||||
mkdir -p $XBPS_MASTERDIR $XBPS_HOSTDIR
|
|
||||||
|
|
||||||
if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
|
|
||||||
echo "ERROR: can't write to masterdir $XBPS_MASTERDIR."
|
|
||||||
exit 1
|
|
||||||
elif [ -d "$XBPS_HOSTDIR" -a ! -w "$XBPS_HOSTDIR" ]; then
|
|
||||||
echo "ERROR: can't write to hostdir: $XBPS_HOSTDIR."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try using chroot-git then git from the host system
|
|
||||||
if command -v chroot-git &>/dev/null; then
|
|
||||||
XBPS_GIT_CMD=$(command -v chroot-git)
|
|
||||||
elif command -v git &>/dev/null; then
|
|
||||||
XBPS_GIT_CMD=$(command -v git)
|
|
||||||
else
|
|
||||||
echo "neither chroot-git or git are available in your system!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
readonly XBPS_GIT_CMD
|
|
||||||
|
|
||||||
if [ -n "$XBPS_HOSTDIR" ]; then
|
if [ -n "$XBPS_HOSTDIR" ]; then
|
||||||
export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
|
export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
|
||||||
|
@ -531,62 +516,80 @@ fi
|
||||||
if [ -z "$XBPS_ALT_REPOSITORY" ]; then
|
if [ -z "$XBPS_ALT_REPOSITORY" ]; then
|
||||||
pushd "$PWD" &>/dev/null
|
pushd "$PWD" &>/dev/null
|
||||||
cd $XBPS_DISTDIR
|
cd $XBPS_DISTDIR
|
||||||
_gitbranch="$($XBPS_GIT_CMD symbolic-ref --short HEAD 2>/dev/null)"
|
if [ -n "$IN_CHROOT" ]; then
|
||||||
if [ "${_gitbranch}" -a "${_gitbranch}" != "master" ]; then
|
_gitbranch="$(chroot-git symbolic-ref --short HEAD 2>/dev/null)"
|
||||||
|
else
|
||||||
|
_gitbranch="$($XBPS_GIT_CMD symbolic-ref --short HEAD 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
if [ -n "${_gitbranch}" -a "${_gitbranch}" != "master" ]; then
|
||||||
export XBPS_ALT_REPOSITORY="${_gitbranch}"
|
export XBPS_ALT_REPOSITORY="${_gitbranch}"
|
||||||
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${_gitbranch}"
|
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${_gitbranch}"
|
||||||
|
if [ -z "$IN_CHROOT" ]; then
|
||||||
|
msg_normal "Using \`$XBPS_REPOSITORY\' as local repository.\n"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
else
|
else
|
||||||
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${XBPS_ALT_REPOSITORY}"
|
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${XBPS_ALT_REPOSITORY}"
|
||||||
|
if [ -z "$IN_CHROOT" ]; then
|
||||||
|
msg_normal "Using \`$XBPS_REPOSITORY\' as local repository.\n"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly XBPS_SRCPKGDIR=$XBPS_DISTDIR/srcpkgs
|
if [ -n "$IN_CHROOT" ]; then
|
||||||
readonly XBPS_COMMONDIR=$XBPS_DISTDIR/common
|
|
||||||
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
|
|
||||||
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
|
|
||||||
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
|
|
||||||
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style
|
|
||||||
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
|
|
||||||
readonly XBPS_BUILDHELPERDIR=$XBPS_COMMONDIR/build-helper
|
|
||||||
|
|
||||||
if [ "$IN_CHROOT" ]; then
|
|
||||||
readonly XBPS_UHELPER_CMD="xbps-uhelper"
|
readonly XBPS_UHELPER_CMD="xbps-uhelper"
|
||||||
readonly XBPS_INSTALL_CMD="xbps-install --repository=$XBPS_REPOSITORY"
|
readonly XBPS_INSTALL_CMD="xbps-install"
|
||||||
readonly XBPS_QUERY_CMD="xbps-query --repository=$XBPS_REPOSITORY"
|
readonly XBPS_QUERY_CMD="xbps-query"
|
||||||
|
readonly XBPS_RINDEX_CMD="xbps-rindex"
|
||||||
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure"
|
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure"
|
||||||
readonly XBPS_REMOVE_CMD="xbps-remove"
|
readonly XBPS_REMOVE_CMD="xbps-remove"
|
||||||
readonly XBPS_CHECKVERS_CMD="xbps-checkvers --repository=$XBPS_REPOSITORY"
|
readonly XBPS_SRCPKGDIR=/void-packages/srcpkgs
|
||||||
|
readonly XBPS_COMMONDIR=/void-packages/common
|
||||||
readonly XBPS_DESTDIR=/destdir
|
readonly XBPS_DESTDIR=/destdir
|
||||||
readonly XBPS_BUILDDIR=/builddir
|
readonly XBPS_BUILDDIR=/builddir
|
||||||
|
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
|
||||||
|
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
|
||||||
|
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
|
||||||
|
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style
|
||||||
|
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
|
||||||
|
readonly XBPS_BUILDHELPERDIR=$XBPS_COMMONDIR/build-helper
|
||||||
else
|
else
|
||||||
readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
|
readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
|
||||||
readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR"
|
readonly XBPS_INSTALL_CMD="xbps-install -C /dev/null -c $XBPS_HOSTDIR/repocache --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR"
|
||||||
readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR"
|
readonly XBPS_QUERY_CMD="xbps-query -C /dev/null -c $XBPS_HOSTDIR/repocache -i --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR"
|
||||||
|
readonly XBPS_RINDEX_CMD="xbps-rindex"
|
||||||
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
|
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
|
||||||
readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
|
readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
|
||||||
readonly XBPS_CHECKVERS_CMD="xbps-checkvers --repository=$XBPS_REPOSITORY"
|
readonly XBPS_SRCPKGDIR=$XBPS_DISTDIR/srcpkgs
|
||||||
|
readonly XBPS_COMMONDIR=$XBPS_DISTDIR/common
|
||||||
|
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
|
||||||
readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
|
readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
|
||||||
readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
|
readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
|
||||||
|
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
|
||||||
|
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
|
||||||
|
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style
|
||||||
|
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
|
||||||
|
readonly XBPS_BUILDHELPERDIR=$XBPS_COMMONDIR/build-helper
|
||||||
fi
|
fi
|
||||||
readonly XBPS_RINDEX_CMD="xbps-rindex"
|
|
||||||
readonly XBPS_FETCH_CMD="xbps-fetch"
|
readonly XBPS_FETCH_CMD="xbps-fetch"
|
||||||
readonly XBPS_DIGEST_CMD="xbps-digest"
|
readonly XBPS_DIGEST_CMD="xbps-digest"
|
||||||
readonly XBPS_CMPVER_CMD="xbps-uhelper cmpver"
|
readonly XBPS_CMPVER_CMD="xbps-uhelper cmpver"
|
||||||
|
|
||||||
readonly XBPS_TARGET="$1"
|
readonly XBPS_TARGET="$1"
|
||||||
if [ "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
XBPS_TARGET_PKG="${2##*/}"
|
XBPS_TARGET_PKG="${2##*/}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for CHROOT_READY and set up XBPS_ARCH environment var for xbps.
|
chroot_check() {
|
||||||
chroot_check
|
if [ -f $XBPS_MASTERDIR/.xbps_chroot_init -o "$XBPS_CHROOT_CMD" = "ethereal" ]; then
|
||||||
check_native_arch
|
export CHROOT_READY=1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
chroot_check
|
||||||
|
|
||||||
# Reconfigure pkgs for 32bit on x86_64 and reexec itself.
|
|
||||||
# XXX: how about 32bit userland on 64bit CPUs? (ppc, arm, etc).
|
|
||||||
if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
||||||
export XBPS_ARCH=${XBPS_ARCH:-$(<$XBPS_MASTERDIR/.xbps_chroot_init)}
|
export XBPS_ARCH=${XBPS_ARCH:-$(cat $XBPS_MASTERDIR/.xbps_chroot_init)}
|
||||||
if [[ $XBPS_MACHINE == x86_64* ]] && [[ $XBPS_ARCH == i686* ]]; then
|
if [[ $XBPS_MACHINE == x86_64* ]] && [[ $XBPS_ARCH == i686* ]]; then
|
||||||
# reconfigure pkgs via linux32
|
# reconfigure pkgs via linux32
|
||||||
linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
|
linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
|
||||||
|
@ -595,21 +598,20 @@ if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
||||||
exec linux32 $0 ${XBPS_OPTIONS} $@
|
exec linux32 $0 ${XBPS_OPTIONS} $@
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$XBPS_ARCH" ]; then
|
if [ -n "$XBPS_ARCH" ]; then
|
||||||
export XBPS_MACHINE=$XBPS_ARCH
|
export XBPS_MACHINE=$XBPS_ARCH
|
||||||
fi
|
fi
|
||||||
# At this point if XBPS_TARGET_MACHINE isn't defined we assume
|
|
||||||
# it's a native build.
|
|
||||||
if [ -z "$XBPS_TARGET_MACHINE" ]; then
|
if [ -z "$XBPS_TARGET_MACHINE" ]; then
|
||||||
export XBPS_TARGET_MACHINE=$XBPS_MACHINE
|
export XBPS_TARGET_MACHINE=${XBPS_ARCH:=$XBPS_MACHINE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
||||||
XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR \
|
XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR XBPS_REPO_DELTAS \
|
||||||
XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \
|
XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \
|
||||||
XBPS_UHELPER_CMD XBPS_INSTALL_CMD XBPS_QUERY_CMD XBPS_BUILD_ONLY_ONE_PKG \
|
XBPS_UHELPER_CMD XBPS_INSTALL_CMD XBPS_QUERY_CMD XBPS_BUILD_ONLY_ONE_PKG \
|
||||||
XBPS_RINDEX_CMD XBPS_RECONFIGURE_CMD XBPS_REMOVE_CMD XBPS_CHECKVERS_CMD \
|
XBPS_RINDEX_CMD XBPS_RECONFIGURE_CMD XBPS_REMOVE_CMD \
|
||||||
XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
|
XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_APIVER XBPS_BUILDSTYLEDIR \
|
||||||
XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
|
XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
|
||||||
XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
|
XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
|
||||||
XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
|
XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
|
||||||
|
@ -627,7 +629,7 @@ for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do
|
||||||
unset val
|
unset val
|
||||||
done
|
done
|
||||||
|
|
||||||
# A temporary masterdir requires xbps-uchroot(1) and -O to use overlayfs
|
# A temporary masterdir requires xbps-uchroot(8) and -O to use overlayfs
|
||||||
# on tmpfs (available with xbps-0.45).
|
# on tmpfs (available with xbps-0.45).
|
||||||
if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_MASTERDIR" ]; then
|
if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_MASTERDIR" ]; then
|
||||||
export XBPS_CHROOT_CMD="uchroot"
|
export XBPS_CHROOT_CMD="uchroot"
|
||||||
|
@ -638,35 +640,31 @@ fi
|
||||||
#
|
#
|
||||||
if [ -z "$IN_CHROOT" ]; then
|
if [ -z "$IN_CHROOT" ]; then
|
||||||
# In non chroot case always prefer host tools.
|
# In non chroot case always prefer host tools.
|
||||||
export PATH="$PATH:$XBPS_MASTERDIR/usr/bin"
|
MYPATH="$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin"
|
||||||
fi
|
export PATH="$PATH:$MYPATH"
|
||||||
|
else
|
||||||
#
|
MYPATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||||
# Set up ccache
|
export PATH="$MYPATH"
|
||||||
#
|
if [ -n "$XBPS_CCACHE" ]; then
|
||||||
if [ "$XBPS_CCACHE" ]; then
|
CCACHEPATH="/usr/lib/ccache/bin"
|
||||||
export CCACHEPATH="/usr/lib/ccache/bin"
|
export CCACHE_DIR="$XBPS_HOSTDIR/ccache"
|
||||||
export CCACHE_DIR="$XBPS_HOSTDIR/ccache"
|
# Avoid not using cached files just due to compiler mtime
|
||||||
# Avoid not using cached files just due to compiler mtime
|
# changes when e.g. bootstrapping
|
||||||
# changes when e.g. bootstrapping
|
export CCACHE_COMPILERCHECK=content CCACHE_COMPRESS=1
|
||||||
export CCACHE_COMPILERCHECK=content CCACHE_COMPRESS=1
|
export PATH="$CCACHEPATH:$PATH"
|
||||||
export PATH="$CCACHEPATH:$PATH"
|
mkdir -p $CCACHE_DIR
|
||||||
mkdir -p $CCACHE_DIR
|
fi
|
||||||
fi
|
if [ -n "$XBPS_DISTCC" ]; then
|
||||||
|
if [ -n "$XBPS_CCACHE" ]; then
|
||||||
#
|
export CCACHE_PREFIX="/usr/bin/distcc"
|
||||||
# Set up distcc
|
else
|
||||||
#
|
DISTCCPATH="/usr/lib/distcc/bin"
|
||||||
if [ "$XBPS_DISTCC" ]; then
|
export PATH="$DISTCCPATH:$PATH"
|
||||||
if [ "$XBPS_CCACHE" ]; then
|
fi
|
||||||
export CCACHE_PREFIX="/usr/bin/distcc"
|
export DISTCC_DIR="$XBPS_HOSTDIR/distcc-${XBPS_CROSS_BUILD:-${XBPS_MACHINE}}"
|
||||||
else
|
export DISTCC_HOSTS="$XBPS_DISTCC_HOSTS"
|
||||||
DISTCCPATH="/usr/lib/distcc/bin"
|
mkdir -p $DISTCC_DIR
|
||||||
export PATH="$DISTCCPATH:$PATH"
|
|
||||||
fi
|
fi
|
||||||
export DISTCC_DIR="$XBPS_HOSTDIR/distcc-${XBPS_CROSS_BUILD:-${XBPS_MACHINE}}"
|
|
||||||
export DISTCC_HOSTS="$XBPS_DISTCC_HOSTS"
|
|
||||||
mkdir -p $DISTCC_DIR
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_build_requirements
|
check_build_requirements
|
||||||
|
@ -677,12 +675,6 @@ if [ -z "$IN_CHROOT" ]; then
|
||||||
setup_distfiles_mirror
|
setup_distfiles_mirror
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#
|
|
||||||
# Read funcs from helpers
|
|
||||||
#
|
|
||||||
for f in ${XBPS_SHUTILSDIR}/*.sh; do
|
|
||||||
[ -r "$f" ] && . $f
|
|
||||||
done
|
|
||||||
|
|
||||||
reconfigure_bootstrap_pkgs
|
reconfigure_bootstrap_pkgs
|
||||||
|
|
||||||
|
@ -697,24 +689,18 @@ case "$XBPS_TARGET" in
|
||||||
# bootstrap from sources
|
# bootstrap from sources
|
||||||
# check for required host utils
|
# check for required host utils
|
||||||
check_reqhost_utils bootstrap
|
check_reqhost_utils bootstrap
|
||||||
[[ $XBPS_MACHINE =~ musl ]] && subarch="-musl"
|
[ ! -d $XBPS_SRCPKGDIR/base-chroot ] && \
|
||||||
[ ! -d $XBPS_SRCPKGDIR/base-chroot${subarch} ] && \
|
msg_error "Cannot find $XBPS_SRCPKGDIR/base-chroot directory!\n"
|
||||||
msg_error "Cannot find $XBPS_SRCPKGDIR/base-chroot${subarch} directory!\n"
|
|
||||||
bootstrap_vpkg=${XBPS_MASTERDIR}/etc/xbps.d/bootstrap-vpkgs.conf
|
bootstrap_vpkg=${XBPS_MASTERDIR}/etc/xbps.d/bootstrap-vpkgs.conf
|
||||||
mkdir -p ${XBPS_MASTERDIR}/etc/xbps.d
|
mkdir -p ${XBPS_MASTERDIR}/etc/xbps.d
|
||||||
if [ ! -s ${bootstrap_vpkg} ]; then
|
if [ ! -s ${bootstrap_vpkg} ]; then
|
||||||
# Fool xbps to resolve dependencies.
|
# Fool xbps to resolve dependencies.
|
||||||
echo 'virtualpkg=libgcc:base-files' >> ${bootstrap_vpkg}
|
echo 'virtualpkg=libgcc-4.4.0_1:base-files' >> ${bootstrap_vpkg}
|
||||||
echo 'virtualpkg=libstdc++:base-files' >> ${bootstrap_vpkg}
|
echo 'virtualpkg=libstdc++-4.4.0_1:base-files' >> ${bootstrap_vpkg}
|
||||||
fi
|
fi
|
||||||
(
|
$XBPS_LIBEXECDIR/build.sh base-chroot base-chroot $XBPS_TARGET || exit 1
|
||||||
export XBPS_ARCH=$XBPS_MACHINE
|
|
||||||
export XBPS_SKIP_REMOTEREPOS=1
|
|
||||||
$XBPS_LIBEXECDIR/build.sh \
|
|
||||||
base-chroot${subarch} base-chroot${subarch} $XBPS_TARGET || exit 1
|
|
||||||
) || exit 1
|
|
||||||
[ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
|
[ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
|
||||||
install_bbootstrap ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
|
install_bbootstrap bootstrap
|
||||||
;;
|
;;
|
||||||
bootstrap-update)
|
bootstrap-update)
|
||||||
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
||||||
|
@ -871,7 +857,7 @@ case "$XBPS_TARGET" in
|
||||||
bulk_build
|
bulk_build
|
||||||
;;
|
;;
|
||||||
show-sys-updates)
|
show-sys-updates)
|
||||||
bulk_build -I
|
bulk_build -i
|
||||||
;;
|
;;
|
||||||
sort-dependencies)
|
sort-dependencies)
|
||||||
bulk_sortdeps ${@/$XBPS_TARGET/}
|
bulk_sortdeps ${@/$XBPS_TARGET/}
|
||||||
|
@ -880,7 +866,7 @@ case "$XBPS_TARGET" in
|
||||||
bulk_update
|
bulk_update
|
||||||
;;
|
;;
|
||||||
update-sys)
|
update-sys)
|
||||||
bulk_update -I
|
bulk_update -i
|
||||||
;;
|
;;
|
||||||
update-check)
|
update-check)
|
||||||
read_pkg ignore-problems
|
read_pkg ignore-problems
|
||||||
|
|
Loading…
Reference in New Issue