Accepting request 55099 from home:wrosenauer:devel
OBS-URL: https://build.opensuse.org/request/show/55099 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=4
This commit is contained in:
parent
bebd76e674
commit
3f9aafed0e
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Dec 8 06:29:42 UTC 2010 - wr@rosenauer.org
|
||||||
|
|
||||||
|
- support mercurial repositories
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Oct 20 16:27:25 UTC 2010 - reddwarf@opensuse.org
|
Wed Oct 20 16:27:25 UTC 2010 - reddwarf@opensuse.org
|
||||||
|
|
||||||
|
@ -2,19 +2,19 @@
|
|||||||
Name: obs-service-tar_scm
|
Name: obs-service-tar_scm
|
||||||
License: GPL v2 or later
|
License: GPL v2 or later
|
||||||
Group: Development/Tools/Building
|
Group: Development/Tools/Building
|
||||||
Summary: An OBS source service: checkout or update a tar ball from svn/git/cvs
|
Summary: An OBS source service: checkout or update a tar ball from svn/git/hg
|
||||||
Version: 0.1
|
Version: 0.2
|
||||||
Release: 1
|
Release: 1
|
||||||
Source: tar_scm
|
Source: tar_scm
|
||||||
Source1: tar_scm.service
|
Source1: tar_scm.service
|
||||||
Requires: subversion git cvs
|
Requires: subversion git mercurial
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This is a source service for openSUSE Build Service.
|
This is a source service for openSUSE Build Service.
|
||||||
|
|
||||||
It supports downloading src.rpms and extracting
|
It supports downloading from svn, git and hg repositories.
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
|
38
tar_scm
38
tar_scm
@ -65,7 +65,7 @@ FILE="$MYFILENAME"
|
|||||||
VERSION="$MYVERSION"
|
VERSION="$MYVERSION"
|
||||||
|
|
||||||
if [ -z "$MYSCM" ]; then
|
if [ -z "$MYSCM" ]; then
|
||||||
echo "ERROR: no scm is given via --scm parameter (git/svn)!"
|
echo "ERROR: no scm is given via --scm parameter (git/svn/hg)!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "$MYURL" ]; then
|
if [ -z "$MYURL" ]; then
|
||||||
@ -88,6 +88,10 @@ if [ -z "$FILE" -a "$MYSCM" == "svn" ]; then
|
|||||||
FILE="${MYURL%/}"
|
FILE="${MYURL%/}"
|
||||||
FILE="${FILE##*/}"
|
FILE="${FILE##*/}"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$FILE" -a "$MYSCM" == "hg" ]; then
|
||||||
|
FILE="${MYURL%/}"
|
||||||
|
FILE="${FILE##*/}"
|
||||||
|
fi
|
||||||
|
|
||||||
existing_tar=$(echo _service:tar_scm:${FILE}-*.tar*)
|
existing_tar=$(echo _service:tar_scm:${FILE}-*.tar*)
|
||||||
if [ -e "$existing_tar" ]; then
|
if [ -e "$existing_tar" ]; then
|
||||||
@ -168,6 +172,38 @@ elif [ "$MYSCM" == "git" ]; then
|
|||||||
VERSION=$MYPREFIX`git show --pretty=%at | head -n 1`
|
VERSION=$MYPREFIX`git show --pretty=%at | head -n 1`
|
||||||
cd -
|
cd -
|
||||||
fi
|
fi
|
||||||
|
elif [ "$MYSCM" == "hg" ]; then
|
||||||
|
if [ -z "$SUBDIR" -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 }'`
|
||||||
|
hg pull || exit 1
|
||||||
|
if [ -n "$MYREVISION" ]; then
|
||||||
|
hg checkout "$MYREVISION" || exit 1
|
||||||
|
fi
|
||||||
|
NEWVERSION=`hg tip | head -n 1 | sed -e 's/\s*//g' | awk -F':' '{ print $2 }'`
|
||||||
|
cd -
|
||||||
|
if [ "$OLDVERSION" == "$NEWVERSION" ]; then
|
||||||
|
# cleanup and skip
|
||||||
|
rm -rf "$TAR_DIRECTORY"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
mv "$TAR_DIRECTORY" "${FILE}" || exit 1
|
||||||
|
else
|
||||||
|
# new checkout
|
||||||
|
hg clone "$MYURL" "${FILE}" || exit 1
|
||||||
|
if [ -n "$MYREVISION" ]; then
|
||||||
|
cd "$FILE"
|
||||||
|
hg checkout "$MYREVISION" || exit 1
|
||||||
|
cd -
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
cd "$FILE"
|
||||||
|
[ -n "$MYPREFIX" ] && MYPREFIX="$MYPREFIX."
|
||||||
|
VERSION=$MYPREFIX`hg tip | head -n 1 | sed -e 's/\s*//g' | awk -F':' '{ print $2 }'`
|
||||||
|
cd -
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "ERROR: unknown scm $MYSCM"
|
echo "ERROR: unknown scm $MYSCM"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
<service name="tar_scm">
|
<service name="tar_scm">
|
||||||
<summary>Create a tar ball from SCM repository</summary>
|
<summary>Create a tar ball from SCM repository</summary>
|
||||||
<description>This service uses a scm client to checkout or update from a given repository. Supported are svn, cvs and git.</description>
|
<description>This service uses a scm client to checkout or update from a given repository. Supported are svn, git and hg.</description>
|
||||||
<parameter name="scm">
|
<parameter name="scm">
|
||||||
<description>Used SCM</description>
|
<description>Used SCM</description>
|
||||||
<allowedvalue>svn</allowedvalue>
|
<allowedvalue>svn</allowedvalue>
|
||||||
<allowedvalue>git</allowedvalue>
|
<allowedvalue>git</allowedvalue>
|
||||||
|
<allowedvalue>hg</allowedvalue>
|
||||||
<required/>
|
<required/>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="url">
|
<parameter name="url">
|
||||||
|
Loading…
Reference in New Issue
Block a user