2014-04-09 14:40:27 +00:00
|
|
|
# vim: set ts=4 sw=4 et:
|
2014-03-22 11:31:42 +00:00
|
|
|
|
|
|
|
check_pkg_arch() {
|
2015-03-19 09:26:19 +00:00
|
|
|
local cross="$1" _arch f found
|
2014-04-09 14:55:58 +00:00
|
|
|
|
2015-02-28 01:38:00 +00:00
|
|
|
if [ -n "$only_for_archs" ]; then
|
2014-04-09 14:55:58 +00:00
|
|
|
if [ -n "$cross" ]; then
|
|
|
|
_arch="$XBPS_TARGET_MACHINE"
|
|
|
|
elif [ -n "$XBPS_ARCH" ]; then
|
|
|
|
_arch="$XBPS_ARCH"
|
|
|
|
else
|
|
|
|
_arch="$XBPS_MACHINE"
|
|
|
|
fi
|
|
|
|
for f in ${only_for_archs}; do
|
|
|
|
if [ "$f" = "${_arch}" ]; then
|
|
|
|
found=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "$found" ]; then
|
|
|
|
msg_red "$pkgname: this package cannot be built for ${_arch}.\n"
|
2015-03-19 09:26:19 +00:00
|
|
|
exit 2
|
2014-04-09 14:55:58 +00:00
|
|
|
fi
|
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
}
|
|
|
|
|
2015-03-23 11:42:35 +00: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 09:10:07 +00:00
|
|
|
remove_pkg_autodeps() {
|
|
|
|
local rval= tmplogf=
|
|
|
|
|
|
|
|
cd $XBPS_MASTERDIR || return 1
|
|
|
|
msg_normal "${pkgver:-xbps-src}: removing autodeps, please wait...\n"
|
|
|
|
tmplogf=$(mktemp)
|
|
|
|
|
2015-04-09 17:45:59 +00:00
|
|
|
remove_pkg_cross_deps
|
|
|
|
$XBPS_RECONFIGURE_CMD -a >> $tmplogf 2>&1
|
2018-01-25 08:30:47 +00:00
|
|
|
echo yes | $XBPS_REMOVE_CMD -Ryod >> $tmplogf 2>&1
|
2015-07-09 09:40:52 +00:00
|
|
|
rval=$?
|
2014-09-05 09:10:07 +00:00
|
|
|
|
2015-07-09 09:40:52 +00:00
|
|
|
if [ $rval -ne 0 ]; then
|
|
|
|
msg_red "${pkgver:-xbps-src}: failed to remove autodeps: (returned $rval)\n"
|
2014-09-05 09:10:07 +00:00
|
|
|
cat $tmplogf && rm -f $tmplogf
|
|
|
|
msg_error "${pkgver:-xbps-src}: cannot continue!\n"
|
|
|
|
fi
|
|
|
|
rm -f $tmplogf
|
|
|
|
}
|
|
|
|
|
2014-03-22 11:31:42 +00:00
|
|
|
remove_pkg_wrksrc() {
|
2014-04-09 14:55:58 +00:00
|
|
|
if [ -d "$wrksrc" ]; then
|
|
|
|
msg_normal "$pkgver: cleaning build directory...\n"
|
2018-08-31 04:30:44 +00:00
|
|
|
chmod -R +wX $wrksrc # Needed to delete Go Modules
|
2014-04-09 14:55:58 +00:00
|
|
|
rm -rf $wrksrc
|
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
}
|
|
|
|
|
2014-12-13 08:42:11 +00:00
|
|
|
remove_pkg_statedir() {
|
|
|
|
if [ -d "$XBPS_STATEDIR" ]; then
|
|
|
|
rm -rf "$XBPS_STATEDIR"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-03-22 11:31:42 +00:00
|
|
|
remove_pkg() {
|
2014-04-09 14:55:58 +00:00
|
|
|
local cross="$1" _destdir f
|
|
|
|
|
|
|
|
[ -z $pkgname ] && msg_error "unexistent package, aborting.\n"
|
|
|
|
|
|
|
|
if [ -n "$cross" ]; then
|
|
|
|
_destdir="$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET"
|
|
|
|
else
|
|
|
|
_destdir="$XBPS_DESTDIR"
|
|
|
|
fi
|
|
|
|
|
2014-08-21 10:16:53 +00:00
|
|
|
[ ! -d ${_destdir} ] && return
|
|
|
|
|
2014-04-09 14:55:58 +00: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 10:02:22 +00:00
|
|
|
rm -f ${XBPS_STATEDIR}/${f}_${cross}_subpkg_install_done
|
|
|
|
rm -f ${XBPS_STATEDIR}/${f}_${cross}_prepkg_done
|
2014-04-09 14:55:58 +00:00
|
|
|
done
|
2014-12-11 10:02:22 +00: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 11:31:42 +00:00
|
|
|
}
|