Rework net/nonet buildout switching
Stefan Bund [Wed, 28 Jul 2010 12:41:10 +0000 (14:41 +0200)]
Makefile.buildout
Makefile.master
Makefile.zope3-buildout

index 47c5738..ee93fba 100644 (file)
@@ -77,23 +77,29 @@ define buildout_opt
     _buildout_opt
 endef
 
-buildout-net.cfg: buildout.cfg
-       @$(buildout_opt) buildout.cfg add buildout download_cache $(DLCACHE)/downloads
-       @$(buildout_opt) buildout.cfg add buildout extends-cache $(DLCACHE)/extends
-       @$(buildout_opt) buildout.cfg set buildout install_from_cache true
-       @$(buildout_opt) buildout.cfg set buildout newest true
+buildout-net.cfg buildout-nonet.cfg: buildout.cfg
        mkdir -p $(DLCACHE)/downloads $(DLCACHE)/extends
-       @(                                      \
-           echo "[buildout]";                  \
-           echo "extends = buildout.cfg";      \
-           echo "install-from-cache = false";  \
-           echo "newest = true";               \
+       @(                                                      \
+           echo "[buildout]";                                  \
+           echo "extends = buildout.cfg";                      \
+           echo "download-cache = $(DLCACHE)/downloads";       \
+           echo "extends-cache = $(DLCACHE)/extends";          \
+           echo "install-from-cache = true";                   \
+           echo "newest = false";                              \
+       ) > buildout-nonet.cfg
+       @(                                                      \
+           echo "[buildout]";                                  \
+           echo "extends = buildout.cfg";                      \
+           echo "download-cache = $(DLCACHE)/downloads";       \
+           echo "extends-cache = $(DLCACHE)/extends";          \
+           echo "install-from-cache = false";                  \
+           echo "newest = true";                               \
        ) >  buildout-net.cfg
 
 BUILDOUT_OPTS = -c buildout-net.cfg
 
-init-nonet: BUILDOUT_OPTS =
-update-nonet: BUILDOUT_OPTS =
+init-nonet: BUILDOUT_OPTS = -c buildout-nonet.cfg
+update-nonet: BUILDOUT_OPTS = -c buildout-nonet.cfg
 
 bootstrap::
        sed -i -e '1s/^#!.*\/python/#!$(subst /,\/,$(PYTHON))/' $(PYTHON_DIR)/bin/*
@@ -101,3 +107,5 @@ bootstrap::
 
 .gitignore::
        @$(gitignore) "/buildout-net.cfg"
+       @$(gitignore) "/buildout-nonet.cfg"
+
index bbd6344..c90ff03 100644 (file)
@@ -62,20 +62,20 @@ default: shorthelp
 #
 # If the file exists in $(DLCACHE), it is retrieved from there instead.
 define httpget
-    _httpget() {                                                       \
-       name="$${1##*/}";                                               \
-       target="$$2";                                                   \
-       [ -n "$$target" ] || target="$$name";                           \
-       cache="$(DLCACHE)/$$name";                                      \
-       if [ -r "$$cache" ]; then                                       \
-           echo "Fetching '$$name' from cache.";                       \
-       else                                                            \
+    _httpget() {                                                               \
+       name="$${1##*/}";                                                       \
+       target="$$2";                                                           \
+       [ -n "$$target" ] || target="$$name";                                   \
+       cache="$(DLCACHE)/$$name";                                              \
+       if [ -r "$$cache" ]; then                                               \
+           echo "Fetching '$$name' from cache.";                               \
+       else                                                                    \
            [ -z "$(HTTPGET_NONET)" ] || ( echo "Missing '$$1'."; exit 2 );     \
-           echo "Downloading '$$1'.";                                  \
-           wget -O "$$cache" "$$1";                                    \
-       fi;                                                             \
-       cp "$$cache" "$$target";                                        \
-    };                                                                 \
+           echo "Downloading '$$1'.";                                          \
+           wget -O "$$cache" "$$1";                                            \
+       fi;                                                                     \
+       cp "$$cache" "$$target";                                                \
+    };                                                                         \
     _httpget
 endef
 
index 510ff66..f354821 100644 (file)
@@ -22,7 +22,7 @@ buildout.cfg:
 eggs::
        @$(install) zopeproject
 
-buildout:: buildout.cfg buildout-net.cfg
+buildout:: buildout.cfg buildout-net.cfg buildout-nonet.cfg
 
 bootstrap::
        @[ -n "$(PROJECTNAME)" ] || (echo "PROJECTNAME not set"; exit 2)