From 9cf4156e6cf87f4eaa96180347badcbbb4a80644 Mon Sep 17 00:00:00 2001 From: Mike Marchetti Date: Mon, 1 Oct 2018 12:37:59 -0400 Subject: [PATCH] Update policy module dependency checking - dependency checking needs to be full package name - POL uses different naming scheme for package Signed-off-by: Mike Marchetti Change-Id: I87c8c6c4291803562225e45b8af86df358dabfb6 --- docker/POL/Makefile | 1 + docker/mk/Makefile.include | 11 ++++++++--- docker/mk/get_version.sh | 11 ++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docker/POL/Makefile b/docker/POL/Makefile index d64462ab..e7833c53 100644 --- a/docker/POL/Makefile +++ b/docker/POL/Makefile @@ -1,3 +1,4 @@ include ../mk/Makefile.include MDG=$(shell basename $(CURDIR)) +CONTAINER_NAME=pol diff --git a/docker/mk/Makefile.include b/docker/mk/Makefile.include index e1f47b3f..fb576e7b 100644 --- a/docker/mk/Makefile.include +++ b/docker/mk/Makefile.include @@ -14,10 +14,12 @@ NO_CACHE ?= --no-cache LOWER_MDG = $(shell echo $(MDG) | tr '[:upper:]' '[:lower:]') +CONTAINER_NAME ?= $(LOWER_MDG) + CMD_DOCKER_ARGS ?= -q DOCKER_ARGS = $(CMD_DOCKER_ARGS) -DEPS := MON IM LCM RO common osmclient devops NBI POL Keystone +DEPS := MON IM LCM RO common osmclient devops NBI policy-module Keystone DEPS_TARGETS = $(addprefix $(MKBUILD)/.dep_, $(DEPS)) @@ -26,6 +28,9 @@ Q=@ $(MKBUILD): $Qmkdir -p $(MKBUILD) +$(MKBUILD)/.dep_policy-module: + $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m POL -p policy-module > $@ + $(MKBUILD)/.dep_%: $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m $* > $@ @@ -42,7 +47,7 @@ build: $(MKBUILD) $(DEPS_TARGETS) --build-arg COMMON_VERSION==$(shell cat $(MKBUILD)/.dep_common) \ --build-arg OSMCLIENT_VERSION==$(shell cat $(MKBUILD)/.dep_osmclient) \ --build-arg NBI_VERSION==$(shell cat $(MKBUILD)/.dep_NBI) \ - --build-arg POL_VERSION==$(shell cat $(MKBUILD)/.dep_POL) \ + --build-arg POL_VERSION==$(shell cat $(MKBUILD)/.dep_policy-module) \ --build-arg DEVOPS_VERSION==$(shell cat $(MKBUILD)/.dep_devops) \ --build-arg LWUI_VERSION==$(shell date +%s) \ $(DOCKER_ARGS) . @@ -51,4 +56,4 @@ clean: rm -f $(MKBUILD)/.dep* tag: - docker tag osm/$(LOWER_MDG) osm/$(LOWER_MDG):$(TAG) + docker tag osm/$(CONTAINER_NAME) osm/$(LOWER_MDG):$(TAG) diff --git a/docker/mk/get_version.sh b/docker/mk/get_version.sh index 8b6e1cdb..7508ac8d 100755 --- a/docker/mk/get_version.sh +++ b/docker/mk/get_version.sh @@ -6,7 +6,7 @@ REPOSITORY="testing" REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian" DEBUG= -while getopts ":r:k:u:R:b:-:dm:" o; do +while getopts ":r:k:u:R:b:-:dm:p:" o; do case "${o}" in r) REPOSITORY=${OPTARG} @@ -23,6 +23,9 @@ while getopts ":r:k:u:R:b:-:dm:" o; do d) DEBUG=y ;; + p) + PACKAGE_NAME=${OPTARG} + ;; m) MDG=${OPTARG} ;; @@ -35,12 +38,14 @@ if [ -z "$MDG" ]; then echo "missing MDG" fi +[ -z "$PACKAGE_NAME" ] && PACKAGE_NAME=$MDG + if [ -n "$DEBUG" ]; then echo curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages fi -curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages 2>/dev/null | awk -v mdg=$MDG '{ - if ( /Package:/ && match($2,tolower(mdg)) ) { +curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages 2>/dev/null | awk -v pkg=$PACKAGE_NAME '{ + if ( /Package:/ && match($2,sprintf("%s$",tolower(pkg)) ) ) { package=1; } else if (package==1 && match($1,"Version:")) { package=0; -- 2.25.1