File: update_revision.sh

package info (click to toggle)
aeskulap 0.2.2b1+git20161206-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,840 kB
  • ctags: 1,302
  • sloc: cpp: 8,894; sh: 5,551; ansic: 685; makefile: 317; xml: 25
file content (93 lines) | stat: -rwxr-xr-x 2,540 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
#
#
#  Aeskulap - DICOM image viewer and network client
#  - generate SPEC-,SOURCES- and SRPM-files from latest git-master and move them
#    into the appropriate directories
#  - you need to check the paths and fix the maintainers name
#
# Copyright (C) 2005 - 2015  Alexander Pipelka
# Copyright (C) 2015  Jens Lody <fedora@jenslody.de>,
#
# This file is part of Aeskulap.
#
#    Aeskulap is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    Aeskulap is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Aeskulap; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#


GITHUB="jenslody-aeskulap"
BASE_URL="https://github.com/jenslody/aeskulap/tarball/master/"
TARBALL_PATH="${HOME}/rpmbuild/SOURCES/"
SPEC_PATH="${HOME}/rpmbuild/SPECS/"
SPEC_FILE="aeskulap.spec"

SCRIPT_DIR=`dirname "$0"`
#echo "x${SCRIPT_DIR}x"
SCRIPT_DIR=`( cd "$SCRIPT_DIR" && pwd )`
#echo "y${SCRIPT_DIR}y"


if test -z "$1"; then
    branch="master"
else
    branch="$1"
fi


# make sure git answers in english
export LC_ALL="C"

# let's import OLD_REV (if there)
if [ -f ./.last_commit ]; then
	. ./.last_commit
else
	OLD_COMMIT=0
fi

cd "$SCRIPT_DIR"

git checkout $branch
git pull
echo "Using 'git log -1' to get the newest commit"
COMMIT=`git log -1 --pretty=format:"%h"`

echo "Found revision: '${COMMIT}'"

DATE=`date +%Y%m%d`

echo "Use checkout-date: '${DATE}'"

cp ${SPEC_FILE} ${SPEC_FILE}.tmp
sed -i "s/%global git .*/%global git $COMMIT/"  ${SPEC_FILE}
sed -i "s/%global checkout_date .*/%global checkout_date $DATE/" ${SPEC_FILE}

rpmdev-bumpspec --comment="Fresh git checkout." --userstring="Jens Lody <fedora@jenslody.de>" ${SPEC_FILE}

vi ${SPEC_FILE}

cp ${SPEC_FILE} ${SPEC_PATH}${SPEC_FILE}
rm -f ${SPEC_FILE}
mv ${SPEC_FILE}.tmp ${SPEC_FILE}

rm -f ${TARBALL_PATH}${GITHUB}-*.tar.gz
wget -c ${BASE_URL}${GITHUB}-${COMMIT}.tar.gz -O ${TARBALL_PATH}${GITHUB}-${COMMIT}.tar.gz

cd ${SPEC_PATH}
rm -f ../SRPMS/${GITHUB}*.src.rpm
rpmbuild -bs ${SPEC_FILE}

echo "OLD_COMMIT=$COMMIT" > ./.last_commit

exit 0