]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - pear-autoup.sh
updated for git
[packages/rpm-build-tools.git] / pear-autoup.sh
CommitLineData
53e0bad9
ER
1#!/bin/sh
2# Try to update pear packages from current distro repos to latest in
3# pear.php.net.
4#
5# $Id$
6# Author: Elan Ruusamäe <glen@pld-linux.org>
7
8set -e
9
014c89d7
ER
10# test that php is working
11php -r 'echo "PHP is working OK\n";'
12
13# test that pear is working
14pear info PEAR >/dev/null
15
9e291454 16# needed pkgs for upgrade test
ba472b43 17rpm -q php-packagexml2cl php-pear-PEAR_Command_Packaging
9e291454 18
3f82af9a 19[ -s pear.desc ] || { poldek --upa; poldek -q -Q --skip-installed --cmd 'search -r php-pear | desc' > pear.desc; }
87a0b461 20[ -s pear.pkgs ] || {
900580bb 21 awk '/^Source.package:/{print $3}' < pear.desc | sed -re 's,-[^-]+-[^-]+.src.rpm$,,' | sort -u > pear.pkgs
87a0b461
ER
22
23 # filter out tests, see https://bugs.launchpad.net/poldek/+bug/620362
24 sed -i -e '/-tests/d' pear.pkgs
25 # more packages affected
26 sed -i -e '/php-pear-Auth_Container_ADOdb/d' pear.pkgs
27 sed -i -e '/php-pear-DB_DataObject-cli/d' pear.pkgs
28 # not pear pkg
29 sed -i -e '/^php-pear$/d' pear.pkgs
30}
31
0e6168a9
ER
32[ -f pear.installed ] || {
33 sudo poldek --update --upa
b538c1b3
ER
34 # as sudo & poldek don't allow us to capture (no pipe or redirection work),
35 # we create markers which we could grab when invoked via "script"
36 echo "BEGIN INSTALL PACKAGES"
0e6168a9 37 sed -e 's,^,install ,' pear.pkgs | sudo poldek
b538c1b3
ER
38 echo "END INSTALL PACKAGES"
39 # rm -f pear.installed && script -c ./pear-autoup.sh pear.install.log
40 # sed -ne '/BEGIN INSTALL PACKAGES/,/END INSTALL PACKAGES/p' pear.install.log | grep -vE 'poldek:/.*install|: ambiguous name|equal version installed, skipped|Nothing to do' | less
0e6168a9
ER
41 touch pear.installed
42}
e86fe056 43[ -s pear.upgrades ] || pear list-upgrades > pear.upgrades
53e0bad9 44
3f82af9a
ER
45subst=$(pear list-channels | awk -vORS="|" '/^[a-z]/{print $2}')
46subst="s/^php-(${subst%\|})-//"
47
b06f4c2a
ER
48# clear it if you do not want to upgrade pkgs. i.e bring ac to sync
49do_upgrade=1
50#do_upgrade=
51
53e0bad9 52for pkg in $(cat pear.pkgs); do
600b4a0a 53 # check if there's update in channel
3f82af9a 54 pearpkg=$(echo "$pkg" | sed -re "$subst")
600b4a0a
ER
55 ver=$(awk -vpkg=$pearpkg '$2 == pkg {print $5}' pear.upgrades)
56 [ "$ver" ] || continue
57
58 # skip already processed packages
53e0bad9 59 [ -d $pkg ] && continue
600b4a0a
ER
60
61 # try upgrading with specified version
62 # pldnotify.awk uses "pear remote-info" which does not respect preferred package states
b06f4c2a 63 ./builder -bb $pkg ${do_upgrade:+-u --upgrade-version $ver} --define "_unpackaged_files_terminate_build 1" || {
53e0bad9
ER
64 cat >&2 <<-EOF
65
66 $pkg failed
67
68 EOF
69 exit 1
70 }
71
72 # check for bad versions (which needs macros
600b4a0a 73 ver=$(awk '/^Version:/{print $2; exit}' $pkg/$pkg.spec)
53e0bad9 74 case "$ver" in
b40766e6 75 *RC* | *a* | *b* | *alpha* | *beta* | *dev*)
53e0bad9
ER
76 cat >&2 <<-EOF
77
78 Package $pkg contains bad version: $ver
79 Update it to use %subver macro instead.
80
81 EOF
82 exit 1
83 ;;
84 esac
53e0bad9 85done
This page took 0.042805 seconds and 4 git commands to generate.