Created
August 21, 2017 19:48
-
-
Save codemedic/9029bd0d2b83e3d0049fce03ef7c3f24 to your computer and use it in GitHub Desktop.
Build RPM from a git repo that uses git-flow (AVH)
This file contains 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
#!/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