diff options
author | Al Stone <ahs3@redhat.com> | 2012-11-28 17:24:42 -0700 |
---|---|---|
committer | Al Stone <ahs3@redhat.com> | 2012-11-28 17:24:42 -0700 |
commit | 5803d1376fb1164931f5cc98f21718072258d3ab (patch) | |
tree | 5285abe320c79cf96cd7047547655728ceabdd38 /report-versions.sh | |
parent | facd28a0ac628ad3633db295a5642e62842c5027 (diff) | |
download | portdep-5803d1376fb1164931f5cc98f21718072258d3ab.tar.gz portdep-5803d1376fb1164931f5cc98f21718072258d3ab.tar.xz portdep-5803d1376fb1164931f5cc98f21718072258d3ab.zip |
Add in the analysis of the Fedora data; it's crude, but usable...
Signed-off-by: Al Stone <ahs3@redhat.com>
Diffstat (limited to 'report-versions.sh')
-rwxr-xr-x | report-versions.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/report-versions.sh b/report-versions.sh new file mode 100755 index 0000000..8dc742e --- /dev/null +++ b/report-versions.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# Sort through the raw results of a scan and list all of +# packages found and their reported versions +# + +if [ "$#" -lt 1 ] +then + echo "usage: ./report-versions.sh <results-file>" + exit 1 +fi + +data="$1" +if [ ! -s "$data" ] +then + echo "? has to be something to work with" + exit 1 +fi + +cat "$data" | ( + declare -i count + count=0 + while IFS='' read -r line || [ -n "$line" ] + do + case "$line" in + Package:*) + [ $count -gt 0 ] && echo $pkg $version + count+=1 + pkg=$(echo $line | sed 's/Package: //') + ;; + Source:*) + version=$(echo $line | sed 's/Source: //' | \ + sed "s/${pkg}-//") + ;; + esac + done +) + |