X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm-build-tools.git;a=blobdiff_plain;f=pear-autoup.sh;h=af1c41ca881482992a0bbda2fa713b5a9e445777;hp=96503f5481245072ed038699ab7121da54eabe58;hb=1fd85958b8deba0d10a59a4e50b2943fb1b0b6df;hpb=12d950d21b5103d424464382a47db88233bef3ee diff --git a/pear-autoup.sh b/pear-autoup.sh index 96503f5..af1c41c 100755 --- a/pear-autoup.sh +++ b/pear-autoup.sh @@ -10,10 +10,14 @@ set -e builder=builder if [ "$1" = "clean" ]; then - rm -rf php-pear-* php-phpunit-* php-symfony-* php-firephp-* php-horde-* php-phpdocs-* pear.* BUILD/* RPMS/* + rm -rf php-pear-* php-phpunit-* php-symfony-* php-symfony2-* php-firephp-* php-horde-* php-phpdocs-* pear.* BUILD/* RPMS/* exit 0 fi +if [ $# -gt 0 ]; then + echo "$*" | tr ' ' '\n' > pear.channels +fi + # test that php is working php -r 'echo "PHP is working OK\n";' @@ -38,19 +42,18 @@ rpm -q php-packagexml2cl php-pear-PEAR_Command_Packaging [ -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 -subst=$(pear list-channels | awk -vORS="|" '/^[a-z]/{print $2}') -subst="s/^php-(${subst%\|})-//" +# process urls to aliases +[ -s pear.rpms ] || { + [ -s pear.channels ] || pear list-channels | sed -ne '4,$p' > pear.channels + while read url alias desc; do + awk -vurl="$url" -valias="$alias" '$1 == url {printf("php-%s-%s %s\n", alias, $2, $5)}' pear.upgrades + done < pear.channels > pear.rpms +} # clear it if you do not want to upgrade pkgs. i.e bring ac to sync do_upgrade=1 @@ -59,8 +62,7 @@ do_upgrade=1 topdir=$(rpm -E %_topdir) for pkg in $(cat pear.pkgs); do # check if there's update in channel - pearpkg=$(echo "$pkg" | sed -re "$subst") - ver=$(awk -vpkg=$pearpkg '$2 == pkg {print $5}' pear.upgrades) + ver=$(awk -vpkg=$pkg '$1 == pkg {print $2}' pear.rpms) [ "$ver" ] || continue # skip already processed packages