2010-01-28 20:14:29 +00:00
|
|
|
#!/bin/bash
|
2010-09-30 14:31:17 +00:00
|
|
|
debug=""
|
2015-11-04 11:02:13 +00:00
|
|
|
#debug="echo "
|
2017-09-11 13:37:44 +00:00
|
|
|
branches=( "f25" "f26" "f27" "master" )
|
2017-09-13 10:52:19 +00:00
|
|
|
releases=( "fc26" "fc26" "fc27" "fc28" )
|
|
|
|
branches_count=4
|
|
|
|
releases_regexp=fc25\\\|fc26\\\|fc27\\\|fc28
|
2017-09-11 13:37:44 +00:00
|
|
|
branches_index=0
|
2010-01-28 20:14:29 +00:00
|
|
|
|
2012-11-12 14:31:27 +00:00
|
|
|
cd `dirname $0`
|
2010-01-28 20:14:29 +00:00
|
|
|
LANG=C
|
|
|
|
SPEC=vim.spec
|
2015-11-04 11:02:13 +00:00
|
|
|
CHANGES=1
|
2016-11-24 10:59:29 +00:00
|
|
|
force=0
|
|
|
|
|
|
|
|
if [ "x$1" == "x--force" ]; then
|
|
|
|
force=1
|
|
|
|
fi
|
2010-01-28 20:14:29 +00:00
|
|
|
|
|
|
|
DATE=`date +"%a %b %d %Y"`
|
2017-09-11 13:37:44 +00:00
|
|
|
fedpkg switch-branch "${branches[@]: $branches_index: 1}"
|
2017-09-08 08:10:56 +00:00
|
|
|
|
2017-08-09 07:33:35 +00:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error with switching branch"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-01-28 20:14:29 +00:00
|
|
|
MAJORVERSION=`grep "define baseversion" vim.spec | cut -d ' ' -f 3`
|
2010-09-30 14:31:17 +00:00
|
|
|
ORIGPL=`grep "define patchlevel" vim.spec | cut -d ' ' -f 3 | sed -e "s/^0*//g"`
|
|
|
|
ORIGPLFILLED=`printf "%03d" $ORIGPL`
|
2010-01-28 20:14:29 +00:00
|
|
|
|
2015-11-04 11:02:13 +00:00
|
|
|
if [ ! -d vim-upstream ]; then
|
|
|
|
git clone https://github.com/vim/vim.git vim-upstream
|
2010-09-30 14:36:37 +00:00
|
|
|
else
|
2015-11-04 11:02:13 +00:00
|
|
|
pushd vim-upstream
|
|
|
|
git pull
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
pushd vim-upstream
|
2015-11-20 12:25:33 +00:00
|
|
|
# get the latest tag. Might be tricky with other packages, but upstream vim uses just a single branch:
|
2015-11-04 11:02:13 +00:00
|
|
|
LASTTAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
2015-11-20 12:25:33 +00:00
|
|
|
# vim upstream tags have the form v7.4.123. Remove the 'v' and get major release and patchlevel:
|
2015-11-04 11:02:13 +00:00
|
|
|
UPSTREAMMAJOR=$(echo $LASTTAG | sed -e 's/v\([0-9]*\.[0-9]*\).*/\1/')
|
2016-11-14 16:02:59 +00:00
|
|
|
LASTPL=`echo $LASTTAG| sed -e 's/.*\.//;s/^0*//'`
|
2015-11-04 11:02:13 +00:00
|
|
|
LASTPLFILLED=`printf "%03d" $LASTPL`
|
2016-11-24 10:59:29 +00:00
|
|
|
if [ $force -ne 1 -a "$ORIGPLFILLED" == "$LASTPLFILLED" ]; then
|
2015-11-04 11:02:13 +00:00
|
|
|
echo "No new patchlevel available"
|
|
|
|
CHANGES=0
|
|
|
|
fi
|
|
|
|
rm -rf dist/* 2>/dev/null
|
|
|
|
make unixall
|
2015-11-20 12:25:33 +00:00
|
|
|
# include patchlevel in tarball name so that older sources won't get overwritten:
|
2015-11-04 11:02:13 +00:00
|
|
|
mv dist/vim-${UPSTREAMMAJOR}.tar.bz2 dist/vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2
|
2015-11-20 12:25:33 +00:00
|
|
|
# We don't include the full upstream changelog in the rpm changelog, just ship a file with
|
|
|
|
# the changes:
|
2015-11-04 11:02:13 +00:00
|
|
|
git log > dist/README.patches
|
|
|
|
popd
|
|
|
|
|
|
|
|
cp -f vim-upstream/dist/README.patches README.patches
|
|
|
|
cp -f vim-upstream/dist/vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2 .
|
2016-11-24 10:34:14 +00:00
|
|
|
#wget https://raw.githubusercontent.com/ignatenkobrain/vim-spec-plugin/master/ftplugin/spec.vim -O ftplugin-spec.vim
|
|
|
|
#wget https://raw.githubusercontent.com/ignatenkobrain/vim-spec-plugin/master/syntax/spec.vim -O syntax-spec.vim
|
2015-11-04 11:19:51 +00:00
|
|
|
if [ $CHANGES -ne 0 ]; then
|
2015-11-20 12:25:33 +00:00
|
|
|
CHLOG="* $DATE Karsten Hopp <karsten@redhat.com> $UPSTREAMMAJOR"
|
|
|
|
$debug sed -i -e "/Release: /cRelease: 1%{?dist}" $SPEC
|
|
|
|
if [ "x$MAJORVERSION" != "x$UPSTREAMMAJOR" ]; then
|
|
|
|
$debug sed -i -s "s/define baseversion: $MAJORVERSION/define baseversion: $UPSTREAMMAJOR=/" $SPEC
|
|
|
|
fi
|
|
|
|
$debug sed -i -e "s/define patchlevel $ORIGPLFILLED/define patchlevel $LASTPLFILLED/" $SPEC
|
|
|
|
$debug sed -i -e "/\%changelog/a$CHLOG.$LASTPLFILLED-1\n- patchlevel $LASTPLFILLED\n" $SPEC
|
|
|
|
$debug fedpkg new-sources vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2
|
|
|
|
$debug git add vim.spec README.patches
|
|
|
|
$debug git commit -m "- patchlevel $LASTPL"
|
2017-09-11 13:37:44 +00:00
|
|
|
# mockbuild
|
2017-08-09 07:33:35 +00:00
|
|
|
$debug fedpkg mockbuild
|
2017-09-08 11:08:09 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error: fedpkg mockbuild"
|
|
|
|
exit 1
|
2017-09-11 13:37:44 +00:00
|
|
|
fi
|
|
|
|
# push
|
2017-09-08 11:08:09 +00:00
|
|
|
$debug fedpkg push
|
2017-09-12 06:25:19 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2017-09-08 11:08:09 +00:00
|
|
|
echo "Error: fedpkg push"
|
|
|
|
exit 1
|
2017-09-08 08:10:56 +00:00
|
|
|
fi
|
2017-09-11 13:37:44 +00:00
|
|
|
# Check if release has pending or testing update - if not, build package
|
|
|
|
pending_update=`bodhi updates query --packages vim --status pending \
|
2017-09-13 10:52:19 +00:00
|
|
|
| grep $releases`
|
2017-09-11 13:37:44 +00:00
|
|
|
testing_update=`bodhi updates query --packages vim --status testing \
|
2017-09-13 10:52:19 +00:00
|
|
|
| grep $releases`
|
2017-09-11 13:37:44 +00:00
|
|
|
if [ "$pending_update" == "" ] && [ "$testing_update" == "" ]; then
|
|
|
|
fedpkg build --nowait
|
2017-09-13 10:52:19 +00:00
|
|
|
bodhi updates new --user zdohnal --type enhancement --notes "The newest \
|
|
|
|
upstream commit" --request testing --autokarma --stable-karma 3 \
|
|
|
|
--unstable-karma -3 vim-${UPSTREAMMAJOR}-${LASTPLFILLED}-1.\
|
|
|
|
${releases[@]: $branches_index: 1}
|
|
|
|
else
|
|
|
|
echo "There are pending/testing updates, do not build package."
|
2017-09-11 13:37:44 +00:00
|
|
|
fi
|
2017-09-13 10:52:19 +00:00
|
|
|
|
|
|
|
# Cut first release
|
|
|
|
releases_regexp=${releases_regexp#*|}
|
|
|
|
|
2017-09-11 13:37:44 +00:00
|
|
|
for branch in "${branches[@]:(1)}";
|
|
|
|
do
|
|
|
|
# switch to branch
|
|
|
|
$debug fedpkg switch-branch $branch
|
|
|
|
# merge with previous branch
|
|
|
|
$debug bash -c "git merge ${branches[@]: $branches_index: 1} <<<':x'"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error: git merge ${branches[@]: $branches_index: 1}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# mockbuild
|
|
|
|
$debug fedpkg mockbuild
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error: fedpkg mockbuild failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# push
|
|
|
|
$debug fedpkg push
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error: fedpkg push"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# Check if release has pending or testing update - if not, build package
|
|
|
|
pending_update=`bodhi updates query --packages vim --status pending \
|
2017-09-13 10:52:19 +00:00
|
|
|
| grep $releases`
|
2017-09-11 13:37:44 +00:00
|
|
|
testing_update=`bodhi updates query --packages vim --status testing \
|
2017-09-13 10:52:19 +00:00
|
|
|
| grep $releases`
|
2017-09-11 13:37:44 +00:00
|
|
|
if [ "$pending_update" == "" ] && [ "$testing_update" == "" ]; then
|
|
|
|
fedpkg build --nowait
|
2017-09-13 10:52:19 +00:00
|
|
|
if [ ${branches[@]: $branches_index: 1} != "master" ]; then
|
|
|
|
bodhi updates new --user zdohnal --type enhancement --notes "The newest \
|
|
|
|
upstream commit" --request testing --autokarma --stable-karma 3 \
|
|
|
|
--unstable-karma -3 vim-${UPSTREAMMAJOR}-${LASTPLFILLED}-1.\
|
|
|
|
${releases[@]: $branches_index: 1}
|
|
|
|
fi
|
2017-09-11 13:37:44 +00:00
|
|
|
fi
|
2017-09-13 10:52:19 +00:00
|
|
|
|
|
|
|
# Increment index and cut first release
|
2017-09-11 13:37:44 +00:00
|
|
|
let "branches_index+=1"
|
2017-09-13 10:52:19 +00:00
|
|
|
releases_regexp=${releases_regexp#*|}
|
2017-09-11 13:37:44 +00:00
|
|
|
done
|
2017-08-09 07:33:35 +00:00
|
|
|
#$debug git push
|
|
|
|
#if [ $? -eq 0 ]; then
|
|
|
|
# $debug rm -f $HOME/.koji/config
|
|
|
|
# $debug fedpkg build
|
|
|
|
# $debug ln -sf ppc-config $HOME/.koji/config
|
|
|
|
#else
|
|
|
|
# echo "GIT push failed"
|
|
|
|
#fi
|
2010-09-30 14:36:37 +00:00
|
|
|
fi
|
2017-09-08 11:08:09 +00:00
|
|
|
exit 0
|