Major infrastructure changes, part 2.
* Moved helpers, common and triggers dirs into xbps-src, where they belong. * Renamed the templates dir to srcpkgs, it was so redundant before. * Make it possible to add subpkgs with no restriction in names, for example udev now has a subpkgs called "libgudev". Previously subpkgs were named "${sourcepkg}-${pkgname}". * xbps-src: changed to look for template files in current directory. That means that most arguments from the targets have been removed. * xbps-src: added a reinstall target, to remove + install. * xbps-src: do not overwrite binpkgs by default, skip them. And more that I forgot because it's a mega-commit that I've been working for some days already... --HG-- extra : convert_revision : 0f466878584d1e6895d2a234f07ea1b2d1e61b3e
This commit is contained in:
parent
3c58e3ad40
commit
85cc462e1d
1305 changed files with 719 additions and 654 deletions
|
@ -8,14 +8,9 @@ clean:
|
|||
|
||||
.PHONY: install
|
||||
install:
|
||||
if [ ! -d $(DESTDIR)$(SHAREDIR) ]; then \
|
||||
install -d $(DESTDIR)$(SHAREDIR); \
|
||||
fi
|
||||
|
||||
for f in *.sh; do \
|
||||
install -m 755 $$f $(DESTDIR)$(SHAREDIR); \
|
||||
done
|
||||
install -d $(DESTDIR)$(SHAREDIR)/shutils
|
||||
install -m 644 *.sh $(DESTDIR)$(SHAREDIR)/shutils
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
-rm -rf $(DESTDIR)$(SHAREDIR)
|
||||
-rm -rf $(DESTDIR)$(SHAREDIR)/shutils
|
||||
|
|
|
@ -87,7 +87,7 @@ install_pkg_deps()
|
|||
install_dependencies_pkg()
|
||||
{
|
||||
local pkg="$1"
|
||||
local lpkgname=$(${XBPS_PKGDB_CMD} getpkgdepname ${pkg})
|
||||
local lpkgname=$(${XBPS_PKGDB_CMD} getpkgname ${pkg})
|
||||
local i pkgn iver reqver notinstalled_deps lver
|
||||
|
||||
[ -z "$pkg" ] && return 1
|
||||
|
|
|
@ -143,16 +143,13 @@ install_xbps_utils()
|
|||
fi
|
||||
cp -f $fetch_cmd $xbps_prefix/sbin
|
||||
for f in bin cmpver digest pkgdb repo; do
|
||||
cp -f $XBPS_INSTALLDIR/sbin/xbps-$f.static \
|
||||
$xbps_prefix/sbin/
|
||||
_cmd="$(which xbps-${f}.static 2>/dev/null)"
|
||||
if [ -z "$_cmd" ]; then
|
||||
echo "Unexisting xbps-${f}.static bin!"
|
||||
exit 1
|
||||
fi
|
||||
cp -f ${_cmd} $xbps_prefix/sbin
|
||||
done
|
||||
cp -f $XBPS_INSTALLDIR/sbin/xbps-src $xbps_prefix/sbin
|
||||
if [ -z $XBPS_INSTALLDIR ]; then
|
||||
installdir=/usr/share/xbps-src
|
||||
else
|
||||
installdir=$XBPS_INSTALLDIR/share/xbps-src
|
||||
fi
|
||||
cp -a $installdir $xbps_prefix/share
|
||||
rebuild_ldso_cache
|
||||
fi
|
||||
}
|
||||
|
@ -178,6 +175,13 @@ xbps_chroot_handler()
|
|||
echo "done."
|
||||
fi
|
||||
|
||||
# Reinstall xbps-src in the chroot
|
||||
if [ ! -f $XBPS_MASTERDIR/usr/local/sbin/xbps-src ]; then
|
||||
env in_chroot=yes LANG=C PATH=$path \
|
||||
chroot $XBPS_MASTERDIR sh -c \
|
||||
"cd /xbps/xbps-src && make install clean"
|
||||
fi
|
||||
|
||||
if [ "$action" = "chroot" ]; then
|
||||
env in_chroot=yes LANG=C PATH=$path \
|
||||
chroot $XBPS_MASTERDIR /bin/sh
|
||||
|
@ -185,8 +189,8 @@ xbps_chroot_handler()
|
|||
[ -n "$only_destdir" ] && \
|
||||
local lenv="install_destdir_target=yes"
|
||||
env in_chroot=yes LANG=C PATH=$path \
|
||||
${lenv} chroot $XBPS_MASTERDIR \
|
||||
/usr/local/sbin/xbps-src $action $pkg
|
||||
${lenv} chroot $XBPS_MASTERDIR sh -c \
|
||||
"cd /xbps/srcpkgs/$pkg && xbps-src $action"
|
||||
fi
|
||||
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."
|
||||
umount_chroot_fs
|
||||
|
@ -280,7 +284,7 @@ if [ "$(id -u)" -ne 0 ]; then
|
|||
if [ -n "$origin_tmpl" ]; then
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
reset_tmpl_vars
|
||||
run_file $XBPS_TEMPLATESDIR/$origin_tmpl/template
|
||||
cd ../$origin_tmpl && . template
|
||||
fi
|
||||
echo "The '$pkgname' package requires to be installed in a chroot."
|
||||
echo "You cannot do this as normal user, try again being root."
|
||||
|
|
|
@ -29,11 +29,9 @@
|
|||
#
|
||||
configure_src_phase()
|
||||
{
|
||||
local f lver pkg="$1"
|
||||
local f lver
|
||||
|
||||
[ -z $pkg ] && [ -z $pkgname ] && return 1
|
||||
|
||||
[ ! -d $wrksrc ] && msg_error "unexistent build directory [$wrksrc]."
|
||||
[ -z $pkgname ] && return 1
|
||||
|
||||
# Apply patches if requested by template file
|
||||
if [ ! -f $XBPS_APPLYPATCHES_DONE ]; then
|
||||
|
@ -57,6 +55,8 @@ configure_src_phase()
|
|||
lver="${version}"
|
||||
fi
|
||||
|
||||
cd $wrksrc || msg_error "unexistent build directory [$wrksrc]."
|
||||
|
||||
# cross compilation vars.
|
||||
if [ -n "$cross_compiler" ]; then
|
||||
. $XBPS_SHUTILSDIR/cross-compilation.sh
|
||||
|
|
|
@ -44,10 +44,10 @@ verify_sha256_cksum()
|
|||
|
||||
fetch_update_cksum()
|
||||
{
|
||||
local tmpl="$XBPS_TEMPLATESDIR/$pkgname/template"
|
||||
local upcmd=$(basename $XBPS_SRCDISTDIR/$1)
|
||||
|
||||
sed -i -e "s|checksum.*|checksum=$(${XBPS_DIGEST_CMD} ${upcmd})|" $tmpl
|
||||
sed -i -e "s|checksum.*|checksum=$(${XBPS_DIGEST_CMD} ${upcmd})|" \
|
||||
template
|
||||
return $?
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,9 @@ strip_files()
|
|||
|
||||
install_src_phase()
|
||||
{
|
||||
local pkg="$1"
|
||||
local f i subpkg lver spkgrev
|
||||
local f i subpkg lver spkgrev saved_wrksrc
|
||||
|
||||
[ -z $pkg ] && [ -z $pkgname ] && return 1
|
||||
[ -z $pkgname ] && return 1
|
||||
|
||||
if [ -n "$revision" ]; then
|
||||
lver="${version}_${revision}"
|
||||
|
@ -70,6 +69,7 @@ install_src_phase()
|
|||
return 0
|
||||
fi
|
||||
|
||||
saved_wrksrc=$wrksrc
|
||||
cd $wrksrc || msg_error "can't change cwd to wrksrc!"
|
||||
|
||||
# Run pre_install func.
|
||||
|
@ -131,38 +131,31 @@ install_src_phase()
|
|||
# Build subpackages if found.
|
||||
#
|
||||
for subpkg in ${subpackages}; do
|
||||
if [ "${pkg}" != "${sourcepkg}" ] && \
|
||||
[ "${pkg}" != "${sourcepkg}-${subpkg}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "$revision" ]; then
|
||||
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}"
|
||||
spkgrev="${subpkg}-${version}_${revision}"
|
||||
else
|
||||
spkgrev="${sourcepkg}-${subpkg}-${version}"
|
||||
spkgrev="${subpkg}-${version}"
|
||||
fi
|
||||
check_installed_pkg ${spkgrev}
|
||||
[ $? -eq 0 ] && continue
|
||||
|
||||
msg_normal "Preparing $sourcepkg subpackage: $sourcepkg-$subpkg"
|
||||
if [ ! -f $XBPS_TEMPLATESDIR/$pkgname/$subpkg.template ]; then
|
||||
msg_error "Cannot find subpackage template!"
|
||||
msg_normal "Preparing ${sourcepkg} subpackage: ${subpkg}"
|
||||
if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then
|
||||
msg_error "Cannot find ${subpkg} subpkg build template!"
|
||||
fi
|
||||
. $XBPS_TEMPLATESDIR/$pkgname/$subpkg.template
|
||||
pkgname=${sourcepkg}-${subpkg}
|
||||
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
|
||||
pkgname=${subpkg}
|
||||
set_tmpl_common_vars
|
||||
run_func do_install || \
|
||||
msg_error "$pkgname do_install stage failed!"
|
||||
run_template ${sourcepkg}
|
||||
[ "$pkg" = "${sourcepkg}-${subpkg}" ] && break
|
||||
done
|
||||
[ -n "$subpackages" ] && setup_tmpl ${sourcepkg}
|
||||
|
||||
#
|
||||
# Remove $wrksrc if -C not specified.
|
||||
#
|
||||
if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then
|
||||
rm -rf $wrksrc && \
|
||||
msg_normal "Removed $pkgname-$lver build directory."
|
||||
if [ -d "$saved_wrksrc" -a -z "$dontrm_builddir" ]; then
|
||||
rm -rf $saved_wrksrc && \
|
||||
msg_normal "Removed $sourcepkg-$lver build directory."
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -25,19 +25,20 @@
|
|||
|
||||
xbps_make_binpkg()
|
||||
{
|
||||
local pkg="$1"
|
||||
local subpkg
|
||||
|
||||
[ -z "$pkgname" ] && return 1
|
||||
|
||||
for subpkg in ${subpackages}; do
|
||||
unset revision
|
||||
. $XBPS_TEMPLATESDIR/$pkgname/$subpkg.template
|
||||
pkgname=${sourcepkg}-${subpkg}
|
||||
. $XBPS_SRCPKGDIR/$pkgname/$subpkg.template
|
||||
pkgname=${subpkg}
|
||||
set_tmpl_common_vars
|
||||
xbps_make_binpkg_real
|
||||
run_template ${sourcepkg}
|
||||
done
|
||||
|
||||
set_tmpl_common_vars
|
||||
[ -n "${subpackages}" ] && set_tmpl_common_vars
|
||||
xbps_make_binpkg_real
|
||||
return $?
|
||||
}
|
||||
|
@ -50,11 +51,10 @@ xbps_make_binpkg_real()
|
|||
{
|
||||
local mfiles binpkg pkgdir arch use_sudo lver dirs _dirs d clevel
|
||||
|
||||
if [ ! -d ${DESTDIR} ]; then
|
||||
echo "$pkgname: unexistent destdir... skipping!"
|
||||
if [ ! -d "${DESTDIR}" ]; then
|
||||
msg_warn "cannot find destdir for $pkgname... skipping!"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cd ${DESTDIR}
|
||||
|
||||
if [ -n "$noarch" ]; then
|
||||
|
@ -62,13 +62,11 @@ xbps_make_binpkg_real()
|
|||
else
|
||||
arch=$xbps_machine
|
||||
fi
|
||||
|
||||
if [ -n "$base_chroot" ]; then
|
||||
use_sudo=no
|
||||
else
|
||||
use_sudo=yes
|
||||
fi
|
||||
|
||||
if [ -n "$revision" ]; then
|
||||
lver="${version}_${revision}"
|
||||
else
|
||||
|
@ -76,6 +74,13 @@ xbps_make_binpkg_real()
|
|||
fi
|
||||
binpkg=$pkgname-$lver.$arch.xbps
|
||||
pkgdir=$XBPS_PACKAGESDIR/$arch
|
||||
#
|
||||
# Don't overwrite existing binpkgs by default, skip them.
|
||||
#
|
||||
if [ -f $pkgdir/$binpkg ]; then
|
||||
msg_normal "Skipping existing $binpkg ..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
#
|
||||
# Make sure that INSTALL is the first file on the archive,
|
||||
|
@ -103,7 +108,7 @@ xbps_make_binpkg_real()
|
|||
-cpf - ${mfiles} ${dirs} | \
|
||||
$XBPS_COMPRESS_CMD ${clevel} -qf > $pkgdir/$binpkg
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "=> Built package: $binpkg"
|
||||
msg_normal "Built package: $binpkg"
|
||||
fi
|
||||
|
||||
return $?
|
||||
|
|
|
@ -38,43 +38,35 @@ _EOF
|
|||
|
||||
xbps_write_metadata_pkg()
|
||||
{
|
||||
local pkg="$1"
|
||||
local subpkg spkgrev
|
||||
|
||||
for subpkg in ${subpackages}; do
|
||||
if [ "${pkg}" != "${sourcepkg}" ] && \
|
||||
[ "${pkg}" != "${sourcepkg}-${subpkg}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "${revision}" ]; then
|
||||
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}"
|
||||
spkgrev="${subpkg}-${version}_${revision}"
|
||||
else
|
||||
spkgrev="${sourcepkg}-${subpkg}-${version}"
|
||||
spkgrev="${subpkg}-${version}"
|
||||
fi
|
||||
check_installed_pkg ${spkgrev}
|
||||
[ $? -eq 0 ] && continue
|
||||
|
||||
if [ ! -f $XBPS_TEMPLATESDIR/$sourcepkg/$subpkg.template ]; then
|
||||
msg_error "Cannot find subpackage template!"
|
||||
if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then
|
||||
msg_error "Cannot find subpackage build template!"
|
||||
fi
|
||||
unset run_depends conf_files noarch triggers replaces \
|
||||
revision openrc_services essential keep_empty_dirs
|
||||
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
|
||||
pkgname=${sourcepkg}-${subpkg}
|
||||
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
|
||||
pkgname=${subpkg}
|
||||
set_tmpl_common_vars
|
||||
xbps_write_metadata_pkg_real
|
||||
run_template ${sourcepkg}
|
||||
[ "${pkg}" = "${sourcepkg}-${subpkg}" ] && break
|
||||
done
|
||||
|
||||
[ -n "${subpackages}" ] && [ "$pkg" != "${sourcepkg}" ] && return $?
|
||||
|
||||
if [ "$build_style" = "meta-template" -a -z "${run_depends}" ]; then
|
||||
for spkg in ${subpackages}; do
|
||||
if [ -n "${revision}" ]; then
|
||||
spkgrev="$sourcepkg-$spkg-${version}_$revision"
|
||||
spkgrev="${spkg}-${version}_$revision"
|
||||
else
|
||||
spkgrev="${sourcepkg}-${spkg}-${version}"
|
||||
spkgrev="${spkg}-${version}"
|
||||
fi
|
||||
run_depends="${run_depends} ${spkgrev}"
|
||||
done
|
||||
|
@ -269,6 +261,8 @@ xbps_write_metadata_pkg_real()
|
|||
<string>$pkgname</string>
|
||||
<key>version</key>
|
||||
<string>$lver</string>
|
||||
<key>pkgver</key>
|
||||
<string>$pkgname-$lver</string>
|
||||
<key>architecture</key>
|
||||
<string>$arch</string>
|
||||
<key>installed_size</key>
|
||||
|
|
|
@ -191,9 +191,9 @@ _EOF
|
|||
case "$action" in
|
||||
install)
|
||||
if [ -n "${sourcepkg}" -a "${sourcepkg}" != "${pkgname}" ]; then
|
||||
install_file=${XBPS_TEMPLATESDIR}/${pkgname}/${pkgname}.INSTALL
|
||||
install_file=$XBPS_SRCPKGDIR/$pkgname/$pkgname.INSTALL
|
||||
else
|
||||
install_file=${XBPS_TEMPLATESDIR}/${pkgname}/INSTALL
|
||||
install_file=$XBPS_SRCPKGDIR/$pkgname/INSTALL
|
||||
fi
|
||||
if [ -f ${install_file} ]; then
|
||||
found=1
|
||||
|
@ -208,9 +208,9 @@ _EOF
|
|||
;;
|
||||
remove)
|
||||
if [ -n "${sourcepkg}" -a "${sourcepkg}" != "${pkgname}" ]; then
|
||||
remove_file=${XBPS_TEMPLATESDIR}/${pkgname}/${pkgname}.REMOVE
|
||||
remove_file=$XBPS_SRCPKGDIR/$pkgname/$pkgname.REMOVE
|
||||
else
|
||||
remove_file=${XBPS_TEMPLATESDIR}/${pkgname}/REMOVE
|
||||
remove_file=$XBPS_SRCPKGDIR/$pkgname/REMOVE
|
||||
fi
|
||||
if [ -f ${remove_file} ]; then
|
||||
found=1
|
||||
|
|
|
@ -30,14 +30,7 @@
|
|||
#
|
||||
install_pkg()
|
||||
{
|
||||
local pkg=
|
||||
local curpkgn="$1"
|
||||
local cdestdir=
|
||||
local cur_tmpl="$XBPS_TEMPLATESDIR/$curpkgn/template"
|
||||
|
||||
if [ -z $cur_tmpl -o ! -f $cur_tmpl ]; then
|
||||
msg_error "cannot find $cur_tmpl template build file."
|
||||
fi
|
||||
local curpkgn="$1" pkg cdestdir
|
||||
|
||||
#
|
||||
# If we are being invoked through the chroot, re-read config file
|
||||
|
@ -48,10 +41,12 @@ install_pkg()
|
|||
set_defvars
|
||||
fi
|
||||
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
reset_tmpl_vars
|
||||
. $cur_tmpl
|
||||
pkg="$curpkgn-$version"
|
||||
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
||||
if [ -n "$doing_deps" ]; then
|
||||
reset_tmpl_vars
|
||||
setup_tmpl $curpkgn
|
||||
fi
|
||||
|
||||
#
|
||||
# If we are the originator package save the path for this template in
|
||||
|
@ -66,11 +61,6 @@ install_pkg()
|
|||
return $?
|
||||
fi
|
||||
|
||||
#
|
||||
# We are going to install a new package.
|
||||
#
|
||||
setup_tmpl $curpkgn
|
||||
|
||||
#
|
||||
# Install dependencies required by this package.
|
||||
#
|
||||
|
@ -79,10 +69,9 @@ install_pkg()
|
|||
install_dependencies_pkg $pkg
|
||||
#
|
||||
# At this point all required deps are installed, and
|
||||
# only remaining is the origin template; install it.
|
||||
# only remaining is the origin package; install it.
|
||||
#
|
||||
unset doing_deps
|
||||
reset_tmpl_vars
|
||||
setup_tmpl $curpkgn
|
||||
fi
|
||||
|
||||
|
@ -108,18 +97,18 @@ install_pkg()
|
|||
fi
|
||||
|
||||
. $XBPS_SHUTILSDIR/install_funcs.sh
|
||||
install_src_phase $curpkgn
|
||||
install_src_phase
|
||||
|
||||
# Always write metadata to package's destdir.
|
||||
. $XBPS_SHUTILSDIR/metadata.sh
|
||||
xbps_write_metadata_pkg $curpkgn
|
||||
xbps_write_metadata_pkg
|
||||
|
||||
#
|
||||
# Do not stow package if it wasn't requested.
|
||||
#
|
||||
if [ -z "$install_destdir_target" ]; then
|
||||
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
||||
stow_pkg $curpkgn
|
||||
stow_pkg_handler stow
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -128,8 +117,7 @@ install_pkg()
|
|||
#
|
||||
list_pkg_files()
|
||||
{
|
||||
local pkg="$1"
|
||||
local ver=
|
||||
local pkg="$1" ver=
|
||||
|
||||
[ -z $pkg ] && msg_error "unexistent package, aborting."
|
||||
|
||||
|
@ -144,29 +132,24 @@ list_pkg_files()
|
|||
#
|
||||
remove_pkg()
|
||||
{
|
||||
local pkg="$1" subpkg ver
|
||||
local subpkg ver
|
||||
|
||||
[ -z $pkg ] && msg_error "unexistent package, aborting."
|
||||
[ -z $pkgname ] && msg_error "unexistent package, aborting."
|
||||
|
||||
if [ ! -f "$XBPS_TEMPLATESDIR/$pkg/template" ]; then
|
||||
msg_error "cannot find template build file."
|
||||
fi
|
||||
ver=$($XBPS_PKGDB_CMD version $pkgname)
|
||||
[ -z "$ver" ] && msg_error "$pkgname is not installed."
|
||||
|
||||
. $XBPS_TEMPLATESDIR/$pkg/template
|
||||
for f in ${subpackages}; do
|
||||
if [ "$pkg" = "${pkgname}-${f}" ]; then
|
||||
pkgname=${pkg}
|
||||
break;
|
||||
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
||||
stow_pkg_handler unstow || return $?
|
||||
|
||||
for subpkg in ${subpackages}; do
|
||||
if [ -d $XBPS_DESTDIR/${subpkg}-${ver%_${revision}} ]; then
|
||||
rm -rf $XBPS_DESTDIR/${subpkg}-${ver%_${revision}}
|
||||
fi
|
||||
done
|
||||
|
||||
ver=$($XBPS_PKGDB_CMD version $pkg)
|
||||
[ -z "$ver" ] && msg_error "$pkg is not installed."
|
||||
|
||||
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
||||
unstow_pkg $pkg
|
||||
if [ $? -eq 0 -a -d $XBPS_DESTDIR/$pkg-${ver%_${revision}} ]; then
|
||||
rm -rf $XBPS_DESTDIR/$pkg-${ver%_${revision}}
|
||||
if [ -d $XBPS_DESTDIR/${pkgname}-${ver%_${revision}} ]; then
|
||||
rm -rf $XBPS_DESTDIR/${pkgname}-${ver%_${revision}}
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
|
|
@ -25,44 +25,40 @@
|
|||
|
||||
. ${XBPS_SHUTILSDIR}/builddep_funcs.sh
|
||||
|
||||
stow_pkg()
|
||||
stow_pkg_handler()
|
||||
{
|
||||
local pkg="$1"
|
||||
local subpkg spkgrev
|
||||
local action="$1" subpkg spkgrev
|
||||
|
||||
for subpkg in ${subpackages}; do
|
||||
if [ "${pkg}" != "${sourcepkg}" ] && \
|
||||
[ "${pkg}" != "${sourcepkg}-${subpkg}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "$revision" ]; then
|
||||
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}"
|
||||
spkgrev="${subpkg}-${version}_${revision}"
|
||||
else
|
||||
spkgrev="${sourcepkg}-${subpkg}-${version}"
|
||||
spkgrev="${subpkg}-${version}"
|
||||
fi
|
||||
check_installed_pkg ${spkgrev}
|
||||
[ $? -eq 0 ] && continue
|
||||
|
||||
if [ ! -f $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template ]; then
|
||||
msg_error "Cannot find subpackage template!"
|
||||
if [ "$action" = "stow" ]; then
|
||||
check_installed_pkg ${spkgrev}
|
||||
[ $? -eq 0 ] && continue
|
||||
fi
|
||||
if [ ! -f $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template ]; then
|
||||
msg_error "Cannot find $subpkg subpkg build template!"
|
||||
fi
|
||||
unset revision
|
||||
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
|
||||
pkgname=${sourcepkg}-${subpkg}
|
||||
. $XBPS_SRCPKGDIR/${sourcepkg}/${subpkg}.template
|
||||
pkgname=${subpkg}
|
||||
set_tmpl_common_vars
|
||||
stow_pkg_real ${pkgname}
|
||||
run_template ${sourcepkg}
|
||||
if [ "${pkg}" = "${sourcepkg}-${subpkg}" ]; then
|
||||
#
|
||||
# If it's a subpackage, just remove sourcepkg from
|
||||
# destdir and return, we are done.
|
||||
#
|
||||
rm -rf $XBPS_DESTDIR/${spkgrev}
|
||||
return $?
|
||||
if [ "$action" = "stow" ]; then
|
||||
stow_pkg_real || return $?
|
||||
else
|
||||
unstow_pkg_real || return $?
|
||||
fi
|
||||
run_template ${sourcepkg}
|
||||
done
|
||||
|
||||
stow_pkg_real ${pkg} ${automatic}
|
||||
if [ "$action" = "stow" ]; then
|
||||
stow_pkg_real
|
||||
else
|
||||
unstow_pkg_real
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
|
@ -72,20 +68,19 @@ stow_pkg()
|
|||
#
|
||||
stow_pkg_real()
|
||||
{
|
||||
local pkg="$1"
|
||||
local i lver regpkgdb_flags
|
||||
|
||||
[ -z "$pkg" ] && return 2
|
||||
[ -z "$pkgname" ] && return 2
|
||||
|
||||
if [ $(id -u) -ne 0 ] && [ ! -w $XBPS_MASTERDIR ]; then
|
||||
msg_error "cannot stow $pkg! (permission denied)"
|
||||
msg_error "cannot stow $pkgname! (permission denied)"
|
||||
fi
|
||||
|
||||
if [ "$build_style" = "meta-template" ]; then
|
||||
[ ! -d ${DESTDIR} ] && mkdir -p ${DESTDIR}
|
||||
fi
|
||||
|
||||
[ -n "$stow_flag" ] && run_template $pkg
|
||||
[ -n "$stow_flag" ] && run_template $pkgname
|
||||
|
||||
cd ${DESTDIR} || exit 1
|
||||
|
||||
|
@ -106,7 +101,7 @@ stow_pkg_real()
|
|||
else
|
||||
lver="${version}"
|
||||
fi
|
||||
$XBPS_PKGDB_CMD register $pkg $lver "$short_desc" || exit 1
|
||||
$XBPS_PKGDB_CMD register $pkgname $lver "$short_desc"
|
||||
return $?
|
||||
}
|
||||
|
||||
|
@ -114,32 +109,32 @@ stow_pkg_real()
|
|||
# Unstow a package, i.e remove its files from masterdir and
|
||||
# unregister pkg from package database.
|
||||
#
|
||||
unstow_pkg()
|
||||
unstow_pkg_real()
|
||||
{
|
||||
local f ver pkg="$1"
|
||||
local f ver
|
||||
|
||||
[ -z $pkg ] && msg_error "template wasn't specified?"
|
||||
[ -z $pkgname ] && return 1
|
||||
|
||||
if [ $(id -u) -ne 0 ] && \
|
||||
[ ! -w $XBPS_MASTERDIR ]; then
|
||||
msg_error "cannot unstow $pkg! (permission denied)"
|
||||
msg_error "cannot unstow $pkgname! (permission denied)"
|
||||
fi
|
||||
|
||||
run_template $pkg
|
||||
run_template $pkgname
|
||||
|
||||
ver=$($XBPS_PKGDB_CMD version $pkg)
|
||||
ver=$($XBPS_PKGDB_CMD version $pkgname)
|
||||
if [ -z "$ver" ]; then
|
||||
msg_error "$pkg is not installed."
|
||||
msg_error "$pkgname is not installed."
|
||||
fi
|
||||
|
||||
cd $XBPS_PKGMETADIR/$pkg || exit 1
|
||||
cd $XBPS_PKGMETADIR/$pkgname || exit 1
|
||||
if [ "$build_style" = "meta-template" ]; then
|
||||
# If it's a metapkg, do nothing.
|
||||
:
|
||||
elif [ ! -f flist ]; then
|
||||
msg_error "$pkg is incomplete, missing flist."
|
||||
msg_error "$pkgname is incomplete, missing flist."
|
||||
elif [ ! -w flist ]; then
|
||||
msg_error "$pkg cannot be removed (permission denied)."
|
||||
msg_error "$pkgname cannot be removed (permission denied)."
|
||||
elif [ -s flist ]; then
|
||||
# Remove installed files.
|
||||
for f in $(cat flist); do
|
||||
|
@ -162,9 +157,9 @@ unstow_pkg()
|
|||
fi
|
||||
|
||||
# Remove metadata dir.
|
||||
rm -rf $XBPS_PKGMETADIR/$pkg
|
||||
rm -rf $XBPS_PKGMETADIR/$pkgname
|
||||
|
||||
# Unregister pkg from plist file.
|
||||
$XBPS_PKGDB_CMD unregister $pkg $ver
|
||||
$XBPS_PKGDB_CMD unregister $pkgname $ver
|
||||
return $?
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ info_tmpl()
|
|||
echo "$long_desc"
|
||||
echo
|
||||
. $XBPS_SHUTILSDIR/builddep_funcs.sh
|
||||
run_template $pkgname
|
||||
check_build_depends_pkg
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "This package requires the following dependencies to be built:"
|
||||
|
@ -95,24 +94,43 @@ setup_tmpl()
|
|||
{
|
||||
local pkg="$1"
|
||||
|
||||
[ -z "$pkg" ] && msg_error "missing package name after target."
|
||||
[ -z "$pkg" ] && return 1
|
||||
[ "$pkgname" = "$pkg" ] && return 0
|
||||
|
||||
for f in $(echo $XBPS_COMMONVARSDIR/*.sh); do
|
||||
[ -r ${f} ] && . ${f}
|
||||
done
|
||||
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkg/template" ]; then
|
||||
if [ "$pkgname" != "$pkg" ]; then
|
||||
reset_tmpl_vars
|
||||
. $XBPS_TEMPLATESDIR/$pkg/template
|
||||
fi
|
||||
if [ -f $XBPS_SRCPKGDIR/${pkg}/template ]; then
|
||||
reset_tmpl_vars
|
||||
. $XBPS_SRCPKGDIR/${pkg}/template
|
||||
prepare_tmpl
|
||||
else
|
||||
msg_error "cannot find '$pkg' template build file."
|
||||
msg_error "Cannot find $pkg build template file."
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
check_builddep_dup()
|
||||
{
|
||||
local dep="$1" i
|
||||
|
||||
for i in ${build_depends}; do
|
||||
[ "${i}" != "${dep}" ] && continue
|
||||
return 1
|
||||
done
|
||||
}
|
||||
|
||||
check_rundep_dup()
|
||||
{
|
||||
local dep="$1" i
|
||||
|
||||
for i in ${run_depends}; do
|
||||
[ "${i}" != "${dep}" ] && continue
|
||||
return 1
|
||||
done
|
||||
}
|
||||
|
||||
Add_dependency()
|
||||
{
|
||||
local type="$1" pkgname="$2" version="$3"
|
||||
|
@ -124,29 +142,41 @@ Add_dependency()
|
|||
|
||||
[ -z "$pkgname" ] && msg_error "Add_dependency: pkgname empty!"
|
||||
|
||||
if [ -f $XBPS_TEMPLATESDIR/${pkgname}/${pkgname}.depends ]; then
|
||||
. $XBPS_TEMPLATESDIR/${pkgname}/${pkgname}.depends
|
||||
elif [ -f $XBPS_TEMPLATESDIR/${pkgname}/depends ]; then
|
||||
. $XBPS_TEMPLATESDIR/${pkgname}/depends
|
||||
if [ -f $XBPS_SRCPKGDIR/${pkgname}/${pkgname}.depends ]; then
|
||||
. $XBPS_SRCPKGDIR/${pkgname}/${pkgname}.depends
|
||||
elif [ -f $XBPS_SRCPKGDIR/${pkgname}/depends ]; then
|
||||
. $XBPS_SRCPKGDIR/${pkgname}/depends
|
||||
fi
|
||||
|
||||
if [ "$type" = "full" -o "$type" = "build" ]; then
|
||||
if [ -z "$version" -a -z "$api_depends" ]; then
|
||||
build_depends="${build_depends} ${pkgname}>=0"
|
||||
if check_builddep_dup "${pkgname}>=0"; then
|
||||
build_depends="${build_depends} ${pkgname}>=0"
|
||||
fi
|
||||
elif [ -z "$version" -a -n "$api_depends" ]; then
|
||||
build_depends="${build_depends} ${pkgname}${api_depends}"
|
||||
if check_builddep_dup "${pkgname}${api_depends}"; then
|
||||
build_depends="${build_depends} ${pkgname}${api_depends}"
|
||||
fi
|
||||
else
|
||||
build_depends="${build_depends} ${pkgname}${version}"
|
||||
if check_builddep_dup "${pkgname}${version}"; then
|
||||
build_depends="${build_depends} ${pkgname}${version}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$type" = "full" -o "$type" = "run" ]; then
|
||||
if [ -z "$version" -a -z "$abi_depends" ]; then
|
||||
run_depends="${run_depends} ${pkgname}>=0"
|
||||
if check_rundep_dup "${pkgname}>=0"; then
|
||||
run_depends="${run_depends} ${pkgname}>=0"
|
||||
fi
|
||||
elif [ -z "$version" -a -n "$abi_depends" ]; then
|
||||
run_depends="${run_depends} ${pkgname}${abi_depends}"
|
||||
if check_rundep_dup "${pkgname}${api_depends}"; then
|
||||
run_depends="${run_depends} ${pkgname}${abi_depends}"
|
||||
fi
|
||||
else
|
||||
run_depends="${run_depends} ${pkgname}${version}"
|
||||
if check_rundep_dup "${pkgname}${version}"; then
|
||||
run_depends="${run_depends} ${pkgname}${version}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -212,8 +242,8 @@ set_tmpl_common_vars()
|
|||
{
|
||||
[ -z "$pkgname" ] && return 1
|
||||
|
||||
FILESDIR=${XBPS_TEMPLATESDIR}/${pkgname}/files
|
||||
PATCHESDIR=${XBPS_TEMPLATESDIR}/${pkgname}/patches
|
||||
FILESDIR=$XBPS_SRCPKGDIR/$pkgname/files
|
||||
PATCHESDIR=$XBPS_SRCPKGDIR/$pkgname/patches
|
||||
DESTDIR=${XBPS_DESTDIR}/${pkgname}-${version}
|
||||
if [ -z "${sourcepkg}" ]; then
|
||||
sourcepkg=${pkgname}
|
||||
|
@ -227,7 +257,11 @@ run_template()
|
|||
|
||||
if [ "$pkgname" != "$pkg" ]; then
|
||||
reset_tmpl_vars
|
||||
. $XBPS_TEMPLATESDIR/$pkg/template
|
||||
if [ ! -d $XBPS_SRCPKGDIR/$pkg -o \
|
||||
! -f $XBPS_SRCPKGDIR/$pkg/template ]; then
|
||||
msg_error "Cannot find $pkg build template file!"
|
||||
fi
|
||||
. $XBPS_SRCPKGDIR/$pkg/template
|
||||
set_tmpl_common_vars
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue