Accepting request 101436 from home:schiele:branches:openSUSE:Tools

add new option to specify a subset of files/subdirectories to pack in the tar ball

OBS-URL: https://build.opensuse.org/request/show/101436
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=30
This commit is contained in:
Adrian Schröter 2012-01-25 08:48:25 +00:00 committed by Git OBS Bridge
parent e24f0c5562
commit 4aab52391d
3 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jan 24 15:46:17 UTC 2012 - rschiele@gmail.com
- add new option to specify a subset of files/subdirectories to
pack in the tar ball
-------------------------------------------------------------------
Tue Jan 24 13:26:19 UTC 2012 - rschiele@gmail.com

16
tar_scm
View File

@ -19,6 +19,7 @@ MYFILENAME=""
MYREVISION=""
MYPACKAGEMETA=""
MYGITARGS="--depth 1"
INCLUDES=""
while test $# -gt 0; do
case $1 in
@ -42,6 +43,10 @@ while test $# -gt 0; do
MYVERSION="$2"
shift
;;
*-include)
INCLUDES="$INCLUDES $2"
shift
;;
*-versionprefix)
MYPREFIX="$2"
shift
@ -276,9 +281,18 @@ else
FILENAME="${FILE}-${VERSION}"
fi
MYINCLUDES=""
for INC in $INCLUDES; do
MYINCLUDES="$MYINCLUDES $FILENAME/$INC"
done
if [ -z "$MYINCLUDES" ]; then
MYINCLUDES="$FILENAME"
fi
mv "$FILE/$MYSUBDIR" "${FILENAME}" || exit 1
tar cf "$MYOUTDIR/${FILENAME}.tar" $EXCLUDES "${FILENAME}" || exit 1
tar cf "$MYOUTDIR/${FILENAME}.tar" $EXCLUDES $MYINCLUDES || exit 1
rm -rf "${FILENAME}" "$FILE"
exit 0

View File

@ -26,7 +26,10 @@
<description>base file name to be created</description>
</parameter>
<parameter name="exclude">
<description>for sepcifing excludes when creating the tar ball</description>
<description>for specifying excludes when creating the tar ball</description>
</parameter>
<parameter name="include">
<description>for specifying subset of files/subdirectories to pack in the tar ball</description>
</parameter>
<parameter name="version">
<description>version to be used in tar. Setting it to an empty string is disabling the version tag.</description>