From 4178c0c69d48cba311fb7b856ce2c3bee9ef62fb Mon Sep 17 00:00:00 2001 From: Ryan Brady Date: Wed, 22 Oct 2014 11:24:04 -0400 Subject: [PATCH] Deprecate map-packages, replaced by pkg-map This patch writes a warning out to stderr to notify element authors that may be using map-packages to migrate to pkg-map. This patch also prints out a warning during image-create that lists the specific elements that are not using pkg-map. Change-Id: I7e2a7611dd5650815736ce998aa94a7833193d06 --- elements/opensuse/bin/map-packages | 6 ++++++ elements/pkg-map/extra-data.d/10-create-pkg-map-dir | 2 +- elements/redhat-common/bin/map-packages | 6 ++++++ elements/rhel/bin/map-packages | 7 ++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/elements/opensuse/bin/map-packages b/elements/opensuse/bin/map-packages index 7cac06c83..1e2f54289 100755 --- a/elements/opensuse/bin/map-packages +++ b/elements/opensuse/bin/map-packages @@ -1,4 +1,6 @@ #!/usr/bin/env python +# dib-lint: disable=indent +# dib-lint indent requirements causes issue with pep8 # Copyright 2013 SUSE Linux Products GmbH # @@ -14,6 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. +from __future__ import print_function import sys # Manually maintained for brevity; consider making this compiled from @@ -57,6 +60,9 @@ package_map = { 'openstack-neutron-openvswitch': 'openstack-neutron-openvswitch-agent', } +print("WARNING: map-packages is deprecated. Please use the pkg-map element.", + file=sys.stderr) + for arg in sys.argv[1:]: print(package_map.get(arg, arg)) sys.exit(0) diff --git a/elements/pkg-map/extra-data.d/10-create-pkg-map-dir b/elements/pkg-map/extra-data.d/10-create-pkg-map-dir index bfd93aa2b..cb9b0467c 100755 --- a/elements/pkg-map/extra-data.d/10-create-pkg-map-dir +++ b/elements/pkg-map/extra-data.d/10-create-pkg-map-dir @@ -7,7 +7,7 @@ sudo mkdir -p $TMP_MOUNT_PATH/usr/share/pkg-map/ for ELEMENT in $IMAGE_ELEMENT ; do for DIR in ${ELEMENTS_PATH//:/ }; do if [ -f "$DIR/$ELEMENT/pkg-map" ]; then - sudo cp $DIR/$ELEMENT/pkg-map $TMP_MOUNT_PATH/usr/share/pkg-map/$ELEMENT + sudo cp "$DIR/$ELEMENT/pkg-map" "$TMP_MOUNT_PATH/usr/share/pkg-map/$ELEMENT" fi done done diff --git a/elements/redhat-common/bin/map-packages b/elements/redhat-common/bin/map-packages index 64244480f..cf2f757e8 100755 --- a/elements/redhat-common/bin/map-packages +++ b/elements/redhat-common/bin/map-packages @@ -1,4 +1,6 @@ #!/usr/bin/env python +# dib-lint: disable=indent +# dib-lint indent requirements causes issue with pep8 # Copyright 2012 Hewlett-Packard Development Company, L.P. # @@ -14,6 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. +from __future__ import print_function import sys # Manually maintained for brevity; consider making this compiled from @@ -80,6 +83,9 @@ package_map = { 'openstack-neutron-dhcp-agent': 'openstack-neutron', } +print("WARNING: map-packages is deprecated. Please use the pkg-map element.", + file=sys.stderr) + for arg in sys.argv[1:]: if arg not in package_map and arg.endswith('-dev'): # convert -dev into devel diff --git a/elements/rhel/bin/map-packages b/elements/rhel/bin/map-packages index 026c46a9a..97e500287 100755 --- a/elements/rhel/bin/map-packages +++ b/elements/rhel/bin/map-packages @@ -1,5 +1,6 @@ #!/usr/bin/env python - +# dib-lint: disable=indent +# dib-lint indent requirements causes issue with pep8 # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -13,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +from __future__ import print_function import sys # Manually maintained for brevity; consider making this compiled from @@ -40,6 +42,9 @@ package_map = { 'vlan': 'vconfig', } +print("WARNING: map-packages is deprecated. Please use the pkg-map element.", + file=sys.stderr) + for arg in sys.argv[1:]: print(package_map.get(arg, arg)) sys.exit(0)