debian: Add packaging
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,3 +12,4 @@ mgmt.static
|
|||||||
mgmt-*
|
mgmt-*
|
||||||
mgmt.iml
|
mgmt.iml
|
||||||
rpmbuild/
|
rpmbuild/
|
||||||
|
*.deb
|
||||||
|
|||||||
12
Makefile
12
Makefile
@@ -290,4 +290,16 @@ upload-rpms: rpmbuild/RPMS/ rpmbuild/RPMS/SHA256SUMS rpmbuild/RPMS/SHA256SUMS.as
|
|||||||
copr: upload-srpms
|
copr: upload-srpms
|
||||||
./misc/copr-build.py https://$(SERVER)/$(REMOTE_PATH)/SRPMS/$(SRPM_BASE)
|
./misc/copr-build.py https://$(SERVER)/$(REMOTE_PATH)/SRPMS/$(SRPM_BASE)
|
||||||
|
|
||||||
|
#
|
||||||
|
# deb build
|
||||||
|
#
|
||||||
|
|
||||||
|
deb:
|
||||||
|
./misc/gen-deb-changelog-from-git.sh
|
||||||
|
dpkg-buildpackage
|
||||||
|
# especially when building in Docker container, pull build artifact in project directory.
|
||||||
|
cp ../mgmt_*_amd64.deb ./
|
||||||
|
# cleanup
|
||||||
|
rm -rf debian/mgmt/
|
||||||
|
|
||||||
# vim: ts=8
|
# vim: ts=8
|
||||||
|
|||||||
7
debian/.gitignore
vendored
Normal file
7
debian/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
*.debhelper.log
|
||||||
|
*debhelper
|
||||||
|
changelog
|
||||||
|
debhelper-build-stamp
|
||||||
|
files
|
||||||
|
mgmt.substvars
|
||||||
|
mgmt/*
|
||||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
9
|
||||||
16
debian/control
vendored
Normal file
16
debian/control
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
Source: mgmt
|
||||||
|
Maintainer: Johan Bloemberg (aequitas) <mgmt@ijohan.nl>
|
||||||
|
Build-Depends:
|
||||||
|
debhelper,
|
||||||
|
devscripts,
|
||||||
|
dh-golang,
|
||||||
|
dh-systemd,
|
||||||
|
golang-go,
|
||||||
|
|
||||||
|
Package: mgmt
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
|
Description: mgmt: next generation config management!
|
||||||
|
The mgmt tool is a next generation config management prototype. It's
|
||||||
|
not yet ready for production, but we hope to get there soon. Get
|
||||||
|
involved today!
|
||||||
21
debian/copyright
vendored
Normal file
21
debian/copyright
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: mgmt
|
||||||
|
Source: <https://github.com/purpleidea/mgmt>
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: Copyright (C) 2013-2018+ James Shubin and the project contributors
|
||||||
|
License: GPL-3.0
|
||||||
|
|
||||||
|
License: GPL-3.0
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
11
debian/mgmt.docs
vendored
Normal file
11
debian/mgmt.docs
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
AUTHORS
|
||||||
|
COPYING
|
||||||
|
COPYRIGHT
|
||||||
|
README.md
|
||||||
|
THANKS
|
||||||
|
TODO.md
|
||||||
|
docs
|
||||||
|
examples
|
||||||
|
misc/bashrc.sh
|
||||||
|
misc/delta-cpu.sh
|
||||||
|
misc/mgmt.service
|
||||||
2
debian/mgmt.install
vendored
Normal file
2
debian/mgmt.install
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mgmt usr/bin
|
||||||
|
misc/mgmt.service /lib/systemd/system
|
||||||
15
debian/rules
vendored
Executable file
15
debian/rules
vendored
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
export DH_OPTIONS
|
||||||
|
export DH_GOPKG := mgmt
|
||||||
|
export DH_GOLANG_INSTALL_ALL := 1
|
||||||
|
unexport GOROOT
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
make build
|
||||||
|
|
||||||
|
override_dh_auto_test:
|
||||||
|
@echo "Tests are disabled for now"
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@ --with=systemd
|
||||||
76
misc/gen-deb-changelog-from-git.sh
Executable file
76
misc/gen-deb-changelog-from-git.sh
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if [ -f "${tmpfile}" ]; then
|
||||||
|
rm -f "${tmpfile}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trap "{ cleanup; }" EXIT SIGTERM
|
||||||
|
|
||||||
|
getCommits() {
|
||||||
|
prevtag="${1}"
|
||||||
|
tag="${2}"
|
||||||
|
local -a authors
|
||||||
|
local ver="${tag}-1"
|
||||||
|
local h
|
||||||
|
|
||||||
|
echo "»»» Processing ${prevtag}..${tag}"
|
||||||
|
numCommits=$(git --no-pager rev-list --count "${prevtag}".."${tag}")
|
||||||
|
if ((numCommits>0)); then
|
||||||
|
echo " ${numCommits} commits found"
|
||||||
|
|
||||||
|
if [ "${tag}" == "HEAD" ]; then
|
||||||
|
h=$(git rev-list --max-count=1 --abbrev-commit HEAD)
|
||||||
|
ver="${prevtag}~1.${h}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${pkgname} (${ver}) UNRELEASED; urgency=low" >> "${tmpfile}"
|
||||||
|
|
||||||
|
authors=($(git log --format='%aN' "${prevtag}".."${tag}" | sort | uniq))
|
||||||
|
for author in "${authors[@]}"; do
|
||||||
|
echo " Gathering commits from ${author}"
|
||||||
|
{
|
||||||
|
echo " [ ${author} ]"
|
||||||
|
git --no-pager log --author="${author}" --pretty=format:' * %s' "${prevtag}".."${tag}"
|
||||||
|
echo ""
|
||||||
|
} >> "${tmpfile}"
|
||||||
|
done
|
||||||
|
|
||||||
|
git --no-pager log -n 1 --pretty='format:%n -- %aN <%aE> %aD%n%n' "${tag}" >> "${tmpfile}"
|
||||||
|
else
|
||||||
|
echo " 0 commits found, skipping"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -d "debian" ]; then
|
||||||
|
echo "Directory ./debian not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmpfile=$(mktemp)
|
||||||
|
firstHash=$(git rev-list --max-parents=0 HEAD) # This should yield the very first commit hash
|
||||||
|
pkgname=$(grep '^Package: ' debian/control | sed 's/^Package: //')
|
||||||
|
tags=($(git tag | sort -r -V))
|
||||||
|
|
||||||
|
echo "»»» Gathering untagged commits"
|
||||||
|
tag=${tags[0]}
|
||||||
|
untagged=$(git rev-list --count "${tag}"..HEAD)
|
||||||
|
if ((untagged>0)); then
|
||||||
|
getCommits "${tag}" HEAD
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
for ((i=1; i<${#tags[@]}; i++)); do
|
||||||
|
tag="${tags[${i}]}"
|
||||||
|
nexttag="${tags[$((i-1))]}"
|
||||||
|
getCommits "${tag}" "${nexttag}"
|
||||||
|
done
|
||||||
|
|
||||||
|
getCommits "${firstHash}" "${tags[-1]}"
|
||||||
|
|
||||||
|
mv "${tmpfile}" debian/changelog
|
||||||
@@ -36,6 +36,8 @@ if [ ! -z "$APT" ]; then
|
|||||||
$sudo_command $APT install -y libvirt-dev || true
|
$sudo_command $APT install -y libvirt-dev || true
|
||||||
$sudo_command $APT install -y libaugeas-dev || true
|
$sudo_command $APT install -y libaugeas-dev || true
|
||||||
$sudo_command $APT install -y libpcap0.8-dev || true
|
$sudo_command $APT install -y libpcap0.8-dev || true
|
||||||
|
# dependencies for building debian packages with `make deb`
|
||||||
|
$sudo_command $APT install -y dpkg-dev devscripts debhelper dh-golang dh-systemd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$BREW" ]; then
|
if [ ! -z "$BREW" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user