diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 45c10d7b..00000000
--- a/.gitattributes
+++ /dev/null
@@ -1,8 +0,0 @@
-.gitignore export-ignore
-.gitattributes export-ignore
-.gitkeep export-ignore
-docs/speeches export-ignore
-docs/video export-ignore
-docs/src/man7 export-ignore
-bin/build-helper export-ignore
-README-maintainers export-ignore
diff --git a/.gitignore b/.gitignore
index 4b80b425..fdf9184f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,61 +1,14 @@
# -vim
-# Swap
-[._]*.s[a-v][a-z]
-[._]*.sw[a-p]
-[._]s[a-rt-v][a-z]
-[._]ss[a-gi-z]
-[._]sw[a-p]
-
-# Session
-Session.vim
-
-# Temporary
-.netrwhist
-*~
-*.tmp
-# Auto-generated tag files
-tags
-# Persistent undo
-[._]*.un~
+.*.swp
# Ignore generated manpages
-docs/src/.marker
-docs/src/man1/*.1
-docs/src/man7/*.7
-docs/src/man7/cdist-type__*.rst
-docs/src/cdist-reference.rst
+doc/man/*.[1-9]
+doc/man/.marker
+doc/man/man*/
-# Ignore cdist cache for version control
-/cache/
+doc/html
-# Ignore inventory basedir
-cdist/inventory/
+conf/type/*/*.7
+conf/type/*/man.html
-# Python: cache, distutils, distribution in general
-__pycache__/
-*.pyc
-MANIFEST
-dist/
-cdist/version.py
-cdist.egg-info/
-# sphinx build dirs, cache
-_build/
-docs/dist
-
-# Ignore temp files used for signing
-cdist-*.tar
-cdist-*.tar.gz
-cdist-*.tar.gz.asc
-
-# Packaging: Archlinux
-/PKGBUILD
-/cdist-*.pkg.tar.xz
-/cdist-*.tar.gz
-/pkg
-/src
-build
-.lock-*
-.git-current-branch
-.lock*
-.pypi-release
diff --git a/HACKERS_README b/HACKERS_README
new file mode 100755
index 00000000..0ae1bdcd
--- /dev/null
+++ b/HACKERS_README
@@ -0,0 +1,49 @@
+cat << eof
+
+Hey hackers,
+
+this README is for you, for those who want to dig into cdist, hack it or try
+to get a deeper understanding.
+
+A lot of documentation is still missing, but running cdist-quickstart should
+give you an impression of how cdist works.
+
+I hope you have a lot of fun with cdist, because it was also a lot of fun to
+develop it!
+
+ -- Nico, 20110304
+
+
+## Conventions
+
+- All variables exported by cdist are prefixed with a double underscore (__)
+- All cdist-internal variables are prefixed with __cdist_ and are generally not exported.
+
+## Running cdist when developing
+
+This file is suitable for execution and saving the objects and
+explorers from cdist. I usually do it like this:
+
+ % ./HACKERS_README
+
+################################################################################
+eof
+
+set -x
+# Tell the user what we do, so this script makes sense during execution
+
+# prepare use (only from top level directory)
+export PATH="$(pwd -P)/bin:$PATH"
+export __cdist_conf_dir="$(pwd -P)/conf"
+
+# Allow user to supply hostname
+target="${1:-localhost}"
+
+# And use hostname as basedir (dangerous, but hackers know what they do)
+export __cdist_local_base_dir="/tmp/$target"
+
+# Run the real script
+cdist-deploy-to "$target"
+
+# Display results
+find "${__cdist_local_base_dir}"
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index a675f446..00000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,3 +0,0 @@
-include docs/changelog
-recursive-include docs/gfx *.png *.text
-recursive-include docs *.text *.html *.1 *.7
diff --git a/Makefile b/Makefile
index fa3327d1..6f1b08a7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,134 +1,120 @@
-#
-# 2013 Nico Schottelius (nico-cdist at schottelius.org)
-#
-# This file is part of cdist.
-#
-# cdist 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.
-#
-# cdist 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 cdist. If not, see .
-#
-#
+# General
+PREFIX=/usr
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/share/man
-.PHONY: help
-help:
- @echo "Please use \`make ' where is one of"
- @echo "man build only man user documentation"
- @echo "html build only html user documentation"
- @echo "docs build both man and html user documentation"
- @echo "dotman build man pages for types in your ~/.cdist directory"
- @echo "speeches build speeches pdf files"
- @echo "install install in the system site-packages directory"
- @echo "install-user install in the user site-packages directory"
- @echo "docs-clean clean documentation"
- @echo "clean clean"
+# Manpage and HTML
+A2XM=a2x -f manpage --no-xmllint
+# A2XH=a2x -f xhtml --no-xmllint
+A2XH=asciidoc -b xhtml11
-DOCS_SRC_DIR=./docs/src
-SPEECHDIR=./docs/speeches
-TYPEDIR=./cdist/conf/type
+# Developer only
+WEBDIR=$$HOME/niconetz
+WEBPAGE=software/cdist.mdwn
+
+# Documentation
+MANDIR=doc/man
+MANGENERATED=$(MANDIR)/cdist-reference.text
+
+MANSRC=$(MANDIR)/cdist.text \
+ $(MANDIR)/cdist-code-run-all.text \
+ $(MANDIR)/cdist-code-run.text \
+ $(MANDIR)/cdist-config.text \
+ $(MANDIR)/cdist-dir.text \
+ $(MANDIR)/cdist-env.text \
+ $(MANDIR)/cdist-explorer-run-global.text \
+ $(MANDIR)/cdist-deploy-to.text \
+ $(MANDIR)/cdist-explorer.text \
+ $(MANDIR)/cdist-manifest.text \
+ $(MANDIR)/cdist-manifest-run.text \
+ $(MANDIR)/cdist-manifest-run-init.text \
+ $(MANDIR)/cdist-manifest-run-all.text \
+ $(MANDIR)/cdist-object-explorer-all.text \
+ $(MANDIR)/cdist-object-gencode.text \
+ $(MANDIR)/cdist-object-gencode-all.text \
+ $(MANDIR)/cdist-quickstart.text \
+ $(MANDIR)/cdist-remote-explorer-run.text \
+ $(MANDIR)/cdist-run-remote.text \
+ $(MANDIR)/cdist-stages.text \
+ $(MANDIR)/cdist-type.text \
+ $(MANDIR)/cdist-type-build-emulation.text \
+ $(MANDIR)/cdist-type-emulator.text \
+ $(MANDIR)/cdist-type-template.text \
-SPHINXM=make -C $(DOCS_SRC_DIR) man
-SPHINXH=make -C $(DOCS_SRC_DIR) html
-SPHINXC=make -C $(DOCS_SRC_DIR) clean
################################################################################
-# Manpages
+# User targets
#
-MAN7DSTDIR=$(DOCS_SRC_DIR)/man7
-# Manpages #1: Types
-# Use shell / ls to get complete list - $(TYPEDIR)/*/man.rst does not work
-# Using ls does not work if no file with given pattern exist, so use wildcard
-MANTYPESRC=$(wildcard $(TYPEDIR)/*/man.rst)
-MANTYPEPREFIX=$(subst $(TYPEDIR)/,$(MAN7DSTDIR)/cdist-type,$(MANTYPESRC))
-MANTYPES=$(subst /man.rst,.rst,$(MANTYPEPREFIX))
+all:
+ @echo ''
+ @echo 'Welcome to cdist!'
+ @echo ''
+ @echo 'Here are the possible targets:'
+ @echo ''
+ @echo ' man: Build manpages (requires Asciidoc (a2x binary))'
+ @echo ' clean: Remove build stuff'
+ @echo ''
+ @echo ''
-# Link manpage: do not create man.html but correct named file
-$(MAN7DSTDIR)/cdist-type%.rst: $(TYPEDIR)/%/man.rst
- mkdir -p $(MAN7DSTDIR)
- ln -sf "../../../$^" $@
+man: doc/man/.marker
-# Manpages #2: reference
-DOCSREF=$(MAN7DSTDIR)/cdist-reference.rst
-DOCSREFSH=$(DOCS_SRC_DIR)/cdist-reference.rst.sh
+doc/man/.marker: $(MANDIR)/cdist-reference.text
+ touch $@
-$(DOCSREF): $(DOCSREFSH)
- $(DOCSREFSH)
+# Manual from core
+mancore: $(MANSRC)
+ for mansrc in $^; do $(A2XM) $$mansrc; $(A2XH) $$mansrc; done
-version:
- @[ -f "cdist/version.py" ] || { \
- printf "Missing 'cdist/version.py', please generate it first.\n" && exit 1; \
- }
+# Manuals from types
+mantype:
+ for man in conf/type/*/man.text; do $(A2XM) $$man; $(A2XH) $$man; done
-# Manpages #3: generic part
-man: version $(MANTYPES) $(DOCSREF)
- $(SPHINXM)
+# Move into manpath directories
+manmove: mantype mancore
+ for manpage in $(MANDIR)/*.[1-9] conf/type/*/*.7; do \
+ cat=$${manpage##*.}; \
+ mandir=$(MANDIR)/man$$cat; \
+ mkdir -p $$mandir; \
+ mv $$manpage $$mandir; \
+ done
+ mkdir -p doc/html
+ mv doc/man/*.html doc/html
-html: version $(MANTYPES) $(DOCSREF)
- $(SPHINXH)
+ for mantype in conf/type/*/man.html; do \
+ mannew=$$(echo $$mantype | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;');\
+ mv $$mantype doc/html/$$mannew; \
+ done
-docs: man html
-
-docs-clean:
- $(SPHINXC)
-
-# Manpages: .cdist Types
-DOT_CDIST_PATH=${HOME}/.cdist
-DOTMAN7DSTDIR=$(MAN7DSTDIR)
-DOTTYPEDIR=$(DOT_CDIST_PATH)/type
-DOTMANTYPESRC=$(wildcard $(DOTTYPEDIR)/*/man.rst)
-DOTMANTYPEPREFIX=$(subst $(DOTTYPEDIR)/,$(DOTMAN7DSTDIR)/cdist-type,$(DOTMANTYPESRC))
-DOTMANTYPES=$(subst /man.rst,.rst,$(DOTMANTYPEPREFIX))
-
-# Link manpage: do not create man.html but correct named file
-$(DOTMAN7DSTDIR)/cdist-type%.rst: $(DOTTYPEDIR)/%/man.rst
- ln -sf "$^" $@
-
-dotman: version $(DOTMANTYPES)
- $(SPHINXM)
+# Reference depends on conf/type/*/man.text - HOWTO with posix make?
+$(MANDIR)/cdist-reference.text: manmove $(MANDIR)/cdist-reference.text.sh
+ $(MANDIR)/cdist-reference.text.sh
+ $(A2XM) $(MANDIR)/cdist-reference.text
+ $(A2XH) $(MANDIR)/cdist-reference.text
+ # Move us to the destination as well
+ make manmove
+
+clean:
+ rm -rf doc/man/*.html doc/man/*.[1-9] doc/man/man[1-9] $(MANGENERATED)
+ rm -f conf/type/*/man.html
################################################################################
-# Speeches
-#
-SPEECHESOURCES=$(SPEECHDIR)/*.tex
-SPEECHES=$(SPEECHESOURCES:.tex=.pdf)
-
-# Create speeches and ensure Toc is up-to-date
-$(SPEECHDIR)/%.pdf: $(SPEECHDIR)/%.tex
- pdflatex -output-directory $(SPEECHDIR) $^
- pdflatex -output-directory $(SPEECHDIR) $^
- pdflatex -output-directory $(SPEECHDIR) $^
-
-speeches: $(SPEECHES)
-
-################################################################################
-# Misc
-#
-clean: docs-clean
- rm -f $(DOCS_SRC_DIR)/cdist-reference.rst
-
- find "$(DOCS_SRC_DIR)" -mindepth 2 -type l \
- | xargs rm -f
-
- find * -name __pycache__ | xargs rm -rf
-
- # distutils
- rm -rf ./build
-
-################################################################################
-# install
+# Developer targets
#
-install:
- python3 setup.py install
+test:
+ # ubuntu
+ .rsync lyni@tablett:cdist
+ # redhat
+ .rsync nicosc@free.ethz.ch:cdist
+ # gentoo
+ .rsync nicosc@ru3.inf.ethz.ch:cdist
-install-user:
- python3 setup.py install --user
+web:
+ cp README $(WEBDIR)/$(WEBPAGE)
+ cd $(WEBDIR) && git commit -m "cdist update" $(WEBPAGE)
+ cd $(WEBDIR) && make pub
+
+pub:
+ git push --mirror
+ git push --mirror github
diff --git a/PKGBUILD.in b/PKGBUILD.in
deleted file mode 100755
index c0188e68..00000000
--- a/PKGBUILD.in
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-version="$1"
-outfile=${0%.in}
-
-cat << eof > "${outfile}"
-pkgname=cdist
-pkgver=$version
-pkgrel=1
-pkgdesc='A Usable Configuration Management System"'
-arch=('any')
-url='https://www.cdi.st/'
-license=('GPL3')
-depends=('python>=3.2.0')
-source=("http://pypi.python.org/packages/source/c/cdist/cdist-\${pkgver}.tar.gz")
-
-package() {
- cd cdist-\${pkgver}
- python3 setup.py build install --root="\${pkgdir}"
- find "\$pkgdir" -type d -exec chmod 0755 {} \;
- find "\$pkgdir" -type f -exec chmod a+r {} \;
-}
-eof
-
-makepkg -g >> "${outfile}"
-
-# Fix this issue:
-# error: failed to upload cdist-3.1.6-1.src.tar.gz: Error - all files must have permissions of 644 or 755.
-chmod a+r "${outfile}"
diff --git a/README b/README
index caf2dac8..c0ecbbbf 100644
--- a/README
+++ b/README
@@ -1,7 +1,207 @@
-cdist
------
+[[!meta title="cdist - usable configuration management"]]
-cdist is a usable configuration management system.
+
+ .. . .x+=:. s
+ dF @88> z` ^% :8
+ '88bu. %8P . origin/
+
+ # Stay on a specific version
+ git checkout -b 1.3 origin/1.3
+
+### Mirrors
+
+ * git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist))
+ * git://git.sans.ethz.ch/cdist ([sans](http://git.sans.ethz.ch/?p=cdist;a=summary))
+
+## Update
+
+To upgrade cdist in the current branch use
+
+ git pull
+
+ # Also update the manpages
+ make man
+ export MANPATH=$MANPATH:$(pwd -P)/doc/man
+
+If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break.
+The master branch on the other hand is the development branch and may not be
+working, break your setup or eat the tree in your garden.
+
+### Upgrading from 1.1 to 1.2
+
+No incompatiblities.
+
+### Upgrading from 1.0 to 1.1
+
+In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and
+**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you
+need to replace **\_\_file** calls in your manifests:
+
+ * Remove --type from all \_\_file calls
+ * If type was symlink, use \_\_link and --type symbolic
+ * If type was directory, use \_\_directory
+
+
+## Support
+
+### IRC
+
+You can join the development ***IRC channel***
+[#cLinux on irc.freenode.org](irc://irc.freenode.org/#cLinux).
+
+### Mailing list
+
+Bug reports, questions, patches, etc. should be send to the
+[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist).
+
+## Used by
+
+If you're using cdist, feel free to send a report to the mailing list.
+Interesting information are for instance
+
+ * Which services do you manage?
+ * How many machines do you manage?
+ * What are the pros/cons you see in cdist?
+ * General comments/critics
+
+### Nico Schottelius, Systems Group ETH Zurich
+
+Yes, I'm actually eating my own dogfood and currently managing
+
+ * [plone](http://plone.org/) (cms)
+ * [moinmoin](http://moinmo.in/) (wiki)
+ * [apache](http://httpd.apache.org/) (webserver)
+ * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication)
+ * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat)
+ * [stunnel](http://stunnel.mirt.net/) (SSL tunnel)
+ * [mercurial-server](http://www.lshift.net/mercurial-server.html) (version control)
+ * [xfce](http://www.xfce.org/) (lightweight desktop environment)
+ * [slim](http://slim.berlios.de/) (graphical login manager for X11)
+
+with cdist on a total of **5** production machines of the
+[Systems Group](http://www.systems.ethz.ch) at the
+[ETH Zurich](http://www.ethz.ch).
diff --git a/README-maintainers b/README-maintainers
deleted file mode 100644
index af57f475..00000000
--- a/README-maintainers
+++ /dev/null
@@ -1,4 +0,0 @@
-Maintainers should use ./bin/build-helper script.
-
-Makefile is intended for end users. It can be used for non-maintaining
-targets that can be run from pure source (without git repository).
diff --git a/bin/build-helper b/bin/build-helper
deleted file mode 100755
index 9a776491..00000000
--- a/bin/build-helper
+++ /dev/null
@@ -1,550 +0,0 @@
-#!/bin/sh
-#
-# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
-# 2016-2019 Darko Poljak (darko.poljak at gmail.com)
-#
-# This file is part of cdist.
-#
-# cdist 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.
-#
-# cdist 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 cdist. If not, see .
-#
-#
-# This file contains the heavy lifting found usually in the Makefile.
-#
-
-usage() {
- printf "usage: %s TARGET [TARGET-ARGS...]
- Available targets:
- changelog-changes
- changelog-version
- check-date
- check-unittest
- ml-release
- archlinux-release
- pypi-release
- release-git-tag
- sign-git-release
- release
- test
- test-remote
- pycodestyle
- pep8
- check-pycodestyle
- shellcheck-global-explorers
- shellcheck-type-explorers
- shellcheck-manifests
- shellcheck-local-gencodes
- shellcheck-remote-gencodes
- shellcheck-scripts
- shellcheck-gencodes
- shellcheck-types
- shellcheck
- shellcheck-type-files
- shellcheck-with-files
- shellcheck-build-helper
- check-shellcheck
- version-branch
- version
- target-version
- clean
- distclean\n" "$1"
-}
-
-basename="${0##*/}"
-
-if [ $# -lt 1 ]
-then
- usage "${basename}"
- exit 1
-fi
-
-option=$1; shift
-
-SHELLCHECKCMD="shellcheck -s sh -f gcc -x"
-# Skip SC2154 for variables starting with __ since such variables are cdist
-# environment variables.
-SHELLCHECK_SKIP=': __.*is referenced but not assigned.*\[SC2154\]'
-
-# Change to checkout directory
-basedir="${0%/*}/../"
-cd "$basedir"
-
-case "$option" in
- changelog-changes)
- if [ "$#" -eq 1 ]; then
- start=$1
- else
- start="[[:digit:]]"
- fi
-
- end="[[:digit:]]"
-
- awk -F: "BEGIN { start=0 }
- {
- if(start == 0) {
- if (\$0 ~ /^$start/) {
- start = 1
- }
- } else {
- if (\$0 ~ /^$end/) {
- exit
- } else {
- print \$0
- }
- }
- }" "$basedir/docs/changelog"
- ;;
-
- changelog-version)
- # get version from changelog
- grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//'
- ;;
-
- check-date)
- # verify date in changelog is today
- date_today="$(date +%Y-%m-%d)"
- date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //')
-
- if [ "$date_today" != "$date_changelog" ]; then
- printf "Date in changelog is not today\n"
- printf "Changelog date: %s\n" "${date_changelog}"
- exit 1
- fi
- ;;
-
- check-unittest)
- "$0" test
- ;;
-
- ml-release)
- if [ $# -ne 1 ]; then
- printf "%s ml-release version\n" "$0" >&2
- exit 1
- fi
-
- version=$1; shift
-
- (
- cat << eof
-Subject: cdist $version has been released
-
-Hello .*,
-
-cdist $version has been released with the following changes:
-
-eof
-
- "$0" changelog-changes "$version"
- cat << eof
-
-eof
- ) > mailinglist.tmp
- ;;
-
- archlinux-release)
- if [ $# -ne 1 ]; then
- printf "%s archlinux-release version\n" "$0" >&2
- exit 1
- fi
- version=$1; shift
-
- ARCHLINUXTAR="cdist-${version}-1.src.tar.gz"
- ./PKGBUILD.in "${version}"
- umask 022
- mkaurball
- burp -c system "${ARCHLINUXTAR}"
- ;;
-
- pypi-release)
- # Ensure that pypi release has the right version
- "$0" version
-
- make docs-clean
- make docs
- python3 setup.py sdist upload
- ;;
-
- release-git-tag)
- target_version=$($0 changelog-version)
- if git rev-parse --verify "refs/tags/${target_version}" 2>/dev/null; then
- printf "Tag for %s exists, aborting\n" "${target_version}"
- exit 1
- fi
- printf "Enter tag description for %s: " "${target_version}"
- read -r tagmessage
-
- # setup for signed tags:
- # gpg --fulL-gen-key
- # gpg --list-secret-keys --keyid-format LONG
- # git config --local user.signingkey
- # for exporting pub key:
- # gpg --armor --export > pubkey.asc
- # gpg --output pubkey.gpg --export
- # show tag with signature
- # git show
- # verify tag signature
- # git tag -v
- #
- # gpg verify signature
- # gpg --verify
- # gpg --no-default-keyring --keyring --verify
- # Ensure gpg-agent is running.
- GPG_TTY=$(tty)
- export GPG_TTY
- gpg-agent
-
- git tag -s "$target_version" -m "$tagmessage"
- git push --tags
- ;;
-
- sign-git-release)
- if [ $# -lt 2 ]
- then
- printf "usage: %s sign-git-release TAG TOKEN [ARCHIVE]\n" "$0"
- printf " if ARCHIVE is not specified then it is created\n"
- exit 1
- fi
- tag="$1"
- if ! git rev-parse -q --verify "${tag}" >/dev/null 2>&1
- then
- printf "Tag \"%s\" not found.\n" "${tag}"
- exit 1
- fi
- token="$2"
- if [ $# -gt 2 ]
- then
- archivename="$3"
- else
- archivename="cdist-${tag}.tar"
- git archive --prefix="cdist-${tag}/" -o "${archivename}" "${tag}" \
- || exit 1
- # make sure target version is generated
- "$0" target-version
- tar -x -f "${archivename}" || exit 1
- cp cdist/version.py "cdist-${tag}/cdist/version.py" || exit 1
- tar -c -f "${archivename}" "cdist-${tag}/" || exit 1
- rm -r -f "cdist-${tag}/"
- gzip "${archivename}" || exit 1
- archivename="${archivename}.gz"
- fi
- gpg --armor --detach-sign "${archivename}" || exit 1
-
- project="ungleich-public%2Fcdist"
- sed_cmd='s/^.*"markdown":"\([^"]*\)".*$/\1/'
-
- # upload archive
- response_archive=$(curl -f -X POST \
- --http1.1 \
- -H "PRIVATE-TOKEN: ${token}" \
- -F "file=@${archivename}" \
- "https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
- | sed "${sed_cmd}") || exit 1
-
- # upload archive signature
- response_archive_sig=$(curl -f -X POST \
- --http1.1 \
- -H "PRIVATE-TOKEN: ${token}" \
- -F "file=@${archivename}.asc" \
- "https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
- | sed "${sed_cmd}") || exit 1
-
- # make release
- changelog=$("$0" changelog-changes "$1" | sed 's/^[[:space:]]*//')
- release_notes=$(
- printf "%s\n\n%s\n\n**Changelog**\n\n%s\n" \
- "${response_archive}" "${response_archive_sig}" "${changelog}"
- )
- curl -f -X POST \
- -H "PRIVATE-TOKEN: ${token}" \
- -F "description=${release_notes}" \
- "https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}/release" \
- || exit 1
-
- # remove generated files (archive and asc)
- if [ $# -eq 2 ]
- then
- rm -f "${archivename}"
- fi
- rm -f "${archivename}.asc"
- ;;
-
- release)
- set -e
- target_version=$($0 changelog-version)
- target_branch=$($0 version-branch)
-
- printf "Beginning release process for %s\n" "${target_version}"
-
- # First check everything is sane
- "$0" check-date
- "$0" check-unittest
- "$0" check-pycodestyle
- "$0" check-shellcheck
-
- # Generate version file to be included in packaging
- "$0" target-version
-
- # Ensure the git status is clean, else abort
- if ! git diff-index --name-only --exit-code HEAD ; then
- printf "Unclean tree, see files above, aborting.\n"
- exit 1
- fi
-
- # Ensure we are on the master branch
- masterbranch=yes
- if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
- printf "Releases are happening from the master branch, aborting.\n"
-
- printf "Enter the magic word to release anyway:"
- read -r magicword
-
- if [ "$magicword" = "iknowwhatido" ]; then
- masterbranch=no
- else
- exit 1
- fi
- fi
-
- if [ "$masterbranch" = yes ]; then
- # Ensure version branch exists
- if ! git rev-parse --verify "refs/heads/${target_branch}" 2>/dev/null; then
- git branch "$target_branch"
- fi
-
- # Merge master branch into version branch
- git checkout "$target_branch"
- git merge master
- fi
-
- # Verify that after the merge everything works
- "$0" check-date
- "$0" check-unittest
-
- # Generate documentation (man and html)
- # First, clean old generated docs
- make docs-clean
- make docs
-
- #############################################################
- # Everything green, let's do the release
-
- # Tag the current commit
- "$0" release-git-tag
-
- # Also merge back the version branch
- if [ "$masterbranch" = yes ]; then
- git checkout master
- git merge "$target_branch"
- fi
-
- # Publish git changes
- # if you want to have mirror locally then uncomment this and comment below
- # git push --mirror
- git push
- # push also new branch and set up tracking
- git push -u origin "${target_branch}"
- # fi
-
- # Create and publish package for pypi
- "$0" pypi-release
-
- # sign git tag
- printf "Enter upstream repository authentication token: "
- read -r token
- "$0" sign-git-release "${target_version}" "${token}"
-
- # Announce change on ML
- "$0" ml-release "${target_version}"
-
- cat << eof
-Manual steps post release:
- - cdist-web
- - send mail body generated in mailinglist.tmp and inform Dmitry for deb
- - twitter
-eof
- ;;
-
- test)
- if [ ! -f "cdist/version.py" ]
- then
- printf "cdist/version.py is missing, generate it first.\n"
- exit 1
- fi
-
- PYTHONPATH="$(pwd -P)"
- export PYTHONPATH
-
- if [ $# -lt 1 ]; then
- python3 -m cdist.test
- else
- python3 -m unittest "$@"
- fi
- ;;
-
- test-remote)
- if [ ! -f "cdist/version.py" ]
- then
- printf "cdist/version.py is missing, generate it first.\n"
- exit 1
- fi
-
- PYTHONPATH="$(pwd -P)"
- export PYTHONPATH
-
- python3 -m cdist.test.exec.remote
- ;;
-
- pycodestyle|pep8)
- pycodestyle "${basedir}" "${basedir}/scripts/cdist" | less
- ;;
-
- check-pycodestyle)
- "$0" pycodestyle
- printf "\\nPlease review pycodestyle report.\\n"
- while true
- do
- printf "Continue (yes/no)?\n"
- any=
- read -r any
- case "$any" in
- yes)
- break
- ;;
- no)
- exit 1
- ;;
- *)
- printf "Please answer with 'yes' or 'no' explicitly.\n"
- ;;
- esac
- done
- ;;
-
- shellcheck-global-explorers)
- find cdist/conf/explorer -type f -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" || exit 0
- ;;
-
- shellcheck-type-explorers)
- find cdist/conf/type -type f -path "*/explorer/*" -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" || exit 0
- ;;
-
- shellcheck-manifests)
- find cdist/conf/type -type f -name manifest -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" || exit 0
- ;;
-
- shellcheck-local-gencodes)
- find cdist/conf/type -type f -name gencode-local -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" || exit 0
- ;;
-
- shellcheck-remote-gencodes)
- find cdist/conf/type -type f -name gencode-remote -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" || exit 0
- ;;
-
- shellcheck-scripts)
- ${SHELLCHECKCMD} scripts/cdist-dump scripts/cdist-new-type || exit 0
- ;;
-
- shellcheck-gencodes)
- "$0" shellcheck-local-gencodes
- "$0" shellcheck-remote-gencodes
- ;;
-
- shellcheck-types)
- "$0" shellcheck-type-explorers
- "$0" shellcheck-manifests
- "$0" shellcheck-gencodes
- ;;
-
- shellcheck)
- "$0" shellcheck-global-explorers
- "$0" shellcheck-types
- "$0" shellcheck-scripts
- ;;
-
- shellcheck-type-files)
- find cdist/conf/type -type f -path "*/files/*" -exec ${SHELLCHECKCMD} {} + | grep -v "${SHELLCHECK_SKIP}" || exit 0
- ;;
-
- shellcheck-with-files)
- "$0" shellcheck
- "$0" shellcheck-type-files
- ;;
-
- shellcheck-build-helper)
- ${SHELLCHECKCMD} ./bin/build-helper
- ;;
-
- check-shellcheck)
- "$0" shellcheck
- printf "\\nPlease review shellcheck report.\\n"
- while true
- do
- printf "Continue (yes/no)?\n"
- any=
- read -r any
- case "$any" in
- yes)
- break
- ;;
- no)
- exit 1
- ;;
- *)
- printf "Please answer with 'yes' or 'no' explicitly.\n"
- ;;
- esac
- done
- ;;
-
- version-branch)
- "$0" changelog-version | cut -d. -f '1,2'
- ;;
-
- version)
- printf "VERSION = \"%s\"\n" "$(git describe)" > cdist/version.py
- ;;
-
- target-version)
- target_version=$($0 changelog-version)
- printf "VERSION = \"%s\"\n" "${target_version}" > cdist/version.py
- ;;
-
- clean)
- make clean
-
- # Archlinux
- rm -f cdist-*.pkg.tar.xz cdist-*.tar.gz
- rm -rf pkg/ src/
-
- rm -f MANIFEST PKGBUILD
- rm -rf dist/
-
- # Signed release
- rm -f cdist-*.tar.gz
- rm -f cdist-*.tar.gz.asc
-
- # Temp files
- rm -f ./*.tmp
- ;;
-
- distclean)
- "$0" clean
- rm -f cdist/version.py
- ;;
- *)
- printf "Unknown target: '%s'.\n" "${option}" >&2
- usage "${basename}"
- exit 1
- ;;
-
-esac
diff --git a/bin/cdist-code-run b/bin/cdist-code-run
new file mode 100755
index 00000000..229d4d1d
--- /dev/null
+++ b/bin/cdist-code-run
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# 2011 Nico Schottelius (nico-cdist at schottelius.org)
+#
+# This file is part of cdist.
+#
+# cdist 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.
+#
+# cdist 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 cdist. If not, see .
+#
+#
+# This binary is executed on the remote side to execute code
+#
+
+. cdist-config
+[ $# -eq 3 ] || __cdist_usage "