Browse Source

many release related cleanups

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2.1
Nico Schottelius 9 years ago
parent
commit
fc9dd61fe0
  1. 1
      .gitignore
  2. 127
      Makefile
  3. 45
      bin/build-helper

1
.gitignore vendored

@ -27,3 +27,4 @@ cdist/version.py
/pkg
/src
build
.lock-*

127
Makefile

@ -18,6 +18,9 @@
#
#
# dist = local
# release = remote
A2XM=a2x -f manpage --no-xmllint -a encoding=UTF-8
A2XH=a2x -f xhtml --no-xmllint -a encoding=UTF-8
helper=./bin/build-helper
@ -36,6 +39,8 @@ WEBPAGE=$(WEBBASE).mdwn
CHANGELOG_VERSION=$(shell $(helper) changelog-version)
CHANGELOG_FILE=docs/changelog
VERSION_FILE=cdist/version.py
################################################################################
# Manpages
#
@ -90,20 +95,18 @@ man: $(MANTYPEALL) $(MANREFALL) $(MANSTATICALL)
# Manpages #5: release part
MANWEBDIR=$(WEBBASE)/man/$(CHANGELOG_VERSION)
man-git: man
man-dist: man
rm -rf "${MANWEBDIR}"
mkdir -p "${MANWEBDIR}/man1" "${MANWEBDIR}/man7"
cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${MANWEBDIR}/man1
cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${MANWEBDIR}/man7
cd ${MANWEBDIR} && git add . && git commit -m "cdist manpages update: $(CHANGELOG_VERSION)"
man-fix-link:
man-release: web-release
# Fix ikiwiki, which does not like symlinks for pseudo security
ssh tee.schottelius.org \
"cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man && rm -f latest && ln -sf "$(CHANGELOG_VERSION)" latest"
man-release: man web-release
################################################################################
# Speeches
#
@ -119,11 +122,11 @@ $(SPEECHDIR)/%.pdf: $(SPEECHDIR)/%.tex
speeches: $(SPEECHES)
speeches-release: speeches
speeches-dist: speeches
rm -rf "${SPEECHESWEBDIR}"
mkdir -p "${SPEECHESWEBDIR}"
cp ${SPEECHES} "${SPEECHESWEBDIR}"
cd ${SPEECHESWEBDIR} && git add . && git commit -m "cdist speeches updated"
cd ${SPEECHESWEBDIR} && git add . && git commit -m "cdist speeches updated" || true
################################################################################
# Website
@ -141,81 +144,117 @@ web-doc:
rsync -av "$(WEBSRCDIR)/" "${WEBBASE}/.."
cd "${WEBBASE}/.." && git add cdist* && git commit -m "cdist doc update" cdist* || true
web-pub: web
cd "${WEBDIR}" && make pub
web-dist: web-blog web-doc
web-release: web-blog web-doc
web-release: web-dist man-dist speeches-dist
cd "${WEBDIR}" && make pub
################################################################################
# Release && release check
# Release: Mailinglist
#
CHECKS=check-version check-date check-unittest
ML_FILE=.lock-ml
DIST=dist-tag dist-branch-merge
# Only send mail once - lock until new changelog things happened
$(ML_FILE): $(CHANGELOG_FILE)
$(helper) ml-release $(CHANGELOG_VERSION)
touch $@
RELEASE=web-release release-man release-pypi release-archlinux-makepkg
RELEASE+=release-blog release-ml
RELEASE+=release-freecode release-archlinux-aur-upload
ml-release: $(ML_FILE)
version=`git describe`
versionchangelog=`$(helper) changelog-version`
versionfile=cdist/version.py
archlinuxtar=cdist-${versionchangelog}-1.src.tar.gz
################################################################################
# Release: Freecode
#
FREECODE_FILE=.lock-freecode
$(versionfile):
$(helper) version
$(FREECODE_FILE): $(CHANGELOG_FILE)
$(helper) freecode-release $(CHANGELOG_VERSION)
touch $@
freecode-release: $(FREECODE_FILE)
$(DIST): dist-check
$(RELEASE): $(DIST) $(CHECKS)
################################################################################
# git and git dependent stuff
#
# Code that is better handled in a shell script
check-%:
$(helper) $@
GIT_TAG_FILE=.git/refs/tags/$(CHANGELOG_VERSION)
GIT_SRC_BRANCH=master
GIT_DST_BRANCH=$(shell echo $(CHANGELOG_VERSION) | cut -d. -f '1,2')
git-tag: $(GIT_TAG_FILE)
$(GIT_TAG_FILE):
@printf "Enter tag description for $(CHANGELOG_VERSION)> "
@read tagmessage; git tag "$(CHANGELOG_VERSION)" -m "$$tagmessage"
#git-branch-merge: git-tag
git-branch-merge:
echo $(GIT_DST_BRANCH)
current=$$(git rev-parse --abbrev-ref HEAD) \
git checkout "$(GIT_DST_BRANCH)" \
git merge "$(GIT_SRC_BRANCH)"
git checkout "$$current"
$(VERSION_FILE): .git/refs/heads/*
echo "VERSION = \"$$(git describe)\"" > $@
# Pub is Nico's "push to all git remotes" thing
pub:
# git-release is the better term
git-release pub:
for remote in "" github sf; do \
echo "Pushing to $$remote" \
git push --mirror $$remote \
done
################################################################################
# dist code
# pypi
#
dist-check: man
dist: $(DIST)
echo "Run \"make release\" to release to the public"
dist-pypi: man version
pypi-release: man $(VERSION_FILE) git-tag
python3 setup.py sdist upload
$(archlinuxtar): PKGBUILD dist-pypi
################################################################################
# archlinux
#
ARCHLINUXTAR=cdist-$(CHANGELOG_VERSION)-1.src.tar.gz
$(ARCHLINUXTAR): PKGBUILD pypi-release
makepkg -c --source
PKGBUILD: PKGBUILD.in
./PKGBUILD.in
archlinux-release: $(ARCHLINUXTAR)
burp -c system $^
################################################################################
# release code
# Release
#
#release: pub $(RELEASE)
release: release-man
echo "Don't forget...: linkedin"
CHECKS=check-date check-unittest
RELEASE=speeches-dist web-release
RELEASE+=ml-release freecode-release
RELEASE+=man-dist pypi-release git-release
RELEASE+=archlinux-release
release: $(RELEASE)
echo "Don't forget...: linkedin"
release-archlinux: $(archlinuxtar)
burp -c system $^
release-blog: blog
release-ml: release-blog
release-pub: man
PKGBUILD: PKGBUILD.in
./PKGBUILD.in
$(DIST): dist-check
$(RELEASE): $(DIST) $(CHECKS)
# Code that is better handled in a shell script
check-%:
$(helper) $@
################################################################################
# Cleanup
#
clean:
rm -f $(MAN7DSTDIR)/cdist-reference.text

45
bin/build-helper

@ -76,16 +76,6 @@ case "$option" in
"$0" test
;;
check-version)
changelog_version=$($0 changelog-version)
if git show --quiet $changelog_version >/dev/null 2>&1; then
echo "Version $changelog_version already exists, aborting."
exit 1
fi
;;
blog)
version=$1; shift
blogfile=$1; shift
@ -113,12 +103,13 @@ eof
git commit -m "cdist blog update: $version" "$blogfile" || true
;;
ml-release)
version=$1; shift
release-ml)
version=$($0 changelog-version)
to_a=cdist
to_d=l.schottelius.org
to=${to_a}@${to_d}
to=n@schottelius.org
from_a=nico-cdist
from_d=schottelius.org
@ -136,7 +127,7 @@ cdist $version has been released with the following changes:
eof
"$0" changelog-changes
"$0" changelog-changes "$version"
cat << eof
Cheers,
@ -150,32 +141,8 @@ eof
;;
dist-tag)
version=$($0 changelog-version)
# add tag
printf "Enter tag description for %s> " "$version"
read tagmessage
git tag "$version" -m "$tagmessage"
;;
dist-branch-merge)
version=$($0 changelog-version)
target_branch=${version%\.*}
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$target_branch" = "$current_branch" ]; then
echo "Skipping merge, already on destination branch"
else
printf "Press enter to git merge $current_branch into \"$target_branch\" > "
read prompt
git checkout "$target_branch"
git merge "$current_branch"
git checkout "$current_branch"
fi
;;
release-freecode)
version=$($0 changelog-version)
freecode-release)
version=$1; shift
api_token=$(awk '/machine freecode login/ { print $8 }' ~/.netrc)
printf "Enter tag list for freecode release %s> " "$version"

Loading…
Cancel
Save