Add $create_wrksrc for use in templates.

If set the specified wrksrc will be created and its distfiles will be
extracted into it.

--HG--
extra : convert_revision : c6b0ff2634a9f764d45fcdd97ecee5d32c8a7ace
This commit is contained in:
Juan RP 2010-01-04 16:05:13 +01:00
parent 6a4d574a12
commit c18153b92c
2 changed files with 20 additions and 23 deletions

View file

@ -1,5 +1,5 @@
#-
# Copyright (c) 2008 Juan Romero Pardines.
# Copyright (c) 2008-2010 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -29,7 +29,7 @@
#
extract_distfiles()
{
local pkg="$1" curfile cursufx ltar_cmd f lver
local pkg="$1" curfile cursufx f lver
[ -f $XBPS_EXTRACT_DONE ] && return 0
[ -z "$in_chroot" -a ! -w $XBPS_BUILDDIR ] && \
@ -59,14 +59,12 @@ extract_distfiles()
return 0
fi
msg_normal "Extracting $pkgname-$lver distfile(s)."
if [ -n "$tar_override_cmd" ]; then
ltar_cmd="$tar_override_cmd"
else
ltar_cmd="tar"
if [ -n "$create_wrksrc" ]; then
mkdir -p ${wrksrc} || return 1
fi
msg_normal "Extracting $pkgname-$lver distfile(s)."
for f in ${distfiles}; do
curfile=$(basename $f)
@ -96,33 +94,36 @@ extract_distfiles()
msg_error "unknown distfile suffix for $curfile."
fi
if [ -n "$create_wrksrc" ]; then
extractdir="$wrksrc"
else
extractdir="$XBPS_BUILDDIR"
fi
case ${cursufx} in
txz)
if [ ! -x $XBPS_MASTERDIR/usr/bin/xz ]; then
msg_error "cannot find xz for extraction."
fi
$ltar_cmd xfJ $XBPS_SRCDISTDIR/$curfile \
-C $XBPS_BUILDDIR
tar xfJ $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi
;;
tbz)
$ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile \
-C $XBPS_BUILDDIR
tar xfj $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi
;;
tgz)
$ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile \
-C $XBPS_BUILDDIR
tar xfz $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi
;;
gz|bz2)
cp -f $XBPS_SRCDISTDIR/$curfile $XBPS_BUILDDIR
cp -f $XBPS_SRCDISTDIR/$curfile $extractdir
if [ "$cursufx" = ".gz" ]; then
cd $XBPS_BUILDDIR && gunzip $curfile
else
@ -130,8 +131,7 @@ extract_distfiles()
fi
;;
tar)
$ltar_cmd xf $XBPS_SRCDISTDIR/$curfile \
-C $XBPS_BUILDDIR
tar xf $XBPS_SRCDISTDIR/$curfile -C $extractdir
if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi
@ -140,7 +140,7 @@ extract_distfiles()
if [ -x $XBPS_MASTERDIR/usr/bin/unzip ]; then
$XBPS_MASTERDIR/usr/bin/unzip \
-q -x $XBPS_SRCDISTDIR/$curfile \
-d $XBPS_BUILDDIR
-d $extractdir
if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi
@ -154,8 +154,5 @@ extract_distfiles()
esac
done
if [ ! -d ${wrksrc} ]; then
mkdir -p ${wrksrc}
fi
touch -f $XBPS_EXTRACT_DONE
}

View file

@ -1,5 +1,5 @@
#-
# Copyright (c) 2008-2009 Juan Romero Pardines.
# Copyright (c) 2008-2010 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -75,7 +75,7 @@ reset_tmpl_vars()
only_for_archs conf_files keep_libtool_archives \
noarch subpackages sourcepkg gtk_iconcache_dirs \
abi_depends api_depends triggers openrc_services \
replaces system_accounts build_wrksrc \
replaces system_accounts build_wrksrc create_wrksrc \
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \
SRCPKGDESTDIR PATCHESDIR"