xbps-src: apply sane indentation to all shell code.

This commit is contained in:
Juan RP 2014-04-09 16:40:27 +02:00
parent a9426525c0
commit 1af40eb476
12 changed files with 1007 additions and 994 deletions

View File

@ -1,12 +1,14 @@
#!/bin/bash
#
# vim: set ts=4 sw=4 et:
#
# Passed arguments:
# $1 - pkgname to build [REQUIRED]
# $2 - cross target [OPTIONAL]
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
fi
PKGNAME="$1"
@ -15,18 +17,18 @@ XBPS_CROSS_BUILD="$2"
. $XBPS_SHUTILSDIR/common.sh
for f in $XBPS_COMMONDIR/helpers/*.sh; do
source_file "$f"
source_file "$f"
done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/build/*.sh; do
source_file "$f"
source_file "$f"
done
if [ -z $pkgname -o -z $version ]; then
msg_error "$1: pkgname/version not set in pkg template!\n"
exit 1
msg_error "$1: pkgname/version not set in pkg template!\n"
exit 1
fi
XBPS_BUILD_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_build_done"
@ -34,54 +36,54 @@ XBPS_PRE_BUILD_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_pre_build_done"
XBPS_POST_BUILD_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_post_build_done"
if [ -f "$XBPS_BUILD_DONE" ]; then
exit 0
exit 0
fi
cd $wrksrc || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n"
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc || \
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n"
cd $build_wrksrc || \
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n"
fi
run_pkg_hooks pre-build
# Run pre_build()
if [ ! -f $XBPS_PRE_BUILD_DONE ]; then
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f pre_build >/dev/null; then
run_func pre_build
touch -f $XBPS_PRE_BUILD_DONE
fi
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f pre_build >/dev/null; then
run_func pre_build
touch -f $XBPS_PRE_BUILD_DONE
fi
fi
# Run do_build()
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f do_build >/dev/null; then
run_func do_build
run_func do_build
else
if [ -n "$build_style" ]; then
if [ ! -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
msg_error "$pkgver: cannot find build helper $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
fi
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
if declare -f do_build >/dev/null; then
run_func do_build
fi
fi
if [ -n "$build_style" ]; then
if [ ! -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
msg_error "$pkgver: cannot find build helper $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
fi
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
if declare -f do_build >/dev/null; then
run_func do_build
fi
fi
fi
touch -f $XBPS_BUILD_DONE
# Run post_build()
if [ ! -f $XBPS_POST_BUILD_DONE ]; then
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f post_build >/dev/null; then
run_func post_build
touch -f $XBPS_POST_BUILD_DONE
fi
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f post_build >/dev/null; then
run_func post_build
touch -f $XBPS_POST_BUILD_DONE
fi
fi
run_pkg_hooks post-build

View File

@ -1,12 +1,14 @@
#!/bin/bash
#
# vim: set ts=4 sw=4 et:
#
# Passed arguments:
# $1 - pkgname to configure [REQUIRED]
# $2 - cross target [OPTIONAL]
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
fi
PKGNAME="$1"
@ -15,13 +17,13 @@ XBPS_CROSS_BUILD="$2"
. $XBPS_SHUTILSDIR/common.sh
for f in $XBPS_COMMONDIR/helpers/*.sh; do
source_file "$f"
source_file "$f"
done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/configure/*.sh; do
source_file "$f"
source_file "$f"
done
XBPS_CONFIGURE_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_configure_done"
@ -29,60 +31,60 @@ XBPS_PRECONFIGURE_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_pre_configure_done"
XBPS_POSTCONFIGURE_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_post_configure_done"
if [ -f "$XBPS_CONFIGURE_DONE" ]; then
exit 0
exit 0
fi
cd $wrksrc || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc].\n"
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc || \
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc].\n"
cd $build_wrksrc || \
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc].\n"
fi
run_pkg_hooks pre-configure
# Run pre_configure()
if [ ! -f $XBPS_PRECONFIGURE_DONE ]; then
cd $wrksrc
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc
fi
if declare -f pre_configure >/dev/null; then
run_func pre_configure
touch -f $XBPS_PRECONFIGURE_DONE
fi
cd $wrksrc
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc
fi
if declare -f pre_configure >/dev/null; then
run_func pre_configure
touch -f $XBPS_PRECONFIGURE_DONE
fi
fi
# Run do_configure()
cd $wrksrc
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc
cd $build_wrksrc
fi
if declare -f do_configure >/dev/null; then
run_func do_configure
run_func do_configure
else
if [ -n "$build_style" ]; then
if [ ! -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
msg_error "$pkgver: cannot find build helper $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
fi
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
if declare -f do_configure >/dev/null; then
run_func do_configure
fi
fi
if [ -n "$build_style" ]; then
if [ ! -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
msg_error "$pkgver: cannot find build helper $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
fi
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
if declare -f do_configure >/dev/null; then
run_func do_configure
fi
fi
fi
touch -f $XBPS_CONFIGURE_DONE
# Run post_configure()
if [ ! -f $XBPS_POSTCONFIGURE_DONE ]; then
cd $wrksrc
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc
fi
if declare -f post_configure >/dev/null; then
run_func post_configure
touch -f $XBPS_POSTCONFIGURE_DONE
fi
cd $wrksrc
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc
fi
if declare -f post_configure >/dev/null; then
run_func post_configure
touch -f $XBPS_POSTCONFIGURE_DONE
fi
fi
run_pkg_hooks post-configure

View File

@ -1,12 +1,14 @@
#!/bin/bash
#
# vim: set ts=4 sw=4 et:
#
# Passed arguments:
# $1 - pkgname [REQUIRED]
# $2 - cross target [OPTIONAL]
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
fi
PKGNAME="$1"
@ -15,19 +17,19 @@ XBPS_CROSS_BUILD="$2"
. $XBPS_SHUTILSDIR/common.sh
for f in $XBPS_COMMONDIR/helpers/*.sh; do
source_file "$f"
source_file "$f"
done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/extract/*.sh; do
source_file "$f"
source_file "$f"
done
XBPS_EXTRACT_DONE="$wrksrc/.xbps_extract_done"
if [ -f $XBPS_EXTRACT_DONE ]; then
exit 0
exit 0
fi
# Run pre-extract hooks
@ -35,24 +37,24 @@ run_pkg_hooks pre-extract
# If template defines pre_extract(), use it.
if declare -f pre_extract >/dev/null; then
run_func pre_extract
run_func pre_extract
fi
# If template defines do_extract() use it rather than the hooks.
if declare -f do_extract >/dev/null; then
[ ! -d "$wrksrc" ] && mkdir -p $wrksrc
cd $wrksrc
run_func do_extract
[ ! -d "$wrksrc" ] && mkdir -p $wrksrc
cd $wrksrc
run_func do_extract
else
# Run do-extract hooks
run_pkg_hooks "do-extract"
# Run do-extract hooks
run_pkg_hooks "do-extract"
fi
touch -f $XBPS_EXTRACT_DONE
# If template defines post_extract(), use it.
if declare -f post_extract >/dev/null; then
run_func post_extract
run_func post_extract
fi
# Run post-extract hooks

View File

@ -1,12 +1,14 @@
#!/bin/bash
#
# vim: set ts=4 sw=4 et:
#
# Passed arguments:
# $1 - pkgname [REQUIRED]
# $2 - cross target [OPTIONAL]
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
fi
PKGNAME="$1"
@ -15,19 +17,19 @@ XBPS_CROSS_BUILD="$2"
. $XBPS_SHUTILSDIR/common.sh
for f in $XBPS_COMMONDIR/helpers/*.sh; do
source_file "$f"
source_file "$f"
done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/fetch/*.sh; do
source_file "$f"
source_file "$f"
done
XBPS_FETCH_DONE="$wrksrc/.xbps_fetch_done"
if [ -f "$XBPS_FETCH_DONE" ]; then
exit 0
exit 0
fi
# Run pre-fetch hooks.
@ -35,23 +37,23 @@ run_pkg_hooks pre-fetch
# If template defines pre_fetch(), use it.
if declare -f pre_fetch >/dev/null; then
run_func pre_fetch
run_func pre_fetch
fi
# If template defines do_fetch(), use it rather than the hooks.
if declare -f do_fetch >/dev/null; then
cd ${XBPS_BUILDDIR}
[ -n "$build_wrksrc" ] && mkdir -p "$wrksrc"
run_func do_fetch
touch -f $XBPS_FETCH_DONE
cd ${XBPS_BUILDDIR}
[ -n "$build_wrksrc" ] && mkdir -p "$wrksrc"
run_func do_fetch
touch -f $XBPS_FETCH_DONE
else
# Run do-fetch hooks.
run_pkg_hooks "do-fetch"
# Run do-fetch hooks.
run_pkg_hooks "do-fetch"
fi
# if templates defines post_fetch(), use it.
if declare -f post_fetch >/dev/null; then
run_func post_fetch
run_func post_fetch
fi
# Run post-fetch hooks.

View File

@ -1,12 +1,14 @@
#!//bin/bash
#
# vim: set ts=4 sw=4 et:
#
# Passed arguments:
# $1 - pkgname [REQUIRED]
# $2 - cross target [OPTIONAL]
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
fi
PKGNAME="$1"
@ -15,13 +17,13 @@ XBPS_CROSS_BUILD="$2"
. $XBPS_SHUTILSDIR/common.sh
for f in $XBPS_COMMONDIR/helpers/*.sh; do
source_file "$f"
source_file "$f"
done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/install/*.sh; do
source_file "$f"
source_file "$f"
done
XBPS_INSTALL_DONE="$wrksrc/.xbps_${pkgname}_${XBPS_CROSS_BUILD}_install_done"
@ -29,51 +31,51 @@ XBPS_PRE_INSTALL_DONE="$wrksrc/.xbps_${pkgname}_${XBPS_CROSS_BUILD}_pre_install_
XBPS_POST_INSTALL_DONE="$wrksrc/.xbps_${pkgname}_${XBPS_CROSS_BUILD}_post_install_done"
if [ -f $XBPS_INSTALL_DONE ]; then
exit 0
exit 0
fi
mkdir -p $XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/$pkgname-$version
cd $wrksrc || msg_error "$pkgver: cannot access to wrksrc [$wrksrc]\n"
if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc \
|| msg_error "$pkgver: cannot access to build_wrksrc [$build_wrksrc]\n"
cd $build_wrksrc \
|| msg_error "$pkgver: cannot access to build_wrksrc [$build_wrksrc]\n"
fi
run_pkg_hooks pre-install
# Run pre_install()
if [ ! -f $XBPS_PRE_INSTALL_DONE ]; then
if declare -f pre_install >/dev/null; then
run_func pre_install
touch -f $XBPS_PRE_INSTALL_DONE
fi
if declare -f pre_install >/dev/null; then
run_func pre_install
touch -f $XBPS_PRE_INSTALL_DONE
fi
fi
# Run do_install()
if [ ! -f $XBPS_INSTALL_DONE ]; then
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f do_install >/dev/null; then
run_func do_install
else
if [ ! -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
msg_error "$pkgver: cannot find build helper $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
fi
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
run_func do_install
fi
touch -f $XBPS_INSTALL_DONE
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f do_install >/dev/null; then
run_func do_install
else
if [ ! -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
msg_error "$pkgver: cannot find build helper $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
fi
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
run_func do_install
fi
touch -f $XBPS_INSTALL_DONE
fi
# Run post_install()
if [ ! -f $XBPS_POST_INSTALL_DONE ]; then
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f post_install >/dev/null; then
run_func post_install
touch -f $XBPS_POST_INSTALL_DONE
fi
cd $wrksrc
[ -n "$build_wrksrc" ] && cd $build_wrksrc
if declare -f post_install >/dev/null; then
run_func post_install
touch -f $XBPS_POST_INSTALL_DONE
fi
fi
exit 0

View File

@ -1,12 +1,14 @@
#!//bin/bash
#
# vim: set ts=4 sw=4 et:
#
# Passed arguments:
# $1 - pkgname [REQUIRED]
# $2 - cross target [OPTIONAL]
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
echo "$(basename $0): invalid number of arguments: pkgname [cross-target]"
exit 1
fi
PKGNAME="$1"
@ -15,42 +17,42 @@ XBPS_CROSS_BUILD="$2"
. $XBPS_SHUTILSDIR/common.sh
for f in $XBPS_COMMONDIR/helpers/*.sh; do
source_file "$f"
source_file "$f"
done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/install/*.sh; do
source_file "$f"
source_file "$f"
done
XBPS_PKG_DONE="$wrksrc/.xbps_${PKGNAME}_${XBPS_CROSS_BUILD}_pkg_done"
if [ -f $XBPS_PKG_DONE ]; then
exit 0
exit 0
fi
#
# Always remove metadata files generated in a previous installation.
#
for f in INSTALL REMOVE files.plist props.plist rdeps shlib-provides shlib-requires; do
[ -f ${PKGDESTDIR}/${f} ] && rm -f ${PKGDESTDIR}/${f}
[ -f ${PKGDESTDIR}/${f} ] && rm -f ${PKGDESTDIR}/${f}
done
# If it's a subpkg execute the pkg_install() function.
if [ "$sourcepkg" != "$PKGNAME" ]; then
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
${PKGNAME}_package
pkgname=$PKGNAME
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
${PKGNAME}_package
pkgname=$PKGNAME
install -d $PKGDESTDIR
if declare -f pkg_install >/dev/null; then
export XBPS_PKGDESTDIR=1
run_func pkg_install
fi
install -d $PKGDESTDIR
if declare -f pkg_install >/dev/null; then
export XBPS_PKGDESTDIR=1
run_func pkg_install
fi
fi
setup_pkg_depends $pkgname

View File

@ -1,13 +1,15 @@
#!/bin/bash
#
# vim: set ts=4 sw=4 et:
#
# Passed arguments:
# $1 - pkgname [REQUIRED]
# $2 - path to local repository [REQUIRED]
# $3 - cross-target [OPTIONAL]
if [ $# -lt 2 -o $# -gt 3 ]; then
echo "$(basename $0): invalid number of arguments: pkgname repository [cross-target]"
exit 1
echo "$(basename $0): invalid number of arguments: pkgname repository [cross-target]"
exit 1
fi
PKGNAME="$1"
@ -17,27 +19,27 @@ XBPS_CROSS_BUILD="$3"
. $XBPS_SHUTILSDIR/common.sh
for f in $XBPS_COMMONDIR/helpers/*.sh; do
source_file "$f"
source_file "$f"
done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/pkg/*.sh; do
source_file "$f"
source_file "$f"
done
if [ "$sourcepkg" != "$PKGNAME" ]; then
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
${PKGNAME}_package
pkgname=$PKGNAME
${PKGNAME}_package
pkgname=$PKGNAME
fi
if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
export XBPS_ARCH=$(cat $XBPS_MASTERDIR/.xbps_chroot_init)
export XBPS_ARCH=$(cat $XBPS_MASTERDIR/.xbps_chroot_init)
fi
# Run pre-pkg hooks.

View File

@ -1,4 +1,4 @@
# -*-* shell *-*-
# vim: set ts=4 sw=4 et:
#
# Install a required package dependency, like:
#
@ -8,32 +8,32 @@
# Any other error number otherwise.
#
install_pkg_from_repos() {
local pkg="$1" cross="$2" rval= tmplogf=
local pkg="$1" cross="$2" rval= tmplogf=
tmplogf=$(mktemp)
if [ -n "$cross" ]; then
$FAKEROOT_CMD $XBPS_INSTALL_XCMD -Ayd "$pkg" >$tmplogf 2>&1
else
$FAKEROOT_CMD $XBPS_INSTALL_CMD -Ayd "$pkg" >$tmplogf 2>&1
fi
rval=$?
if [ $rval -ne 0 -a $rval -ne 17 ]; then
# xbps-install can return:
#
# SUCCESS (0): package installed successfully.
# ENOENT (2): package missing in repositories.
# EEXIST (17): package already installed.
# ENODEV (19): package depends on missing dependencies.
# ENOTSUP (95): no repositories registered.
#
[ -z "$XBPS_KEEP_ALL" ] && remove_pkg_autodeps
msg_red "$pkgver: failed to install '$1' dependency! (error $rval)\n"
cat $tmplogf && rm -f $tmplogf
msg_error "Please see above for the real error, exiting...\n"
fi
rm -f $tmplogf
[ $rval -eq 17 ] && rval=0
return $rval
tmplogf=$(mktemp)
if [ -n "$cross" ]; then
$FAKEROOT_CMD $XBPS_INSTALL_XCMD -Ayd "$pkg" >$tmplogf 2>&1
else
$FAKEROOT_CMD $XBPS_INSTALL_CMD -Ayd "$pkg" >$tmplogf 2>&1
fi
rval=$?
if [ $rval -ne 0 -a $rval -ne 17 ]; then
# xbps-install can return:
#
# SUCCESS (0): package installed successfully.
# ENOENT (2): package missing in repositories.
# EEXIST (17): package already installed.
# ENODEV (19): package depends on missing dependencies.
# ENOTSUP (95): no repositories registered.
#
[ -z "$XBPS_KEEP_ALL" ] && remove_pkg_autodeps
msg_red "$pkgver: failed to install '$1' dependency! (error $rval)\n"
cat $tmplogf && rm -f $tmplogf
msg_error "Please see above for the real error, exiting...\n"
fi
rm -f $tmplogf
[ $rval -eq 17 ] && rval=0
return $rval
}
#
@ -41,208 +41,208 @@ install_pkg_from_repos() {
# package, 1 if no match and 2 if not installed.
#
check_pkgdep_matched() {
local pkg="$1" cross="$2" uhelper= pkgn= iver=
local pkg="$1" cross="$2" uhelper= pkgn= iver=
[ "$build_style" = "meta" ] && return 2
[ -z "$pkg" ] && return 255
[ "$build_style" = "meta" ] && return 2
[ -z "$pkg" ] && return 255
pkgn="$($XBPS_UHELPER_CMD getpkgdepname ${pkg})"
if [ -z "$pkgn" ]; then
pkgn="$($XBPS_UHELPER_CMD getpkgname ${pkg})"
fi
[ -z "$pkgn" ] && return 255
pkgn="$($XBPS_UHELPER_CMD getpkgdepname ${pkg})"
if [ -z "$pkgn" ]; then
pkgn="$($XBPS_UHELPER_CMD getpkgname ${pkg})"
fi
[ -z "$pkgn" ] && return 255
if [ -n "$cross" ]; then
uhelper="$XBPS_UHELPER_XCMD"
else
uhelper="$XBPS_UHELPER_CMD"
fi
if [ -n "$cross" ]; then
uhelper="$XBPS_UHELPER_XCMD"
else
uhelper="$XBPS_UHELPER_CMD"
fi
iver="$($uhelper version $pkgn)"
if [ $? -eq 0 -a -n "$iver" ]; then
$XBPS_UHELPER_CMD pkgmatch "${pkgn}-${iver}" "${pkg}"
[ $? -eq 1 ] && return 0
else
return 2
fi
iver="$($uhelper version $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
return 1
}
#
# Installs all dependencies required by a package.
#
install_pkg_deps() {
local pkg="$1" cross="$2" i rval _realpkg curpkgdepname pkgn iver _props _exact
local pkg="$1" cross="$2" i rval _realpkg curpkgdepname pkgn iver _props _exact
local -a host_binpkg_deps binpkg_deps
local -a host_missing_deps missing_deps
local -a host_binpkg_deps binpkg_deps
local -a host_missing_deps missing_deps
[ -z "$pkgname" ] && return 2
[ -z "$pkgname" ] && return 2
setup_pkg_depends
setup_pkg_depends
if [ -z "$build_depends" -a -z "$host_build_depends" ]; then
return 0
fi
if [ -z "$build_depends" -a -z "$host_build_depends" ]; then
return 0
fi
msg_normal "$pkgver: required dependencies:\n"
msg_normal "$pkgver: required dependencies:\n"
#
# Host build dependencies.
#
for i in ${host_build_depends}; do
_realpkg="${i%\?*}"
pkgn=$($XBPS_UHELPER_CMD getpkgdepname "${_realpkg}")
if [ -z "$pkgn" ]; then
pkgn=$($XBPS_UHELPER_CMD getpkgname "${_realpkg}")
if [ -z "$pkgn" ]; then
msg_error "$pkgver: invalid build dependency: ${i}\n"
fi
_exact=1
fi
check_pkgdep_matched "${_realpkg}"
local rval=$?
if [ $rval -eq 0 ]; then
iver=$($XBPS_UHELPER_CMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [host] ${_realpkg}: found '$pkgn-$iver'."
continue
fi
elif [ $rval -eq 1 ]; then
iver=$($XBPS_UHELPER_CMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [host] ${_realpkg}: installed ${iver} (unresolved) removing..."
$FAKEROOT_CMD $XBPS_REMOVE_CMD -iyf $pkgn >/dev/null 2>&1
fi
else
if [ -n "${_exact}" ]; then
unset _exact
_props=$($XBPS_QUERY_CMD -R -ppkgver,repository "${pkgn}" 2>/dev/null)
else
_props=$($XBPS_QUERY_CMD -R -ppkgver,repository "${_realpkg}" 2>/dev/null)
fi
if [ -n "${_props}" ]; then
set -- ${_props}
$XBPS_UHELPER_CMD pkgmatch ${1} "${_realpkg}"
if [ $? -eq 1 ]; then
echo " [host] ${_realpkg}: found $1 in $2."
host_binpkg_deps+=("$1")
shift 2
continue
else
echo " [host] ${_realpkg}: not found."
fi
shift 2
else
echo " [host] ${_realpkg}: not found."
fi
fi
host_missing_deps+=("${_realpkg}")
done
#
# Host build dependencies.
#
for i in ${host_build_depends}; do
_realpkg="${i%\?*}"
pkgn=$($XBPS_UHELPER_CMD getpkgdepname "${_realpkg}")
if [ -z "$pkgn" ]; then
pkgn=$($XBPS_UHELPER_CMD getpkgname "${_realpkg}")
if [ -z "$pkgn" ]; then
msg_error "$pkgver: invalid build dependency: ${i}\n"
fi
_exact=1
fi
check_pkgdep_matched "${_realpkg}"
local rval=$?
if [ $rval -eq 0 ]; then
iver=$($XBPS_UHELPER_CMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [host] ${_realpkg}: found '$pkgn-$iver'."
continue
fi
elif [ $rval -eq 1 ]; then
iver=$($XBPS_UHELPER_CMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [host] ${_realpkg}: installed ${iver} (unresolved) removing..."
$FAKEROOT_CMD $XBPS_REMOVE_CMD -iyf $pkgn >/dev/null 2>&1
fi
else
if [ -n "${_exact}" ]; then
unset _exact
_props=$($XBPS_QUERY_CMD -R -ppkgver,repository "${pkgn}" 2>/dev/null)
else
_props=$($XBPS_QUERY_CMD -R -ppkgver,repository "${_realpkg}" 2>/dev/null)
fi
if [ -n "${_props}" ]; then
set -- ${_props}
$XBPS_UHELPER_CMD pkgmatch ${1} "${_realpkg}"
if [ $? -eq 1 ]; then
echo " [host] ${_realpkg}: found $1 in $2."
host_binpkg_deps+=("$1")
shift 2
continue
else
echo " [host] ${_realpkg}: not found."
fi
shift 2
else
echo " [host] ${_realpkg}: not found."
fi
fi
host_missing_deps+=("${_realpkg}")
done
#
# Target build dependencies.
#
for i in ${build_depends}; do
_realpkg="${i%\?*}"
pkgn=$($XBPS_UHELPER_CMD getpkgdepname "${_realpkg}")
if [ -z "$pkgn" ]; then
pkgn=$($XBPS_UHELPER_CMD getpkgname "${_realpkg}")
if [ -z "$pkgn" ]; then
msg_error "$pkgver: invalid build dependency: ${_realpkg}\n"
fi
_exact=1
fi
check_pkgdep_matched "${_realpkg}" $cross
local rval=$?
if [ $rval -eq 0 ]; then
iver=$($XBPS_UHELPER_XCMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [target] ${_realpkg}: found '$pkgn-$iver'."
continue
fi
elif [ $rval -eq 1 ]; then
iver=$($XBPS_UHELPER_XCMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [target] ${_realpkg}: installed ${iver} (unresolved) removing..."
$XBPS_REMOVE_XCMD -iyf $pkgn >/dev/null 2>&1
fi
else
if [ -n "${_exact}" ]; then
unset _exact
_props=$($XBPS_QUERY_XCMD -R -ppkgver,repository "${pkgn}" 2>/dev/null)
else
_props=$($XBPS_QUERY_XCMD -R -ppkgver,repository "${_realpkg}" 2>/dev/null)
fi
if [ -n "${_props}" ]; then
set -- ${_props}
$XBPS_UHELPER_CMD pkgmatch ${1} "${_realpkg}"
if [ $? -eq 1 ]; then
echo " [target] ${_realpkg}: found $1 in $2."
binpkg_deps+=("$1")
shift 2
continue
else
echo " [target] ${_realpkg}: not found."
fi
shift 2
else
echo " [target] ${_realpkg}: not found."
fi
fi
missing_deps+=("${_realpkg}")
done
#
# Target build dependencies.
#
for i in ${build_depends}; do
_realpkg="${i%\?*}"
pkgn=$($XBPS_UHELPER_CMD getpkgdepname "${_realpkg}")
if [ -z "$pkgn" ]; then
pkgn=$($XBPS_UHELPER_CMD getpkgname "${_realpkg}")
if [ -z "$pkgn" ]; then
msg_error "$pkgver: invalid build dependency: ${_realpkg}\n"
fi
_exact=1
fi
check_pkgdep_matched "${_realpkg}" $cross
local rval=$?
if [ $rval -eq 0 ]; then
iver=$($XBPS_UHELPER_XCMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [target] ${_realpkg}: found '$pkgn-$iver'."
continue
fi
elif [ $rval -eq 1 ]; then
iver=$($XBPS_UHELPER_XCMD version "${pkgn}")
if [ $? -eq 0 -a -n "$iver" ]; then
echo " [target] ${_realpkg}: installed ${iver} (unresolved) removing..."
$XBPS_REMOVE_XCMD -iyf $pkgn >/dev/null 2>&1
fi
else
if [ -n "${_exact}" ]; then
unset _exact
_props=$($XBPS_QUERY_XCMD -R -ppkgver,repository "${pkgn}" 2>/dev/null)
else
_props=$($XBPS_QUERY_XCMD -R -ppkgver,repository "${_realpkg}" 2>/dev/null)
fi
if [ -n "${_props}" ]; then
set -- ${_props}
$XBPS_UHELPER_CMD pkgmatch ${1} "${_realpkg}"
if [ $? -eq 1 ]; then
echo " [target] ${_realpkg}: found $1 in $2."
binpkg_deps+=("$1")
shift 2
continue
else
echo " [target] ${_realpkg}: not found."
fi
shift 2
else
echo " [target] ${_realpkg}: not found."
fi
fi
missing_deps+=("${_realpkg}")
done
# Host missing dependencies, build from srcpkgs.
for i in ${host_missing_deps[@]}; do
curpkgdepname=$($XBPS_UHELPER_CMD getpkgdepname "$i")
setup_pkg $curpkgdepname
${XBPS_UHELPER_CMD} pkgmatch "$pkgver" "$i"
if [ $? -eq 0 ]; then
setup_pkg $XBPS_TARGET_PKG
msg_error_nochroot "$pkgver: required host dependency '$i' cannot be resolved!\n"
fi
install_pkg full
setup_pkg $XBPS_TARGET_PKG $XBPS_CROSS_BUILD
install_pkg_deps $sourcepkg $XBPS_CROSS_BUILD
done
# Host missing dependencies, build from srcpkgs.
for i in ${host_missing_deps[@]}; do
curpkgdepname=$($XBPS_UHELPER_CMD getpkgdepname "$i")
setup_pkg $curpkgdepname
${XBPS_UHELPER_CMD} pkgmatch "$pkgver" "$i"
if [ $? -eq 0 ]; then
setup_pkg $XBPS_TARGET_PKG
msg_error_nochroot "$pkgver: required host dependency '$i' cannot be resolved!\n"
fi
install_pkg full
setup_pkg $XBPS_TARGET_PKG $XBPS_CROSS_BUILD
install_pkg_deps $sourcepkg $XBPS_CROSS_BUILD
done
# Target missing dependencies, build from srcpkgs.
for i in ${missing_deps[@]}; do
# packages not found in repos, install from source.
curpkgdepname=$($XBPS_UHELPER_CMD getpkgdepname "$i")
setup_pkg $curpkgdepname $cross
# Check if version in srcpkg satisfied required dependency,
# and bail out if doesn't.
$XBPS_UHELPER_CMD pkgmatch "$pkgver" "$i"
if [ $? -eq 0 ]; then
setup_pkg $XBPS_TARGET_PKG $cross
msg_error_nochroot "$pkgver: required target dependency '$i' cannot be resolved!\n"
fi
install_pkg full $cross
setup_pkg $XBPS_TARGET_PKG $XBPS_CROSS_BUILD
install_pkg_deps $sourcepkg $XBPS_CROSS_BUILD
done
# Target missing dependencies, build from srcpkgs.
for i in ${missing_deps[@]}; do
# packages not found in repos, install from source.
curpkgdepname=$($XBPS_UHELPER_CMD getpkgdepname "$i")
setup_pkg $curpkgdepname $cross
# Check if version in srcpkg satisfied required dependency,
# and bail out if doesn't.
$XBPS_UHELPER_CMD pkgmatch "$pkgver" "$i"
if [ $? -eq 0 ]; then
setup_pkg $XBPS_TARGET_PKG $cross
msg_error_nochroot "$pkgver: required target dependency '$i' cannot be resolved!\n"
fi
install_pkg full $cross
setup_pkg $XBPS_TARGET_PKG $XBPS_CROSS_BUILD
install_pkg_deps $sourcepkg $XBPS_CROSS_BUILD
done
if [ "$TARGETPKG_PKGDEPS_DONE" ]; then
return 0
fi
if [ "$TARGETPKG_PKGDEPS_DONE" ]; then
return 0
fi
for i in ${host_binpkg_deps[@]}; do
msg_normal "$pkgver: installing host dependency '$i' ...\n"
install_pkg_from_repos "${i}"
done
for i in ${host_binpkg_deps[@]}; do
msg_normal "$pkgver: installing host dependency '$i' ...\n"
install_pkg_from_repos "${i}"
done
for i in ${binpkg_deps[@]}; do
if [ -n "$CHROOT_READY" -a "$build_style" = "meta" ]; then
continue
fi
msg_normal "$pkgver: installing target dependency '$i' ...\n"
install_pkg_from_repos "$i" $cross
done
for i in ${binpkg_deps[@]}; do
if [ -n "$CHROOT_READY" -a "$build_style" = "meta" ]; then
continue
fi
msg_normal "$pkgver: installing target dependency '$i' ...\n"
install_pkg_from_repos "$i" $cross
done
if [ "$XBPS_TARGET_PKG" = "$sourcepkg" ]; then
TARGETPKG_PKGDEPS_DONE=1
fi
if [ "$XBPS_TARGET_PKG" = "$sourcepkg" ]; then
TARGETPKG_PKGDEPS_DONE=1
fi
}

View File

@ -1,9 +1,9 @@
# -*-* shell *-*-
# vim: set ts=4 sw=4 et:
chroot_init() {
XBPSSRC_CF=$XBPS_MASTERDIR/etc/xbps/xbps-src.conf
XBPSSRC_CF=$XBPS_MASTERDIR/etc/xbps/xbps-src.conf
cat > $XBPSSRC_CF <<_EOF
cat > $XBPSSRC_CF <<_EOF
# Generated configuration file by xbps-src, DO NOT EDIT!
XBPS_MASTERDIR=/
XBPS_CFLAGS="$XBPS_CFLAGS"
@ -11,30 +11,30 @@ XBPS_CXXFLAGS="$XBPS_CXXFLAGS"
XBPS_CPPFLAGS="$XBPS_CPPFLAGS"
XBPS_LDFLAGS="$XBPS_LDFLAGS"
_EOF
if [ -n "$XBPS_MAKEJOBS" ]; then
echo "XBPS_MAKEJOBS=$XBPS_MAKEJOBS" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_HOSTDIR" ]; then
echo "XBPS_HOSTDIR=/host" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_CCACHE" ]; then
echo "XBPS_CCACHE=$XBPS_CCACHE" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_DISTCC" ]; then
echo "XBPS_DISTCC=$XBPS_DISTCC" >> $XBPSSRC_CF
echo "XBPS_DISTCC_HOSTS=\"${XBPS_DISTCC_HOSTS}\"" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_USE_GIT_REVS" ]; then
echo "XBPS_USE_GIT_REVS=yes" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_DEBUG_PKGS" ]; then
echo "XBPS_DEBUG_PKGS=yes" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_MAKEJOBS" ]; then
echo "XBPS_MAKEJOBS=$XBPS_MAKEJOBS" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_HOSTDIR" ]; then
echo "XBPS_HOSTDIR=/host" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_CCACHE" ]; then
echo "XBPS_CCACHE=$XBPS_CCACHE" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_DISTCC" ]; then
echo "XBPS_DISTCC=$XBPS_DISTCC" >> $XBPSSRC_CF
echo "XBPS_DISTCC_HOSTS=\"${XBPS_DISTCC_HOSTS}\"" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_USE_GIT_REVS" ]; then
echo "XBPS_USE_GIT_REVS=yes" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_DEBUG_PKGS" ]; then
echo "XBPS_DEBUG_PKGS=yes" >> $XBPSSRC_CF
fi
echo "# End of configuration file." >> $XBPSSRC_CF
echo "# End of configuration file." >> $XBPSSRC_CF
# Create custom script to start the chroot bash shell.
cat > $XBPS_MASTERDIR/bin/xbps-shell <<_EOF
# Create custom script to start the chroot bash shell.
cat > $XBPS_MASTERDIR/bin/xbps-shell <<_EOF
#!/bin/sh
XBPS_SRC_VERSION="$XBPS_SRC_VERSION"
@ -44,161 +44,160 @@ XBPS_SRC_VERSION="$XBPS_SRC_VERSION"
PATH=/xbps-packages:/usr/bin:/usr/sbin
exec env -i PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/distcc" @@XARCH@@ \
CCACHE_DIR="/ccache" IN_CHROOT=1 LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h
CCACHE_DIR="/ccache" IN_CHROOT=1 LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h
_EOF
if [ -n "$XBPS_ARCH" ]; then
sed -e "s,@@XARCH@@,XBPS_ARCH=${XBPS_ARCH},g" -i $XBPS_MASTERDIR/bin/xbps-shell
else
sed -e 's,@@XARCH@@,,g' -i $XBPS_MASTERDIR/bin/xbps-shell
fi
chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
if [ -n "$XBPS_ARCH" ]; then
sed -e "s,@@XARCH@@,XBPS_ARCH=${XBPS_ARCH},g" -i $XBPS_MASTERDIR/bin/xbps-shell
else
sed -e 's,@@XARCH@@,,g' -i $XBPS_MASTERDIR/bin/xbps-shell
fi
chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
cp -f /etc/resolv.conf $XBPS_MASTERDIR/etc
cp -f /etc/resolv.conf $XBPS_MASTERDIR/etc
# Update xbps alternative repository if set.
mkdir -p $XBPS_MASTERDIR/etc/xbps/repos
if [ -n "$XBPS_ALT_REPOSITORY" ]; then
( \
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}"; \
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}/nonfree"; \
) > $XBPS_MASTERDIR/etc/xbps/repos/alternative.conf
else
: > $XBPS_MASTERDIR/etc/xbps/repos/alternative.conf
fi
# Update xbps alternative repository if set.
mkdir -p $XBPS_MASTERDIR/etc/xbps/repos
if [ -n "$XBPS_ALT_REPOSITORY" ]; then
( \
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}"; \
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}/nonfree"; \
) > $XBPS_MASTERDIR/etc/xbps/repos/alternative.conf
else
: > $XBPS_MASTERDIR/etc/xbps/repos/alternative.conf
fi
}
chroot_prepare() {
local f=
local f=
if [ -f $XBPS_MASTERDIR/.xbps_chroot_init ]; then
return 0
elif [ ! -f $XBPS_MASTERDIR/bin/bash ]; then
msg_error "Bootstrap not installed in $XBPS_MASTERDIR, can't continue.\n"
fi
if [ -f $XBPS_MASTERDIR/.xbps_chroot_init ]; then
return 0
elif [ ! -f $XBPS_MASTERDIR/bin/bash ]; then
msg_error "Bootstrap not installed in $XBPS_MASTERDIR, can't continue.\n"
fi
# Create some required files.
cp -f /etc/services $XBPS_MASTERDIR/etc
[ -f /etc/localtime ] && cp -f /etc/localtime $XBPS_MASTERDIR/etc
# Create some required files.
cp -f /etc/services $XBPS_MASTERDIR/etc
[ -f /etc/localtime ] && cp -f /etc/localtime $XBPS_MASTERDIR/etc
for f in dev sys proc host boot; do
[ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
done
for f in dev sys proc host boot; do
[ ! -d $XBPS_MASTERDIR/$f ] && mkdir -p $XBPS_MASTERDIR/$f
done
# Copy /etc/passwd and /etc/group from base-files.
cp -f $XBPS_SRCPKGDIR/base-files/files/passwd $XBPS_MASTERDIR/etc
echo "$(whoami):x:$(id -u):$(id -g):$(whoami) user:/tmp:/bin/xbps-shell" \
>> $XBPS_MASTERDIR/etc/passwd
cp -f $XBPS_SRCPKGDIR/base-files/files/group $XBPS_MASTERDIR/etc
echo "$(whoami):x:$(id -g):" >> $XBPS_MASTERDIR/etc/group
# Copy /etc/passwd and /etc/group from base-files.
cp -f $XBPS_SRCPKGDIR/base-files/files/passwd $XBPS_MASTERDIR/etc
echo "$(whoami):x:$(id -u):$(id -g):$(whoami) user:/tmp:/bin/xbps-shell" \
>> $XBPS_MASTERDIR/etc/passwd
cp -f $XBPS_SRCPKGDIR/base-files/files/group $XBPS_MASTERDIR/etc
echo "$(whoami):x:$(id -g):" >> $XBPS_MASTERDIR/etc/group
# Copy /etc/hosts from base-files.
cp -f $XBPS_SRCPKGDIR/base-files/files/hosts $XBPS_MASTERDIR/etc
# Copy /etc/hosts from base-files.
cp -f $XBPS_SRCPKGDIR/base-files/files/hosts $XBPS_MASTERDIR/etc
rm -f $XBPS_MASTERDIR/etc/xbps/xbps.conf
rm -f $XBPS_MASTERDIR/etc/xbps/xbps.conf
# Prepare default locale: en_US.UTF-8.
if [ -s ${XBPS_MASTERDIR}/etc/default/libc-locales ]; then
echo 'en_US.UTF-8 UTF-8' >> ${XBPS_MASTERDIR}/etc/default/libc-locales
$XBPS_RECONFIGURE_CMD -f glibc-locales
fi
# Prepare default locale: en_US.UTF-8.
if [ -s ${XBPS_MASTERDIR}/etc/default/libc-locales ]; then
echo 'en_US.UTF-8 UTF-8' >> ${XBPS_MASTERDIR}/etc/default/libc-locales
$XBPS_RECONFIGURE_CMD -f glibc-locales
fi
touch -f $XBPS_MASTERDIR/.xbps_chroot_init
[ -n "$1" ] && echo $1 >> $XBPS_MASTERDIR/.xbps_chroot_init
touch -f $XBPS_MASTERDIR/.xbps_chroot_init
[ -n "$1" ] && echo $1 >> $XBPS_MASTERDIR/.xbps_chroot_init
return 0
return 0
}
chroot_sync_repos() {
local f=
local f=
# Copy xbps configuration files to the masterdir.
if [ ! -f ${XBPS_MASTERDIR}/etc/xbps/xbps.conf ]; then
install -Dm644 ${XBPS_COMMONDIR}/xbps-src/chroot/xbps.conf \
${XBPS_MASTERDIR}/etc/xbps/xbps.conf
fi
if [ ! -f ${XBPS_MASTERDIR}/etc/xbps/repos/local.conf ]; then
install -Dm644 ${XBPS_COMMONDIR}/xbps-src/chroot/repos-local.conf \
${XBPS_MASTERDIR}/etc/xbps/repos/local.conf
fi
if [ ! -f ${XBPS_MASTERDIR}/etc/xbps/repos/remote.conf ]; then
install -Dm644 ${XBPS_COMMONDIR}/xbps-src/chroot/repos-remote.conf \
${XBPS_MASTERDIR}/etc/xbps/repos/remote.conf
fi
# Copy xbps configuration files to the masterdir.
if [ ! -f ${XBPS_MASTERDIR}/etc/xbps/xbps.conf ]; then
install -Dm644 ${XBPS_COMMONDIR}/xbps-src/chroot/xbps.conf \
${XBPS_MASTERDIR}/etc/xbps/xbps.conf
fi
if [ ! -f ${XBPS_MASTERDIR}/etc/xbps/repos/local.conf ]; then
install -Dm644 ${XBPS_COMMONDIR}/xbps-src/chroot/repos-local.conf \
${XBPS_MASTERDIR}/etc/xbps/repos/local.conf
fi
if [ ! -f ${XBPS_MASTERDIR}/etc/xbps/repos/remote.conf ]; then
install -Dm644 ${XBPS_COMMONDIR}/xbps-src/chroot/repos-remote.conf \
${XBPS_MASTERDIR}/etc/xbps/repos/remote.conf
fi
# if -N is set, comment out remote repositories from xbps.conf.
if [ -n "$XBPS_SKIP_REMOTEREPOS" ]; then
sed -e 's,^.*\(include=/etc/xbps/repos/remote.conf$\),#\1,' \
-i ${XBPS_MASTERDIR}/etc/xbps/xbps.conf
else
sed -e 's,^#.*\(include=/etc/xbps/repos/remote.conf$\),\1,' \
-i ${XBPS_MASTERDIR}/etc/xbps/xbps.conf
# Make sure to sync index for remote repositories.
$CHROOT_CMD $XBPS_MASTERDIR /usr/sbin/xbps-install -S
if [ -n "$XBPS_CROSS_BUILD" ]; then
# Copy host keys to the target rootdir.
if [ ! -d $XBPS_MASTERDIR/usr/$XBPS_CROSS_TRIPLET/var/db/xbps/keys ]; then
mkdir -p $XBPS_MASTERDIR/usr/$XBPS_CROSS_TRIPLET/var/db/xbps/keys
fi
cp -a $XBPS_MASTERDIR/var/db/xbps/keys/*.plist \
$XBPS_MASTERDIR/usr/$XBPS_CROSS_TRIPLET/var/db/xbps/keys
env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH \
$CHROOT_CMD $XBPS_MASTERDIR /usr/sbin/xbps-install \
-r /usr/$XBPS_CROSS_TRIPLET -S
fi
fi
# if -N is set, comment out remote repositories from xbps.conf.
if [ -n "$XBPS_SKIP_REMOTEREPOS" ]; then
sed -e 's,^.*\(include=/etc/xbps/repos/remote.conf$\),#\1,' \
-i ${XBPS_MASTERDIR}/etc/xbps/xbps.conf
else
sed -e 's,^#.*\(include=/etc/xbps/repos/remote.conf$\),\1,' \
-i ${XBPS_MASTERDIR}/etc/xbps/xbps.conf
# Make sure to sync index for remote repositories.
$CHROOT_CMD $XBPS_MASTERDIR /usr/sbin/xbps-install -S
if [ -n "$XBPS_CROSS_BUILD" ]; then
# Copy host keys to the target rootdir.
if [ ! -d $XBPS_MASTERDIR/usr/$XBPS_CROSS_TRIPLET/var/db/xbps/keys ]; then
mkdir -p $XBPS_MASTERDIR/usr/$XBPS_CROSS_TRIPLET/var/db/xbps/keys
fi
cp -a $XBPS_MASTERDIR/var/db/xbps/keys/*.plist \
$XBPS_MASTERDIR/usr/$XBPS_CROSS_TRIPLET/var/db/xbps/keys
env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH \
$CHROOT_CMD $XBPS_MASTERDIR /usr/sbin/xbps-install \
-r /usr/$XBPS_CROSS_TRIPLET -S
fi
fi
return 0
return 0
}
chroot_handler() {
local action="$1" pkg="$2" rv=0 arg= _envargs= _chargs=
local action="$1" pkg="$2" rv=0 arg= _envargs= _chargs=
# Debian uses /run/shm instead...
if [ -d /run/shm ]; then
mkdir -p ${XBPS_MASTERDIR}/run/shm
_chargs+=" -S /run/shm"
elif [ -d /dev/shm ]; then
mkdir -p ${XBPS_MASTERDIR}/dev/shm
_chargs+=" -S /dev/shm"
fi
# Debian uses /run/shm instead...
if [ -d /run/shm ]; then
mkdir -p ${XBPS_MASTERDIR}/run/shm
_chargs+=" -S /run/shm"
elif [ -d /dev/shm ]; then
mkdir -p ${XBPS_MASTERDIR}/dev/shm
_chargs+=" -S /dev/shm"
fi
if [ -n "$XBPS_HOSTDIR" ]; then
_chargs+=" -H $XBPS_HOSTDIR"
fi
if [ ! -d $XBPS_MASTERDIR/xbps-packages ]; then
mkdir -p $XBPS_MASTERDIR/xbps-packages
fi
_chargs+=" -D ${XBPS_DISTDIR}"
if [ -n "$XBPS_HOSTDIR" ]; then
_chargs+=" -H $XBPS_HOSTDIR"
fi
if [ ! -d $XBPS_MASTERDIR/xbps-packages ]; then
mkdir -p $XBPS_MASTERDIR/xbps-packages
fi
_chargs+=" -D ${XBPS_DISTDIR}"
[ -z "$action" -a -z "$pkg" ] && return 1
[ -z "$action" -a -z "$pkg" ] && return 1
case "$action" in
fetch|extract|build|configure|install|install-destdir|pkg|build-pkg|bootstrap-update|chroot)
chroot_prepare || return $?
chroot_init || return $?
chroot_sync_repos || return $?
;;
esac
case "$action" in
fetch|extract|build|configure|install|install-destdir|pkg|build-pkg|bootstrap-update|chroot)
chroot_prepare || return $?
chroot_init || return $?
chroot_sync_repos || return $?
;;
esac
if [ "$action" = "chroot" ]; then
$CHROOT_CMD ${_chargs} $XBPS_MASTERDIR /bin/xbps-shell || rv=$?
else
[ -n "$XBPS_BUILD_OPTS" ] && arg="$arg -o $XBPS_BUILD_OPTS"
[ -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_SKIP_DEPS" ] && arg="$arg -I"
[ -n "$XBPS_ALT_REPOSITORY" ] && arg="$arg -r $XBPS_ALT_REPOSITORY"
if [ "$action" = "chroot" ]; then
$CHROOT_CMD ${_chargs} $XBPS_MASTERDIR /bin/xbps-shell || rv=$?
else
[ -n "$XBPS_BUILD_OPTS" ] && arg="$arg -o $XBPS_BUILD_OPTS"
[ -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_SKIP_DEPS" ] && arg="$arg -I"
[ -n "$XBPS_ALT_REPOSITORY" ] && arg="$arg -r $XBPS_ALT_REPOSITORY"
action="$arg $action"
env -i PATH=/bin:/sbin:/usr/bin:/usr/sbin HOME=/tmp IN_CHROOT=1 LANG=en_US.UTF-8 \
$CHROOT_CMD ${_chargs} $XBPS_MASTERDIR /xbps-packages/xbps-src $action $pkg || rv=$?
fi
action="$arg $action"
env -i PATH=/bin:/sbin:/usr/bin:/usr/sbin HOME=/tmp IN_CHROOT=1 LANG=en_US.UTF-8 \
$CHROOT_CMD ${_chargs} $XBPS_MASTERDIR /xbps-packages/xbps-src $action $pkg || rv=$?
fi
return $rv
return $rv
}

View File

@ -1,541 +1,541 @@
# -*-* shell *-*-
# vim: set ts=4 sw=4 et:
run_func() {
local func="$1" desc="$2" restoretrap= logpipe= logfile= teepid=
local func="$1" desc="$2" restoretrap= logpipe= logfile= teepid=
if [ -d "${wrksrc}" ]; then
logpipe=$(mktemp -u --tmpdir=${wrksrc} .xbps_${XBPS_CROSS_BUILD}_XXXXXXXX.logpipe)
logfile=${wrksrc}/.xbps_${XBPS_CROSS_BUILD}_${func}.log
else
logpipe=$(mktemp -t -u .xbps_${XBPS_CROSS_BUILD}_${func}_${pkgname}_logpipe.XXXXXXX)
logfile=$(mktemp -t .xbps_${XBPS_CROSS_BUILD}_${func}_${pkgname}.log.XXXXXXXX)
fi
if [ -d "${wrksrc}" ]; then
logpipe=$(mktemp -u --tmpdir=${wrksrc} .xbps_${XBPS_CROSS_BUILD}_XXXXXXXX.logpipe)
logfile=${wrksrc}/.xbps_${XBPS_CROSS_BUILD}_${func}.log
else
logpipe=$(mktemp -t -u .xbps_${XBPS_CROSS_BUILD}_${func}_${pkgname}_logpipe.XXXXXXX)
logfile=$(mktemp -t .xbps_${XBPS_CROSS_BUILD}_${func}_${pkgname}.log.XXXXXXXX)
fi
msg_normal "${pkgver:-xbps-src}: running ${desc:-${func}} ...\n"
msg_normal "${pkgver:-xbps-src}: running ${desc:-${func}} ...\n"
set -E
restoretrap=$(trap -p ERR)
trap 'error_func $func $LINENO' ERR
set -E
restoretrap=$(trap -p ERR)
trap 'error_func $func $LINENO' ERR
mkfifo "$logpipe"
tee "$logfile" < "$logpipe" &
teepid=$!
mkfifo "$logpipe"
tee "$logfile" < "$logpipe" &
teepid=$!
$func &>"$logpipe"
$func &>"$logpipe"
wait $teepid
rm "$logpipe"
wait $teepid
rm "$logpipe"
eval "$restoretrap"
set +E
eval "$restoretrap"
set +E
}
error_func() {
if [ -n "$1" -a -n "$2" ]; then
msg_red "$pkgver: failed to run $1() at line $2.\n"
fi
exit 2
if [ -n "$1" -a -n "$2" ]; then
msg_red "$pkgver: failed to run $1() at line $2.\n"
fi
exit 2
}
msg_red() {
# error messages in bold/red
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
printf >&2 "=> ERROR: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
# error messages in bold/red
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
printf >&2 "=> ERROR: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
}
msg_red_nochroot() {
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
printf >&2 "$@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
printf >&2 "$@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
}
msg_error() {
msg_red "$@"
kill -INT $$; exit 1
msg_red "$@"
kill -INT $$; exit 1
}
msg_error_nochroot() {
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
printf >&2 "=> ERROR: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
exit 1
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
printf >&2 "=> ERROR: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
exit 1
}
msg_warn() {
# warn messages in bold/yellow
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[33m"
printf >&2 "=> WARNING: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
# warn messages in bold/yellow
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[33m"
printf >&2 "=> WARNING: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
}
msg_warn_nochroot() {
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[33m"
printf >&2 "=> WARNING: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[33m"
printf >&2 "=> WARNING: $@"
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
}
msg_normal() {
# normal messages in bold
[ -n "$NOCOLORS" ] || printf "\033[1m"
printf "=> $@"
[ -n "$NOCOLORS" ] || printf "\033[m"
# normal messages in bold
[ -n "$NOCOLORS" ] || printf "\033[1m"
printf "=> $@"
[ -n "$NOCOLORS" ] || printf "\033[m"
}
msg_normal_append() {
[ -n "$NOCOLORS" ] || printf "\033[1m"
printf "$@"
[ -n "$NOCOLORS" ] || printf "\033[m"
[ -n "$NOCOLORS" ] || printf "\033[1m"
printf "$@"
[ -n "$NOCOLORS" ] || printf "\033[m"
}
set_build_options() {
local f j opt optval _optsset
local -A options
local f j opt optval _optsset
local -A options
if [ -z "$build_options" ]; then
return 0
fi
if [ -z "$build_options" ]; then
return 0
fi
for f in ${build_options}; do
OIFS="$IFS"; IFS=','
for j in ${XBPS_BUILD_OPTS}; do
opt=${j#\~}
opt_disabled=${j:0:1}
if [ "$opt" = "$f" ]; then
if [ "$opt_disabled" != "~" ]; then
options[$opt]=1
else
options[$opt]=0
fi
fi
done
IFS="$OIFS"
done
for f in ${build_options}; do
OIFS="$IFS"; IFS=','
for j in ${XBPS_BUILD_OPTS}; do
opt=${j#\~}
opt_disabled=${j:0:1}
if [ "$opt" = "$f" ]; then
if [ "$opt_disabled" != "~" ]; then
options[$opt]=1
else
options[$opt]=0
fi
fi
done
IFS="$OIFS"
done
for f in ${build_options_default}; do
optval=${options[$f]}
if [[ -z "$optval" ]] || [[ $optval -eq 1 ]]; then
options[$f]=1
fi
done
for f in ${build_options_default}; do
optval=${options[$f]}
if [[ -z "$optval" ]] || [[ $optval -eq 1 ]]; then
options[$f]=1
fi
done
# Prepare final options.
for f in ${!options[@]}; do
optval=${options[$f]}
if [[ $optval -eq 1 ]]; then
eval build_option_${f}=1
fi
done
# Prepare final options.
for f in ${!options[@]}; do
optval=${options[$f]}
if [[ $optval -eq 1 ]]; then
eval build_option_${f}=1
fi
done
# Re-read pkg template to get conditional vars.
if [ -z "$XBPS_BUILD_OPTIONS_PARSED" ]; then
source_file $XBPS_SRCPKGDIR/$pkgname/template
XBPS_BUILD_OPTIONS_PARSED=1
unset PKG_BUILD_OPTIONS
set_build_options
return 0
fi
# Re-read pkg template to get conditional vars.
if [ -z "$XBPS_BUILD_OPTIONS_PARSED" ]; then
source_file $XBPS_SRCPKGDIR/$pkgname/template
XBPS_BUILD_OPTIONS_PARSED=1
unset PKG_BUILD_OPTIONS
set_build_options
return 0
fi
for f in ${build_options}; do
optval=${options[$f]}
if [[ $optval -eq 1 ]]; then
_optsset="${_optsset} ${f}"
else
_optsset="${_optsset} ~${f}"
fi
done
for f in ${build_options}; do
optval=${options[$f]}
if [[ $optval -eq 1 ]]; then
_optsset="${_optsset} ${f}"
else
_optsset="${_optsset} ~${f}"
fi
done
for f in ${_optsset}; do
if [ -z "$PKG_BUILD_OPTIONS" ]; then
PKG_BUILD_OPTIONS="$f"
else
PKG_BUILD_OPTIONS="$PKG_BUILD_OPTIONS $f"
fi
done
for f in ${_optsset}; do
if [ -z "$PKG_BUILD_OPTIONS" ]; then
PKG_BUILD_OPTIONS="$f"
else
PKG_BUILD_OPTIONS="$PKG_BUILD_OPTIONS $f"
fi
done
# Sort pkg build options alphabetically.
export PKG_BUILD_OPTIONS="$(echo "$PKG_BUILD_OPTIONS"|tr ' ' '\n'|sort|tr '\n' ' ')"
# Sort pkg build options alphabetically.
export PKG_BUILD_OPTIONS="$(echo "$PKG_BUILD_OPTIONS"|tr ' ' '\n'|sort|tr '\n' ' ')"
}
source_file() {
local f="$1"
local f="$1"
if [ ! -f "$f" -o ! -r "$f" ]; then
return 0
fi
if ! source "$f"; then
msg_error "xbps-src: failed to read $f!\n"
fi
if [ ! -f "$f" -o ! -r "$f" ]; then
return 0
fi
if ! source "$f"; then
msg_error "xbps-src: failed to read $f!\n"
fi
}
run_pkg_hooks() {
local phase="$1" hookn
local phase="$1" hookn
eval unset -f hook
for f in ${XBPS_COMMONDIR}/hooks/${phase}/*.sh; do
[ ! -r $f ] && continue
hookn=$(basename $f)
hookn=${hookn%.sh}
. $f
run_func hook "$phase hook: $hookn"
done
eval unset -f hook
for f in ${XBPS_COMMONDIR}/hooks/${phase}/*.sh; do
[ ! -r $f ] && continue
hookn=$(basename $f)
hookn=${hookn%.sh}
. $f
run_func hook "$phase hook: $hookn"
done
}
get_subpkgs() {
local args list
local args list
args="$(typeset -F|grep -E '_package$')"
set -- ${args}
while [ $# -gt 0 ]; do
list+=" ${3%_package}"; shift 3
done
for f in ${list}; do
echo "$f"
done
args="$(typeset -F|grep -E '_package$')"
set -- ${args}
while [ $# -gt 0 ]; do
list+=" ${3%_package}"; shift 3
done
for f in ${list}; do
echo "$f"
done
}
setup_pkg() {
local pkg="$1" cross="$2"
local val _vars f
local pkg="$1" cross="$2"
local val _vars f
[ -z "$pkg" ] && return 1
[ -z "$pkg" ] && return 1
# Start with a sane environment
unset -v PKG_BUILD_OPTIONS XBPS_CROSS_CFLAGS XBPS_CROSS_CXXFLAGS XBPS_CROSS_CPPFLAGS XBPS_CROSS_LDFLAGS
unset -v run_depends build_depends host_build_depends
# Start with a sane environment
unset -v PKG_BUILD_OPTIONS XBPS_CROSS_CFLAGS XBPS_CROSS_CXXFLAGS XBPS_CROSS_CPPFLAGS XBPS_CROSS_LDFLAGS
unset -v run_depends build_depends host_build_depends
for f in ${subpackages}; do
eval unset -f ${f}_package
done
for f in ${subpackages}; do
eval unset -f ${f}_package
done
if [ -n "$cross" ]; then
source_file $XBPS_CROSSPFDIR/${cross}.sh
if [ -n "$cross" ]; then
source_file $XBPS_CROSSPFDIR/${cross}.sh
REQ_VARS="TARGET_ARCH CROSS_TRIPLET CROSS_CFLAGS CROSS_CXXFLAGS"
for f in ${REQ_VARS}; do
eval val="\$XBPS_$f"
if [ -z "$val" ]; then
echo "ERROR: XBPS_$f is not defined!"
exit 1
fi
done
REQ_VARS="TARGET_ARCH CROSS_TRIPLET CROSS_CFLAGS CROSS_CXXFLAGS"
for f in ${REQ_VARS}; do
eval val="\$XBPS_$f"
if [ -z "$val" ]; then
echo "ERROR: XBPS_$f is not defined!"
exit 1
fi
done
export XBPS_TARGET_MACHINE=$XBPS_TARGET_ARCH
export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET
export XBPS_TARGET_MACHINE=$XBPS_TARGET_ARCH
export XBPS_CROSS_BASE=/usr/$XBPS_CROSS_TRIPLET
XBPS_INSTALL_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_INSTALL_CMD -c /host/repocache -r $XBPS_CROSS_BASE"
XBPS_QUERY_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_QUERY_CMD -c /host/repocache -r $XBPS_CROSS_BASE"
XBPS_RECONFIGURE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_RECONFIGURE_CMD -r $XBPS_CROSS_BASE"
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_REMOVE_CMD -r $XBPS_CROSS_BASE"
XBPS_RINDEX_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_RINDEX_CMD"
XBPS_UHELPER_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH xbps-uhelper -r $XBPS_CROSS_BASE"
XBPS_INSTALL_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_INSTALL_CMD -c /host/repocache -r $XBPS_CROSS_BASE"
XBPS_QUERY_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_QUERY_CMD -c /host/repocache -r $XBPS_CROSS_BASE"
XBPS_RECONFIGURE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_RECONFIGURE_CMD -r $XBPS_CROSS_BASE"
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_REMOVE_CMD -r $XBPS_CROSS_BASE"
XBPS_RINDEX_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH $XBPS_RINDEX_CMD"
XBPS_UHELPER_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH xbps-uhelper -r $XBPS_CROSS_BASE"
else
export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE}
unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS
unset XBPS_CROSS_CFLAGS XBPS_CROSS_CXXFLAGS XBPS_CROSS_CPPFLAGS
else
export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE}
unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS
unset XBPS_CROSS_CFLAGS XBPS_CROSS_CXXFLAGS XBPS_CROSS_CPPFLAGS
XBPS_INSTALL_XCMD="$XBPS_INSTALL_CMD"
XBPS_QUERY_XCMD="$XBPS_QUERY_CMD"
XBPS_RECONFIGURE_XCMD="$XBPS_RECONFIGURE_CMD"
XBPS_REMOVE_XCMD="$XBPS_REMOVE_CMD"
XBPS_RINDEX_XCMD="$XBPS_RINDEX_CMD"
XBPS_UHELPER_XCMD="$XBPS_UHELPER_CMD"
XBPS_INSTALL_XCMD="$XBPS_INSTALL_CMD"
XBPS_QUERY_XCMD="$XBPS_QUERY_CMD"
XBPS_RECONFIGURE_XCMD="$XBPS_RECONFIGURE_CMD"
XBPS_REMOVE_XCMD="$XBPS_REMOVE_CMD"
XBPS_RINDEX_XCMD="$XBPS_RINDEX_CMD"
XBPS_UHELPER_XCMD="$XBPS_UHELPER_CMD"
fi
fi
export XBPS_INSTALL_XCMD XBPS_QUERY_XCMD XBPS_RECONFIGURE_XCMD \
XBPS_REMOVE_XCMD XBPS_RINDEX_XCMD XBPS_UHELPER_XCMD
export XBPS_INSTALL_XCMD XBPS_QUERY_XCMD XBPS_RECONFIGURE_XCMD \
XBPS_REMOVE_XCMD XBPS_RINDEX_XCMD XBPS_UHELPER_XCMD
# Source all sourcepkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup/*.sh; do
source_file "$f"
done
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
# Source all sourcepkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup/*.sh; do
source_file "$f"
done
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
if [ ! -f ${XBPS_SRCPKGDIR}/${pkg}/template ]; then
msg_error "xbps-src: unexistent file: ${XBPS_SRCPKGDIR}/${pkg}/template\n"
fi
if [ -n "$cross" ]; then
export CROSS_BUILD="$cross"
source_file ${XBPS_SRCPKGDIR}/${pkg}/template
else
unset CROSS_BUILD
source_file ${XBPS_SRCPKGDIR}/${pkg}/template
fi
if [ ! -f ${XBPS_SRCPKGDIR}/${pkg}/template ]; then
msg_error "xbps-src: unexistent file: ${XBPS_SRCPKGDIR}/${pkg}/template\n"
fi
if [ -n "$cross" ]; then
export CROSS_BUILD="$cross"
source_file ${XBPS_SRCPKGDIR}/${pkg}/template
else
unset CROSS_BUILD
source_file ${XBPS_SRCPKGDIR}/${pkg}/template
fi
# Check if required vars weren't set.
_vars="pkgname version short_desc revision homepage license"
for f in ${_vars}; do
eval val="\$$f"
if [ -z "$val" -o -z "$f" ]; then
msg_error "\"$f\" not set on $pkgname template.\n"
fi
done
# Check if required vars weren't set.
_vars="pkgname version short_desc revision homepage license"
for f in ${_vars}; do
eval val="\$$f"
if [ -z "$val" -o -z "$f" ]; then
msg_error "\"$f\" not set on $pkgname template.\n"
fi
done
# Check if base-chroot is already installed.
if [ -z "$bootstrap" ]; then
check_installed_pkg base-chroot-0.1_1
if [ $? -ne 0 ]; then
msg_red "${pkg} is not a bootstrap package and cannot be built without it.\n"
msg_error "Please install bootstrap packages and try again.\n"
fi
fi
# Check if base-chroot is already installed.
if [ -z "$bootstrap" ]; then
check_installed_pkg base-chroot-0.1_1
if [ $? -ne 0 ]; then
msg_red "${pkg} is not a bootstrap package and cannot be built without it.\n"
msg_error "Please install bootstrap packages and try again.\n"
fi
fi
sourcepkg="${pkgname}"
subpackages="$(get_subpkgs)"
sourcepkg="${pkgname}"
subpackages="$(get_subpkgs)"
if [ -h $XBPS_SRCPKGDIR/$pkg ]; then
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
pkgname=$pkg
if ! declare -f ${pkg}_package >/dev/null; then
msg_error "$pkgname: missing ${pkg}_package() function!\n"
fi
fi
if [ -h $XBPS_SRCPKGDIR/$pkg ]; then
# Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f"
done
pkgname=$pkg
if ! declare -f ${pkg}_package >/dev/null; then
msg_error "$pkgname: missing ${pkg}_package() function!\n"
fi
fi
pkgver="${pkg}-${version}_${revision}"
pkgver="${pkg}-${version}_${revision}"
# If build_style() unset, a do_install() function must be defined.
if [ -z "$build_style" ]; then
# Check that at least do_install() is defined.
if ! declare -f do_install >/dev/null; then
msg_error "$pkgver: missing do_install() function!\n"
fi
fi
# If build_style() unset, a do_install() function must be defined.
if [ -z "$build_style" ]; then
# Check that at least do_install() is defined.
if ! declare -f do_install >/dev/null; then
msg_error "$pkgver: missing do_install() function!\n"
fi
fi
FILESDIR=$XBPS_SRCPKGDIR/$sourcepkg/files
PATCHESDIR=$XBPS_SRCPKGDIR/$sourcepkg/patches
DESTDIR=$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${sourcepkg}-${version}
PKGDESTDIR=$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${pkg}-${version}
FILESDIR=$XBPS_SRCPKGDIR/$sourcepkg/files
PATCHESDIR=$XBPS_SRCPKGDIR/$sourcepkg/patches
DESTDIR=$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${sourcepkg}-${version}
PKGDESTDIR=$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${pkg}-${version}
if [ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ]; then
makejobs="-j$XBPS_MAKEJOBS"
fi
if [ -n "$XBPS_MAKEJOBS" -a -z "$disable_parallel_build" ]; then
makejobs="-j$XBPS_MAKEJOBS"
fi
# For nonfree/bootstrap pkgs there's no point in building -dbg pkgs, disable them.
if [ -z "$XBPS_DEBUG_PKGS" -o -n "$nonfree" -o -n "$bootstrap" ]; then
disable_debug=yes
fi
# If a package sets force_debug_pkgs, always build -dbg pkgs.
if [ -n "$force_debug_pkgs" ]; then
unset disable_debug
fi
# -g is required to build -dbg packages.
if [ -z "$disable_debug" ]; then
dbgflags="-g"
fi
# For nonfree/bootstrap pkgs there's no point in building -dbg pkgs, disable them.
if [ -z "$XBPS_DEBUG_PKGS" -o -n "$nonfree" -o -n "$bootstrap" ]; then
disable_debug=yes
fi
# If a package sets force_debug_pkgs, always build -dbg pkgs.
if [ -n "$force_debug_pkgs" ]; then
unset disable_debug
fi
# -g is required to build -dbg packages.
if [ -z "$disable_debug" ]; then
dbgflags="-g"
fi
export CFLAGS="$XBPS_CFLAGS $XBPS_CROSS_CFLAGS $CFLAGS $dbgflags"
export CXXFLAGS="$XBPS_CXXFLAGS $XBPS_CROSS_CXXFLAGS $CXXFLAGS $dbgflags"
export CPPFLAGS="$XBPS_CPPFLAGS $XBPS_CROSS_CPPFLAGS $CPPFLAGS"
export LDFLAGS="$LDFLAGS $XBPS_LDFLAGS $XBPS_CROSS_LDFLAGS"
export CFLAGS="$XBPS_CFLAGS $XBPS_CROSS_CFLAGS $CFLAGS $dbgflags"
export CXXFLAGS="$XBPS_CXXFLAGS $XBPS_CROSS_CXXFLAGS $CXXFLAGS $dbgflags"
export CPPFLAGS="$XBPS_CPPFLAGS $XBPS_CROSS_CPPFLAGS $CPPFLAGS"
export LDFLAGS="$LDFLAGS $XBPS_LDFLAGS $XBPS_CROSS_LDFLAGS"
export BUILD_CC="cc"
export BUILD_CFLAGS="$XBPS_CFLAGS"
export BUILD_CC="cc"
export BUILD_CFLAGS="$XBPS_CFLAGS"
if [ -n "$cross" ]; then
export CC="${XBPS_CROSS_TRIPLET}-gcc"
export CXX="${XBPS_CROSS_TRIPLET}-c++"
export CPP="${XBPS_CROSS_TRIPLET}-cpp"
export GCC="$CC"
export LD="${XBPS_CROSS_TRIPLET}-ld"
export AR="${XBPS_CROSS_TRIPLET}-ar"
export AS="${XBPS_CROSS_TRIPLET}-as"
export RANLIB="${XBPS_CROSS_TRIPLET}-ranlib"
export STRIP="${XBPS_CROSS_TRIPLET}-strip"
export OBJDUMP="${XBPS_CROSS_TRIPLET}-objdump"
export OBJCOPY="${XBPS_CROSS_TRIPLET}-objcopy"
export NM="${XBPS_CROSS_TRIPLET}-nm"
export READELF="${XBPS_CROSS_TRIPLET}-readelf"
else
export CC="cc"
export CXX="g++"
export CPP="cpp"
export GCC="$CC"
export LD="ld"
export AR="ar"
export AS="as"
export RANLIB="ranlib"
export STRIP="strip"
export OBJDUMP="objdump"
export OBJCOPY="objcopy"
export NM="nm"
export READELF="readelf"
fi
if [ -n "$cross" ]; then
export CC="${XBPS_CROSS_TRIPLET}-gcc"
export CXX="${XBPS_CROSS_TRIPLET}-c++"
export CPP="${XBPS_CROSS_TRIPLET}-cpp"
export GCC="$CC"
export LD="${XBPS_CROSS_TRIPLET}-ld"
export AR="${XBPS_CROSS_TRIPLET}-ar"
export AS="${XBPS_CROSS_TRIPLET}-as"
export RANLIB="${XBPS_CROSS_TRIPLET}-ranlib"
export STRIP="${XBPS_CROSS_TRIPLET}-strip"
export OBJDUMP="${XBPS_CROSS_TRIPLET}-objdump"
export OBJCOPY="${XBPS_CROSS_TRIPLET}-objcopy"
export NM="${XBPS_CROSS_TRIPLET}-nm"
export READELF="${XBPS_CROSS_TRIPLET}-readelf"
else
export CC="cc"
export CXX="g++"
export CPP="cpp"
export GCC="$CC"
export LD="ld"
export AR="ar"
export AS="as"
export RANLIB="ranlib"
export STRIP="strip"
export OBJDUMP="objdump"
export OBJCOPY="objcopy"
export NM="nm"
export READELF="readelf"
fi
set_build_options
set_build_options
# Setup some specific package vars.
if [ -z "$wrksrc" ]; then
wrksrc="$XBPS_BUILDDIR/${sourcepkg}-${version}"
else
wrksrc="$XBPS_BUILDDIR/$wrksrc"
fi
# Setup some specific package vars.
if [ -z "$wrksrc" ]; then
wrksrc="$XBPS_BUILDDIR/${sourcepkg}-${version}"
else
wrksrc="$XBPS_BUILDDIR/$wrksrc"
fi
}
setup_pkg_depends() {
local pkg="$1" j _pkgdepname _pkgdep _depname
local pkg="$1" j _pkgdepname _pkgdep _depname
if [ -n "$pkg" ]; then
# subpkg
if declare -f ${pkg}_package >/dev/null; then
${pkg}_package
fi
fi
if [ -n "$pkg" ]; then
# subpkg
if declare -f ${pkg}_package >/dev/null; then
${pkg}_package
fi
fi
for j in ${depends}; do
_depname="${j#*\?}"
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
if [ -z "${_pkgdepname}" ]; then
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
fi
for j in ${depends}; do
_depname="${j#*\?}"
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
if [ -z "${_pkgdepname}" ]; then
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
fi
if [ -z "${_pkgdepname}" ]; then
_pkgdep="${_depname}>=0"
else
_pkgdep="${_depname}"
fi
run_depends+=" ${_pkgdep}"
done
for j in ${hostmakedepends}; do
_depname="${j%\?*}"
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
if [ -z "${_pkgdepname}" ]; then
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
fi
if [ -z "${_pkgdepname}" ]; then
_pkgdep="${_depname}>=0"
else
_pkgdep="${_depname}"
fi
host_build_depends+=" ${_pkgdep}"
done
for j in ${makedepends}; do
_depname="${j%\?*}"
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
if [ -z "${_pkgdepname}" ]; then
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
fi
if [ -z "${_pkgdepname}" ]; then
_pkgdep="${_depname}>=0"
else
_pkgdep="${_depname}"
fi
build_depends+=" ${_pkgdep}"
done
if [ -z "${_pkgdepname}" ]; then
_pkgdep="${_depname}>=0"
else
_pkgdep="${_depname}"
fi
run_depends+=" ${_pkgdep}"
done
for j in ${hostmakedepends}; do
_depname="${j%\?*}"
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
if [ -z "${_pkgdepname}" ]; then
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
fi
if [ -z "${_pkgdepname}" ]; then
_pkgdep="${_depname}>=0"
else
_pkgdep="${_depname}"
fi
host_build_depends+=" ${_pkgdep}"
done
for j in ${makedepends}; do
_depname="${j%\?*}"
_pkgdepname="$($XBPS_UHELPER_CMD getpkgdepname ${_depname} 2>/dev/null)"
if [ -z "${_pkgdepname}" ]; then
_pkgdepname="$($XBPS_UHELPER_CMD getpkgname ${_depname} 2>/dev/null)"
fi
if [ -z "${_pkgdepname}" ]; then
_pkgdep="${_depname}>=0"
else
_pkgdep="${_depname}"
fi
build_depends+=" ${_pkgdep}"
done
}
_remove_pkg_cross_deps() {
local rval= tmplogf=
[ -z "$XBPS_CROSS_BUILD" ] && return 0
local rval= tmplogf=
[ -z "$XBPS_CROSS_BUILD" ] && return 0
cd $XBPS_MASTERDIR || return 1
msg_normal "${pkgver:-xbps-src}: removing autocrossdeps, please wait...\n"
tmplogf=$(mktemp)
cd $XBPS_MASTERDIR || return 1
msg_normal "${pkgver:-xbps-src}: removing autocrossdeps, please wait...\n"
tmplogf=$(mktemp)
if [ -z "$XBPS_REMOVE_XCMD" ]; then
source_file $XBPS_CROSSPFDIR/${XBPS_CROSS_BUILD}.sh
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH xbps-remove -r /usr/$XBPS_CROSS_TRIPLET"
fi
if [ -z "$XBPS_REMOVE_XCMD" ]; then
source_file $XBPS_CROSSPFDIR/${XBPS_CROSS_BUILD}.sh
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH xbps-remove -r /usr/$XBPS_CROSS_TRIPLET"
fi
$FAKEROOT_CMD $XBPS_REMOVE_XCMD -Ryo > $tmplogf 2>&1
if [ $? -ne 0 ]; then
msg_red "${pkgver:-xbps-src}: failed to remove autocrossdeps:\n"
cat $tmplogf && rm -f $tmplogf
msg_error "${pkgver:-xbps-src}: cannot continue!\n"
fi
rm -f $tmplogf
$FAKEROOT_CMD $XBPS_REMOVE_XCMD -Ryo > $tmplogf 2>&1
if [ $? -ne 0 ]; then
msg_red "${pkgver:-xbps-src}: failed to remove autocrossdeps:\n"
cat $tmplogf && rm -f $tmplogf
msg_error "${pkgver:-xbps-src}: cannot continue!\n"
fi
rm -f $tmplogf
}
remove_pkg_autodeps() {
local rval= tmplogf=
local rval= tmplogf=
[ -z "$CHROOT_READY" ] && return 0
[ -z "$CHROOT_READY" ] && return 0
cd $XBPS_MASTERDIR || return 1
msg_normal "${pkgver:-xbps-src}: removing autodeps, please wait...\n"
tmplogf=$(mktemp)
cd $XBPS_MASTERDIR || return 1
msg_normal "${pkgver:-xbps-src}: removing autodeps, please wait...\n"
tmplogf=$(mktemp)
_remove_pkg_cross_deps
_remove_pkg_cross_deps
$FAKEROOT_CMD xbps-reconfigure -a >> $tmplogf 2>&1
$FAKEROOT_CMD xbps-remove -Ryo >> $tmplogf 2>&1
$FAKEROOT_CMD xbps-reconfigure -a >> $tmplogf 2>&1
$FAKEROOT_CMD xbps-remove -Ryo >> $tmplogf 2>&1
if [ $? -ne 0 ]; then
msg_red "${pkgver:-xbps-src}: failed to remove autodeps:\n"
cat $tmplogf && rm -f $tmplogf
msg_error "${pkgver:-xbps-src}: cannot continue!\n"
fi
rm -f $tmplogf
if [ $? -ne 0 ]; then
msg_red "${pkgver:-xbps-src}: failed to remove autodeps:\n"
cat $tmplogf && rm -f $tmplogf
msg_error "${pkgver:-xbps-src}: cannot continue!\n"
fi
rm -f $tmplogf
}
install_cross_pkg() {
local cross="$1" rval
local cross="$1" rval
[ -z "$cross" -o "$cross" = "" ] && return 0
[ -z "$cross" -o "$cross" = "" ] && return 0
source_file ${XBPS_CROSSPFDIR}/${cross}.sh
source_file ${XBPS_CROSSPFDIR}/${cross}.sh
if [ -z "$CHROOT_READY" ]; then
echo "ERROR: chroot mode not activated (install a bootstrap)."
exit 1
elif [ -z "$IN_CHROOT" ]; then
return 0
fi
if [ -z "$CHROOT_READY" ]; then
echo "ERROR: chroot mode not activated (install a bootstrap)."
exit 1
elif [ -z "$IN_CHROOT" ]; then
return 0
fi
# Install required pkgs for cross building.
if [ "$XBPS_TARGET" != "remove-autodeps" ]; then
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
if [ $? -ne 0 ]; then
msg_normal "Installing cross pkg: cross-${XBPS_CROSS_TRIPLET} ...\n"
$XBPS_INSTALL_CMD -y cross-${XBPS_CROSS_TRIPLET} &>/dev/null
rval=$?
if [ $rval -ne 0 ]; then
msg_error "failed to install cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
fi
fi
if [ ! -d ${XBPS_CROSS_BASE}/var/db/xbps/keys ]; then
mkdir -p ${XBPS_CROSS_BASE}/var/db/xbps/keys
cp ${XBPS_MASTERDIR}/var/db/xbps/keys/*.plist \
${XBPS_CROSS_BASE}/var/db/xbps/keys
fi
$XBPS_INSTALL_CMD --repository=http://repo.voidlinux.eu/current \
-r ${XBPS_CROSS_BASE} -SAy cross-vpkg-dummy &>/dev/null
rval=$?
if [ $rval -ne 0 -a $rval -ne 17 ]; then
msg_error "failed to install cross-vpkg-dummy (error $rval)\n"
fi
fi
# Install required pkgs for cross building.
if [ "$XBPS_TARGET" != "remove-autodeps" ]; then
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
if [ $? -ne 0 ]; then
msg_normal "Installing cross pkg: cross-${XBPS_CROSS_TRIPLET} ...\n"
$XBPS_INSTALL_CMD -y cross-${XBPS_CROSS_TRIPLET} &>/dev/null
rval=$?
if [ $rval -ne 0 ]; then
msg_error "failed to install cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
fi
fi
if [ ! -d ${XBPS_CROSS_BASE}/var/db/xbps/keys ]; then
mkdir -p ${XBPS_CROSS_BASE}/var/db/xbps/keys
cp ${XBPS_MASTERDIR}/var/db/xbps/keys/*.plist \
${XBPS_CROSS_BASE}/var/db/xbps/keys
fi
$XBPS_INSTALL_CMD --repository=http://repo.voidlinux.eu/current \
-r ${XBPS_CROSS_BASE} -SAy cross-vpkg-dummy &>/dev/null
rval=$?
if [ $rval -ne 0 -a $rval -ne 17 ]; then
msg_error "failed to install cross-vpkg-dummy (error $rval)\n"
fi
fi
}
remove_cross_pkg() {
local cross="$1" rval
local cross="$1" rval
[ -z "$cross" -o "$cross" = "" ] && return 0
[ -z "$cross" -o "$cross" = "" ] && return 0
source_file ${XBPS_CROSSPFDIR}/${cross}.sh
source_file ${XBPS_CROSSPFDIR}/${cross}.sh
if [ -z "$CHROOT_READY" ]; then
echo "ERROR: chroot mode not activated (install a bootstrap)."
exit 1
elif [ -z "$IN_CHROOT" ]; then
return 0
fi
if [ -z "$CHROOT_READY" ]; then
echo "ERROR: chroot mode not activated (install a bootstrap)."
exit 1
elif [ -z "$IN_CHROOT" ]; then
return 0
fi
msg_normal "Removing cross pkg: cross-${XBPS_CROSS_TRIPLET} ...\n"
$XBPS_REMOVE_CMD -y cross-${XBPS_CROSS_TRIPLET} &>/dev/null
rval=$?
if [ $rval -ne 0 ]; then
msg_error "failed to remove cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
fi
msg_normal "Removing cross pkg: cross-${XBPS_CROSS_TRIPLET} ...\n"
$XBPS_REMOVE_CMD -y cross-${XBPS_CROSS_TRIPLET} &>/dev/null
rval=$?
if [ $rval -ne 0 ]; then
msg_error "failed to remove cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
fi
}
#
@ -543,24 +543,24 @@ remove_cross_pkg() {
# installed package, otherwise 1.
#
check_installed_pkg() {
local pkg="$1" cross="$2" uhelper= pkgn= iver=
local pkg="$1" cross="$2" uhelper= pkgn= iver=
[ -z "$pkg" ] && return 2
[ -z "$pkg" ] && return 2
pkgn="$($XBPS_UHELPER_CMD getpkgname ${pkg})"
[ -z "$pkgn" ] && return 2
pkgn="$($XBPS_UHELPER_CMD getpkgname ${pkg})"
[ -z "$pkgn" ] && return 2
if [ -n "$cross" ]; then
uhelper="$XBPS_UHELPER_XCMD"
else
uhelper="$XBPS_UHELPER_CMD"
fi
if [ -n "$cross" ]; then
uhelper="$XBPS_UHELPER_XCMD"
else
uhelper="$XBPS_UHELPER_CMD"
fi
iver="$($uhelper version $pkgn)"
if [ $? -eq 0 -a -n "$iver" ]; then
$XBPS_CMPVER_CMD "${pkgn}-${iver}" "${pkg}"
[ $? -eq 0 -o $? -eq 1 ] && return 0
fi
iver="$($uhelper version $pkgn)"
if [ $? -eq 0 -a -n "$iver" ]; then
$XBPS_CMPVER_CMD "${pkgn}-${iver}" "${pkg}"
[ $? -eq 0 -o $? -eq 1 ] && return 0
fi
return 1
return 1
}

View File

@ -1,4 +1,4 @@
# -*-* shell *-*-
# vim: set ts=4 sw=4 et:
show_build_options() {
local f opt desc

View File

@ -1,85 +1,85 @@
# -*-* shell *-*-
# vim: set ts=4 sw=4 et:
show_pkg() {
local i=
local i=
echo "pkgname: $pkgname"
echo "version: $version"
echo "revision: $revision"
for i in ${distfiles}; do
[ -n "$i" ] && echo "distfiles: $i"
done
for i in ${checksum}; do
[ -n "$i" ] && echo "checksum: $i"
done
[ -n "$noarch" ] && echo "noarch: yes"
echo "maintainer: $maintainer"
[ -n "$homepage" ] && echo "Upstream URL: $homepage"
[ -n "$license" ] && echo "License(s): $license"
[ -n "$build_style" ] && echo "build_style: $build_style"
for i in ${configure_args}; do
[ -n "$i" ] && echo "configure_args: $i"
done
echo "short_desc: $short_desc"
for i in ${subpackages}; do
[ -n "$i" ] && echo "subpackages: $i"
done
for i in ${conf_files}; do
[ -n "$i" ] && echo "conf_files: $i"
done
for i in ${replaces}; do
[ -n "$i" ] && echo "replaces: $i"
done
for i in ${provides}; do
[ -n "$i" ] && echo "provides: $i"
done
for i in ${conflicts}; do
[ -n "$i" ] && echo "conflicts: $i"
done
[ -n "$long_desc" ] && echo "long_desc: $long_desc"
echo "pkgname: $pkgname"
echo "version: $version"
echo "revision: $revision"
for i in ${distfiles}; do
[ -n "$i" ] && echo "distfiles: $i"
done
for i in ${checksum}; do
[ -n "$i" ] && echo "checksum: $i"
done
[ -n "$noarch" ] && echo "noarch: yes"
echo "maintainer: $maintainer"
[ -n "$homepage" ] && echo "Upstream URL: $homepage"
[ -n "$license" ] && echo "License(s): $license"
[ -n "$build_style" ] && echo "build_style: $build_style"
for i in ${configure_args}; do
[ -n "$i" ] && echo "configure_args: $i"
done
echo "short_desc: $short_desc"
for i in ${subpackages}; do
[ -n "$i" ] && echo "subpackages: $i"
done
for i in ${conf_files}; do
[ -n "$i" ] && echo "conf_files: $i"
done
for i in ${replaces}; do
[ -n "$i" ] && echo "replaces: $i"
done
for i in ${provides}; do
[ -n "$i" ] && echo "provides: $i"
done
for i in ${conflicts}; do
[ -n "$i" ] && echo "conflicts: $i"
done
[ -n "$long_desc" ] && echo "long_desc: $long_desc"
}
show_pkg_deps() {
[ -f "${PKGDESTDIR}/rdeps" ] && cat ${PKGDESTDIR}/rdeps
[ -f "${PKGDESTDIR}/rdeps" ] && cat ${PKGDESTDIR}/rdeps
}
show_pkg_files() {
[ -d ${PKGDESTDIR} ] && find ${PKGDESTDIR} -print
[ -d ${PKGDESTDIR} ] && find ${PKGDESTDIR} -print
}
show_pkg_build_deps() {
local f=
local f=
# build time deps
for f in ${hostmakedepends} ${makedepends}; do
echo "$f"
done
# build time deps
for f in ${hostmakedepends} ${makedepends}; do
echo "$f"
done
}
show_pkg_options() {
local f= j= state= desc= enabled=
local f= j= state= desc= enabled=
for f in ${build_options}; do
for j in ${build_options_default}; do
if [ "$f" = "$j" ]; then
enabled=1
break
fi
done
state="OFF"
if [ -n "$enabled" ]; then
state="ON"
unset enabled
fi
eval desc="\$desc_option_$f"
printf "$f: $desc [$state]\n"
done
for f in ${build_options}; do
for j in ${build_options_default}; do
if [ "$f" = "$j" ]; then
enabled=1
break
fi
done
state="OFF"
if [ -n "$enabled" ]; then
state="ON"
unset enabled
fi
eval desc="\$desc_option_$f"
printf "$f: $desc [$state]\n"
done
}
show_pkg_shlib_provides() {
[ -f "${PKGDESTDIR}/shlib-provides" ] && cat ${PKGDESTDIR}/shlib-provides
[ -f "${PKGDESTDIR}/shlib-provides" ] && cat ${PKGDESTDIR}/shlib-provides
}
show_pkg_shlib_requires() {
[ -f "${PKGDESTDIR}/shlib-requires" ] && cat ${PKGDESTDIR}/shlib-requires
[ -f "${PKGDESTDIR}/shlib-requires" ] && cat ${PKGDESTDIR}/shlib-requires
}