Created
January 9, 2014 12:07
-
-
Save unakatsuo/8333120 to your computer and use it in GitHub Desktop.
Get dependency list from RPM spec in bash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read dependency information from rpmbuild/SPECS/*.spec. | |
# % cat rpmbuild/SPECS/*.spec | rpmspec_depends | |
function rpmspec_depends() { | |
# 0. remove redhat meta variables. | |
# 1. convert space list to line list. | |
# 2. remove trailing spaces. | |
# 3. remove debian meta variables. i.e. ${shlib:Depends} | |
# 4. remove version conditions. | |
# 5. remove wakame-vdc packages. | |
awk -F: '$1 == "BuildRequires" || $1 == "Requires" { print substr($0, length($1)+2)}' | \ | |
egrep -v '%|=' |\ | |
sed -e 's|\s* \s*|\n|g' | \ | |
sed -e 's/^[ ]*//g' -e 's/[ ]*$//' | \ | |
sed -e '/\$/d' | \ | |
sed -e 's|[\(].*[\)]||g' | \ | |
sort | uniq | \ | |
egrep -v '^wakame-vdc' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment