From 3e7c804fe5c755285046b40ce9d3965bbf095e79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Catalinas=20Jim=C3=A9nez?= <jimenezrick@gmail.com>
Date: Sun, 21 Sep 2014 17:59:38 +0100
Subject: [PATCH] Explain in the doc how to create a global dependency

---
 docs/man/man7/cdist-manifest.text | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/docs/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text
index 73e480ea..80df5410 100644
--- a/docs/man/man7/cdist-manifest.text
+++ b/docs/man/man7/cdist-manifest.text
@@ -125,7 +125,7 @@ requirements can be added white space separated.
 --------------------------------------------------------------------------------
 
 Above the "require" variable is only set for the command that is 
-immediately following it. Dependencies should allways be declared that way.
+immediately following it. Dependencies should always be declared that way.
 
 On line 4 you can see that the instantion of a type "\__link" object needs
 the object "__file/etc/cdist-configured" to be present, before it can proceed.
@@ -136,6 +136,29 @@ to be created. The task of cdist is to make sure, that the dependency will be
 resolved appropriately and thus "\__file/etc/cdist-configured" be created
 if necessary before "__link" proceeds (or to abort execution with an error).
 
+If you really need to make all types depend on a common dependency, you can
+export the "require" variable as well. But then, if you need to add extra
+dependencies to a specific type, you have to make sure that you append these
+to the globally already defined one.
+
+--------------------------------------------------------------------------------
+
+# First of all, update the package index
+__package_update_index
+# Upgrade all the installed packages afterwards
+require="__package_update_index" __package_upgrade_all
+# Create a common dependency for all the next types so that they get to
+# be executed only after the package upgrade has finished
+export require="__package_upgrade_all"
+
+# Ensure that lighttpd is installed after we have upgraded all the packages
+__package lighttpd --state present
+# Ensure that munin is installed after lighttpd is present and after all
+# the packages are upgraded
+require="$require __package/lighttpd" __package munin --state present
+
+--------------------------------------------------------------------------------
+
 All objects that are created in a type manifest are automatically required
 from the type that is calling them. This is called "autorequirement" in
 cdist jargon.