2014-04-09 16:40:27 +02:00
|
|
|
# vim: set ts=4 sw=4 et:
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2021-08-18 01:05:00 +02:00
|
|
|
check_existing_pkg() {
|
|
|
|
local arch= curpkg=
|
|
|
|
if [ -z "$XBPS_PRESERVE_PKGS" ] || [ "$XBPS_BUILD_FORCEMODE" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
arch=$XBPS_TARGET_MACHINE
|
|
|
|
curpkg=$XBPS_REPOSITORY/$repository/$pkgver.$arch.xbps
|
|
|
|
if [ -e $curpkg ]; then
|
|
|
|
msg_warn "$pkgver: skipping build due to existing $curpkg\n"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
check_pkg_arch() {
|
2015-12-03 10:04:16 +01:00
|
|
|
local cross="$1" _arch f match nonegation
|
2014-04-09 16:55:58 +02:00
|
|
|
|
2021-01-20 12:55:11 +01:00
|
|
|
if [ -n "$archs" ]; then
|
2014-04-09 16:55:58 +02:00
|
|
|
if [ -n "$cross" ]; then
|
|
|
|
_arch="$XBPS_TARGET_MACHINE"
|
|
|
|
elif [ -n "$XBPS_ARCH" ]; then
|
|
|
|
_arch="$XBPS_ARCH"
|
|
|
|
else
|
|
|
|
_arch="$XBPS_MACHINE"
|
|
|
|
fi
|
2015-12-03 10:04:16 +01:00
|
|
|
set -f
|
|
|
|
for f in ${archs}; do
|
|
|
|
set +f
|
|
|
|
nonegation=${f##\~*}
|
|
|
|
f=${f#\~}
|
|
|
|
case "${_arch}" in
|
|
|
|
$f) match=1; break ;;
|
|
|
|
esac
|
2014-04-09 16:55:58 +02:00
|
|
|
done
|
2015-12-03 10:04:16 +01:00
|
|
|
if [ -z "$nonegation" -a -n "$match" ] || [ -n "$nonegation" -a -z "$match" ]; then
|
2022-04-23 13:12:36 +02:00
|
|
|
report_broken "${pkgname}-${version}_${revision}: this package cannot be built for ${_arch}.\n"
|
2014-04-09 16:55:58 +02:00
|
|
|
fi
|
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|
|
|
|
|
2015-03-23 12:42:35 +01:00
|
|
|
# Returns 1 if pkg is available in xbps repositories, 0 otherwise.
|
|
|
|
pkg_available() {
|
|
|
|
local pkg="$1" cross="$2" pkgver
|
|
|
|
|
|
|
|
if [ -n "$cross" ]; then
|
|
|
|
pkgver=$($XBPS_QUERY_XCMD -R -ppkgver "${pkg}" 2>/dev/null)
|
|
|
|
else
|
|
|
|
pkgver=$($XBPS_QUERY_CMD -R -ppkgver "${pkg}" 2>/dev/null)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$pkgver" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2014-09-05 11:10:07 +02:00
|
|
|
remove_pkg_autodeps() {
|
2019-10-21 20:58:31 +02:00
|
|
|
local rval= tmplogf= errlogf= prevs=
|
2014-09-05 11:10:07 +02:00
|
|
|
|
|
|
|
cd $XBPS_MASTERDIR || return 1
|
|
|
|
msg_normal "${pkgver:-xbps-src}: removing autodeps, please wait...\n"
|
2019-06-17 17:38:07 +02:00
|
|
|
tmplogf=$(mktemp) || exit 1
|
2019-10-21 20:58:31 +02:00
|
|
|
errlogf=$(mktemp) || exit 1
|
2014-09-05 11:10:07 +02:00
|
|
|
|
2015-04-09 19:45:59 +02:00
|
|
|
remove_pkg_cross_deps
|
|
|
|
$XBPS_RECONFIGURE_CMD -a >> $tmplogf 2>&1
|
2023-09-11 04:30:55 +02:00
|
|
|
prevs=$(stat_size $tmplogf)
|
2019-10-21 20:58:31 +02:00
|
|
|
echo yes | $XBPS_REMOVE_CMD -Ryod 2>> $errlogf 1>> $tmplogf
|
2015-07-09 11:40:52 +02:00
|
|
|
rval=$?
|
2019-10-21 20:58:31 +02:00
|
|
|
while [ $rval -eq 0 ]; do
|
2023-09-11 04:30:55 +02:00
|
|
|
local curs=$(stat_size $tmplogf)
|
2019-10-21 20:58:31 +02:00
|
|
|
if [ $curs -eq $prevs ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
prevs=$curs
|
|
|
|
echo yes | $XBPS_REMOVE_CMD -Ryod 2>> $errlogf 1>> $tmplogf
|
2019-07-10 19:48:54 +02:00
|
|
|
rval=$?
|
2019-10-21 20:58:31 +02:00
|
|
|
done
|
2014-09-05 11:10:07 +02:00
|
|
|
|
2015-07-09 11:40:52 +02:00
|
|
|
if [ $rval -ne 0 ]; then
|
|
|
|
msg_red "${pkgver:-xbps-src}: failed to remove autodeps: (returned $rval)\n"
|
2014-09-05 11:10:07 +02:00
|
|
|
cat $tmplogf && rm -f $tmplogf
|
2019-10-21 20:58:31 +02:00
|
|
|
cat $errlogf && rm -f $errlogf
|
2014-09-05 11:10:07 +02:00
|
|
|
msg_error "${pkgver:-xbps-src}: cannot continue!\n"
|
|
|
|
fi
|
|
|
|
rm -f $tmplogf
|
2019-10-21 20:58:31 +02:00
|
|
|
rm -f $errlogf
|
2014-09-05 11:10:07 +02:00
|
|
|
}
|
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
remove_pkg_wrksrc() {
|
2014-04-09 16:55:58 +02:00
|
|
|
if [ -d "$wrksrc" ]; then
|
|
|
|
msg_normal "$pkgver: cleaning build directory...\n"
|
2021-05-14 21:10:09 +02:00
|
|
|
rm -rf "$wrksrc" 2>/dev/null || chmod -R +wX "$wrksrc" # Needed to delete Go Modules
|
2020-09-02 19:04:41 +02:00
|
|
|
rm -rf "$wrksrc"
|
2014-04-09 16:55:58 +02:00
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|
|
|
|
|
2014-12-13 09:42:11 +01:00
|
|
|
remove_pkg_statedir() {
|
|
|
|
if [ -d "$XBPS_STATEDIR" ]; then
|
|
|
|
rm -rf "$XBPS_STATEDIR"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
remove_pkg() {
|
2014-04-09 16:55:58 +02:00
|
|
|
local cross="$1" _destdir f
|
|
|
|
|
2023-04-16 15:36:29 +02:00
|
|
|
[ -z $pkgname ] && msg_error "nonexistent package, aborting.\n"
|
2014-04-09 16:55:58 +02:00
|
|
|
|
|
|
|
if [ -n "$cross" ]; then
|
|
|
|
_destdir="$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET"
|
|
|
|
else
|
|
|
|
_destdir="$XBPS_DESTDIR"
|
|
|
|
fi
|
|
|
|
|
2014-08-21 12:16:53 +02:00
|
|
|
[ ! -d ${_destdir} ] && return
|
|
|
|
|
2014-04-09 16:55:58 +02:00
|
|
|
for f in ${sourcepkg} ${subpackages}; do
|
|
|
|
if [ -d "${_destdir}/${f}-${version}" ]; then
|
|
|
|
msg_normal "$f: removing files from destdir...\n"
|
|
|
|
rm -rf ${_destdir}/${f}-${version}
|
|
|
|
fi
|
|
|
|
if [ -d "${_destdir}/${f}-dbg-${version}" ]; then
|
|
|
|
msg_normal "$f: removing dbg files from destdir...\n"
|
|
|
|
rm -rf ${_destdir}/${f}-dbg-${version}
|
|
|
|
fi
|
|
|
|
if [ -d "${_destdir}/${f}-32bit-${version}" ]; then
|
|
|
|
msg_normal "$f: removing 32bit files from destdir...\n"
|
|
|
|
rm -rf ${_destdir}/${f}-32bit-${version}
|
|
|
|
fi
|
2014-12-11 11:02:22 +01:00
|
|
|
rm -f ${XBPS_STATEDIR}/${f}_${cross}_subpkg_install_done
|
|
|
|
rm -f ${XBPS_STATEDIR}/${f}_${cross}_prepkg_done
|
2014-04-09 16:55:58 +02:00
|
|
|
done
|
2014-12-11 11:02:22 +01:00
|
|
|
rm -f ${XBPS_STATEDIR}/${sourcepkg}_${cross}_install_done
|
|
|
|
rm -f ${XBPS_STATEDIR}/${sourcepkg}_${cross}_pre_install_done
|
|
|
|
rm -f ${XBPS_STATEDIR}/${sourcepkg}_${cross}_post_install_done
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|