add non-versioned tar ball support

OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=25
This commit is contained in:
Adrian Schröter 2011-08-29 07:04:54 +00:00 committed by Git OBS Bridge
parent b6753f4717
commit d2b9050ffe
2 changed files with 19 additions and 8 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Aug 29 07:01:36 UTC 2011 - adrian@suse.de
- make it possible to create tar balls without version tag (#714542)
-------------------------------------------------------------------
Fri Aug 26 06:49:13 UTC 2011 - adrian@suse.de

22
tar_scm
View File

@ -13,7 +13,7 @@
# defaults
MYSCM=""
MYURL=""
MYVERSION=""
MYVERSION="_auto_"
MYPREFIX=""
MYFILENAME=""
MYREVISION=""
@ -168,7 +168,7 @@ if [ "$MYSCM" == "svn" ]; then
cd -
fi
fi
if [ -z "$VERSION" ]; then
if [ "$VERSION" == "_auto_" ]; then
cd "$FILE"
[ -n "$MYPREFIX" ] && MYPREFIX="$MYPREFIX.rev"
VERSION="$MYPREFIX"`LC_ALL=C svn info | sed -n 's,^Last Changed Rev: \(.*\),\1,p'`
@ -195,7 +195,7 @@ elif [ "$MYSCM" == "git" ]; then
cd -
fi
fi
if [ -z "$VERSION" ]; then
if [ "$VERSION" == "_auto_" ]; then
cd "$FILE"
[ -n "$MYPREFIX" ] && MYPREFIX="$MYPREFIX."
VERSION="$MYPREFIX"`git show --pretty=%at | head -n 1`
@ -219,7 +219,7 @@ elif [ "$MYSCM" == "hg" ]; then
hg update "$MYREVISION" || exit 1
cd -
fi
if [ -z "$VERSION" ]; then
if [ "$VERSION" == "_auto_" ]; then
cd "$FILE"
[ -n "$MYPREFIX" ] && MYPREFIX="$MYPREFIX."
# current working revision
@ -246,7 +246,7 @@ elif [ "$MYSCM" == "bzr" ]; then
bzr checkout "$MYURL" "${FILE}" || exit 1
fi
fi
if [ -z "$VERSION" ]; then
if [ "$VERSION" == "_auto_" ]; then
cd "$FILE"
[ -n "$MYPREFIX" ] && MYPREFIX="$MYPREFIX."
VERSION="$MYPREFIX"`bzr revno`
@ -262,9 +262,15 @@ if [ ! -e "$FILE/$MYSUBDIR" ]; then
exit 1
fi
mv "$FILE/$MYSUBDIR" "${FILE}-${VERSION}" || exit 1
if [ -z "$VERSION" ]; then
FILENAME="$FILE"
else
FILENAME="${FILE}-${VERSION}"
fi
tar cf "$MYOUTDIR/${FILE}-${VERSION}.tar" $EXCLUDES "${FILE}-${VERSION}" || exit 1
rm -rf "${FILE}-${VERSION}" "$FILE"
mv "$FILE/$MYSUBDIR" "${FILENAME}" || exit 1
tar cf "$MYOUTDIR/${FILENAME}.tar" $EXCLUDES "${FILENAME}" || exit 1
rm -rf "${FILENAME}" "$FILE"
exit 0