From fceeed2f1946ecc26610079d14867b2305fe0117 Mon Sep 17 00:00:00 2001 From: Esteban Carnevale Date: Wed, 5 Nov 2014 11:33:35 -0300 Subject: pcr-vs-aur: Add script --- pcr-vs-aur | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100755 pcr-vs-aur (limited to 'pcr-vs-aur') diff --git a/pcr-vs-aur b/pcr-vs-aur new file mode 100755 index 0000000..a27a168 --- /dev/null +++ b/pcr-vs-aur @@ -0,0 +1,162 @@ +#!/bin/bash + +# alfplayer +# 2014-06-12 +# +# Prints Parabola PCR packages with the corresponding AUR +# packages, only if the version of the Parabola package is older +# than the Arch package version. + +set -e + +name="aur-vs-pcr" + +baseconfpath="/etc/libredbdiff" +basedbpath="/var/lib/libredbdiff" + +conffile="$baseconfpath/pacman.conf.parabola" +conffilearch="$baseconfpath/pacman.conf.archlinux" + +dbpath="$basedbpath/pacman.parabola" +dbpatharch="$basedbpath/pacman.archlinux" + +field_pkgname=40 +field_version=40 +field_time=10 + + +error() { echo -e "Error. $@" > /dev/stderr ; exit 1; } + +verbose=1 + +while true ; do + if [[ $1 =~ ^(-v|--verbose)$ ]] ; then + verbose=0 + shift + elif [[ $# == 1 && $1 =~ ^(-h|--help)$ ]] ; then + echo -e "${name}. Show PCR repository packages that need to be updated from AUR. +Usage: +${name} [pattern]\t\tRegular output. +${name} -v [pattern]\t\tAlso print package names of unmatched and updated packages. + +Specify [pattern] to filter package names. It can be empty to show all PCR packages. + +Examples: +${name} pkgtool\t\tSearches for package names including the substring \"pkgtool\". +${name} ^emacs.*\t\tSearches for package names starting with \"emacs\". +${name} -v emacs.*\t\tSame as previous but it also prints unmatched and updated packages." + exit 0 + else + pattern="$1" + if [[ $2 ]] ; then + error "Bad arguments. Nothing done. Run \"aur-vs-pcr -h\" for usage information." + else + break + fi + fi +done + +if ! which jshon > /dev/null ; then + echo "jshon is not installed (package \"jshon\")" +fi + +# Save PCR package information to a file +expac -S '%r/%n %v %b %p' -t '%F' | grep "^pcr" | cut -b 5- | \ + awk -v pattern="$pattern" "\$1 ~ pattern" > /tmp/aur-vs-pcr.tmp + +pkgname_list="$(head -c -1 /tmp/aur-vs-pcr.tmp | awk '{print $1}' | sed ':a;N;$!ba;s/\n/ /g')" + +declare -Ax ver_arch time_arch maintainer_arch ood_arch provides_string_arch desc_arch + +pkg_count="$(wc -w <<< "${pkgname_list}")" + +set +m +shopt -s lastpipe + +# Query using the HTTP AUR RPC about 400 packages at a time. The request is denied using 500. +for (( j=0 ; j ${pkgname}" + fi + fi + else + if [[ $verbose == 0 ]] ; then + echo "o ${pkgname}" + fi + fi +done < /tmp/aur-vs-pcr.tmp -- cgit v1.2.3-54-g00ecf