Update policy module dependency checking 99/6599/1
authorMike Marchetti <mmarchetti@sandvine.com>
Mon, 1 Oct 2018 16:37:59 +0000 (12:37 -0400)
committerMike Marchetti <mmarchetti@sandvine.com>
Mon, 1 Oct 2018 16:40:28 +0000 (12:40 -0400)
- dependency checking needs to be full package name
- POL uses different naming scheme for package
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
Change-Id: I87c8c6c4291803562225e45b8af86df358dabfb6

docker/POL/Makefile
docker/mk/Makefile.include
docker/mk/get_version.sh

index d64462a..e7833c5 100644 (file)
@@ -1,3 +1,4 @@
 include ../mk/Makefile.include
 
 MDG=$(shell basename $(CURDIR))
+CONTAINER_NAME=pol
index e1f47b3..fb576e7 100644 (file)
@@ -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)
index 8b6e1cd..7508ac8 100755 (executable)
@@ -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;