Rework how $revision is used. Works much better in all cases.

$version is not modified anymore.

--HG--
extra : convert_revision : a83408f47e22db2f34cd33d6d47eb2f045ae2758
This commit is contained in:
Juan RP 2009-03-28 08:27:29 +01:00
parent e0d52c9d11
commit 75bd88afc6
10 changed files with 106 additions and 60 deletions

View file

@ -31,7 +31,7 @@ build_src_phase()
{
local pkgparam="$1"
local pkg="$pkgname-$version"
local f=
local f
[ -z $pkgparam ] && [ -z $pkgname -o -z $version ] && return 1
@ -47,6 +47,8 @@ build_src_phase()
cd $wrksrc || exit 1
[ -n "$revision" ] && pkg="${pkg}_${revision}"
# cross compilation vars.
if [ -n "$cross_compiler" ]; then
. $XBPS_HELPERSDIR/cross-compilation.sh

View file

@ -89,13 +89,19 @@ install_dependencies_pkg()
{
local pkg="$1"
local lpkgname=$(xbps-pkgdb getpkgname ${pkg})
local i ipkgname iversion reqvers notinstalled_deps
local i ipkgname iversion reqvers notinstalled_deps lver
[ -z "$pkg" ] && return 1
doing_deps=true
echo "==> Required build dependencies for $pkgname-$version... "
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
echo "==> Required build dependencies for $pkgname-$lver... "
for i in ${build_depends}; do
ipkgname=$(xbps-pkgdb getpkgname ${i})
iversion=$($XBPS_REGPKGDB_CMD version $ipkgname)

View file

@ -29,8 +29,7 @@
#
configure_src_phase()
{
local pkg="$1"
local f=
local f lver pkg="$1"
[ -z $pkg ] && [ -z $pkgname ] && return 1
@ -50,6 +49,12 @@ configure_src_phase()
"$build_style" = "only-install" -o \
"$build_style" = "custom-install" ] && return 0
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
# cross compilation vars.
if [ -n "$cross_compiler" ]; then
. $XBPS_HELPERSDIR/cross-compilation.sh
@ -64,7 +69,7 @@ configure_src_phase()
export "$f"
done
msg_normal "Running configure phase for $pkgname-$version."
msg_normal "Running configure phase for $pkgname-$lver."
[ -z "$configure_script" ] && configure_script="./configure"

View file

@ -29,13 +29,8 @@
#
extract_distfiles()
{
local pkg="$1"
local count=0
local curfile=
local cursufx=
local lwrksrc=
local ltar_cmd=
local f=
local count=0 pkg="$1"
local curfile cursufx lwrksrc ltar_cmd f lver
[ -f $XBPS_EXTRACT_DONE ] && return 0
[ -z "$in_chroot" -a ! -w $XBPS_BUILDDIR ] && \
@ -51,11 +46,16 @@ extract_distfiles()
#
[ "$build_style" = "meta-template" ] && return 0
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
#
# If noextract is set, do a "fake extraction".
#
if [ -n "$noextract" ]; then
msg_normal "Manual extraction for $pkgname-$version."
msg_normal "Manual extraction for $pkgname-$lver."
mkdir $wrksrc
touch -f $XBPS_EXTRACT_DONE
return 0
@ -73,7 +73,7 @@ extract_distfiles()
mkdir $wrksrc
fi
msg_normal "Extracting $pkgname-$version distfile(s)."
msg_normal "Extracting $pkgname-$lver distfile(s)."
if [ -n "$tar_override_cmd" ]; then
ltar_cmd="$tar_override_cmd"

View file

@ -30,17 +30,22 @@
install_src_phase()
{
local pkg="$1"
local f=
local i=
local subpkg=
local f i subpkg lver spkgrev
[ -z $pkg ] && [ -z $pkgname ] && return 1
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
#
# There's nothing we can do if we are a meta template.
# Just creating the dir is enough to write the package metadata.
#
if [ "$build_style" = "meta-template" ]; then
mkdir -p $XBPS_DESTDIR/$pkgname-$version
mkdir -p $XBPS_DESTDIR/$pkgname-$lver
return 0
fi
@ -51,7 +56,7 @@ install_src_phase()
# Run pre_install func.
run_func pre_install
msg_normal "Running install phase for $pkgname-$version."
msg_normal "Running install phase for $pkgname-$lver."
# cross compilation vars.
if [ -n "$cross_compiler" ]; then
@ -62,7 +67,7 @@ install_src_phase()
if [ "$build_style" = "custom-install" ]; then
run_func do_install
else
make_install
make_install $lver
fi
# Run post_install func.
@ -71,7 +76,7 @@ install_src_phase()
# unset cross compiler vars.
[ -n "$cross_compiler" ] && cross_compile_unsetvars
msg_normal "Installed $pkgname-$version into $XBPS_DESTDIR."
msg_normal "Installed $pkgname-$lver into $XBPS_DESTDIR."
touch -f $XBPS_INSTALL_DONE
@ -83,7 +88,12 @@ install_src_phase()
[ "${pkg}" != "${sourcepkg}-${subpkg}" ]; then
continue
fi
check_installed_pkg ${sourcepkg}-${subpkg}-${version}
if [ -n "$revision" ]; then
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}"
else
spkgrev="${sourcepkg}-${subpkg}-${version}"
fi
check_installed_pkg ${spkgrev}
[ $? -eq 0 ] && continue
msg_normal "Preparing ${sourcepkg} subpackage: $sourcepkg-$subpkg"
@ -105,7 +115,7 @@ install_src_phase()
if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then
rm -rf $wrksrc
[ $? -eq 0 ] && \
msg_normal "Removed $pkgname-$version build directory."
msg_normal "Removed $pkgname-$lver build directory."
fi
}
@ -115,6 +125,8 @@ install_src_phase()
make_install()
{
local lver="$1"
if [ "$build_style" = "perl_module" ]; then
make_install_target="install"
elif [ -z "$make_install_target" ]; then
@ -131,7 +143,7 @@ make_install()
#
run_rootcmd no ${make_cmd} ${make_install_target} ${make_install_args}
if [ "$?" -ne 0 ]; then
msg_error "installing $pkgname-$version."
msg_error "installing $pkgname-$lver."
exit 1
fi

View file

@ -50,7 +50,7 @@ xbps_make_binpkg()
#
xbps_make_binpkg_real()
{
local binpkg pkgdir arch use_sudo
local binpkg pkgdir arch use_sudo lver
if [ ! -d ${DESTDIR} ]; then
echo "$pkgname: unexistent destdir... skipping!"
@ -71,7 +71,12 @@ xbps_make_binpkg_real()
use_sudo=yes
fi
binpkg=$pkgname-$version.$arch.xbps
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
binpkg=$pkgname-$lver.$arch.xbps
pkgdir=$XBPS_PACKAGESDIR/$arch
if [ -x ./INSTALL ]; then

View file

@ -41,20 +41,26 @@ _EOF
xbps_write_metadata_pkg()
{
local pkg="$1"
local subpkg
local subpkg spkgrev
for subpkg in ${subpackages}; do
if [ "${pkg}" != "${sourcepkg}" ] && \
[ "${pkg}" != "${sourcepkg}-${subpkg}" ]; then
continue
fi
check_installed_pkg ${sourcepkg}-${subpkg}-${version}
if [ -n "${revision}" ]; then
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}"
else
spkgrev="${sourcepkg}-${subpkg}-${version}"
fi
check_installed_pkg ${spkgrev}
[ $? -eq 0 ] && continue
if [ ! -f $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template ]; then
msg_error "Cannot find subpackage template!"
fi
unset run_depends conf_files keep_dirs noarch triggers
unset run_depends conf_files keep_dirs noarch triggers \
revision
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
pkgname=${sourcepkg}-${subpkg}
set_tmpl_common_vars
@ -67,7 +73,12 @@ xbps_write_metadata_pkg()
if [ "$build_style" = "meta-template" -a -z "${run_depends}" ]; then
for subpkg in ${subpackages}; do
run_depends="$run_depends ${sourcepkg}-${subpkg}-${version}"
if [ -n "${revision}" ]; then
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}"
else
spkgrev="${sourcepkg}-${subpkg}-${version}"
fi
run_depends="${run_depends} ${spkgrev}"
done
fi
set_tmpl_common_vars
@ -81,7 +92,7 @@ xbps_write_metadata_pkg()
xbps_write_metadata_pkg_real()
{
local metadir=${DESTDIR}/var/db/xbps/metadata/$pkgname
local f i j arch dirat lnkat newlnk TMPFLIST TMPFPLIST
local f i j arch dirat lnkat newlnk lver TMPFLIST TMPFPLIST
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
if [ ! -d "${DESTDIR}" ]; then
@ -95,6 +106,12 @@ xbps_write_metadata_pkg_real()
arch=$xbps_machine
fi
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
# Write the files.plist file.
TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1
TMPFPLIST=$(mktemp -t fplist.XXXXXXXXXX) || exit 1
@ -159,7 +176,7 @@ xbps_write_metadata_pkg_real()
fi
cd ${DESTDIR}
msg_normal "Writing package metadata for $pkgname-$version..."
msg_normal "Writing package metadata for $pkgname-$lver..."
write_metadata_flist_header $TMPFPLIST
@ -245,7 +262,7 @@ xbps_write_metadata_pkg_real()
<key>pkgname</key>
<string>$pkgname</string>
<key>version</key>
<string>$version</string>
<string>$lver</string>
<key>architecture</key>
<string>$arch</string>
<key>installed_size</key>

View file

@ -145,9 +145,7 @@ list_pkg_files()
#
remove_pkg()
{
local pkg="$1"
local subpkg=
local ver=
local pkg="$1" subpkg ver
[ -z $pkg ] && msg_error "unexistent package, aborting."
@ -168,8 +166,8 @@ remove_pkg()
. $XBPS_SHUTILSDIR/stow_funcs.sh
unstow_pkg $pkg
if [ $? -eq 0 -a -d $XBPS_DESTDIR/$pkg-$ver ]; then
rm -rf $XBPS_DESTDIR/$pkg-$ver
if [ $? -eq 0 -a -d $XBPS_DESTDIR/$pkg-${ver%_${revision}} ]; then
rm -rf $XBPS_DESTDIR/$pkg-${ver%_${revision}}
fi
return $?
}

View file

@ -29,19 +29,25 @@ stow_pkg()
{
local pkg="$1"
local automatic="$2"
local subpkg=
local subpkg spkgrev
for subpkg in ${subpackages}; do
if [ "${pkg}" != "${sourcepkg}" ] && \
[ "${pkg}" != "${sourcepkg}-${subpkg}" ]; then
continue
fi
check_installed_pkg ${sourcepkg}-${subpkg}-${version}
if [ -n "$revision" ]; then
spkgrev="${sourcepkg}-${subpkg}-${version}_${revision}"
else
spkgrev="${sourcepkg}-${subpkg}-${version}"
fi
check_installed_pkg ${spkgrev}
[ $? -eq 0 ] && continue
if [ ! -f $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template ]; then
msg_error "Cannot find subpackage template!"
fi
unset revision
. $XBPS_TEMPLATESDIR/${sourcepkg}/${subpkg}.template
pkgname=${sourcepkg}-${subpkg}
set_tmpl_common_vars
@ -52,7 +58,7 @@ stow_pkg()
# If it's a subpackage, just remove sourcepkg from
# destdir and return, we are done.
#
rm -rf $XBPS_DESTDIR/${sourcepkg}-${version}
rm -rf $XBPS_DESTDIR/${spkgrev}
return $?
fi
done
@ -70,7 +76,7 @@ stow_pkg_real()
{
local pkg="$1"
local automatic="$2"
local i=
local i lver regpkgdb_flags
[ -z "$pkg" ] && return 2
@ -96,12 +102,15 @@ stow_pkg_real()
# Register pkg in plist file and add automatic installation
# object if requested.
#
local regpkgdb_flags=
if [ -n "$automatic" ]; then
regpkgdb_flags="-a"
[ -n "$automatic" ] && regpkgdb_flags="-a"
if [ -n "$revision" ]; then
lver="${version}_${revision}"
else
lver="${version}"
fi
$XBPS_REGPKGDB_CMD $regpkgdb_flags register \
$pkg $version "$short_desc" || exit 1
$pkg $lver "$short_desc" || exit 1
}
#
@ -110,9 +119,7 @@ stow_pkg_real()
#
unstow_pkg()
{
local pkg="$1"
local f=
local ver=
local f ver pkg="$1"
[ -z $pkg ] && msg_error "template wasn't specified?"

View file

@ -32,6 +32,7 @@ info_tmpl()
echo "pkgname: $pkgname"
echo "version: $version"
[ -n "$revision" ] && echo "revision: $revision"
for i in "${distfiles}"; do
[ -n "$i" ] && echo "distfile: $i"
done
@ -65,7 +66,7 @@ reset_tmpl_vars()
make_build_target configure_script noextract \
pre_configure pre_build pre_install \
post_configure post_build post_install \
make_install_target version revision _revset \
make_install_target version revision \
sgml_catalogs xml_catalogs xml_entries sgml_entries \
build_depends libtool_fixup_la_stage no_fixup_libtool \
disable_parallel_build run_depends cross_compiler \
@ -152,9 +153,7 @@ Add_dependency()
#
prepare_tmpl()
{
local REQ_VARS=
local i=
local found=
local REQ_VARS i found
#
# There's nothing of interest if we are a meta template.
@ -162,7 +161,7 @@ prepare_tmpl()
[ "$build_style" = "meta-template" ] && return 0
if [ "$build_style" = "custom-install" -a -z "$distfiles" ]; then
mkdir -p $XBPS_BUILDDIR/$pkgname-$version
return 0
fi
REQ_VARS="pkgname version build_style short_desc long_desc"
@ -208,11 +207,6 @@ set_tmpl_common_vars()
{
[ -z "$pkgname" ] && return 1
if [ -z "${_revset}" -a -n "$revision" ]; then
_revset=1
version="${version}_${revision}"
fi
FILESDIR=${XBPS_TEMPLATESDIR}/${pkgname}/files
DESTDIR=${XBPS_DESTDIR}/${pkgname}-${version}
SRCPKGDESTDIR=${XBPS_DESTDIR}/${sourcepkg}-${version}