diff --git a/obs-service-set_version.spec b/obs-service-set_version.spec index daebd23..91eb27f 100644 --- a/obs-service-set_version.spec +++ b/obs-service-set_version.spec @@ -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 diff --git a/set_version b/set_version index 3001fb8..d090c6f 100644 --- a/set_version +++ b/set_version @@ -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" } diff --git a/set_version.service b/set_version.service index 7da12a4..74c50bc 100644 --- a/set_version.service +++ b/set_version.service @@ -1,5 +1,5 @@ - Updates version in spec file + Updates version in spec and dsc files This service updates a spec file according to the existing files. Can be used after download_url or tar_scm service.