Skip to content

Instantly share code, notes, and snippets.

@awood
Created October 2, 2013 16:25
Show Gist options
  • Save awood/6796396 to your computer and use it in GitHub Desktop.
Save awood/6796396 to your computer and use it in GitHub Desktop.
A simple shell script to grab Java spec files so you can examine and learn from them. It looks in source repositories for items with a BuildRequires on jpackage-utils. Then it grabs the location for that SRPM, downloads it, and extracts the spec file. This script is probably Fedora specific.
#! /bin/bash
packages=$(repoquery --qf "%{name}" --archlist=src --enablerepo='*-source' --whatrequires jpackage-utils | sort | uniq)
for p in $packages; do
srpm_location=$(repoquery --qf "%{location}" --archlist=src --enablerepo='*-source' $p)
srpm=$(curl -s -O -w '%{filename_effective}' $srpm_location)
rpm2cpio $srpm | cpio --quiet -id ${p}.spec
rm $srpm
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment