PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 3 | package="libnetconf2" |
| 4 | url="https://github.com/cesnet/libnetconf2" |
| 5 | |
PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 6 | if [ "$TRAVIS_PULL_REQUEST" == "true" -o "$TRAVIS_EVENT_TYPE" != "cron" ] ; then |
| 7 | exit 0 |
| 8 | fi |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 9 | |
| 10 | #install OSC |
| 11 | sudo apt-get install -y osc |
| 12 | |
PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 13 | # check osb_user and osb_pass |
| 14 | if [ -z "${osb_user}" -o -z "${osb_pass}" ]; then |
| 15 | exit 0 |
| 16 | fi |
| 17 | |
| 18 | # fill username and password for opensuse build and downlaod last package information |
| 19 | echo -e "[general]\napiurl = https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = ${osb_user}\npass = ${osb_pass}" >~/.oscrc |
Michal Vasko | 34a6d74 | 2019-12-10 15:25:07 +0100 | [diff] [blame] | 20 | cd ./build |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 21 | |
PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 22 | osc checkout home:liberouter |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 23 | cp home:liberouter/$package/$package.spec home:liberouter/$package/debian.changelog home:liberouter |
| 24 | cp build-packages/debian* build-packages/$package* home:liberouter/$package |
| 25 | cd home:liberouter/$package |
PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 26 | |
| 27 | # check versions |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 28 | VERSION=$(cat $package.spec | grep "Version: " | awk '{print $NF}') |
| 29 | OLDVERSION=$(cat ../$package.spec | grep "Version: " | awk '{print $NF}') |
Michal Vasko | 34a6d74 | 2019-12-10 15:25:07 +0100 | [diff] [blame] | 30 | if [ -z "$FORCEVERSION" -a "$VERSION" == "$OLDVERSION" ]; then |
PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 31 | exit 0 |
| 32 | fi |
| 33 | |
| 34 | # create new changelog and paste old changelog |
Michal Vasko | 34a6d74 | 2019-12-10 15:25:07 +0100 | [diff] [blame] | 35 | if [ "$VERSION" != "$OLDVERSION" ]; then |
| 36 | logtime=$(git log -i --grep="VERSION .* $OLDVERSION" | grep "Date: " | sed 's/Date:[ ]*//') |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 37 | echo -e "$package ($VERSION) stable; urgency=low\n" >debian.changelog |
Michal Vasko | 34a6d74 | 2019-12-10 15:25:07 +0100 | [diff] [blame] | 38 | git log --since="$logtime" --pretty=format:" * %s (%aN)%n" | grep "BUGFIX\|CHANGE\|FEATURE" >>debian.changelog |
| 39 | git log -1 --pretty=format:"%n -- %aN <%aE> %aD%n" >>debian.changelog |
| 40 | echo -e "\n" >>debian.changelog |
| 41 | cat ../debian.changelog >>debian.changelog |
| 42 | fi |
| 43 | |
| 44 | if [ "$VERSION" != "$OLDVERSION" ]; then |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 45 | git log -1 --date=format:'%a %b %d %Y' --pretty=format:"* %ad %aN <%aE>" | tr -d "\n" >>$package.spec |
| 46 | echo " $VERSION" >>$package.spec |
| 47 | git log --since="$logtime" --pretty=format:"- %s (%aN)" | grep "BUGFIX\|CHANGE\|FEATURE" >>$package.spec |
| 48 | echo -e "\n" >>$package.spec |
Michal Vasko | 34a6d74 | 2019-12-10 15:25:07 +0100 | [diff] [blame] | 49 | fi |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 50 | cat ../$package.spec | sed -e '1,/%changelog/d' >>$package.spec |
PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 51 | |
| 52 | # download source and update to opensuse build |
Michal Vasko | 4cb2d72 | 2020-04-23 13:49:16 +0200 | [diff] [blame] | 53 | wget "${url}/archive/master.tar.gz" -O master.tar.gz |
PavolVican | 384786e | 2017-07-12 15:31:20 +0200 | [diff] [blame] | 54 | osc commit -m travis-update |