|
|
16bcfe0 |
#!/bin/bash
|
|
|
4a08e5d |
debug=""
|
|
|
56ffd8a |
#debug="echo "
|
|
|
22d6f1f |
branches=( "master" "f33" "f32" "f31" )
|
|
|
8199cda |
releases=( "fc34" "fc33" "fc32" "fc31" )
|
|
|
8199cda |
regexps=( "fc34" "\|fc33" "\|fc32" "\|fc31" )
|
|
|
93718cf |
bodhi_enabled=( "0" "1" "1" "1" )
|
|
|
66ccb62 |
#releases_regexp=fc28\\\|fc27\\\|fc28
|
|
|
66ccb62 |
|
|
|
5f35bde |
branches_index=0
|
|
|
0e06071 |
release_index=0
|
|
|
66ccb62 |
regexp_index=0
|
|
|
fbda9b3 |
bodhi_enabled_index=0
|
|
|
468749c |
done_build=0
|
|
|
66ccb62 |
releases_regexp="${regexps[@]: regexp_index: 1}"
|
|
|
66ccb62 |
let "regexp_index+=1"
|
|
|
16bcfe0 |
|
|
|
722559b |
cd `dirname $0`
|
|
|
16bcfe0 |
LANG=C
|
|
|
16bcfe0 |
SPEC=vim.spec
|
|
|
56ffd8a |
CHANGES=1
|
|
|
87222ef |
force=0
|
|
|
87222ef |
|
|
|
87222ef |
if [ "x$1" == "x--force" ]; then
|
|
|
87222ef |
force=1
|
|
|
87222ef |
fi
|
|
|
16bcfe0 |
|
|
|
16bcfe0 |
DATE=`date +"%a %b %d %Y"`
|
|
|
6e7834f |
$debug fedpkg switch-branch "${branches[@]: $branches_index: 1}"
|
|
|
e51544b |
|
|
|
b26d699 |
|
|
|
b26d699 |
if [ $? -ne 0 ]; then
|
|
|
b26d699 |
echo "Error with switching branch"
|
|
|
b26d699 |
exit 1
|
|
|
b26d699 |
fi
|
|
|
b26d699 |
|
|
|
16bcfe0 |
MAJORVERSION=`grep "define baseversion" vim.spec | cut -d ' ' -f 3`
|
|
|
59beea4 |
MAJORVERDIR=$(echo $MAJORVERSION | sed -e 's/\.//')
|
|
|
c331934 |
EPOCH=`grep "Epoch:" vim.spec | cut -d ':' -f 2`
|
|
|
c331934 |
PACKAGER=`rpmdev-packager`
|
|
|
4a08e5d |
ORIGPL=`grep "define patchlevel" vim.spec | cut -d ' ' -f 3 | sed -e "s/^0*//g"`
|
|
|
4a08e5d |
ORIGPLFILLED=`printf "%03d" $ORIGPL`
|
|
|
16bcfe0 |
|
|
|
56ffd8a |
if [ ! -d vim-upstream ]; then
|
|
|
56ffd8a |
git clone https://github.com/vim/vim.git vim-upstream
|
|
|
bba8e96 |
else
|
|
|
56ffd8a |
pushd vim-upstream
|
|
|
56ffd8a |
git pull
|
|
|
56ffd8a |
popd
|
|
|
56ffd8a |
fi
|
|
|
56ffd8a |
|
|
|
56ffd8a |
pushd vim-upstream
|
|
|
66ccb62 |
|
|
|
8710382 |
# get the latest tag. Might be tricky with other packages, but upstream vim uses just a single branch:
|
|
|
56ffd8a |
LASTTAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
|
|
66ccb62 |
|
|
|
8710382 |
# vim upstream tags have the form v7.4.123. Remove the 'v' and get major release and patchlevel:
|
|
|
56ffd8a |
UPSTREAMMAJOR=$(echo $LASTTAG | sed -e 's/v\([0-9]*\.[0-9]*\).*/\1/')
|
|
|
59beea4 |
UPSTREAMMAJORDIR=$(echo $UPSTREAMMAJOR | sed -e 's/\.//')
|
|
|
73a6a78 |
LASTPL=`echo $LASTTAG| sed -e 's/.*\.//;s/^0*//'`
|
|
|
56ffd8a |
LASTPLFILLED=`printf "%03d" $LASTPL`
|
|
|
87222ef |
if [ $force -ne 1 -a "$ORIGPLFILLED" == "$LASTPLFILLED" ]; then
|
|
|
56ffd8a |
echo "No new patchlevel available"
|
|
|
56ffd8a |
CHANGES=0
|
|
|
56ffd8a |
fi
|
|
|
56ffd8a |
rm -rf dist/* 2>/dev/null
|
|
|
56ffd8a |
make unixall
|
|
|
66ccb62 |
|
|
|
8710382 |
# include patchlevel in tarball name so that older sources won't get overwritten:
|
|
|
56ffd8a |
mv dist/vim-${UPSTREAMMAJOR}.tar.bz2 dist/vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2
|
|
|
66ccb62 |
|
|
|
8710382 |
# We don't include the full upstream changelog in the rpm changelog, just ship a file with
|
|
|
8710382 |
# the changes:
|
|
|
56ffd8a |
popd
|
|
|
56ffd8a |
|
|
|
56ffd8a |
cp -f vim-upstream/dist/vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2 .
|
|
|
ec1b06f |
#wget https://raw.githubusercontent.com/ignatenkobrain/vim-spec-plugin/master/ftplugin/spec.vim -O ftplugin-spec.vim
|
|
|
ec1b06f |
#wget https://raw.githubusercontent.com/ignatenkobrain/vim-spec-plugin/master/syntax/spec.vim -O syntax-spec.vim
|
|
|
bcbb2a2 |
if [ $CHANGES -ne 0 ]; then
|
|
|
f55f597 |
CHLOG="* $DATE $PACKAGER -$EPOCH:$UPSTREAMMAJOR"
|
|
|
8710382 |
$debug sed -i -e "/Release: /cRelease: 1%{?dist}" $SPEC
|
|
|
8710382 |
if [ "x$MAJORVERSION" != "x$UPSTREAMMAJOR" ]; then
|
|
|
59beea4 |
$debug sed -i -s "s/define baseversion $MAJORVERSION/define baseversion $UPSTREAMMAJOR/" $SPEC
|
|
|
59beea4 |
$debug sed -i -s "s/define vimdir vim$MAJORVERDIR/define vimdir vim$UPSTREAMMAJORDIR/" $SPEC
|
|
|
8710382 |
fi
|
|
|
8710382 |
$debug sed -i -e "s/define patchlevel $ORIGPLFILLED/define patchlevel $LASTPLFILLED/" $SPEC
|
|
|
8710382 |
$debug sed -i -e "/\%changelog/a$CHLOG.$LASTPLFILLED-1\n- patchlevel $LASTPLFILLED\n" $SPEC
|
|
|
8710382 |
$debug fedpkg new-sources vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2
|
|
|
c48460c |
$debug git add vim.spec
|
|
|
8710382 |
$debug git commit -m "- patchlevel $LASTPL"
|
|
|
66ccb62 |
|
|
|
5f35bde |
# mockbuild
|
|
|
b26d699 |
$debug fedpkg mockbuild
|
|
|
d6afc62 |
if [ $? -ne 0 ]; then
|
|
|
d6afc62 |
echo "Error: fedpkg mockbuild"
|
|
|
d6afc62 |
exit 1
|
|
|
5f35bde |
fi
|
|
|
66ccb62 |
|
|
|
5f35bde |
# push
|
|
|
d6afc62 |
$debug fedpkg push
|
|
|
9a6f130 |
if [ $? -ne 0 ]; then
|
|
|
d6afc62 |
echo "Error: fedpkg push"
|
|
|
d6afc62 |
exit 1
|
|
|
e51544b |
fi
|
|
|
66ccb62 |
|
|
|
5f35bde |
# Check if release has pending or testing update - if not, build package
|
|
|
e68ece3 |
# and submit update for testing
|
|
|
5f35bde |
pending_update=`bodhi updates query --packages vim --status pending \
|
|
|
e68ece3 |
| grep $releases_regexp`
|
|
|
5f35bde |
testing_update=`bodhi updates query --packages vim --status testing \
|
|
|
e68ece3 |
| grep $releases_regexp`
|
|
|
0e06071 |
|
|
|
5f35bde |
if [ "$pending_update" == "" ] && [ "$testing_update" == "" ]; then
|
|
|
6e7834f |
$debug fedpkg build
|
|
|
e68ece3 |
if [ $? -eq 0 ]; then
|
|
|
468749c |
done_build=1
|
|
|
e68ece3 |
else
|
|
|
e68ece3 |
echo "Error when building package in $branch"
|
|
|
e68ece3 |
exit 1
|
|
|
e68ece3 |
fi
|
|
|
53e3240 |
else
|
|
|
53e3240 |
echo "There are pending/testing updates, do not build package."
|
|
|
5f35bde |
fi
|
|
|
53e3240 |
|
|
|
9bf4b17 |
let "release_index+=1"
|
|
|
fbda9b3 |
let "bodhi_enabled_index+=1"
|
|
|
9bf4b17 |
|
|
|
5f35bde |
for branch in "${branches[@]:(1)}";
|
|
|
5f35bde |
do
|
|
|
5f35bde |
# switch to branch
|
|
|
5f35bde |
$debug fedpkg switch-branch $branch
|
|
|
66ccb62 |
|
|
|
5f35bde |
# merge with previous branch
|
|
|
5f35bde |
$debug bash -c "git merge ${branches[@]: $branches_index: 1} <<<':x'"
|
|
|
5f35bde |
if [ $? -ne 0 ]; then
|
|
|
5f35bde |
echo "Error: git merge ${branches[@]: $branches_index: 1}"
|
|
|
5f35bde |
exit 1
|
|
|
5f35bde |
fi
|
|
|
66ccb62 |
|
|
|
5f35bde |
# mockbuild
|
|
|
5f35bde |
$debug fedpkg mockbuild
|
|
|
5f35bde |
if [ $? -ne 0 ]; then
|
|
|
5f35bde |
echo "Error: fedpkg mockbuild failed"
|
|
|
5f35bde |
exit 1
|
|
|
5f35bde |
fi
|
|
|
66ccb62 |
|
|
|
5f35bde |
# push
|
|
|
5f35bde |
$debug fedpkg push
|
|
|
5f35bde |
if [ $? -ne 0 ]; then
|
|
|
5f35bde |
echo "Error: fedpkg push"
|
|
|
5f35bde |
exit 1
|
|
|
5f35bde |
fi
|
|
|
66ccb62 |
|
|
|
fbda9b3 |
# append next release to regexp - because we need to check if there aren't
|
|
|
fbda9b3 |
# any testing updates from higher branches (lower branch cannot have
|
|
|
fbda9b3 |
# bigger NVR than higher branch) in next iteration
|
|
|
66ccb62 |
releases_regexp="$releases_regexp${regexps[@]: regexp_index: 1}"
|
|
|
66ccb62 |
|
|
|
5f35bde |
# Check if release has pending or testing update - if not, build package
|
|
|
e68ece3 |
# and submit update for testing
|
|
|
0c733d9 |
# | grep $releases_regexp`
|
|
|
fbda9b3 |
# done_build is checking, if previous branch did build - lower branch can do
|
|
|
fbda9b3 |
# a build only when higher branch build was ok.
|
|
|
5f35bde |
testing_update=`bodhi updates query --packages vim --status testing \
|
|
|
e68ece3 |
| grep $releases_regexp`
|
|
|
de93288 |
if [ "$testing_update" == "" ] && [ $done_build -eq 1 ]; then
|
|
|
6e7834f |
$debug fedpkg build
|
|
|
e68ece3 |
if [ $? -eq 0 ]; then
|
|
|
fbda9b3 |
# if branch isn't master or branch is enabled in bodhi, create update
|
|
|
de93288 |
if [ $branch != "master" ] || [ ${bodhi_enabled[@]: $bodhi_enabled_index: 1} -eq 1 ]; then
|
|
|
ae8b9a1 |
$debug bodhi updates new --user zdohnal --type enhancement --notes "The newest upstream commit" --request testing --autotime --autokarma --stable-karma 3 --unstable-karma -3 vim-${UPSTREAMMAJOR}.${LASTPLFILLED}-1.${releases[@]: $release_index: 1}
|
|
|
e68ece3 |
fi
|
|
|
e68ece3 |
else
|
|
|
e68ece3 |
echo "Error when building package for $branch"
|
|
|
e68ece3 |
exit 1
|
|
|
53e3240 |
fi
|
|
|
468749c |
else
|
|
|
468749c |
done_build=0
|
|
|
5f35bde |
fi
|
|
|
53e3240 |
|
|
|
fbda9b3 |
# Increment index
|
|
|
8354e62 |
let "branches_index+=1"
|
|
|
9bf4b17 |
let "release_index+=1"
|
|
|
66ccb62 |
let "regexp_index+=1"
|
|
|
fbda9b3 |
let "bodhi_enabled_index+=1"
|
|
|
5f35bde |
done
|
|
|
b26d699 |
#$debug git push
|
|
|
b26d699 |
#if [ $? -eq 0 ]; then
|
|
|
b26d699 |
# $debug rm -f $HOME/.koji/config
|
|
|
b26d699 |
# $debug fedpkg build
|
|
|
b26d699 |
# $debug ln -sf ppc-config $HOME/.koji/config
|
|
|
b26d699 |
#else
|
|
|
b26d699 |
# echo "GIT push failed"
|
|
|
b26d699 |
#fi
|
|
|
bba8e96 |
fi
|
|
|
85fe8c8 |
|
|
|
85fe8c8 |
#go back to master
|
|
|
85fe8c8 |
$debug fedpkg switch-branch master
|
|
|
85fe8c8 |
|
|
|
d6afc62 |
exit 0
|