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. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -29,7 +29,7 @@
# #
extract_distfiles() extract_distfiles()
{ {
local pkg="$1" curfile cursufx ltar_cmd f lver local pkg="$1" curfile cursufx f lver
[ -f $XBPS_EXTRACT_DONE ] && return 0 [ -f $XBPS_EXTRACT_DONE ] && return 0
[ -z "$in_chroot" -a ! -w $XBPS_BUILDDIR ] && \ [ -z "$in_chroot" -a ! -w $XBPS_BUILDDIR ] && \
@ -59,14 +59,12 @@ extract_distfiles()
return 0 return 0
fi fi
msg_normal "Extracting $pkgname-$lver distfile(s)." if [ -n "$create_wrksrc" ]; then
mkdir -p ${wrksrc} || return 1
if [ -n "$tar_override_cmd" ]; then
ltar_cmd="$tar_override_cmd"
else
ltar_cmd="tar"
fi fi
msg_normal "Extracting $pkgname-$lver distfile(s)."
for f in ${distfiles}; do for f in ${distfiles}; do
curfile=$(basename $f) curfile=$(basename $f)
@ -96,33 +94,36 @@ extract_distfiles()
msg_error "unknown distfile suffix for $curfile." msg_error "unknown distfile suffix for $curfile."
fi fi
if [ -n "$create_wrksrc" ]; then
extractdir="$wrksrc"
else
extractdir="$XBPS_BUILDDIR"
fi
case ${cursufx} in case ${cursufx} in
txz) txz)
if [ ! -x $XBPS_MASTERDIR/usr/bin/xz ]; then if [ ! -x $XBPS_MASTERDIR/usr/bin/xz ]; then
msg_error "cannot find xz for extraction." msg_error "cannot find xz for extraction."
fi fi
$ltar_cmd xfJ $XBPS_SRCDISTDIR/$curfile \ tar xfJ $XBPS_SRCDISTDIR/$curfile -C $extractdir
-C $XBPS_BUILDDIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi fi
;; ;;
tbz) tbz)
$ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile \ tar xfj $XBPS_SRCDISTDIR/$curfile -C $extractdir
-C $XBPS_BUILDDIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi fi
;; ;;
tgz) tgz)
$ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile \ tar xfz $XBPS_SRCDISTDIR/$curfile -C $extractdir
-C $XBPS_BUILDDIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi fi
;; ;;
gz|bz2) gz|bz2)
cp -f $XBPS_SRCDISTDIR/$curfile $XBPS_BUILDDIR cp -f $XBPS_SRCDISTDIR/$curfile $extractdir
if [ "$cursufx" = ".gz" ]; then if [ "$cursufx" = ".gz" ]; then
cd $XBPS_BUILDDIR && gunzip $curfile cd $XBPS_BUILDDIR && gunzip $curfile
else else
@ -130,8 +131,7 @@ extract_distfiles()
fi fi
;; ;;
tar) tar)
$ltar_cmd xf $XBPS_SRCDISTDIR/$curfile \ tar xf $XBPS_SRCDISTDIR/$curfile -C $extractdir
-C $XBPS_BUILDDIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi fi
@ -140,7 +140,7 @@ extract_distfiles()
if [ -x $XBPS_MASTERDIR/usr/bin/unzip ]; then if [ -x $XBPS_MASTERDIR/usr/bin/unzip ]; then
$XBPS_MASTERDIR/usr/bin/unzip \ $XBPS_MASTERDIR/usr/bin/unzip \
-q -x $XBPS_SRCDISTDIR/$curfile \ -q -x $XBPS_SRCDISTDIR/$curfile \
-d $XBPS_BUILDDIR -d $extractdir
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $XBPS_BUILDDIR." msg_error "extracting $curfile into $XBPS_BUILDDIR."
fi fi
@ -154,8 +154,5 @@ extract_distfiles()
esac esac
done done
if [ ! -d ${wrksrc} ]; then
mkdir -p ${wrksrc}
fi
touch -f $XBPS_EXTRACT_DONE 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. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # 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 \ only_for_archs conf_files keep_libtool_archives \
noarch subpackages sourcepkg gtk_iconcache_dirs \ noarch subpackages sourcepkg gtk_iconcache_dirs \
abi_depends api_depends triggers openrc_services \ 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_EXTRACT_DONE XBPS_CONFIGURE_DONE \
XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \ XBPS_BUILD_DONE XBPS_INSTALL_DONE FILESDIR DESTDIR \
SRCPKGDESTDIR PATCHESDIR" SRCPKGDESTDIR PATCHESDIR"