Skip to content

Instantly share code, notes, and snippets.

@harish2704
Last active March 17, 2018 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harish2704/a2b0317a08ebe83af534805e31aa7b94 to your computer and use it in GitHub Desktop.
Save harish2704/a2b0317a08ebe83af534805e31aa7b94 to your computer and use it in GitHub Desktop.
mk-build-deps equivalent for rpm. Generate dummy rpm package satisfying build deps of a spec file
#!/usr/bin/env bash
#
# Usage: rpm-mk-build-deps.sh <path_to_spec_file>
#
mkBuildDeps(){
specFile=$1
pkgName=$(rpmspec -q $specFile --qf '%{name}')
pkgVersion=$(rpmspec -q $specFile --qf '%{version}')
OLDIFS=$IFS; IFS=$'\n'
deps=($(rpmspec -q $specFile --buildrequires | sed 's/^/-d\n/g'))
IFS=$OLDIFS
fpm.ruby2.5 \
-s empty \
-t rpm \
-n "${pkgName}-build-deps" \
-v "$pkgVersion" \
--iteration noop \
"${deps[@]@E}"
}
mkBuildDeps "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment