-
-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds new make targets for rpm, deb, and pacman packages. It also adds a phony target that uploads tarballs of the packages, along with their signed (and unsigned) checksums to the github release page. Once the current commit is tagged as a release, run `make release` to build the packages and upload them to github.
- Loading branch information
1 parent
cc02e96
commit 80931e1
Showing
7 changed files
with
243 additions
and
90 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ mgmt.static | |
build/mgmt-* | ||
mgmt.iml | ||
rpmbuild/ | ||
*.deb | ||
releases/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
# This script packages rpm, deb, and pacman packages of mgmt with fpm. The | ||
# first argument is the package type, and all subsequent arguments are the | ||
# dependencies. Example usage: `./fpm-pack.sh deb dependency1 dependency2` | ||
|
||
# the binary to package | ||
BINARY="mgmt" | ||
# git tag pointing to the current commit | ||
TAG=$(git tag -l --points-at HEAD) | ||
# maintainer email | ||
MAINTAINER="[email protected]" | ||
# project url | ||
URL="https://github.com/purpleidea/mgmt/" | ||
# project description | ||
DESCRIPTION="Next generation distributed, event-driven, parallel config management!" | ||
# project license | ||
LICENSE="GPLv3" | ||
# location to install the binary | ||
PREFIX="/usr/bin" | ||
# release directory | ||
DIR="releases" | ||
|
||
# placeholder for dependencies to be read from arguments | ||
DEPS= | ||
# placeholder for changelog argument parsed from the package type | ||
CHANGELOG= | ||
|
||
# make sure we're on a tagged commit | ||
if [ "$TAG" == "" ]; then | ||
echo "cannot release an untagged commit" | ||
exit 1 | ||
fi | ||
|
||
# make sure the package type is valid | ||
if [ "$1" != "deb" ] && [ "$1" != "rpm" ] && [ "$1" != "pacman" ]; then | ||
echo "invalid package type" | ||
exit 1 | ||
fi | ||
|
||
# there are no changelogs for pacman packages | ||
if [ "$1" != "pacman" ]; then | ||
CHANGELOG="--${1}-changelog=${DIR}/${1}/changelog" | ||
fi | ||
|
||
# arguments after the first one are deps | ||
for i in "${@:2}"; do | ||
DEPS="$DEPS -d $i" | ||
done | ||
|
||
# build the package | ||
fpm \ | ||
--log error \ | ||
--name "$BINARY" \ | ||
--version "$TAG" \ | ||
--maintainer "$MAINTAINER" \ | ||
--url "$URL" \ | ||
--description "$DESCRIPTION" \ | ||
--license "$LICENSE" \ | ||
--input-type dir \ | ||
--output-type "$1" \ | ||
--package "${DIR}/${1}/" \ | ||
${CHANGELOG} \ | ||
${DEPS} \ | ||
--prefix "$PREFIX" \ | ||
"$BINARY" |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# This script generates a deb changelog from the project's git history. | ||
|
||
# path to store the changelog | ||
CHANGELOG="releases/deb/changelog" | ||
# input to format flag for git tag | ||
TAG_FORMAT="-- %(creator) %(creatordate:format:%a, %d %b %Y %H:%M:%S %z) %(refname:lstrip=2)" | ||
# a list of tags to be parsed in the loop | ||
TAGS=$(git tag --sort=-creatordate --format="$TAG_FORMAT" | sed -r 's/[0-9]+ -[0-9]+ //') | ||
|
||
# placeholder for the next line of the list | ||
THIS_TAGLINE= | ||
|
||
# parse the list | ||
while read -r LAST_TAGLINE; do | ||
# read ahead one tag | ||
if [ "$THIS_TAGLINE" == "" ]; then | ||
# store the tag for the next iteration | ||
THIS_TAGLINE="$LAST_TAGLINE" | ||
continue | ||
fi | ||
|
||
# grab the tags from the last column of the taglines | ||
THIS_TAG=$(echo "$THIS_TAGLINE" | awk '{print $NF}') | ||
LAST_TAG=$(echo "$LAST_TAGLINE" | awk '{print $NF}') | ||
|
||
# print the release description | ||
printf "mgmt (%s) unstable; priority=low\n\n" "$THIS_TAG" >> "$CHANGELOG" | ||
|
||
# print all the commits between the tags | ||
git shortlog -n "${LAST_TAG}...${THIS_TAG}" | sed -r '/\):/s/^/ * /' >> "$CHANGELOG" | ||
|
||
# print the release signature | ||
printf "%s\n\n\n" "$THIS_TAGLINE" | sed -r 's/[0-9]\.[0-9]\.[0-9]+//'>> "$CHANGELOG" | ||
|
||
# first tag is special since there's no previous one | ||
if [ "$LAST_TAG" == "0.0.1" ]; then | ||
# print all the commits before the first tag | ||
git shortlog -n "$LAST_TAG" | sed -r '/\):/s/^/ * /' >> "$CHANGELOG" | ||
# print the release signature | ||
printf "%s\n" "$LAST_TAGLINE" | sed -r 's/[0-9]\.[0-9]\.[0-9]+//'>> "$CHANGELOG" | ||
fi | ||
|
||
# store the tag for the next iteration | ||
THIS_TAGLINE="$LAST_TAGLINE" | ||
done <<< "$TAGS" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# This script generates an rpm changelog from the project's git history. | ||
|
||
# path to store the changelog | ||
CHANGELOG="releases/rpm/changelog" | ||
# input to format flag for git tag | ||
TAG_FORMAT="* %(creatordate:format:%a %b %d %Y) %(creator) %(refname:lstrip=2)" | ||
# a list of tags to be parsed in the loop | ||
TAGS=$(git tag --sort=-creatordate --format="$TAG_FORMAT" | sed -r 's/[0-9]+ -[0-9]+ //') | ||
|
||
# placeholder for the next line of the list | ||
THIS_TAGLINE= | ||
|
||
# parse the list | ||
while read -r LAST_TAGLINE; do | ||
# read ahead one tag | ||
if [ "$THIS_TAGLINE" == "" ]; then | ||
# store the tag for the next iteration | ||
THIS_TAGLINE="$LAST_TAGLINE" | ||
continue | ||
fi | ||
|
||
# grab the tags from the last column of the taglines | ||
THIS_TAG=$(echo "$THIS_TAGLINE" | awk '{print $NF}') | ||
LAST_TAG=$(echo "$LAST_TAGLINE" | awk '{print $NF}') | ||
|
||
# print the release description | ||
printf "\n%s\n\n" "$THIS_TAGLINE" >> "$CHANGELOG" | ||
|
||
# print all the commits between the tags | ||
git shortlog -n ${LAST_TAG}...${THIS_TAG} | sed -r '/\):/s/^/ - /' >> "$CHANGELOG" | ||
|
||
# first tag is special since there's no previous one | ||
if [ "$LAST_TAG" == "0.0.1" ]; then | ||
# print the release description | ||
printf "\n%s\n\n" "$LAST_TAGLINE" >> "$CHANGELOG" | ||
# print all the commits before the first tag | ||
git shortlog -n $LAST_TAG | sed -r '/\):/s/^/ - /' >> "$CHANGELOG" | ||
fi | ||
|
||
# store the tag for the next iteration | ||
THIS_TAGLINE="$LAST_TAGLINE" | ||
done <<< "$TAGS" | ||
|
||
# trim the first and last lines | ||
sed -i '1d;$d' "$CHANGELOG" |