]> git.pld-linux.org Git - packages/google-chrome.git/commitdiff
use python3 repomd module to query rpm repo
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 31 Jan 2019 20:45:02 +0000 (22:45 +0200)
committerElan Ruusamäe <glen@pld-linux.org>
Thu, 31 Jan 2019 20:45:45 +0000 (22:45 +0200)
https://pypi.org/project/repomd/

update-source.sh

index 4575a569ef7b27736b1d59bacd5ddacb083967a9..207124f88bacb32ad9a410e7d256942a206f0e5d 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 die() {
        echo >&2 "$0: $*"
        exit 1
@@ -33,25 +35,21 @@ esac
 
 sourceurl=https://dl.google.com/linux/$product/rpm/stable/$arch
 
-set -e
-
 fetch_version() {
-       echo -n "Fetching latest version... "
-       t=$(mktemp)
+       echo -n "Fetching latest version for $branch... "
 
        # poldek is buggy, see https://bugs.launchpad.net/poldek/+bug/1026762
        #poldek -q --st=metadata --source "$sourceurl/" --update
        #poldek -q --skip-installed --st=metadata --source "$sourceurl/" --cmd "ls google-chrome-$branch" > $t
 
-       repodata=primary-$branch-$(date +%Y%m%d).xml
-       [ "$cache" = "yes" ] || rm -f "$repodata"
-       test -e $repodata || {
-               wget $sourceurl/repodata/primary.xml.gz -O $repodata.gz
-               gzip -dc $repodata.gz > $repodata || test -s $repodata
-       }
-       perl -ne 'm{<name>google-'$product-$branch'</name>} and m{<version epoch="0" ver="([\d.]+)" rel="(\d+)"/>} and print "$1 $2"' > $t < $repodata
-
-       set -- $(sed -re "s,^.+-([^-]+)-([^-]+).$arch$,\1 \2," $t)
+       set -- $(
+               python3 <<-EOF
+                       import repomd
+                       repo = repomd.load('$sourceurl')
+                       package = repo.find('google-$product-$branch')
+                       print("{0} {1}".format(package.version, package.release))
+               EOF
+       )
 
        ver=$1
        rel=$2
This page took 0.119756 seconds and 4 git commands to generate.