4 # env variables controlling behaviour
5 # build_package=[0|1] - build package when new version is fetched
6 # publish_packages=[0|1] - publish built packages in ~/public_html/$dist/$arch
7 # quiet=[0|1] - discard stdout of process
9 # there's "patches" branch which mixes tarball and patches
10 echo >&2 This script no longer works
19 local patch msg over file
21 echo "Updating $specfile to $ver"
22 patch=${ver#$basever.}
23 if [ -z "$patch" ]; then
24 echo >&2 "Will not set empty patchlevel"
28 s/^\(%define[ \t]\+patchlevel[ \t]\+\)[0-9]\+\$/\1$patch/
29 s/^\(%define[ \t]\+rel[ \t]\+\)[0-9.]\+\$/\11/
32 # fetch missing/mismatching files manually. faster than builder script does that
33 md5sum -c sources 2>/dev/null | awk -F: '$NF != " OK" {print $1}' | while read file; do
37 WGET_OPTS="-nv" ../builder -g $specfile
39 if [ "$build_package" != 0 ]; then
45 echo "updated to $ver" > $msg
47 over=$(git diff sources | awk '/^\+[0-9a-f]+/{over=$NF; gsub(/\./, "\\.",over); print over; exit}')
48 sed -ne "/$over/,\$p" README.patches | sed -re 's,^[ 0-9]+ ,,' >> $msg
49 git commit -F $msg $specfile sources
54 local logfile=$outdir/$pkg.log
58 # setup custom logfile via $HOME_ETC hack
59 # TODO: just add --logfile support for builder
60 cat > $outdir/.builderrc <<-EOF
61 if [ -n "$HOME_ETC" ]; then
62 . "$HOME_ETC/.builderrc"
63 elif [ -r ~/.builderrc ]; then
71 ../builder -bb --clean \
72 --define "_unpackaged_files_terminate_build 1" \
73 --define '_enable_debug_packages 0' \
74 --define "_builddir $outdir" \
75 --define "_rpmdir $rpmdir" \
77 echo "Package build failed" >&2
78 tail -n 1000 $logfile >&2
81 echo >&2 "Package build OK"
83 if [ "$publish_packages" ] && [ "$(ls $rpmdir/*.rpm 2>/dev/null)" ]; then
89 local rpmdest=~/public_html/$dist/$arch/
93 chmod 644 $rpmdir/*.rpm
94 mv -v $rpmdir/*.rpm $rpmdest/
95 poldek --cachedir=$HOME/tmp --mkidx -s $rpmdest/ --mt=pndir
101 # setup $quiet, you may override with env it
102 quiet=${quiet:-$(tty -s && echo 0 || echo 1)}
103 if [ "$quiet" = "1" ]; then
104 # we do not want output when running on cron
111 baseurl=ftp://ftp.vim.org/pub/editors/vim/patches/$basever
112 sources=ftp://ftp.vim.org/pub/editors/vim/patches/$basever/MD5SUMS
115 dist=$(rpm -E %{pld_release})
116 arch=$(rpm -E %{_host_cpu})
117 outdir=$(readlink -f $dir)/BUILD-$dist-$arch
120 status=$(git status --porcelain sources)
121 if [ "$status" ]; then
122 echo >&2 "WARNING: sources status not clean; commit or stash any pending changes"
129 echo "Fetching latest patches list..."
130 wget -nv $sources -O sources.tmp 2>&1
131 sort -k 2 -V < sources.tmp > sources.new
132 # exclude files already in git tree
133 git ls-files "$basever.*" | sed -e 's/\./\\./g;s/$/$/'| grep -vf - sources.new > sources
134 rm sources.new sources.tmp
135 # also update patches README
136 wget -nv $baseurl/README -O README.patches 2>&1
137 ver=$(tail -n1 sources | awk '{print $NF}')
140 curpatch=$(awk '/^%define[ ]+patchlevel[ ]+/{print $NF}' $specfile)
141 curver=$basever.$curpatch
143 if [ "$curver" != "$ver" ]; then
144 update_sources "$ver"
146 echo "$specfile already up to $ver"