Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@codemedic
Created August 21, 2017 19:48
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 codemedic/9029bd0d2b83e3d0049fce03ef7c3f24 to your computer and use it in GitHub Desktop.
Save codemedic/9029bd0d2b83e3d0049fce03ef7c3f24 to your computer and use it in GitHub Desktop.
Build RPM from a git repo that uses git-flow (AVH)
#!/bin/bash
: "${branch:="$(git rev-parse --abbrev-ref HEAD)"}"
: "${tag_or_branch:="$branch"}"
spec=( *spec )
spec=${spec%%.spec}
# Relies on git-describe being functional; so git-flow AVH edition is essential
version="$(git describe --abbrev=0 "$branch")"
git archive --prefix="${spec}-${version}/" \
-o "$(rpm --eval '%{_topdir}')/SOURCES/${spec}/${spec}-${version}.tar.gz" \
"$tag_or_branch"
rpmbuild -bb --nodeps --define "__build_pkg_version $version" "${spec}.spec"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment