Outstanding! Thanks a bunch.
-pwl
-----Original Message-----
From: Kok, Auke-jan H [
]
Sent: Wednesday, January 27, 2016 4:05 PM
To: Long, Paul <paul.long(a)intel.com>
Cc:
Subject: Re: [Dev] how to find what package is in what bundle
And here's a github gist with the file - unmaliced by e-mail transactions:
Cheers,
Auke
On Wed, Jan 27, 2016 at 4:02 PM, Kok, Auke-jan H <auke-jan.h.kok(a)intel.com>
wrote:
On Wed, Jan 27, 2016 at 3:43 PM, Long, Paul
<paul.long(a)intel.com> wrote:
What is the best way to figure out what packages
are included in what
bundles?
There is some work going on to make this functionality available from
within the `swupd` command, but until then (as jaime notices) there's
no builtin way to get the detailed information easily.
However, we've had this idea around for a long time, and I wrote a
shell script that basically does the pickling for you. You should be
able to just call it with e.g. "bin/sar" if you're looking for the sar
binary:
$ clr-locate bin/sar
[.....................................................................
............] sysadmin-advanced pnp-tools-basic pnp-tools-advanced
pnp-tools-intermediate bat:
/usr/bin/sar
The periods are where it downloads all the compressed manifests. At
the end it displays all matches, and for each match, it lists in what
bundle you can find that match. In this case, there are several
bundles that provide that binary.
Note that currently, each invocation causes it to download about 50mb
of data. So use this sparsely :^)
Here's the script - It'll likely not survive copy-paste and mailers,
though, so make sure you check it.
Cheers,
Auke
===========8<=============
#!/bin/bash
# grab $VERSION_ID from os-release
eval `grep VERSION_ID /usr/lib/os-release`
# fetch bundles
BUNDLES=( `awk '{print $4}' /var/lib/swupd/${VERSION_ID}/Manifest.MoM`
)
NEXT=0
if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [
"$1" == "" ]; then
&2 echo "Usage: $0 [-n] [pattern]"
&2 echo "Options:"
&2 echo " -h | --help Display this help message"
&2 echo " -n Do not query external manifests"
exit
1
elif [ "$1" == "-n" ]; then
NEXT=1
shift
fi
TMP=`mktemp`
&2 echo -n "["
for BUNDLE in
${BUNDLES[@]}; do
if [ -f "/var/lib/swupd/${VERSION_ID}/Manifest.${BUNDLE}" ]; then
awk '{print $4}'
/var/lib/swupd/${VERSION_ID}/Manifest.${BUNDLE} | grep "$@" | sed
"s/^/${BUNDLE}\t/"
elif [ "$NEXT" != "1" ]; then
(
BV=`awk -v b=$BUNDLE '($4==b){print $3}'
/var/lib/swupd/${VERSION_ID}/Manifest.MoM`
curl --fail -s
"https://download.clearlinux.org/update/${BV}/Manifest.${BUNDLE}.tar"
| tar xJf - -O Manifest.${BUNDLE} | awk '{print $4}' | grep "$@" | sed
"s/^/${BUNDLE}\t/"
&2 echo -n .
) &
fi
done > $TMP
wait
&2 echo "]"
for FILE in `awk '{print $2}' $TMP | sort | uniq`; do
B=`awk -v file="${FILE}" '($2 == file){print $1}' $TMP | tr
'\n' '
' | sed 's/ $//'`
echo -e "${B}:\n\t${FILE}"
done
rm $TMP
===========8<=============