rewrite vim-update to update from the newest branch to the oldest

This commit is contained in:
Zdenek Dohnal 2017-12-01 13:22:26 +01:00
parent 955d8909bd
commit 66ccb62662
2 changed files with 27 additions and 7 deletions

View File

@ -1,12 +1,17 @@
#!/bin/bash #!/bin/bash
debug="" debug=""
#debug="echo " #debug="echo "
branches=( "f26" "f27" "master" ) branches=( "master" "f27" "f26" )
releases=( "fc26" "fc27" "fc28" ) releases=( "fc28" "fc27" "fc26" )
regexps=( "fc28" "\\\|fc27" "\\\|fc26" )
branches_count=4 branches_count=4
releases_regexp=fc26\\\|fc27\\\|fc28 #releases_regexp=fc28\\\|fc27\\\|fc28
branches_index=0 branches_index=0
release_index=0 release_index=0
regexp_index=0
releases_regexp="${regexps[@]: regexp_index: 1}"
let "regexp_index+=1"
cd `dirname $0` cd `dirname $0`
LANG=C LANG=C
@ -40,8 +45,10 @@ else
fi fi
pushd vim-upstream pushd vim-upstream
# get the latest tag. Might be tricky with other packages, but upstream vim uses just a single branch: # get the latest tag. Might be tricky with other packages, but upstream vim uses just a single branch:
LASTTAG=$(git describe --tags $(git rev-list --tags --max-count=1)) LASTTAG=$(git describe --tags $(git rev-list --tags --max-count=1))
# vim upstream tags have the form v7.4.123. Remove the 'v' and get major release and patchlevel: # vim upstream tags have the form v7.4.123. Remove the 'v' and get major release and patchlevel:
UPSTREAMMAJOR=$(echo $LASTTAG | sed -e 's/v\([0-9]*\.[0-9]*\).*/\1/') UPSTREAMMAJOR=$(echo $LASTTAG | sed -e 's/v\([0-9]*\.[0-9]*\).*/\1/')
LASTPL=`echo $LASTTAG| sed -e 's/.*\.//;s/^0*//'` LASTPL=`echo $LASTTAG| sed -e 's/.*\.//;s/^0*//'`
@ -52,8 +59,10 @@ if [ $force -ne 1 -a "$ORIGPLFILLED" == "$LASTPLFILLED" ]; then
fi fi
rm -rf dist/* 2>/dev/null rm -rf dist/* 2>/dev/null
make unixall make unixall
# include patchlevel in tarball name so that older sources won't get overwritten: # include patchlevel in tarball name so that older sources won't get overwritten:
mv dist/vim-${UPSTREAMMAJOR}.tar.bz2 dist/vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2 mv dist/vim-${UPSTREAMMAJOR}.tar.bz2 dist/vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2
# We don't include the full upstream changelog in the rpm changelog, just ship a file with # We don't include the full upstream changelog in the rpm changelog, just ship a file with
# the changes: # the changes:
popd popd
@ -72,26 +81,27 @@ if [ $CHANGES -ne 0 ]; then
$debug fedpkg new-sources vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2 $debug fedpkg new-sources vim-${UPSTREAMMAJOR}-${LASTPLFILLED}.tar.bz2
$debug git add vim.spec $debug git add vim.spec
$debug git commit -m "- patchlevel $LASTPL" $debug git commit -m "- patchlevel $LASTPL"
# mockbuild # mockbuild
$debug fedpkg mockbuild $debug fedpkg mockbuild
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: fedpkg mockbuild" echo "Error: fedpkg mockbuild"
exit 1 exit 1
fi fi
# push # push
$debug fedpkg push $debug fedpkg push
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: fedpkg push" echo "Error: fedpkg push"
exit 1 exit 1
fi fi
# Check if release has pending or testing update - if not, build package # Check if release has pending or testing update - if not, build package
# and submit update for testing # and submit update for testing
pending_update=`bodhi updates query --packages vim --status pending \ pending_update=`bodhi updates query --packages vim --status pending \
| grep $releases_regexp` | grep $releases_regexp`
testing_update=`bodhi updates query --packages vim --status testing \ testing_update=`bodhi updates query --packages vim --status testing \
| grep $releases_regexp` | grep $releases_regexp`
# Cut the head of releases_regexp string
releases_regexp=${releases_regexp#*|}
if [ "$pending_update" == "" ] && [ "$testing_update" == "" ]; then if [ "$pending_update" == "" ] && [ "$testing_update" == "" ]; then
fedpkg build fedpkg build
@ -111,24 +121,31 @@ if [ $CHANGES -ne 0 ]; then
do do
# switch to branch # switch to branch
$debug fedpkg switch-branch $branch $debug fedpkg switch-branch $branch
# merge with previous branch # merge with previous branch
$debug bash -c "git merge ${branches[@]: $branches_index: 1} <<<':x'" $debug bash -c "git merge ${branches[@]: $branches_index: 1} <<<':x'"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: git merge ${branches[@]: $branches_index: 1}" echo "Error: git merge ${branches[@]: $branches_index: 1}"
exit 1 exit 1
fi fi
# mockbuild # mockbuild
$debug fedpkg mockbuild $debug fedpkg mockbuild
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: fedpkg mockbuild failed" echo "Error: fedpkg mockbuild failed"
exit 1 exit 1
fi fi
# push # push
$debug fedpkg push $debug fedpkg push
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: fedpkg push" echo "Error: fedpkg push"
exit 1 exit 1
fi fi
# append next release to regexp
releases_regexp="$releases_regexp${regexps[@]: regexp_index: 1}"
# Check if release has pending or testing update - if not, build package # Check if release has pending or testing update - if not, build package
# and submit update for testing # and submit update for testing
pending_update=`bodhi updates query --packages vim --status pending \ pending_update=`bodhi updates query --packages vim --status pending \
@ -150,7 +167,7 @@ if [ $CHANGES -ne 0 ]; then
# Increment index and cut the head of releases_regexp string # Increment index and cut the head of releases_regexp string
let "branches_index+=1" let "branches_index+=1"
let "release_index+=1" let "release_index+=1"
releases_regexp=${releases_regexp#*|} let "regexp_index+=1"
done done
#$debug git push #$debug git push
#if [ $? -eq 0 ]; then #if [ $? -eq 0 ]; then

View File

@ -24,7 +24,7 @@ Summary: The VIM editor
URL: http://www.vim.org/ URL: http://www.vim.org/
Name: vim Name: vim
Version: %{baseversion}.%{patchlevel} Version: %{baseversion}.%{patchlevel}
Release: 2%{?dist} Release: 3%{?dist}
License: Vim License: Vim
Group: Applications/Editors Group: Applications/Editors
Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2 Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2
@ -766,6 +766,9 @@ update-desktop-database &> /dev/null ||:
%{_datadir}/icons/locolor/*/apps/* %{_datadir}/icons/locolor/*/apps/*
%changelog %changelog
* Fri Dec 01 2017 Zdenek Dohnal <zdohnal@redhat.com> - 8.0.1359-3
- rewrite vim-update to update from the newest branch to the oldest
* Thu Nov 30 2017 Zdenek Dohnal <zdohnal@redhat.com> - 8.0.1359-2 * Thu Nov 30 2017 Zdenek Dohnal <zdohnal@redhat.com> - 8.0.1359-2
- 1508629 - missing full path and safe guards in file triggers in -common - 1508629 - missing full path and safe guards in file triggers in -common