Accepting request 146894 from home:steffens:branch:openSUSE:Tools

added support for dpkg tar file naming (${NAME}_${VERSION}.orig.tar.gz)

OBS-URL: https://build.opensuse.org/request/show/146894
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-set_version?expand=0&rev=10
This commit is contained in:
Adrian Schröter 2013-01-04 12:52:04 +00:00 committed by Git OBS Bridge
parent 9e80363550
commit 63c3da9c22
3 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#
# spec file for package obs-service-set_version
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed

View File

@ -45,21 +45,25 @@ done
get_version_from_file () {
if [ -z "$MYVERSION" ]; then
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*-\([0123456789].*\).tar.*,\1,p" | head -n 1`
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*[-_]\([0123456789].*\).tar.*,\1,p" | head -n 1`
fi
if [ -z "$MYVERSION" ]; then
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*-\([0123456789].*\).tgz$,\1,p" | head -n 1`
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*[-_]\([0123456789].*\).tgz$,\1,p" | head -n 1`
fi
if [ -z "$MYVERSION" ]; then
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*-\([0123456789].*\).tbz2$,\1,p" | head -n 1`
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*[-_]\([0123456789].*\).tbz2$,\1,p" | head -n 1`
fi
if [ -z "$MYVERSION" ]; then
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*-\([0123456789].*\).zip$,\1,p" | head -n 1`
MYVERSION=`ls -1t | sed -n "s,$BASENAME.*[-_]\([0123456789].*\).zip$,\1,p" | head -n 1`
fi
if [ -z "$MYVERSION" ]; then
echo "ERROR: no version is given and can't get detected automatically"
exit 1
fi
# remove trailing ".orig", used by dpkg sources
MYVERSION=`sed s/.orig$// <<<$MYVERSION`
echo "Detected version as $MYVERSION"
}

View File

@ -1,5 +1,5 @@
<service name="set_version">
<summary>Updates version in spec file</summary>
<summary>Updates version in spec and dsc files</summary>
<description>This service updates a spec file according to the existing files.
Can be used after download_url or tar_scm service.
</description>