From 33552e5930b0958c1d0930cfa5f92ac7abe7532e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:26:06 +0100 Subject: [PATCH 01/35] [DOC] include hackers manpage Signed-off-by: Nico Schottelius --- Makefile | 1 + doc/man/cdist-hacker.text | 65 +++++++++++++++++++++++++++++++++++++++ doc/man/cdist.text | 1 + 3 files changed, 67 insertions(+) create mode 100644 doc/man/cdist-hacker.text diff --git a/Makefile b/Makefile index 29d86c67..fea5a8ea 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ MANSRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-explorer-run-global.text \ $(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-explorer.text \ + $(MANDIR)/cdist-hacker.text \ $(MANDIR)/cdist-manifest.text \ $(MANDIR)/cdist-manifest-run.text \ $(MANDIR)/cdist-manifest-run-all.text \ diff --git a/doc/man/cdist-hacker.text b/doc/man/cdist-hacker.text new file mode 100644 index 00000000..093eaf61 --- /dev/null +++ b/doc/man/cdist-hacker.text @@ -0,0 +1,65 @@ +cdist-hacker(7) +=============== +Nico Schottelius + + +NAME +---- +cdist-hacker - How to get (stuff) into cdist + + +WELCOME +------- +Welcome dear hacker! I invite you to a tour of pointers to +get into the usable configuration mangament system, cdist. + +The first thing to know is probably that cdist is brought to +you by people who care about how code looks like and who think +twice before merging or implementing a feature: Less features +with good usability are far better than the opposite. + + +UNDERSTANDING CDIST INTERNALS +----------------------------- +IF you are interested in how cdist internally works, you can open +bin/cdist-config and bin/cdist-deploy-to in your favorite editor and +read the scripts bin/cdist-deploy-to calls. The magnificent HACKERS_README +may be of great help as well. + + +HOW TO SUBMIT STUFF FOR INCLUSION INTO UPSTREAM CDIST +----------------------------------------------------- +If you did some cool changes to cdist, which you value as a benefit for +everybody using cdist, you're welcome to propose inclusion into upstream. + +There are though some requirements to ensure your changes don't break others +work nor kill the authors brain: + +- Code submission must be done via git +- Code to be included should be branched of the upstream "master" branch + - Exception: Bugfixes to a version branch +- Code submissions must be in your master branch + - Exception: If you only want a comment on your code, but not an inclusion. + +As soon as your work meets these requirements, you can contact me +(IRC, Mailinglist, Phone, RFC 1149) and I'll check your code before +including it. + + +HOW TO SUBMIT A NEW TYPE +------------------------ +Submitting a type works as described above, with the additional requirement +that a corresponding manpage named man.text in asciidoc format with +the manpage-name "cdist-type__NAME" is included in the type directory +AND asciidoc is able to compile it. + + +SEE ALSO +-------- +- cdist(7) + + +COPYING +------- +Copyright \(C) 2011 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/cdist.text b/doc/man/cdist.text index 957e7cb4..44be52b1 100644 --- a/doc/man/cdist.text +++ b/doc/man/cdist.text @@ -32,6 +32,7 @@ SEE ALSO - Website: http://www.nico.schottelius.org/cdist/[] - cdist-best-practise(7) - cdist-deploy-to(1) +- cdist-hacker(7) - cdist-manifest(7) - cdist-quickstart(1) - cdist-type(7) From c9680285962c33fa3f5f936ca3f79da831ffa552 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:28:07 +0100 Subject: [PATCH 02/35] Revert "use __apt_update_index" (until it works) This reverts commit 15b1bdab7791033a6154a75d0000ee4069fe8fa0. --- conf/type/__apt_ppa/manifest | 5 ----- 1 file changed, 5 deletions(-) diff --git a/conf/type/__apt_ppa/manifest b/conf/type/__apt_ppa/manifest index ad6ee614..d5df9e23 100755 --- a/conf/type/__apt_ppa/manifest +++ b/conf/type/__apt_ppa/manifest @@ -27,8 +27,3 @@ require="__package/python-software-properties" \ --source "$__type/files/remove-apt-repository" \ --mode 0755 -# FIXME: rewrite to use $__self once that exists -# FIXME: only run if something changed. currently working arround this in -# __apt_update_index/gencode-remote -require="__apt_ppa/$__object_id" __apt_update_index - From 0961e003be1a8dfbba0529cd12f25fdcbae837ac Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:28:20 +0100 Subject: [PATCH 03/35] Revert "new type: __apt_update_index" (until it works) This reverts commit 9094f50b035421e2d773f08ce54bbb0a477262fd. --- conf/type/__apt_update_index/gencode-remote | 35 ---------------- conf/type/__apt_update_index/man.text | 44 --------------------- conf/type/__apt_update_index/singleton | 0 3 files changed, 79 deletions(-) delete mode 100755 conf/type/__apt_update_index/gencode-remote delete mode 100644 conf/type/__apt_update_index/man.text delete mode 100644 conf/type/__apt_update_index/singleton diff --git a/conf/type/__apt_update_index/gencode-remote b/conf/type/__apt_update_index/gencode-remote deleted file mode 100755 index ad2296df..00000000 --- a/conf/type/__apt_update_index/gencode-remote +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# 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 . -# - -# BIG FAT FIXME: there must be a better way to do this! -tmpdir=$(mktemp -d) -cleanup() { - rm -rf "$tmpdir" -} -trap cleanup EXIT - -should="$tmpdir/should" -is="$tmpdir/is" - -find "$__global/object/__apt_ppa" -path "*.cdist/parameter/state" | xargs cat > "$should" -find "$__global/object/__apt_ppa" -path "*.cdist/explorer/state" | xargs cat > "$is" - -diff -ru "$is" "$should" || echo apt-get update - diff --git a/conf/type/__apt_update_index/man.text b/conf/type/__apt_update_index/man.text deleted file mode 100644 index dffba372..00000000 --- a/conf/type/__apt_update_index/man.text +++ /dev/null @@ -1,44 +0,0 @@ -cdist-type__apt_update_index(7) -========================== -Steven Armstrong - - -NAME ----- -cdist-type__apt_update_index - resynchronize the apt package index - - -DESCRIPTION ------------ -This cdist type allows you to resynchronize the package index files from their -sources. In other words, it runs `apt-get update`. - -FIXME: currently hard coded to work together with the __apt_ppa type - - -REQUIRED PARAMETERS -------------------- -None. - -OPTIONAL PARAMETERS -------------------- -None. - - -EXAMPLES --------- - --------------------------------------------------------------------------------- -__apt_update_index --------------------------------------------------------------------------------- - - -SEE ALSO --------- -- cdist-type(7) - - -COPYING -------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__apt_update_index/singleton b/conf/type/__apt_update_index/singleton deleted file mode 100644 index e69de29b..00000000 From b34a40b9e83895c00659ecdbbb8421208cc69c43 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:37:16 +0100 Subject: [PATCH 04/35] update makefile Signed-off-by: Nico Schottelius --- Makefile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index fea5a8ea..a545b749 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,8 @@ all: man: doc/man/.marker -doc/man/.marker: $(MANDIR)/cdist-reference.text +# FIXME: also depends on conf/type/*/man.text! +doc/man/.marker: manmove touch $@ # Manual from core @@ -75,7 +76,7 @@ mantype: for man in conf/type/*/man.text; do $(A2XM) $$man; $(A2XH) $$man; done # Move into manpath directories -manmove: mantype mancore +manmove: mantype mancore $(MANGENERATED) for manpage in $(MANDIR)/*.[1-9] conf/type/*/*.7; do \ cat=$${manpage##*.}; \ mandir=$(MANDIR)/man$$cat; \ @@ -91,15 +92,13 @@ manmove: mantype mancore done # 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: $(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 -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9] $(MANGENERATED) rm -f conf/type/*/man.html rm -rf doc/html @@ -115,8 +114,7 @@ test: # gentoo .rsync nicosc@ru3.inf.ethz.ch:cdist -#web: manmove -web: +web: man cp README $(WEBDIR)/$(WEBPAGE) cp -r doc/html/* $(WEBDIR)/$(WEBBASE)/man cd $(WEBDIR) && git commit -m "cdist update" $(WEBBASE) $(WEBPAGE) From 6d4f702eacd0b82d9daf8b5ff7cdfe063fb6d2b5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:39:26 +0100 Subject: [PATCH 05/35] shrink hackers_readme in favor for the manpage Signed-off-by: Nico Schottelius --- HACKERS_README | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/HACKERS_README b/HACKERS_README index 0ae1bdcd..66103acc 100755 --- a/HACKERS_README +++ b/HACKERS_README @@ -3,21 +3,12 @@ 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. +to get a deeper understanding. Please read doc/man/cdist-hacker.text. 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. + -- Nico, 20110324 ## Running cdist when developing From fa2f49e847942d07b86e167c3ae4e40c5e4945a6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:42:06 +0100 Subject: [PATCH 06/35] also git add html pages Signed-off-by: Nico Schottelius --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index a545b749..d7706926 100644 --- a/Makefile +++ b/Makefile @@ -117,6 +117,7 @@ test: web: man cp README $(WEBDIR)/$(WEBPAGE) cp -r doc/html/* $(WEBDIR)/$(WEBBASE)/man + cd $(WEBDIR) && git add $(WEBBASE)/man cd $(WEBDIR) && git commit -m "cdist update" $(WEBBASE) $(WEBPAGE) cd $(WEBDIR) && make pub From b14f7a431c8e68b2edf7e685ee3cc31404b10f05 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:45:31 +0100 Subject: [PATCH 07/35] rm mandir on webpage before copying (removes old manpages) Signed-off-by: Nico Schottelius --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index d7706926..1023d541 100644 --- a/Makefile +++ b/Makefile @@ -116,6 +116,7 @@ test: web: man cp README $(WEBDIR)/$(WEBPAGE) + rm -rf $(WEBDIR)/$(WEBBASE)/man && mkdir $(WEBDIR)/$(WEBBASE)/man cp -r doc/html/* $(WEBDIR)/$(WEBBASE)/man cd $(WEBDIR) && git add $(WEBBASE)/man cd $(WEBDIR) && git commit -m "cdist update" $(WEBBASE) $(WEBPAGE) From e685df7aa193938c8f392d8f5bdb456242812be0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:49:22 +0100 Subject: [PATCH 08/35] -typo Signed-off-by: Nico Schottelius --- doc/man/cdist-env.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/cdist-env.text b/doc/man/cdist-env.text index cf54d363..9a736133 100644 --- a/doc/man/cdist-env.text +++ b/doc/man/cdist-env.text @@ -32,7 +32,7 @@ in csh variants (csh, tcsh): eval `./bin/cdist-env` -------------------------------------------------------------------------------- -For bourne shell, the is also a shorter version: +For bourne shell, there is also a shorter version: -------------------------------------------------------------------------------- . ./bin/cdist-env -------------------------------------------------------------------------------- From c72833ce748b8be5d763bb7006af1ed3b8f02630 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 15:58:47 +0100 Subject: [PATCH 09/35] comment about conf/manifest/init in cdist-hacker Signed-off-by: Nico Schottelius --- doc/man/cdist-hacker.text | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/man/cdist-hacker.text b/doc/man/cdist-hacker.text index 093eaf61..d55f1c2f 100644 --- a/doc/man/cdist-hacker.text +++ b/doc/man/cdist-hacker.text @@ -27,6 +27,12 @@ read the scripts bin/cdist-deploy-to calls. The magnificent HACKERS_README may be of great help as well. +CODING CONVENTIONS (CORE) +------------------------- +- All variables exported by cdist are prefixed with a double underscore (__) +- All cdist-internal variables are prefixed with __cdist_ and are generally not exported. + + HOW TO SUBMIT STUFF FOR INCLUSION INTO UPSTREAM CDIST ----------------------------------------------------- If you did some cool changes to cdist, which you value as a benefit for @@ -40,6 +46,8 @@ work nor kill the authors brain: - Exception: Bugfixes to a version branch - Code submissions must be in your master branch - Exception: If you only want a comment on your code, but not an inclusion. +- Do not add conf/manifest/init - This file should only be touched in your + private branch! As soon as your work meets these requirements, you can contact me (IRC, Mailinglist, Phone, RFC 1149) and I'll check your code before From de81a2e80e6117243a7e1257a34b7701c87bb0dd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 16:00:46 +0100 Subject: [PATCH 10/35] change todos Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 26 +++++++++++++++++++++++--- doc/dev/todo/post-1.3 | 27 --------------------------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index bf13881e..3556f371 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,3 +1,23 @@ -Document redefine behaviour -release cdist 1.4.0 - perhaps include __self +Core: + - support $__self = relative_type/object_id + - cache + +Cache: + Assume you want to configure stuff one host ("monitor node"), + depending on the configuration of other hosts ("cluster nodes"). + + For instance, the monitor host would like to know, + which hosts are configured with the provider + "apache" and option --start true. + + This requires the monitor node to be able to + query all other configured nodes. It can't + ask for all hosts, because cdist does not + know which hosts are configured or may exist. + + Example implementation + + If cdist keeps ("caches") the configuration of every + node it configures, each new node can query the + cache for existing nodes that acquired the given + configuration. diff --git a/doc/dev/todo/post-1.3 b/doc/dev/todo/post-1.3 index ec186d3a..c73a623b 100644 --- a/doc/dev/todo/post-1.3 +++ b/doc/dev/todo/post-1.3 @@ -1,30 +1,3 @@ -Core: - - allow redefine object, if everything same - - support $__self = relative_type/object_id - - .cdist - - cache - - display changes if object cannot be merged to user - -Cache: - Assume you want to configure stuff one host ("monitor node"), - depending on the configuration of other hosts ("cluster nodes"). - - For instance, the monitor host would like to know, - which hosts are configured with the provider - "apache" and option --start true. - - This requires the monitor node to be able to - query all other configured nodes. It can't - ask for all hosts, because cdist does not - know which hosts are configured or may exist. - - Example implementation - - If cdist keeps ("caches") the configuration of every - node it configures, each new node can query the - cache for existing nodes that acquired the given - configuration. - Types to be written/extended: - __ssh-keys (host/user) - __service From cd8ab7664a1f6a11b420f003d717a17f1914f627 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 16:02:15 +0100 Subject: [PATCH 11/35] rename post-1.3 todo Signed-off-by: Nico Schottelius --- doc/dev/todo/{post-1.3 => TAKEME} | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename doc/dev/todo/{post-1.3 => TAKEME} (54%) diff --git a/doc/dev/todo/post-1.3 b/doc/dev/todo/TAKEME similarity index 54% rename from doc/dev/todo/post-1.3 rename to doc/dev/todo/TAKEME index c73a623b..9fa083cc 100644 --- a/doc/dev/todo/post-1.3 +++ b/doc/dev/todo/TAKEME @@ -1,6 +1,10 @@ +The following list of todos has not been assigned to any developer. + +Feel free to pick one: + Types to be written/extended: - __ssh-keys (host/user) - - __service + - Think about __service - necessary? - __file_edit - regexp replace (can probably cover all?) -> aka sed. From f02254915a01640976368abedfc756f02bb99eb0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 17:41:20 +0100 Subject: [PATCH 12/35] begin to cleanup manpage generation Signed-off-by: Nico Schottelius --- Makefile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1023d541..93faa58a 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,8 @@ WEBPAGE=$(WEBBASE).mdwn # Documentation MANDIR=doc/man -MANGENERATED=$(MANDIR)/cdist-reference.text -MANSRC=$(MANDIR)/cdist.text \ - $(MANDIR)/cdist-best-practise.text \ +MAN1SRC= \ $(MANDIR)/cdist-code-run.text \ $(MANDIR)/cdist-code-run-all.text \ $(MANDIR)/cdist-config.text \ @@ -28,23 +26,29 @@ MANSRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-explorer-run-global.text \ $(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-explorer.text \ - $(MANDIR)/cdist-hacker.text \ $(MANDIR)/cdist-manifest.text \ $(MANDIR)/cdist-manifest-run.text \ - $(MANDIR)/cdist-manifest-run-all.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 \ +MAN7SRC=$(MANDIR)/cdist.text \ + $(MANDIR)/cdist-best-practise.text \ + $(MANDIR)/cdist-hacker.text \ + $(MANDIR)/cdist-quickstart.text \ + $(MANDIR)/cdist-reference.text \ + $(MANDIR)/cdist-stages.text \ + $(MANDIR)/cdist-type.text \ + +MAN1DST=$(MAN1SRC:.text=.1) +MAN7DST=$(MAN1SRC:.text=.7) ################################################################################ # User targets From 3dc37c17a33dccac168d26e7eace09e46f94ae9f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 18:32:53 +0100 Subject: [PATCH 13/35] require gnu make for manpages Signed-off-by: Nico Schottelius --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index feca4bc4..389470a0 100644 --- a/README +++ b/README @@ -107,7 +107,7 @@ To install cdist, execute the following commands: cd cdist export PATH=$PATH:$(pwd -P)/bin - # If you want the manpages (requires asciidoc to be installed) + # If you want the manpages (requires gmake and asciidoc to be installed) make man export MANPATH=$MANPATH:$(pwd -P)/doc/man @@ -136,7 +136,7 @@ may vanish at any point. To select a specific branch use git checkout -b origin/ # Stay on a specific version - git checkout -b 1.3 origin/1.3 + git checkout -b 1.4 origin/1.4 ### Mirrors From 0370412757d3ead117c54bcf434c17ed1f328ede Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 18:43:08 +0100 Subject: [PATCH 14/35] manpage generation cleaup Signed-off-by: Nico Schottelius --- Makefile | 41 ++++++++++++++++++++++------------------- doc/changelog | 3 +++ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 93faa58a..e43876b3 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ WEBPAGE=$(WEBBASE).mdwn # Documentation MANDIR=doc/man +HTMLDIR=$(MANDIR)/html MAN1SRC= \ $(MANDIR)/cdist-code-run.text \ @@ -46,9 +47,11 @@ MAN7SRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-reference.text \ $(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-type.text \ + $(shell ls conf/type/*/man.text) MAN1DST=$(MAN1SRC:.text=.1) -MAN7DST=$(MAN1SRC:.text=.7) +MAN7DST=$(MAN7SRC:.text=.7) +MANHTML=$(MAN1SRC:.text=.html) $(MAN7SRC:.text=.html) ################################################################################ # User targets @@ -65,34 +68,34 @@ all: @echo '' @echo '' -man: doc/man/.marker -# FIXME: also depends on conf/type/*/man.text! -doc/man/.marker: manmove - touch $@ +%.1 %.7: %.text + $(A2XM) $*.text -# Manual from core -mancore: $(MANSRC) - for mansrc in $^; do $(A2XM) $$mansrc; $(A2XH) $$mansrc; done +%.html: %.text + $(A2XH) $*.text -# Manuals from types -mantype: - for man in conf/type/*/man.text; do $(A2XM) $$man; $(A2XH) $$man; done +man: $(MAN1DST) $(MAN7DST) + +html: $(MANHTML) + +# man: doc/man/.marker # Move into manpath directories -manmove: mantype mancore $(MANGENERATED) +manmove: $(MAN1DST) $(MAN7DST) $(MANHTML) 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 + mkdir -p $(HTMLDIR) + mv doc/man/*.html $(HTMLDIR) 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; \ + mannew=$$(echo $$mantype | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;');\ + mv $$mantype doc/html/$$mannew; \ done # Reference depends on conf/type/*/man.text - HOWTO with posix make? @@ -102,9 +105,9 @@ $(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh $(A2XH) $(MANDIR)/cdist-reference.text clean: - rm -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9] $(MANGENERATED) - rm -f conf/type/*/man.html - rm -rf doc/html + rm -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9] + rm -f conf/type/*/man.html $(MANDIR)/cdist-reference.text + rm -rf $(HTMLDIR) ################################################################################ # Developer targets diff --git a/doc/changelog b/doc/changelog index f78b1660..6e119393 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +1.4.1: + * Manpage generation cleanup + 1.4.0: 2011-03-24 * Add --recursive to __directory * Move cdist generated stuff to .cdist of an object From e27501218f5629b281b86f2dbea988c3d39bebaf Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 24 Mar 2011 23:16:25 +0100 Subject: [PATCH 15/35] new type __key_value Signed-off-by: Steven Armstrong --- conf/type/__key_value/explorer/value | 33 +++++++++++++ conf/type/__key_value/gencode-remote | 52 +++++++++++++++++++++ conf/type/__key_value/man.text | 59 ++++++++++++++++++++++++ conf/type/__key_value/manifest | 26 +++++++++++ conf/type/__key_value/parameter/optional | 1 + conf/type/__key_value/parameter/required | 3 ++ 6 files changed, 174 insertions(+) create mode 100755 conf/type/__key_value/explorer/value create mode 100755 conf/type/__key_value/gencode-remote create mode 100644 conf/type/__key_value/man.text create mode 100755 conf/type/__key_value/manifest create mode 100644 conf/type/__key_value/parameter/optional create mode 100644 conf/type/__key_value/parameter/required diff --git a/conf/type/__key_value/explorer/value b/conf/type/__key_value/explorer/value new file mode 100755 index 00000000..b1d7983f --- /dev/null +++ b/conf/type/__key_value/explorer/value @@ -0,0 +1,33 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# 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 . +# +# +# Get the current value of key or __NOTSET__ if the key doesn't exist. +# + +key="$(cat "$__object/parameter/key")" +file="$(cat "$__object/parameter/file")" +delimiter="$(cat "$__object/parameter/delimiter")" + +awk -F "$delimiter" ' +BEGIN { found=0 } +/^'$key'/ { print $2; found=1 } +END { if (found) exit 0; else exit 1 }' "$file" \ +|| echo "__NOTSET__" + diff --git a/conf/type/__key_value/gencode-remote b/conf/type/__key_value/gencode-remote new file mode 100755 index 00000000..e41cd9b5 --- /dev/null +++ b/conf/type/__key_value/gencode-remote @@ -0,0 +1,52 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# 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 . +# + +value_is="$(cat "$__object/explorer/value")" +value_should="$(cat "$__object/parameter/value")" + +key="$(cat "$__object/parameter/key")" +file="$(cat "$__object/parameter/file")" +delimiter="$(cat "$__object/parameter/delimiter")" + +if [ "$value_is" != "$value_should" ]; then + case "$value_is" in + __NOTSET__) + # add key and value + echo "echo \"${key}${delimiter}${value_should}\" >> \"$file\"" + ;; + *) + if [ "$value_should" = '__NOTSET__' ]; then + # remove key and value + cat << DONE +sed -i '/^${key}/d' "$file" +DONE + else + # change value + cat << DONE +awk -F "$delimiter" ' +/${key}${delimiter}*/{gsub(/$value_is/, $value_should)};{print}' "$file" > "${file}+" \ +&& mv "${file}+" "$file" + +DONE + fi + ;; + esac +fi + diff --git a/conf/type/__key_value/man.text b/conf/type/__key_value/man.text new file mode 100644 index 00000000..78ba09a5 --- /dev/null +++ b/conf/type/__key_value/man.text @@ -0,0 +1,59 @@ +cdist-type__key_value(7) +========================== +Steven Armstrong + + +NAME +---- +cdist-type__key_value - Change property values in files + + +DESCRIPTION +----------- +This cdist type allows you to change values in a key value based config +file. + + +REQUIRED PARAMETERS +------------------- +value:: + The value for the key. Setting the value to __NOTSET__ will remove the key + from the file. +file:: + The file to operate on. +delimiter:: + The delimiter which seperates the key from the value. + + +OPTIONAL PARAMETERS +------------------- +key:: + The key to change. Defaults to object_id. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Set the maximum system user id +__key_value SYS_UID_MAX --file /etc/login.defs --value 666 --delimiter ' ' + +# Same with fancy id +__key_value my-fancy-id --file /etc/login.defs --key SYS_UID_MAX --value 666 \ + --delimiter ' ' + +# Enable packet forwarding +__key_value net.ipv4.ip_forward --file /etc/sysctl.conf --value 1 \ + --delimiter '=' +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__key_value/manifest b/conf/type/__key_value/manifest new file mode 100755 index 00000000..706b0b0d --- /dev/null +++ b/conf/type/__key_value/manifest @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# 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 . +# + +if [ -f "$__object/parameter/key" ]; then + key="$(cat "$__object/parameter/key")" +else + echo "$__object_id" > "$__object/parameter/key" +fi + diff --git a/conf/type/__key_value/parameter/optional b/conf/type/__key_value/parameter/optional new file mode 100644 index 00000000..06bfde49 --- /dev/null +++ b/conf/type/__key_value/parameter/optional @@ -0,0 +1 @@ +key diff --git a/conf/type/__key_value/parameter/required b/conf/type/__key_value/parameter/required new file mode 100644 index 00000000..8f4aa53c --- /dev/null +++ b/conf/type/__key_value/parameter/required @@ -0,0 +1,3 @@ +value +file +delimiter From b959a14dc251826ff05a00d8cbc1226e408c4cb0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 24 Mar 2011 23:22:08 +0100 Subject: [PATCH 16/35] fix length of ascidoc header Signed-off-by: Steven Armstrong --- conf/type/__key_value/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__key_value/man.text b/conf/type/__key_value/man.text index 78ba09a5..70711f97 100644 --- a/conf/type/__key_value/man.text +++ b/conf/type/__key_value/man.text @@ -1,5 +1,5 @@ cdist-type__key_value(7) -========================== +======================== Steven Armstrong From 46ceb3e3a924275bd096809b31f724044a502795 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 23:30:42 +0100 Subject: [PATCH 17/35] use variable instead of hardcoded value Signed-off-by: Nico Schottelius --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e43876b3..7b1e3dfa 100644 --- a/Makefile +++ b/Makefile @@ -121,10 +121,10 @@ test: # gentoo .rsync nicosc@ru3.inf.ethz.ch:cdist -web: man +web: manmove cp README $(WEBDIR)/$(WEBPAGE) rm -rf $(WEBDIR)/$(WEBBASE)/man && mkdir $(WEBDIR)/$(WEBBASE)/man - cp -r doc/html/* $(WEBDIR)/$(WEBBASE)/man + cp -r $(HTMLDIR)/* $(WEBDIR)/$(WEBBASE)/man cd $(WEBDIR) && git add $(WEBBASE)/man cd $(WEBDIR) && git commit -m "cdist update" $(WEBBASE) $(WEBPAGE) cd $(WEBDIR) && make pub From 79f6f90a05189bf4a6edca40e11c937c219631d3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 23:33:07 +0100 Subject: [PATCH 18/35] changelog+= __type/__key_value Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 6e119393..cd8cd4cc 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,6 @@ 1.4.1: * Manpage generation cleanup + * New type __key_value (Steven Armstrong) 1.4.0: 2011-03-24 * Add --recursive to __directory From fa309545a8b272ac3b2555c3bb3a4c2ec8ccabc4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 23:35:39 +0100 Subject: [PATCH 19/35] more stuff for 1.4.1 Signed-off-by: Nico Schottelius --- doc/changelog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index cd8cd4cc..fb0bb1f9 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,8 @@ 1.4.1: - * Manpage generation cleanup * New type __key_value (Steven Armstrong) + * New type __apt_ppa (Steven Armstrong) + * Documentation: Manpage generation cleanup + * Documentation: Manpage fix for __apt_ppa 1.4.0: 2011-03-24 * Add --recursive to __directory From ca139aa444650ae3815440a1f766122035a48460 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Mar 2011 23:40:56 +0100 Subject: [PATCH 20/35] fixup manpage move/html Signed-off-by: Nico Schottelius --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7b1e3dfa..98ac3a76 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ manmove: $(MAN1DST) $(MAN7DST) $(MANHTML) mv doc/man/*.html $(HTMLDIR) 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; \ + mv $$mantype $(HTMLDIR)/$$mannew; \ done # Reference depends on conf/type/*/man.text - HOWTO with posix make? From 042638943a028b01965430b29951d0e544000014 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 11:17:52 +0100 Subject: [PATCH 21/35] begin real clean manpage solution Signed-off-by: Nico Schottelius --- Makefile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 98ac3a76..fb6161b2 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,10 @@ WEBPAGE=$(WEBBASE).mdwn # Documentation MANDIR=doc/man -HTMLDIR=$(MANDIR)/html + +MAN1DSTDIR=$(MANDIR)/man1 +MAN7DSTDIR=$(MANDIR)/man7 +MANHTMLDIR=$(MANDIR)/html MAN1SRC= \ $(MANDIR)/cdist-code-run.text \ @@ -47,12 +50,14 @@ MAN7SRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-reference.text \ $(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-type.text \ - $(shell ls conf/type/*/man.text) + +MAN7TYPESRC=$(shell ls conf/type/*/man.text) MAN1DST=$(MAN1SRC:.text=.1) MAN7DST=$(MAN7SRC:.text=.7) MANHTML=$(MAN1SRC:.text=.html) $(MAN7SRC:.text=.html) + ################################################################################ # User targets # @@ -69,11 +74,15 @@ all: @echo '' -%.1 %.7: %.text +$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): + mkdir -p $< + +%.1 %.7: %.text $(MAN1DSTDIR) $(MAN7DSTDIR) $(A2XM) $*.text %.html: %.text - $(A2XH) $*.text + $(A2XH) -o $(MANHTMLDIR)/$(@F) $< + #$(A2XH) -o $(MANHTMLDIR)/$(@F) $*.text man: $(MAN1DST) $(MAN7DST) @@ -91,11 +100,11 @@ manmove: $(MAN1DST) $(MAN7DST) $(MANHTML) done # HTML - mkdir -p $(HTMLDIR) - mv doc/man/*.html $(HTMLDIR) + mkdir -p $(MANHTMLDIR) + mv doc/man/*.html $(MANHTMLDIR) for mantype in conf/type/*/man.html; do \ mannew=$$(echo $$mantype | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;');\ - mv $$mantype $(HTMLDIR)/$$mannew; \ + mv $$mantype $(MANHTMLDIR)/$$mannew; \ done # Reference depends on conf/type/*/man.text - HOWTO with posix make? @@ -107,7 +116,7 @@ $(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh clean: rm -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9] rm -f conf/type/*/man.html $(MANDIR)/cdist-reference.text - rm -rf $(HTMLDIR) + rm -rf $(MANHTMLDIR) ################################################################################ # Developer targets @@ -124,7 +133,7 @@ test: web: manmove cp README $(WEBDIR)/$(WEBPAGE) rm -rf $(WEBDIR)/$(WEBBASE)/man && mkdir $(WEBDIR)/$(WEBBASE)/man - cp -r $(HTMLDIR)/* $(WEBDIR)/$(WEBBASE)/man + cp -r $(MANHTMLDIR)/* $(WEBDIR)/$(WEBBASE)/man cd $(WEBDIR) && git add $(WEBBASE)/man cd $(WEBDIR) && git commit -m "cdist update" $(WEBBASE) $(WEBPAGE) cd $(WEBDIR) && make pub From bbe4f940e37a667aa209a8134b2bdb964b2c7a7b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 11:34:29 +0100 Subject: [PATCH 22/35] in theory finish generation for man1 and man7 core cleanly Signed-off-by: Nico Schottelius --- Makefile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index fb6161b2..4af52565 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,8 @@ MAN7SRC=$(MANDIR)/cdist.text \ MAN7TYPESRC=$(shell ls conf/type/*/man.text) -MAN1DST=$(MAN1SRC:.text=.1) -MAN7DST=$(MAN7SRC:.text=.7) +MAN1DST=$(addprefix $(MAN1DSTDIR)/,$(notdir $(MAN1SRC:.text=.1))) +MAN7DST=$(addprefix $(MAN7DSTDIR)/,$(notdir $(MAN7SRC:.text=.7))) MANHTML=$(MAN1SRC:.text=.html) $(MAN7SRC:.text=.html) @@ -74,15 +74,27 @@ all: @echo '' -$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): - mkdir -p $< +################################################################################ +# Documentation +# -%.1 %.7: %.text $(MAN1DSTDIR) $(MAN7DSTDIR) +# Create output dirs +$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): + mkdir -p $@ + +# Link source files +manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) + for mansrc in $(MAN1SRC); do ln -sf $$mansrc $(MAN1DSTDIR); done + for mansrc in $(MAN7SRC); do ln -sf $$mansrc $(MAN7DSTDIR); done + for mansrc in $(MAN7TYPESRC); do \ + dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \ + ln -sf $$mansrc $$dst; done + +%.1 %.7: %.text manlink $(A2XM) $*.text %.html: %.text $(A2XH) -o $(MANHTMLDIR)/$(@F) $< - #$(A2XH) -o $(MANHTMLDIR)/$(@F) $*.text man: $(MAN1DST) $(MAN7DST) From 6e85d65b72321c849ce224b6708bb031180310ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 11:35:43 +0100 Subject: [PATCH 23/35] and in practise link to .. is better than somewhere else Signed-off-by: Nico Schottelius --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4af52565..d0d43073 100644 --- a/Makefile +++ b/Makefile @@ -84,8 +84,8 @@ $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): # Link source files manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) - for mansrc in $(MAN1SRC); do ln -sf $$mansrc $(MAN1DSTDIR); done - for mansrc in $(MAN7SRC); do ln -sf $$mansrc $(MAN7DSTDIR); done + for mansrc in $(notdir $(MAN1SRC)); do ln -sf ../$$mansrc $(MAN1DSTDIR); done + for mansrc in $(notdir $(MAN7SRC)); do ln -sf ../$$mansrc $(MAN7DSTDIR); done for mansrc in $(MAN7TYPESRC); do \ dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \ ln -sf $$mansrc $$dst; done From 3e72555e5923f9f433fd6f8dfd700cb53f8be41c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 11:46:56 +0100 Subject: [PATCH 24/35] make man is clean now Signed-off-by: Nico Schottelius --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d0d43073..47d0e3df 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ MAN7SRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-type.text \ MAN7TYPESRC=$(shell ls conf/type/*/man.text) - +MAN7TYPEDST=$(shell for mansrc in $(MAN7TYPESRC:.text=.7); do dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; echo $$dst; done) MAN1DST=$(addprefix $(MAN1DSTDIR)/,$(notdir $(MAN1SRC:.text=.1))) MAN7DST=$(addprefix $(MAN7DSTDIR)/,$(notdir $(MAN7SRC:.text=.7))) MANHTML=$(MAN1SRC:.text=.html) $(MAN7SRC:.text=.html) @@ -84,11 +84,11 @@ $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): # Link source files manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) - for mansrc in $(notdir $(MAN1SRC)); do ln -sf ../$$mansrc $(MAN1DSTDIR); done - for mansrc in $(notdir $(MAN7SRC)); do ln -sf ../$$mansrc $(MAN7DSTDIR); done + for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done + for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done for mansrc in $(MAN7TYPESRC); do \ dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \ - ln -sf $$mansrc $$dst; done + ln -sf ../../../$$mansrc $$dst; done %.1 %.7: %.text manlink $(A2XM) $*.text @@ -96,7 +96,7 @@ manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) %.html: %.text $(A2XH) -o $(MANHTMLDIR)/$(@F) $< -man: $(MAN1DST) $(MAN7DST) +man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST) html: $(MANHTML) From 58391818ccd6a616524b7b98417870853603c4cf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 11:52:51 +0100 Subject: [PATCH 25/35] remove old manmove target Signed-off-by: Nico Schottelius --- Makefile | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 47d0e3df..2b795740 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ MAN7TYPESRC=$(shell ls conf/type/*/man.text) MAN7TYPEDST=$(shell for mansrc in $(MAN7TYPESRC:.text=.7); do dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; echo $$dst; done) MAN1DST=$(addprefix $(MAN1DSTDIR)/,$(notdir $(MAN1SRC:.text=.1))) MAN7DST=$(addprefix $(MAN7DSTDIR)/,$(notdir $(MAN7SRC:.text=.7))) -MANHTML=$(MAN1SRC:.text=.html) $(MAN7SRC:.text=.html) +MANHTML=$(MAN1DST:.1=.html) $(MAN7DST:.7=.html) $(MAN7TYPEDST:.7=.html) ################################################################################ @@ -83,7 +83,7 @@ $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): mkdir -p $@ # Link source files -manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) +manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done for mansrc in $(MAN7TYPESRC); do \ @@ -100,25 +100,6 @@ man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST) html: $(MANHTML) -# man: doc/man/.marker - -# Move into manpath directories -manmove: $(MAN1DST) $(MAN7DST) $(MANHTML) - for manpage in $(MANDIR)/*.[1-9] conf/type/*/*.7; do \ - cat=$${manpage##*.}; \ - mandir=$(MANDIR)/man$$cat; \ - mkdir -p $$mandir; \ - mv $$manpage $$mandir; \ - done - - # HTML - mkdir -p $(MANHTMLDIR) - mv doc/man/*.html $(MANHTMLDIR) - for mantype in conf/type/*/man.html; do \ - mannew=$$(echo $$mantype | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;');\ - mv $$mantype $(MANHTMLDIR)/$$mannew; \ - done - # Reference depends on conf/type/*/man.text - HOWTO with posix make? $(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh $(MANDIR)/cdist-reference.text.sh From bd25d6810b836552a245677c8189e0ddcd4293fa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 19:39:50 +0100 Subject: [PATCH 26/35] makefile cleanup, todo add Signed-off-by: Nico Schottelius --- Makefile | 11 ++++++----- doc/dev/todo/TAKEME | 9 ++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 2b795740..3de70201 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,7 @@ all: @echo 'Here are the possible targets:' @echo '' @echo ' man: Build manpages (requires Asciidoc)' + @echo ' manhtml: Build html-manpages (requires Asciidoc)' @echo ' clean: Remove build stuff' @echo '' @echo '' @@ -83,7 +84,7 @@ $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): mkdir -p $@ # Link source files -manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) +manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done for mansrc in $(MAN7TYPESRC); do \ @@ -93,14 +94,14 @@ manlink: $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) %.1 %.7: %.text manlink $(A2XM) $*.text -%.html: %.text +%.html: %.text manlink $(A2XH) -o $(MANHTMLDIR)/$(@F) $< man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST) -html: $(MANHTML) +# $(MANHTML): $(MANHTMLDIR) +manhtml: $(MANHTML) -# Reference depends on conf/type/*/man.text - HOWTO with posix make? $(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh $(MANDIR)/cdist-reference.text.sh $(A2XM) $(MANDIR)/cdist-reference.text @@ -109,7 +110,7 @@ $(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh clean: rm -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9] rm -f conf/type/*/man.html $(MANDIR)/cdist-reference.text - rm -rf $(MANHTMLDIR) + rm -rf $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) ################################################################################ # Developer targets diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 9fa083cc..2881c06c 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -1,7 +1,14 @@ +UNASSIGNED TODOS +---------------- The following list of todos has not been assigned to any developer. +Feel free to pick one! -Feel free to pick one: +CORE +---- +Only build manpages if necessary for types as well as for the core! +TYPES +------ Types to be written/extended: - __ssh-keys (host/user) - Think about __service - necessary? From 1a2f7bb8bb3df13ed9ae81c089eb31684e186e66 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 20:31:20 +0100 Subject: [PATCH 27/35] link type manpages into tempdir Signed-off-by: Nico Schottelius --- Makefile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3de70201..b09d5719 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,8 @@ MANDIR=doc/man MAN1DSTDIR=$(MANDIR)/man1 MAN7DSTDIR=$(MANDIR)/man7 MANHTMLDIR=$(MANDIR)/html +MANTMPDIR=$(MANDIR)/tmp +MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) MAN1SRC= \ $(MANDIR)/cdist-code-run.text \ @@ -79,8 +81,18 @@ all: # Documentation # +# Type manpages are in no good format for asciidoc, make them look good! +manlinktypes: $(MANTMPDIR) + for mansrc in $(MAN7TYPESRC); do \ + dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;$(MANTMPDIR)/;')"; \ + ln -sf ../../../$$mansrc $$dst; done + +################################################################################ + +man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST) + # Create output dirs -$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR): +$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR): mkdir -p $@ # Link source files @@ -91,14 +103,12 @@ manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANH dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \ ln -sf ../../../$$mansrc $$dst; done -%.1 %.7: %.text manlink +%.1 %.7: %.text manlink $(MANOUTDIRS) $(A2XM) $*.text %.html: %.text manlink $(A2XH) -o $(MANHTMLDIR)/$(@F) $< -man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST) - # $(MANHTML): $(MANHTMLDIR) manhtml: $(MANHTML) From 1398cde9f0f29f33420439ef608f50fe3d4a8e8d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 20:34:13 +0100 Subject: [PATCH 28/35] also link core manpages into tmp Signed-off-by: Nico Schottelius --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b09d5719..79188352 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,12 @@ all: # # Type manpages are in no good format for asciidoc, make them look good! -manlinktypes: $(MANTMPDIR) +manlink: $(MANTMPDIR) for mansrc in $(MAN7TYPESRC); do \ dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;$(MANTMPDIR)/;')"; \ ln -sf ../../../$$mansrc $$dst; done + for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MANTMPDIR); done + for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MANTMPDIR); done ################################################################################ From 8c3782f091db1bcba723bf72d4f244d8d185fa60 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 20:49:09 +0100 Subject: [PATCH 29/35] further cleanups to the man build system Signed-off-by: Nico Schottelius --- Makefile | 52 +++++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 79188352..e06db5c0 100644 --- a/Makefile +++ b/Makefile @@ -5,23 +5,20 @@ MANDIR=$(PREFIX)/share/man # Manpage and HTML A2XM=a2x -f manpage --no-xmllint -# A2XH=a2x -f xhtml --no-xmllint -A2XH=asciidoc -b xhtml11 +A2XH=a2x -f xhtml --no-xmllint -# Developer only +# Developer webbase WEBDIR=$$HOME/niconetz WEBBASE=software/cdist WEBPAGE=$(WEBBASE).mdwn - # Documentation MANDIR=doc/man MAN1DSTDIR=$(MANDIR)/man1 MAN7DSTDIR=$(MANDIR)/man7 MANHTMLDIR=$(MANDIR)/html -MANTMPDIR=$(MANDIR)/tmp -MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) +MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR) MAN1SRC= \ $(MANDIR)/cdist-code-run.text \ @@ -53,12 +50,17 @@ MAN7SRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-type.text \ +# Manpages from types MAN7TYPESRC=$(shell ls conf/type/*/man.text) -MAN7TYPEDST=$(shell for mansrc in $(MAN7TYPESRC:.text=.7); do dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; echo $$dst; done) -MAN1DST=$(addprefix $(MAN1DSTDIR)/,$(notdir $(MAN1SRC:.text=.1))) -MAN7DST=$(addprefix $(MAN7DSTDIR)/,$(notdir $(MAN7SRC:.text=.7))) -MANHTML=$(MAN1DST:.1=.html) $(MAN7DST:.7=.html) $(MAN7TYPEDST:.7=.html) +# Source files after linking them +MAN1TMPSRC=$(shell ls $(MAN1DSTDIR)/*.text) +MAN7TMPSRC=$(shell ls $(MAN7DSTDIR)/*.text) + +# Destination files based on linked files, not static list +MAN1DST=$(MAN1TMPSRC:.text=.1) +MAN7DST=$(MAN7TMPSRC:.text=.7) +MANHTML=$(MAN1TMPSRC:.text=.html) $(MAN7TMPSRC:.text=.html) ################################################################################ # User targets @@ -81,48 +83,36 @@ all: # Documentation # -# Type manpages are in no good format for asciidoc, make them look good! -manlink: $(MANTMPDIR) - for mansrc in $(MAN7TYPESRC); do \ - dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;$(MANTMPDIR)/;')"; \ - ln -sf ../../../$$mansrc $$dst; done - for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MANTMPDIR); done - for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MANTMPDIR); done +# Create manpages +man: $(MAN1DST) $(MAN7DST) +manhtml: $(MANHTML) -################################################################################ - -man: $(MAN1DST) $(MAN7DST) $(MAN7TYPEDST) +$(MANHTML): $(MANHTMLDIR) # Create output dirs $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR): mkdir -p $@ # Link source files -manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) +manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MANOUTDIRS) for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done for mansrc in $(MAN7TYPESRC); do \ dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \ ln -sf ../../../$$mansrc $$dst; done -%.1 %.7: %.text manlink $(MANOUTDIRS) +%.1 %.7: %.text manlink $(A2XM) $*.text %.html: %.text manlink - $(A2XH) -o $(MANHTMLDIR)/$(@F) $< - -# $(MANHTML): $(MANHTMLDIR) -manhtml: $(MANHTML) + $(A2XH) $< $(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh $(MANDIR)/cdist-reference.text.sh - $(A2XM) $(MANDIR)/cdist-reference.text - $(A2XH) $(MANDIR)/cdist-reference.text clean: - rm -rf doc/man/html/* doc/man/*.[1-9] doc/man/man[1-9] - rm -f conf/type/*/man.html $(MANDIR)/cdist-reference.text - rm -rf $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) + rm -rf $(MANOUTDIRS) + rm -f $(MANDIR)/cdist-reference.text ################################################################################ # Developer targets From 8a01df66dd8b7202a7e604f12f81bb47a3eee565 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 20:54:50 +0100 Subject: [PATCH 30/35] does not work: MAN1TMPSRC=$(shell ls $(MAN1DSTDIR)/*.text) is expanded before manlink was run Signed-off-by: Nico Schottelius --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e06db5c0..fc55ea03 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ all: man: $(MAN1DST) $(MAN7DST) manhtml: $(MANHTML) -$(MANHTML): $(MANHTMLDIR) +$(MAN1DST) $(MAN7DST) $(MANHTML): $(MANOUTDIRS) # Create output dirs $(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR): From 4d33e524a122745c8d62eb0015cd4b9ef46d4092 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 20:56:25 +0100 Subject: [PATCH 31/35] begin to migrate makefile to shell script Signed-off-by: Nico Schottelius --- Makefile => build.sh | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) rename Makefile => build.sh (80%) diff --git a/Makefile b/build.sh similarity index 80% rename from Makefile rename to build.sh index fc55ea03..f8544f09 100644 --- a/Makefile +++ b/build.sh @@ -1,7 +1,27 @@ -# General -PREFIX=/usr -BINDIR=$(PREFIX)/bin -MANDIR=$(PREFIX)/share/man +#!/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 . +# +# +# Push a directory to a target, both sides have the same name (i.e. explorers) +# or +# Pull a directory from a target, both sides have the same name (i.e. explorers) +# # Manpage and HTML A2XM=a2x -f manpage --no-xmllint @@ -17,7 +37,6 @@ MANDIR=doc/man MAN1DSTDIR=$(MANDIR)/man1 MAN7DSTDIR=$(MANDIR)/man7 -MANHTMLDIR=$(MANDIR)/html MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR) MAN1SRC= \ From 8b9b95f98479c3002c9ca13da9ff8295f9d3d4ef Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 21:04:26 +0100 Subject: [PATCH 32/35] partial transformation Signed-off-by: Nico Schottelius --- build.sh | 156 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 84 insertions(+), 72 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index f8544f09..8509eddc --- a/build.sh +++ b/build.sh @@ -24,57 +24,98 @@ # # Manpage and HTML -A2XM=a2x -f manpage --no-xmllint -A2XH=a2x -f xhtml --no-xmllint +A2XM="a2x -f manpage --no-xmllint" +A2XH="a2x -f xhtml --no-xmllint" # Developer webbase -WEBDIR=$$HOME/niconetz +WEBDIR=$HOME/niconetz WEBBASE=software/cdist -WEBPAGE=$(WEBBASE).mdwn +WEBPAGE=${WEBBASE}.mdwn # Documentation MANDIR=doc/man - -MAN1DSTDIR=$(MANDIR)/man1 -MAN7DSTDIR=$(MANDIR)/man7 -MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR) +MAN1DSTDIR=${MANDIR}/man1 +MAN7DSTDIR=${MANDIR}/man7 MAN1SRC= \ - $(MANDIR)/cdist-code-run.text \ - $(MANDIR)/cdist-code-run-all.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-remote-explorer-run.text \ - $(MANDIR)/cdist-run-remote.text \ - $(MANDIR)/cdist-type-build-emulation.text \ - $(MANDIR)/cdist-type-emulator.text \ - $(MANDIR)/cdist-type-template.text \ + ${MANDIR}/cdist-code-run.text \ + ${MANDIR}/cdist-code-run-all.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-remote-explorer-run.text \ + ${MANDIR}/cdist-run-remote.text \ + ${MANDIR}/cdist-type-build-emulation.text \ + ${MANDIR}/cdist-type-emulator.text \ + ${MANDIR}/cdist-type-template.text + +MAN7SRC=${MANDIR}/cdist.text \ + ${MANDIR}/cdist-best-practise.text \ + ${MANDIR}/cdist-hacker.text \ + ${MANDIR}/cdist-quickstart.text \ + ${MANDIR}/cdist-reference.text \ + ${MANDIR}/cdist-stages.text \ + ${MANDIR}/cdist-type.text \ + + +case "$1" in + man) + for mansrc in ${MAN1SRC} ${MAN7SRC}; do + ln -sf ../../../$mansrc ${MAN1DSTDIR}; + done + for mansrc in ${MAN7TYPESRC}; do + dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')" + ln -sf ../../../$$mansrc $$dst + done + ;; + + web) + cp README ${WEBDIR}/${WEBPAGE} + rm -rf ${WEBDIR}/${WEBBASE}/man && mkdir ${WEBDIR}/${WEBBASE}/man + cp -r $(MANHTMLDIR)/* ${WEBDIR}/${WEBBASE}/man + cd ${WEBDIR} && git add ${WEBBASE}/man + cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} + cd ${WEBDIR} && make pub + ;; + + pub) + git push --mirror + git push --mirror github + ;; + + *) + echo '' + echo 'Welcome to cdist!' + echo '' + echo 'Here are the possible targets:' + echo '' + echo ' man: Build manpages (requires Asciidoc)' + echo ' manhtml: Build html-manpages (requires Asciidoc)' + echo ' clean: Remove build stuff' + echo '' + echo '' + echo "Unknown target, \"$1\"" >&2 + exit 1 + ;; +esac -MAN7SRC=$(MANDIR)/cdist.text \ - $(MANDIR)/cdist-best-practise.text \ - $(MANDIR)/cdist-hacker.text \ - $(MANDIR)/cdist-quickstart.text \ - $(MANDIR)/cdist-reference.text \ - $(MANDIR)/cdist-stages.text \ - $(MANDIR)/cdist-type.text \ # Manpages from types -MAN7TYPESRC=$(shell ls conf/type/*/man.text) +MAN7TYPESRC=$(ls conf/type/*/man.text) # Source files after linking them -MAN1TMPSRC=$(shell ls $(MAN1DSTDIR)/*.text) -MAN7TMPSRC=$(shell ls $(MAN7DSTDIR)/*.text) +MAN1TMPSRC=$(shell ls ${MAN1DSTDIR}/*.text) +MAN7TMPSRC=$(shell ls ${MAN7DSTDIR}/*.text) # Destination files based on linked files, not static list MAN1DST=$(MAN1TMPSRC:.text=.1) @@ -85,18 +126,6 @@ MANHTML=$(MAN1TMPSRC:.text=.html) $(MAN7TMPSRC:.text=.html) # User targets # -all: - @echo '' - @echo 'Welcome to cdist!' - @echo '' - @echo 'Here are the possible targets:' - @echo '' - @echo ' man: Build manpages (requires Asciidoc)' - @echo ' manhtml: Build html-manpages (requires Asciidoc)' - @echo ' clean: Remove build stuff' - @echo '' - @echo '' - ################################################################################ # Documentation @@ -109,16 +138,11 @@ manhtml: $(MANHTML) $(MAN1DST) $(MAN7DST) $(MANHTML): $(MANOUTDIRS) # Create output dirs -$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR): +${MAN1DSTDIR} ${MAN7DSTDIR} $(MANHTMLDIR) $(MANTMPDIR): mkdir -p $@ # Link source files -manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MANOUTDIRS) - for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done - for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done - for mansrc in $(MAN7TYPESRC); do \ - dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \ - ln -sf ../../../$$mansrc $$dst; done +manlink: ${MAN1SRC} ${MAN7SRC} $(MANTYPE7SRC) $(MANOUTDIRS) %.1 %.7: %.text manlink $(A2XM) $*.text @@ -126,12 +150,12 @@ manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MANOUTDIRS) %.html: %.text manlink $(A2XH) $< -$(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh - $(MANDIR)/cdist-reference.text.sh +${MANDIR}/cdist-reference.text: ${MANDIR}/cdist-reference.text.sh + ${MANDIR}/cdist-reference.text.sh clean: rm -rf $(MANOUTDIRS) - rm -f $(MANDIR)/cdist-reference.text + rm -f ${MANDIR}/cdist-reference.text ################################################################################ # Developer targets @@ -144,15 +168,3 @@ test: .rsync nicosc@free.ethz.ch:cdist # gentoo .rsync nicosc@ru3.inf.ethz.ch:cdist - -web: manmove - cp README $(WEBDIR)/$(WEBPAGE) - rm -rf $(WEBDIR)/$(WEBBASE)/man && mkdir $(WEBDIR)/$(WEBBASE)/man - cp -r $(MANHTMLDIR)/* $(WEBDIR)/$(WEBBASE)/man - cd $(WEBDIR) && git add $(WEBBASE)/man - cd $(WEBDIR) && git commit -m "cdist update" $(WEBBASE) $(WEBPAGE) - cd $(WEBDIR) && make pub - -pub: - git push --mirror - git push --mirror github From 88ca7a44ec5180034afb31ce816d690fdbf5f47a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 22:10:52 +0100 Subject: [PATCH 33/35] finish most parts of translation Signed-off-by: Nico Schottelius --- build.sh | 157 +++++++++++++++++++++---------------------------------- 1 file changed, 59 insertions(+), 98 deletions(-) diff --git a/build.sh b/build.sh index 8509eddc..cf0574fd 100755 --- a/build.sh +++ b/build.sh @@ -37,55 +37,71 @@ MANDIR=doc/man MAN1DSTDIR=${MANDIR}/man1 MAN7DSTDIR=${MANDIR}/man7 -MAN1SRC= \ - ${MANDIR}/cdist-code-run.text \ - ${MANDIR}/cdist-code-run-all.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-remote-explorer-run.text \ - ${MANDIR}/cdist-run-remote.text \ - ${MANDIR}/cdist-type-build-emulation.text \ - ${MANDIR}/cdist-type-emulator.text \ - ${MANDIR}/cdist-type-template.text - -MAN7SRC=${MANDIR}/cdist.text \ - ${MANDIR}/cdist-best-practise.text \ - ${MANDIR}/cdist-hacker.text \ - ${MANDIR}/cdist-quickstart.text \ - ${MANDIR}/cdist-reference.text \ - ${MANDIR}/cdist-stages.text \ - ${MANDIR}/cdist-type.text \ - - case "$1" in man) - for mansrc in ${MAN1SRC} ${MAN7SRC}; do - ln -sf ../../../$mansrc ${MAN1DSTDIR}; + set -e + "$0" mandirs + "$0" mantype + "$0" man1 + "$0" man7 + "$0" manbuild + ;; + + manbuild) + for src in ${MAN1DSTDIR}/*.text ${MAN7DSTDIR}/*.text; do + echo "Compiling manpage and html for $src" + $A2XM "$src" + $A2XH "$src" done + ;; + + mandirs) + # Create destination directories + mkdir -p "${MAN1DSTDIR}" "${MAN7DSTDIR}" + ;; + + mantype) for mansrc in ${MAN7TYPESRC}; do dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')" - ln -sf ../../../$$mansrc $$dst + ln -sf "../../../$mansrc" "$dst" done ;; + man1) + for man in cdist-code-run.text cdist-code-run-all.text cdist-config.text \ + cdist-dir.text cdist-env.text cdist-explorer-run-global.text \ + cdist-deploy-to.text cdist-explorer.text cdist-manifest.text \ + cdist-manifest-run.text cdist-manifest-run-init.text \ + cdist-manifest-run-all.text cdist-object-explorer-all.text \ + cdist-object-gencode.text cdist-object-gencode-all.text \ + cdist-remote-explorer-run.text cdist-run-remote.text \ + cdist-type-build-emulation.text cdist-type-emulator.text \ + cdist-type-template.text + do + ln -sf ../$man ${MAN1DSTDIR} + done + ;; + + man7) + for man in cdist.text cdist-best-practise.text cdist-hacker.text \ + cdist-quickstart.text cdist-reference.text cdist-stages.text \ + cdist-type.text + do + ln -sf ../$man ${MAN7DSTDIR} + done + ;; + + mangen) + ${MANDIR}/cdist-reference.text.sh + ;; + web) cp README ${WEBDIR}/${WEBPAGE} rm -rf ${WEBDIR}/${WEBBASE}/man && mkdir ${WEBDIR}/${WEBBASE}/man - cp -r $(MANHTMLDIR)/* ${WEBDIR}/${WEBBASE}/man - cd ${WEBDIR} && git add ${WEBBASE}/man - cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} - cd ${WEBDIR} && make pub + cp -r ${MANHTMLDIR}/* ${WEBDIR}/${WEBBASE}/man + cd ${WEBDIR} && echo git add ${WEBBASE}/man + cd ${WEBDIR} && echo git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} + cd ${WEBDIR} && echo make pub ;; pub) @@ -93,6 +109,11 @@ case "$1" in git push --mirror github ;; + clean) + rm -rf "$MAN1DSTDIR" "$MAN7DSTDIR" + rm -f ${MANDIR}/cdist-reference.text + ;; + *) echo '' echo 'Welcome to cdist!' @@ -108,63 +129,3 @@ case "$1" in exit 1 ;; esac - - -# Manpages from types -MAN7TYPESRC=$(ls conf/type/*/man.text) - -# Source files after linking them -MAN1TMPSRC=$(shell ls ${MAN1DSTDIR}/*.text) -MAN7TMPSRC=$(shell ls ${MAN7DSTDIR}/*.text) - -# Destination files based on linked files, not static list -MAN1DST=$(MAN1TMPSRC:.text=.1) -MAN7DST=$(MAN7TMPSRC:.text=.7) -MANHTML=$(MAN1TMPSRC:.text=.html) $(MAN7TMPSRC:.text=.html) - -################################################################################ -# User targets -# - - -################################################################################ -# Documentation -# - -# Create manpages -man: $(MAN1DST) $(MAN7DST) -manhtml: $(MANHTML) - -$(MAN1DST) $(MAN7DST) $(MANHTML): $(MANOUTDIRS) - -# Create output dirs -${MAN1DSTDIR} ${MAN7DSTDIR} $(MANHTMLDIR) $(MANTMPDIR): - mkdir -p $@ - -# Link source files -manlink: ${MAN1SRC} ${MAN7SRC} $(MANTYPE7SRC) $(MANOUTDIRS) - -%.1 %.7: %.text manlink - $(A2XM) $*.text - -%.html: %.text manlink - $(A2XH) $< - -${MANDIR}/cdist-reference.text: ${MANDIR}/cdist-reference.text.sh - ${MANDIR}/cdist-reference.text.sh - -clean: - rm -rf $(MANOUTDIRS) - rm -f ${MANDIR}/cdist-reference.text - -################################################################################ -# Developer targets -# - -test: - # ubuntu - .rsync lyni@tablett:cdist - # redhat - .rsync nicosc@free.ethz.ch:cdist - # gentoo - .rsync nicosc@ru3.inf.ethz.ch:cdist From 683e813ce22da3ff76933dff093710e16a104db7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 22:13:07 +0100 Subject: [PATCH 34/35] adjust web target Signed-off-by: Nico Schottelius --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index cf0574fd..2c1570f5 100755 --- a/build.sh +++ b/build.sh @@ -98,10 +98,10 @@ case "$1" in web) cp README ${WEBDIR}/${WEBPAGE} rm -rf ${WEBDIR}/${WEBBASE}/man && mkdir ${WEBDIR}/${WEBBASE}/man - cp -r ${MANHTMLDIR}/* ${WEBDIR}/${WEBBASE}/man - cd ${WEBDIR} && echo git add ${WEBBASE}/man - cd ${WEBDIR} && echo git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} - cd ${WEBDIR} && echo make pub + cp ${MAN1DSTDIR}/*.html ${MAN7DSTDIR}/*.html ${WEBDIR}/${WEBBASE}/man + cd ${WEBDIR} && git add ${WEBBASE}/man + cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} + cd ${WEBDIR} && make pub ;; pub) From 3356564c7772bfc1202aed4957663a23ce2b60e7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 22:24:02 +0100 Subject: [PATCH 35/35] upgrade to 1.4.1 Signed-off-by: Nico Schottelius --- bin/cdist-config | 2 +- doc/changelog | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 00872438..86039f00 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -19,7 +19,7 @@ # # -__cdist_version="1.4.0" +__cdist_version="1.4.1" # Fail if something bogus is going on set -u diff --git a/doc/changelog b/doc/changelog index fb0bb1f9..5cfae26f 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -1.4.1: +1.4.1: 2011-03-25 * New type __key_value (Steven Armstrong) * New type __apt_ppa (Steven Armstrong) * Documentation: Manpage generation cleanup