- fix subdir usage for git

OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=8
This commit is contained in:
Adrian Schröter 2011-01-12 10:03:13 +00:00 committed by Git OBS Bridge
parent df8c59e87f
commit f5575d6a11
2 changed files with 21 additions and 8 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jan 12 10:02:41 UTC 2011 - adrian@suse.de
- fix subdir usage for git
-------------------------------------------------------------------
Thu Dec 30 12:41:57 UTC 2010 - adrian@suse.de

24
tar_scm
View File

@ -113,7 +113,7 @@ if [ -e "$existing_tar" ]; then
fi
if [ "$MYSCM" == "svn" ]; then
if [ -z "$SUBDIR" -a -d "$TAR_DIRECTORY" ]; then
if [ -z "$MYSUBDIR" -a -d "$TAR_DIRECTORY" ]; then
# update existing content for speed/bandwidth reasons
cd "$TAR_DIRECTORY"
OLDVERSION=`LC_ALL=C svn info | sed -n 's,^Last Changed Rev: \(.*\),\1,p'`
@ -132,10 +132,18 @@ if [ "$MYSCM" == "svn" ]; then
mv "$TAR_DIRECTORY" "${FILE}" || exit 1
else
# new checkout
if [ -n "$MYSUBDIR" ]; then
# just checkout the subdir
mkdir -p "$MYSUBDIR"
cd "$MYSUBDIR"
fi
if [ -n "$MYREVISION" ]; then
svn co -r"$MYREVISION" "$MYURL" "${FILE}" || exit 1
svn co -r"$MYREVISION" "$MYURL/$MYSUBDIR" "${FILE}" || exit 1
else
svn co "$MYURL" "${FILE}" || exit 1
svn co "$MYURL/$MYSUBDIR" "${FILE}" || exit 1
fi
if [ -n "$MYSUBDIR" ]; then
cd -
fi
fi
if [ -z "$VERSION" ]; then
@ -145,7 +153,7 @@ if [ "$MYSCM" == "svn" ]; then
cd -
fi
elif [ "$MYSCM" == "git" ]; then
if [ -z "$SUBDIR" -a -d "$TAR_DIRECTORY" ]; then
if [ -z "$MYSUBDIR" -a -d "$TAR_DIRECTORY" ]; then
# update existing content for speed/bandwidth reasons
cd "$TAR_DIRECTORY"
OLDVERSION=`git show --pretty=%at | head -n 1`
@ -177,7 +185,7 @@ elif [ "$MYSCM" == "git" ]; then
cd -
fi
elif [ "$MYSCM" == "hg" ]; then
if [ -z "$SUBDIR" -a -d "$TAR_DIRECTORY" ]; then
if [ -z "$MYSUBDIR" -a -d "$TAR_DIRECTORY" ]; then
# update existing content for speed/bandwidth reasons
cd "$TAR_DIRECTORY"
OLDVERSION=`hg tip | head -n 1 | sed -e 's/\s*//g' | awk -F':' '{ print $2 }'`
@ -213,12 +221,12 @@ else
exit 1
fi
if [ ! -e "$FILE/$SUBDIR" ]; then
echo "Directory does not exist: $FILE/$SUBDIR"
if [ ! -e "$FILE/$MYSUBDIR" ]; then
echo "Directory does not exist: $FILE/$MYSUBDIR"
exit 1
fi
mv "$FILE/$SUBDIR" "${FILE}-${VERSION}" || exit 1
mv "$FILE/$MYSUBDIR" "${FILE}-${VERSION}" || exit 1
tar cf "$MYOUTDIR/${FILE}-${VERSION}.tar" $EXCLUDES "${FILE}-${VERSION}" || exit 1
rm -rf "${FILE}-${VERSION}"