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
16 # setup $quiet, you may override with env it
17 quiet=${quiet:-$(tty -s && echo 0 || echo 1)}
18 if [ "$quiet" = "1" ]; then
19 # we do not want output when running on cron
26 baseurl=ftp://ftp.vim.org/pub/editors/vim/patches/$basever
27 sources=ftp://ftp.vim.org/pub/editors/vim/patches/$basever/MD5SUMS
29 status=$(git status --porcelain sources)
30 if [ "$status" ]; then
31 echo >&2 "sources status not clean; commit or stash any pending changes"
39 echo "Fetching latest patches list..."
40 wget -nv $sources -O sources
41 git status --porcelain sources
43 status=$(git status --porcelain sources)
44 if [ -z "$status" ]; then
45 echo >&2 "No changes to 'sources'. All done"
49 ver=$(tail -n1 sources | awk '{print $NF}')
52 curpatch=$(awk '/^%define[ ]+patchlevel[ ]+/{print $NF}' $specfile)
53 curver=$basever.$curpatch
55 if [ "$curver" != "$ver" ]; then
56 echo "Updating $specfile to $ver"
57 patch=${ver#$basever.}
58 if [ -z "$patch" ]; then
59 echo >&2 "Will not set empty patchlevel"
63 s/^\(%define[ \t]\+patchlevel[ \t]\+\)[0-9]\+\$/\1$patch/
66 WGET_OPTS="-nv" ../builder -g $specfile
68 if [ "$build_package" != 0 ]; then
69 dist=$(rpm -E %{pld_release})
70 arch=$(rpm -E %{_host_cpu})
71 outdir=$(readlink -f $dir)/BUILD-$dist-$arch
72 logfile=$outdir/$pkg.log
76 # setup custom logfile via $HOME_ETC hack
77 # TODO: just add --logfile support for builder
78 cat > $outdir/.builderrc <<-EOF
79 if [ -n "$HOME_ETC" ]; then
80 . "$HOME_ETC/.builderrc"
81 elif [ -r ~/.builderrc ]; then
89 ../builder -bb --clean \
90 --define "_unpackaged_files_terminate_build 1" \
91 --define '_enable_debug_packages 0' \
92 --define "_builddir $outdir" \
93 --define "_rpmdir $rpmdir" \
95 echo "Package build failed"
96 tail -n 1000 $logfile >&2
100 rpmdest=~/public_html/$dist/$arch/
101 if [ "$publish_packages" ] && [ "$(ls $rpmdir/*.rpm 2>/dev/null)" ]; then
104 chmod 644 $rpmdir/*.rpm
105 mv -v $rpmdir/*.rpm $rpmdest/
106 poldek --cachedir=$HOME/tmp --mkidx -s $rpmdest/ --mt=pndir
110 echo "$specfile already up to $ver"