From 514daf3d4611c3d6f451964b5f7ebce22219e6d3 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 16 Jul 2016 21:43:38 +0200 Subject: replace krebs.build.populate by populate --- Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index aa5d5d8c..be069ec3 100644 --- a/Makefile +++ b/Makefile @@ -68,23 +68,27 @@ evaluate = \ -I stockholm=$(stockholm) \ -E "let eval = import ; in with eval; $(1)" -execute = \ - result=$$($(call evaluate,config.krebs.build.$(1))) && \ - script=$$(echo "$$result" | jq -r .) && \ - echo "$$script" | PS5=% sh - ifeq ($(MAKECMDGOALS),) $(error No goals specified) endif # usage: make deploy system=foo [target_host=bar] deploy: ssh ?= ssh -deploy: - $(call execute,populate) +deploy: populate $(ssh) $(target_user)@$(target_host) -p $(target_port) \ env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \ nixos-rebuild switch --show-trace -I $(target_path) +# usage: make populate system=foo +ifeq ($(debug),true) +populate: populate-flags = --debug +endif +populate: + source=$$($(call evaluate,config.krebs.build.source) --json --strict) && \ + echo $$source | populate \ + $(target_user)@$(target_host):$(target_port)$(target_path) \ + $(populate-flags) + # usage: make build.pkgs.get build build.:;@$(call build,$${expr-eval}) build.%:;@$(call build,$@) @@ -99,7 +103,7 @@ install: $(ssh) $(target_user)@$(target_host) -p $(target_port) \ env target_path=$(target_path) \ sh -s prepare < krebs/4lib/infest/prepare.sh - target_path=/mnt$(target_path) $(call execute,populate) + $(MAKE) populate target_path=/mnt$(target_path) $(ssh) $(target_user)@$(target_host) -p $(target_port) \ env NIXOS_CONFIG=$(target_path)/nixos-config \ STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \ @@ -117,8 +121,7 @@ $(error bad method: $(method)) endif endif test: ssh ?= ssh -test: - $(call execute,populate) +test: populate $(ssh) $(target_user)@$(target_host) -p $(target_port) \ $(command) --show-trace -I $(target_path) \ -A config.system.build.toplevel $(target_path)/stockholm -- cgit v1.2.3 From 9c4ed31565f3491f055963bcd7869bd0c1e62aa5 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 17 Jul 2016 00:31:53 +0200 Subject: make populate: drop redundant variable: source --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index be069ec3..064cba48 100644 --- a/Makefile +++ b/Makefile @@ -84,10 +84,10 @@ ifeq ($(debug),true) populate: populate-flags = --debug endif populate: - source=$$($(call evaluate,config.krebs.build.source) --json --strict) && \ - echo $$source | populate \ - $(target_user)@$(target_host):$(target_port)$(target_path) \ - $(populate-flags) + $(call evaluate,config.krebs.build.source) --json --strict | \ + populate \ + $(target_user)@$(target_host):$(target_port)$(target_path) \ + $(populate-flags) # usage: make build.pkgs.get build build.:;@$(call build,$${expr-eval}) -- cgit v1.2.3 From a428b4dcbb92ddd90f184f72a97ffdb300083e6e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 17 Jul 2016 00:52:21 +0200 Subject: make build -> make pkgs --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 064cba48..510d7b5c 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ build = \ --show-trace \ -I nixos-config=$(nixos-config) \ -I stockholm=$(stockholm) \ - -E "let build = import ; in $(1)" + -E "with import ; $(1)" evaluate = \ nix-instantiate \ @@ -89,9 +89,9 @@ populate: $(target_user)@$(target_host):$(target_port)$(target_path) \ $(populate-flags) -# usage: make build.pkgs.get -build build.:;@$(call build,$${expr-eval}) -build.%:;@$(call build,$@) +# usage: make pkgs.populate +pkgs:;@$(error no package selected) +pkgs.%:;@$(call build,$@) # usage: make LOGNAME=shared system=wolf eval.config.krebs.build.host.name eval eval.:;@$(call evaluate,$${expr-eval}) -- cgit v1.2.3 From 10ff2cf70a11ae7a624d34c09bd04ff3f1b51983 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 17 Jul 2016 01:30:11 +0200 Subject: make populate: admit $ssh --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 510d7b5c..8279637c 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,9 @@ deploy: populate ifeq ($(debug),true) populate: populate-flags = --debug endif +ifneq ($(ssh),) +populate: populate-flags += --ssh=$(ssh) +endif populate: $(call evaluate,config.krebs.build.source) --json --strict | \ populate \ -- cgit v1.2.3 From 0b84e3f161cee0ac20c6a85f18ad946ce980e0c2 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 17 Jul 2016 02:37:46 +0200 Subject: Makefile: define default target --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8279637c..e6a8eeb9 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,8 @@ $(if $(target_user),,$(error unbound variable: target_user)) $(if $(target_port),,$(error unbound variable: target_port)) $(if $(target_path),,$(error unbound variable: target_path)) +export target ?= $(target_user)@$(target_host):$(target_port)$(target_path) + build = \ nix-build \ --no-out-link \ @@ -81,16 +83,14 @@ deploy: populate # usage: make populate system=foo ifeq ($(debug),true) -populate: populate-flags = --debug +populate: populate-flags += --debug endif ifneq ($(ssh),) populate: populate-flags += --ssh=$(ssh) endif populate: $(call evaluate,config.krebs.build.source) --json --strict | \ - populate \ - $(target_user)@$(target_host):$(target_port)$(target_path) \ - $(populate-flags) + populate $(target) $(populate-flags) # usage: make pkgs.populate pkgs:;@$(error no package selected) -- cgit v1.2.3 From 14ccdf48b61e400fd45e180cd0a16e8f99bd0678 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 17 Jul 2016 02:58:20 +0200 Subject: make deploy: admit debug --- Makefile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e6a8eeb9..3857a239 100644 --- a/Makefile +++ b/Makefile @@ -41,17 +41,17 @@ target_path ?= $(_target_path) endif endif -export target_host ?= $(system) -export target_user ?= root -export target_port ?= 22 -export target_path ?= /var/src +target_host ?= $(system) +target_user ?= root +target_port ?= 22 +target_path ?= /var/src $(if $(target_host),,$(error unbound variable: target_host)) $(if $(target_user),,$(error unbound variable: target_user)) $(if $(target_port),,$(error unbound variable: target_port)) $(if $(target_path),,$(error unbound variable: target_path)) -export target ?= $(target_user)@$(target_host):$(target_port)$(target_path) +target ?= $(target_user)@$(target_host):$(target_port)$(target_path) build = \ nix-build \ @@ -75,11 +75,17 @@ $(error No goals specified) endif # usage: make deploy system=foo [target_host=bar] +ifeq ($(debug),true) +deploy: rebuild-command = dry-activate +else +deploy: rebuild-command = switch +endif deploy: ssh ?= ssh -deploy: populate +deploy: + $(MAKE) populate debug=false $(ssh) $(target_user)@$(target_host) -p $(target_port) \ env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \ - nixos-rebuild switch --show-trace -I $(target_path) + nixos-rebuild $(rebuild-command) --show-trace -I $(target_path) # usage: make populate system=foo ifeq ($(debug),true) -- cgit v1.2.3