forked from ungleich-public/cdist
more stuff in the makefile
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
4dfa653823
commit
96e58af1da
2 changed files with 70 additions and 133 deletions
73
Makefile
73
Makefile
|
@ -18,35 +18,78 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
DIST=dist-tag dist-branch-merge dist-pypi dist-archlinux-makepkg
|
MANDIR=docs/man
|
||||||
RELEASE=web release-man pub
|
MAN1DSTDIR=$(MANDIR)/man1
|
||||||
RELEASE+=release-blog release-ml
|
MAN7DSTDIR=$(MANDIR)/man7
|
||||||
RELEASE+=dist-freecode dist-manual dist-archlinux-aur-upload
|
MANREF=$(MAN7DSTDIR)/cdist-reference.text
|
||||||
|
MANREFSH=$(MANDIR)/cdist-reference.text.sh
|
||||||
|
|
||||||
|
CHECKS=check-version check-date
|
||||||
|
|
||||||
|
DIST=dist-tag dist-branch-merge
|
||||||
|
|
||||||
|
RELEASE=release-web release-man release-pypi release-archlinux-makepkg
|
||||||
|
RELEASE+=release-blog release-ml
|
||||||
|
RELEASE+=release-freecode release-archlinux-aur-upload
|
||||||
|
|
||||||
|
helper=./build-helper
|
||||||
|
version=`git describe`
|
||||||
|
versionchangelog=`$(helper) changelog-version`
|
||||||
|
versionfile=cdist/version.py
|
||||||
|
|
||||||
|
archlinuxtar=cdist-${versionchangelog}-1.src.tar.gz
|
||||||
|
|
||||||
|
$(versionfile):
|
||||||
|
echo $(version) > $@
|
||||||
|
|
||||||
version:
|
|
||||||
|
|
||||||
$(DIST): dist-check
|
$(DIST): dist-check
|
||||||
$(RELEASE): $(DIST)
|
$(RELEASE): $(DIST) $(CHECKS)
|
||||||
|
|
||||||
man: mangen mantype manbuild
|
man: $(MANREF) mantype manbuild
|
||||||
|
|
||||||
|
$(MANREF): $(MANREFSH)
|
||||||
|
$(MANREFSH)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# generic code
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# dist code
|
||||||
|
#
|
||||||
|
dist-check: man
|
||||||
|
|
||||||
dist: $(DIST)
|
dist: $(DIST)
|
||||||
echo "Run \"make release\" to release to the public"
|
echo "Run \"make release\" to release to the public"
|
||||||
|
|
||||||
release: $(RELEASE)
|
dist-pypi: man version
|
||||||
|
python3 setup.py sdist upload
|
||||||
|
|
||||||
dist-archlinux: dist-pypi
|
$(archlinuxtar): PKGBUILD dist-pypi
|
||||||
|
|
||||||
dist-check: clean man
|
|
||||||
|
|
||||||
dist-archlinux-makepkg: PKGBUILD
|
|
||||||
makepkg -c --source
|
makepkg -c --source
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# release code
|
||||||
|
#
|
||||||
|
release: pub $(RELEASE)
|
||||||
|
echo "Don't forget...: linkedin"
|
||||||
|
|
||||||
|
|
||||||
|
release-archlinux: $(archlinuxtar)
|
||||||
|
burp -c system $^
|
||||||
|
|
||||||
|
release-blog: blog
|
||||||
|
release-ml: release-blog
|
||||||
release-pub: man
|
release-pub: man
|
||||||
|
|
||||||
|
release-web: web-doc
|
||||||
|
|
||||||
PKGBUILD: PKGBUILD.in
|
PKGBUILD: PKGBUILD.in
|
||||||
./PKGBUILD.in
|
./PKGBUILD.in
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# generic call
|
||||||
%:
|
%:
|
||||||
./build-helper $@
|
$(helper) $@
|
||||||
|
|
||||||
|
|
130
build-helper
130
build-helper
|
@ -18,14 +18,9 @@
|
||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Push a directory to a target, both sides have the same name (i.e. explorers)
|
# This file contains the heavy lifting found usually in the Makefile
|
||||||
# or
|
|
||||||
# Pull a directory from a target, both sides have the same name (i.e. explorers)
|
|
||||||
#
|
#
|
||||||
|
|
||||||
# exit on any error
|
|
||||||
#set -e
|
|
||||||
|
|
||||||
basedir=${0%/*}
|
basedir=${0%/*}
|
||||||
version=$(cd "$basedir" && git describe)
|
version=$(cd "$basedir" && git describe)
|
||||||
|
|
||||||
|
@ -51,13 +46,6 @@ SPEECHESDIR=docs/speeches
|
||||||
cd "$basedir"
|
cd "$basedir"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
man)
|
|
||||||
set -e
|
|
||||||
"$0" mangen
|
|
||||||
"$0" mantype
|
|
||||||
"$0" manbuild
|
|
||||||
;;
|
|
||||||
|
|
||||||
manbuild)
|
manbuild)
|
||||||
trap abort INT
|
trap abort INT
|
||||||
abort() {
|
abort() {
|
||||||
|
@ -86,13 +74,7 @@ case "$1" in
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
mangen)
|
release-man)
|
||||||
${MANDIR}/cdist-reference.text.sh
|
|
||||||
;;
|
|
||||||
|
|
||||||
man-pub)
|
|
||||||
$0 man
|
|
||||||
|
|
||||||
version=$($0 changelog-version)
|
version=$($0 changelog-version)
|
||||||
|
|
||||||
rm -rf "${WEBMAN}"
|
rm -rf "${WEBMAN}"
|
||||||
|
@ -102,36 +84,6 @@ case "$1" in
|
||||||
cd ${WEBMAN} && git add . && git commit -m "Cdist Manpage update: $version"
|
cd ${WEBMAN} && git add . && git commit -m "Cdist Manpage update: $version"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dist)
|
|
||||||
set -e
|
|
||||||
# Do the checks
|
|
||||||
$0 dist-check
|
|
||||||
|
|
||||||
# Git changes - everything depends on this
|
|
||||||
$0 dist-tag
|
|
||||||
$0 dist-branch-merge
|
|
||||||
|
|
||||||
# Pypi first - is the base for others
|
|
||||||
$0 dist-pypi
|
|
||||||
|
|
||||||
# Archlinux depends on successful pypi ;-)
|
|
||||||
$0 dist-archlinux
|
|
||||||
|
|
||||||
# Update website (includes documentation)
|
|
||||||
$0 web
|
|
||||||
|
|
||||||
# Update manpages on website
|
|
||||||
$0 man-pub
|
|
||||||
|
|
||||||
# update git repos
|
|
||||||
$0 pub
|
|
||||||
|
|
||||||
$0 dist-blog
|
|
||||||
$0 dist-freecode
|
|
||||||
$0 dist-ml
|
|
||||||
$0 dist-manual
|
|
||||||
;;
|
|
||||||
|
|
||||||
changelog-changes)
|
changelog-changes)
|
||||||
awk -F: 'BEGIN { start=0 } { if ($0 ~ /^[[:digit:]]/) { if(start == 0) {start = 1 } else { exit } } else { if(start==1) {print $0 }} }' "$basedir/docs/changelog"
|
awk -F: 'BEGIN { start=0 } { if ($0 ~ /^[[:digit:]]/) { if(start == 0) {start = 1 } else { exit } } else { if(start==1) {print $0 }} }' "$basedir/docs/changelog"
|
||||||
;;
|
;;
|
||||||
|
@ -141,12 +93,7 @@ case "$1" in
|
||||||
grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//'
|
grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dist-check)
|
check-version)
|
||||||
set -e
|
|
||||||
echo "Verifying documentation building works ..."
|
|
||||||
$0 clean
|
|
||||||
$0 man
|
|
||||||
|
|
||||||
changelog_version=$($0 changelog-version)
|
changelog_version=$($0 changelog-version)
|
||||||
echo "Target version from changelog: $changelog_version"
|
echo "Target version from changelog: $changelog_version"
|
||||||
|
|
||||||
|
@ -154,7 +101,9 @@ case "$1" in
|
||||||
echo "Version $changelog_version already exists, aborting."
|
echo "Version $changelog_version already exists, aborting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
check-date)
|
||||||
# verify date in changelog
|
# verify date in changelog
|
||||||
date_today="$(date +%Y-%m-%d)"
|
date_today="$(date +%Y-%m-%d)"
|
||||||
date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //')
|
date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //')
|
||||||
|
@ -164,7 +113,6 @@ case "$1" in
|
||||||
echo "Changelog: $date_changelog"
|
echo "Changelog: $date_changelog"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
blog)
|
blog)
|
||||||
|
@ -186,8 +134,7 @@ For more information visit the [[cdist homepage|software/cdist]].
|
||||||
eof
|
eof
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dist-blog)
|
release-blog)
|
||||||
$0 blog
|
|
||||||
version=$($0 changelog-version)
|
version=$($0 changelog-version)
|
||||||
file=cdist-${version}-released.mdwn
|
file=cdist-${version}-released.mdwn
|
||||||
cd "$WEBBLOG"
|
cd "$WEBBLOG"
|
||||||
|
@ -196,8 +143,7 @@ eof
|
||||||
git push
|
git push
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dist-ml)
|
release-ml)
|
||||||
$0 blog
|
|
||||||
version=$($0 changelog-version)
|
version=$($0 changelog-version)
|
||||||
to_a=cdist
|
to_a=cdist
|
||||||
to_d=l.schottelius.org
|
to_d=l.schottelius.org
|
||||||
|
@ -233,16 +179,6 @@ eof
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
dist-manual)
|
|
||||||
cat << notes
|
|
||||||
|
|
||||||
To be done manually...
|
|
||||||
|
|
||||||
- linkedin entry
|
|
||||||
notes
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
dist-tag)
|
dist-tag)
|
||||||
version=$($0 changelog-version)
|
version=$($0 changelog-version)
|
||||||
# add tag
|
# add tag
|
||||||
|
@ -267,23 +203,7 @@ notes
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dist-archlinux)
|
release-freecode)
|
||||||
$0 dist-archlinux-makepkg
|
|
||||||
$0 dist-archlinux-aur-upload
|
|
||||||
;;
|
|
||||||
|
|
||||||
dist-archlinux-makepkg)
|
|
||||||
./PKGBUILD.in
|
|
||||||
makepkg -c --source
|
|
||||||
;;
|
|
||||||
|
|
||||||
dist-archlinux-aur-upload)
|
|
||||||
version=$($0 changelog-version)
|
|
||||||
tar=cdist-${version}-1.src.tar.gz
|
|
||||||
burp -c system "$tar"
|
|
||||||
;;
|
|
||||||
|
|
||||||
dist-freecode)
|
|
||||||
version=$($0 changelog-version)
|
version=$($0 changelog-version)
|
||||||
api_token=$(awk '/machine freecode login/ { print $8 }' ~/.netrc)
|
api_token=$(awk '/machine freecode login/ { print $8 }' ~/.netrc)
|
||||||
|
|
||||||
|
@ -316,13 +236,7 @@ eof
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dist-pypi)
|
dist-speeches)
|
||||||
$0 man
|
|
||||||
$0 version
|
|
||||||
python3 setup.py sdist upload
|
|
||||||
;;
|
|
||||||
|
|
||||||
speeches)
|
|
||||||
cd "$SPEECHESDIR"
|
cd "$SPEECHESDIR"
|
||||||
for speech in *tex; do
|
for speech in *tex; do
|
||||||
pdflatex "$speech"
|
pdflatex "$speech"
|
||||||
|
@ -339,16 +253,15 @@ eof
|
||||||
cd "${WEBDIR}" && make pub
|
cd "${WEBDIR}" && make pub
|
||||||
;;
|
;;
|
||||||
|
|
||||||
web)
|
release-web)
|
||||||
set -e
|
set -e
|
||||||
"$0" web-doc
|
|
||||||
# Fix ikiwiki, which does not like symlinks for pseudo security
|
# Fix ikiwiki, which does not like symlinks for pseudo security
|
||||||
ssh tee.schottelius.org \
|
ssh tee.schottelius.org \
|
||||||
"cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man &&
|
"cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man &&
|
||||||
rm -f latest && ln -sf "$version" latest"
|
rm -f latest && ln -sf "$version" latest"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
p|pu|pub)
|
pub)
|
||||||
for remote in "" github sf; do
|
for remote in "" github sf; do
|
||||||
echo "Pushing to $remote"
|
echo "Pushing to $remote"
|
||||||
git push --mirror $remote
|
git push --mirror $remote
|
||||||
|
@ -376,11 +289,6 @@ eof
|
||||||
rm -rf pkg/ src/
|
rm -rf pkg/ src/
|
||||||
;;
|
;;
|
||||||
|
|
||||||
very-clean)
|
|
||||||
$0 clean
|
|
||||||
$0 clean-dist
|
|
||||||
;;
|
|
||||||
|
|
||||||
test)
|
test)
|
||||||
shift # skip t
|
shift # skip t
|
||||||
export PYTHONPATH="$(pwd -P)"
|
export PYTHONPATH="$(pwd -P)"
|
||||||
|
@ -392,22 +300,8 @@ eof
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
version)
|
|
||||||
echo "VERSION=\"$version\"" > cdist/version.py
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo ''
|
echo "Unknown target $@ - aborting"
|
||||||
echo 'Welcome to cdist!'
|
|
||||||
echo ''
|
|
||||||
echo 'Here are the possible targets:'
|
|
||||||
echo ''
|
|
||||||
echo ' clean: Remove build stuff'
|
|
||||||
echo ' man: Build manpages (requires Asciidoc)'
|
|
||||||
echo ' test: Run tests'
|
|
||||||
echo ''
|
|
||||||
echo ''
|
|
||||||
echo "Unknown target, \"$1\"" >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue