]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - pear-autoup.sh
- old change: check files from CVS
[packages/rpm-build-tools.git] / pear-autoup.sh
index a1b63feecc995ac7cf1bf9fa2a76a0a6c1664f39..2811026b73d7ab8e95ad4dd2e933b3ece16fb1ff 100644 (file)
@@ -7,12 +7,16 @@
 
 set -e
 
-[ -s pear.ls ] || poldek -q --skip-installed --cmd 'ls php-pear-*' > pear.ls
-[ -s pear.desc ] || {
-       for pkg in $(cat pear.ls); do
-               poldek -q --skip-installed --cmd "desc $pkg"
-       done
-} > pear.desc
+# test that php is working
+php -r 'echo "PHP is working OK\n";'
+
+# test that pear is working
+pear info PEAR >/dev/null
+
+# needed pkgs for upgrade test
+rpm -q php-packagexml2cl php-pear-PEAR_Command_Packaging
+
+[ -s pear.desc ] || { poldek --upa; poldek -q -Q --skip-installed --cmd 'search -r php-pear | desc' > pear.desc; }
 [ -s pear.pkgs ] || {
        awk '/^Source.package:/{print $3}' < pear.desc | sed -re 's,-[^-]+-[^-]+.src.rpm$,,' | sort -u > pear.pkgs
 
@@ -27,17 +31,27 @@ set -e
 
 [ -f pear.installed ] || {
        sudo poldek  --update --upa
+       # as sudo & poldek don't allow us to capture (no pipe or redirection work),
+       # we create markers which we could grab when invoked via "script"
+       echo "BEGIN INSTALL PACKAGES"
        sed -e 's,^,install ,' pear.pkgs | sudo poldek
+       echo "END INSTALL PACKAGES"
+       # rm -f pear.installed && script -c ./pear-autoup.sh pear.install.log
+       # 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
        touch pear.installed
 }
 [ -s pear.upgrades ] || pear list-upgrades > pear.upgrades
 
-# test that php is working
-php -r 'echo "PHP is working OK\n";'
+subst=$(pear list-channels | awk -vORS="|" '/^[a-z]/{print $2}')
+subst="s/^php-(${subst%\|})-//"
+
+# clear it if you do not want to upgrade pkgs. i.e bring ac to sync
+do_upgrade=1
+#do_upgrade=
 
 for pkg in $(cat pear.pkgs); do
        # check if there's update in channel
-       pearpkg=${pkg#php-pear-}
+       pearpkg=$(echo "$pkg" | sed -re "$subst")
        ver=$(awk -vpkg=$pearpkg '$2 == pkg {print $5}' pear.upgrades)
        [ "$ver" ] || continue
 
@@ -46,7 +60,7 @@ for pkg in $(cat pear.pkgs); do
 
        # try upgrading with specified version
        # pldnotify.awk uses "pear remote-info" which does not respect preferred package states
-       ./builder -bb -u $pkg --upgrade-version $ver --define "_unpackaged_files_terminate_build 1" || {
+       ./builder -bb $pkg ${do_upgrade:+-u --upgrade-version $ver} --define "_unpackaged_files_terminate_build 1" || {
                cat >&2 <<-EOF
 
                $pkg failed
This page took 0.047786 seconds and 4 git commands to generate.