linux - Tool / command to query debian repository (like repoquery for rpm repository) -
im trying query latest version of package given repository url & package name. if http://in.archive.ubuntu.com/ubuntu/ repository & gcc package name there command / tool me find latest version of available? tried using apt-get & apt-cache problem not want add repository url /etc/apt/sources.list of box since dont have root access. tried running
apt-get update -o rootdir=<local-dir> thinking add repository url < local-dir >/etc/apt/sources.list & run
apt-cache show <pkg-name> -o rootdir=<local-dir> but apt-get update switched root-dir fails saying
chrooting <local-dir>/ e: sub-process returned error code is possible? or there alternative?
i don't know if there "official" way, it's easy write own script parses package list:
#!/bin/bash if [ -n "$1" ] package="$1" else package="gcc" fi release=$(lsb_release -c|awk '{ print $2 }') file=$(tempfile) wget -o /dev/null -o $file http://in.archive.ubuntu.com/ubuntu/dists/$release/main/binary-amd64/packages.gz gunzip -qc $file | grep -a 10 "^package: $package$" | awk '/version/ { print $2 }' rm $file this works if running on ubuntu , looking packages matching current version. if you're running on distro, set
release="saucy" for example.
have fun!
Comments
Post a Comment