add checkout depth parameter, based on work of Markus Lehtonen <markus.lehtonen@linux.intel.com>
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=20
This commit is contained in:
parent
c19f265b65
commit
6a8b18a2fd
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 25 13:52:06 UTC 2011 - adrian@suse.de
|
||||
|
||||
- add support for (git) checkout depth, original patch by
|
||||
Markus Lehtonen <markus.lehtonen@linux.intel.com>
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 17 07:54:29 UTC 2011 - adrian@suse.de
|
||||
|
||||
|
13
tar_scm
13
tar_scm
@ -18,6 +18,7 @@ MYPREFIX=""
|
||||
MYFILENAME=""
|
||||
MYREVISION=""
|
||||
MYPACKAGEMETA=""
|
||||
MYGITARGS="--depth 1"
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
@ -61,6 +62,14 @@ while test $# -gt 0; do
|
||||
MYOUTDIR="$2"
|
||||
shift
|
||||
;;
|
||||
*-history-depth)
|
||||
if [ "$2" == "full" ]; then
|
||||
MYGITARGS=""
|
||||
else
|
||||
MYGITARGS="--depth $2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo Unknown parameter $1.
|
||||
echo 'Usage: tar_scm --scm $SCM --url $URL --outdir $OUT'
|
||||
@ -166,7 +175,7 @@ elif [ "$MYSCM" == "git" ]; then
|
||||
# update existing content for speed/bandwidth reasons
|
||||
cd "$TAR_DIRECTORY"
|
||||
OLDVERSION=`git show --pretty=%at | head -n 1`
|
||||
git pull || exit 1
|
||||
git pull $MYGITARGS || exit 1
|
||||
if [ -n "$MYREVISION" ]; then
|
||||
git checkout "$MYREVISION" || exit 1
|
||||
fi
|
||||
@ -180,7 +189,7 @@ elif [ "$MYSCM" == "git" ]; then
|
||||
mv "$TAR_DIRECTORY" "${FILE}" || exit 1
|
||||
else
|
||||
# new checkout
|
||||
git clone --depth 1 "$MYURL" "${FILE}" || exit 1
|
||||
git clone "$MYGITARGS" "$MYURL" "${FILE}" || exit 1
|
||||
if [ -n "$MYREVISION" ]; then
|
||||
cd "$FILE"
|
||||
git checkout "$MYREVISION" || exit 1
|
||||
|
@ -35,5 +35,8 @@
|
||||
<description>Package the meta data of SCM to allow the user or OBS to update after un-tar</description>
|
||||
<allowedvalue>yes</allowedvalue>
|
||||
</parameter>
|
||||
<parameter name="history-depth">
|
||||
<description>Stored history depth. Special value "full" clones/pulls full history. Only valid if SCM git is used.</description>
|
||||
</parameter>
|
||||
</service>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user