From f5575d6a11b8a1585fdfff77f69d069a95ecfdccf6caff426943c2d4eac45754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Wed, 12 Jan 2011 10:03:13 +0000 Subject: [PATCH] - fix subdir usage for git OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=8 --- obs-service-tar_scm.changes | 5 +++++ tar_scm | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/obs-service-tar_scm.changes b/obs-service-tar_scm.changes index 9235c14..eb9e7b5 100644 --- a/obs-service-tar_scm.changes +++ b/obs-service-tar_scm.changes @@ -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 diff --git a/tar_scm b/tar_scm index a173750..9a6199d 100644 --- a/tar_scm +++ b/tar_scm @@ -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}"