projects
/
osm
/
devops.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Dockerfiles to add missing apt-update before apt-install
[osm/devops.git]
/
descriptor-packages
/
mk
/
pkg.mk
diff --git
a/descriptor-packages/mk/pkg.mk
b/descriptor-packages/mk/pkg.mk
index
350af35
..
4226ebf
100644
(file)
--- a/
descriptor-packages/mk/pkg.mk
+++ b/
descriptor-packages/mk/pkg.mk
@@
-20,49
+20,63
@@
TOOLS_DIR := $(TOPDIR)/descriptor-packages/tools
PKG_BASE_NAME := $(shell basename $(shell pwd))
PKG_NAME := $(addsuffix .tar.gz, $(PKG_BASE_NAME))
PKG_BASE_NAME := $(shell basename $(shell pwd))
PKG_NAME := $(addsuffix .tar.gz, $(PKG_BASE_NAME))
-CHARM_DIR := $(TOPDIR)/
juju-
charms
+CHARM_DIR := $(TOPDIR)/charms
CHARM_SRC_DIR := $(CHARM_DIR)/layers
CHARM_DOCKER_TAG := charm-tools
CHARM_BUILD_DIR := $(CHARM_DIR)/builds
CHARM_SRC_DIR := $(CHARM_DIR)/layers
CHARM_DOCKER_TAG := charm-tools
CHARM_BUILD_DIR := $(CHARM_DIR)/builds
+DOCKER_BUILD ?=
Q=@
GEN_VNFD_PKG := $(TOOLS_DIR)/gen_vnfd_pkg.sh
GEN_NSD_PKG := $(TOOLS_DIR)/gen_nsd_pkg.sh
GEN_PKG := $(TOOLS_DIR)/generate_descriptor_pkg.sh
Q=@
GEN_VNFD_PKG := $(TOOLS_DIR)/gen_vnfd_pkg.sh
GEN_NSD_PKG := $(TOOLS_DIR)/gen_nsd_pkg.sh
GEN_PKG := $(TOOLS_DIR)/generate_descriptor_pkg.sh
+TEST_PKG := $(TOOLS_DIR)/validate_descriptor.py
BUILD_VNFD := $(shell readlink -f .|sed -e 's/\/.*descriptor-packages//' | grep vnfd)
DEP_FILES = $(wildcard src/*)
ifdef BUILD_VNFD
BUILD_VNFD := $(shell readlink -f .|sed -e 's/\/.*descriptor-packages//' | grep vnfd)
DEP_FILES = $(wildcard src/*)
ifdef BUILD_VNFD
-$(BUILD_DIR)/$(PKG_BASE_NAME): src
$(DEP_FILES)
+$(BUILD_DIR)/$(PKG_BASE_NAME): src
$(Q)mkdir -p $@
$(Q)cp -rf $</. $@
$(Q)$(GEN_VNFD_PKG) $< $@
else
$(Q)mkdir -p $@
$(Q)cp -rf $</. $@
$(Q)$(GEN_VNFD_PKG) $< $@
else
-$(BUILD_DIR)/$(PKG_BASE_NAME): src
$(DEP_FILES)
+$(BUILD_DIR)/$(PKG_BASE_NAME): src
$(Q)mkdir -p $@
$(Q)cp -rf $</. $@
$(Q)$(GEN_NSD_PKG) $< $@
endif
ifdef VNFD_CHARM
$(Q)mkdir -p $@
$(Q)cp -rf $</. $@
$(Q)$(GEN_NSD_PKG) $< $@
endif
ifdef VNFD_CHARM
-$(BUILD_DIR)/$(PKG_NAME): $(
BUILD_DIR)/$(PKG_BASE_NAME
) $(CHARM_BUILD_DIR)/$(VNFD_CHARM)
+$(BUILD_DIR)/$(PKG_NAME): $(
DEP_FILES
) $(CHARM_BUILD_DIR)/$(VNFD_CHARM)
$(Q)echo "building $(PKG_BASE_NAME) with charm $(VNFD_CHARM)"
$(Q)echo "building $(PKG_BASE_NAME) with charm $(VNFD_CHARM)"
+ $(Q)$(MAKE) --no-print-directory $(BUILD_DIR)/$(PKG_BASE_NAME)
$(Q)cp -rf $(CHARM_BUILD_DIR)/$(VNFD_CHARM) $(BUILD_DIR)/$(PKG_BASE_NAME)/charms
$(Q)$(GEN_PKG) --no-remove-files -d $(BUILD_DIR) $(BUILD_DIR)/$(PKG_BASE_NAME)
else
$(Q)cp -rf $(CHARM_BUILD_DIR)/$(VNFD_CHARM) $(BUILD_DIR)/$(PKG_BASE_NAME)/charms
$(Q)$(GEN_PKG) --no-remove-files -d $(BUILD_DIR) $(BUILD_DIR)/$(PKG_BASE_NAME)
else
-$(BUILD_DIR)/$(PKG_NAME): $(BUILD_DIR)/$(PKG_BASE_NAME)
- $(Q)echo "building $(PKG_BASE_NAME)"
+$(BUILD_DIR)/$(PKG_NAME): $(DEP_FILES)
+ $(Q)echo "building $(PKG_BASE_NAME) $(BUILD_DIR)"
+ $(Q)$(MAKE) --no-print-directory $(BUILD_DIR)/$(PKG_BASE_NAME)
$(Q)$(GEN_PKG) --no-remove-files -d $(BUILD_DIR) $(BUILD_DIR)/$(PKG_BASE_NAME)
endif
$(Q)$(GEN_PKG) --no-remove-files -d $(BUILD_DIR) $(BUILD_DIR)/$(PKG_BASE_NAME)
endif
+ifdef DOCKER_BUILD
$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
$(Q)docker build -q -t $(CHARM_DOCKER_TAG) $(CHARM_DIR)/.
$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
$(Q)docker build -q -t $(CHARM_DOCKER_TAG) $(CHARM_DIR)/.
- $(Q)docker run -u $$(id -u):$$(id -g) -v$(CHARM_DIR):$(CHARM_DIR) -w$(CHARM_DIR) $(CHARM_DOCKER_TAG) charm-build -o $(CHARM_DIR) $<
-
+ $(CHARM_DIR) $(CHARM_DOCKER_TAG) charm-build -o $(CHARM_DIR) $<
+else
+$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
+ $(Q)charm build -o $(CHARM_DIR) $<
+endif
+
clean:
$(Q)rm -rf $(BUILD_DIR)
$(Q)rm -rf $(CHARM_BUILD_DIR)
clean:
$(Q)rm -rf $(BUILD_DIR)
$(Q)rm -rf $(CHARM_BUILD_DIR)
+test:
+ $(Q)echo -n testing $(shell readlink -f src/*.yaml) " "
+ $(Q)$(TEST_PKG) src/*.yaml
+ $(Q)echo OK
+
.DEFAULT_GOAL := all
.DEFAULT_GOAL := all