Accepting request 175299 from openSUSE:Tools

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/175299
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/obs-service-set_version?expand=0&rev=5
This commit is contained in:
Stephan Kulow 2013-05-16 09:15:14 +00:00 committed by Git OBS Bridge
commit 1e86a416ee
4 changed files with 25 additions and 6 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Apr 16 09:30:01 UTC 2013 - adrian@suse.de
- add support for PKGBUILD aka Arch Linux files
-------------------------------------------------------------------
Tue Jun 26 15:01:27 UTC 2012 - saschpe@suse.de

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"
}
@ -89,6 +93,16 @@ write_files () {
rm -f "$FILE"
fi
done
if [ -e PKGBUILD ]; then
FILE=`ls -1 _service:*[-_]${MYVERSION}* | head -n 1`
[ -z "$FILE" ] && FILE=`ls -1 *[-_]${MYVERSION}* | head -n 1`
MD5=`md5sum "$FILE" | head -n 1 | cut -d\ -f 1`
sed "0,/^pkgver=\(\s*\)[^%]*/s//pkgver=\1$MYVERSION/" PKGBUILD > "$MYOUTDIR/PKGBUILD" || exit 1
sed -r -i "s,^pkgrel=.*,pkgrel=0," "$MYOUTDIR/PKGBUILD" || exit 1
sed -r -i "s,^md5sums=.*,md5sums=('$MD5')," "$MYOUTDIR/PKGBUILD" || exit 1
fi
}
get_version_from_file

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>