From f039a9b79602bb083b1c6caf62e9f156fb0b2d0a Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 7 Apr 2017 18:22:51 +0200 Subject: [PATCH] drop deprecated map-services/packages from zypper element Change-Id: Ie3065dcc6aefccba93c02085e9977681d1b0535c --- diskimage_builder/elements/base/pkg-map | 3 + diskimage_builder/elements/bootloader/pkg-map | 1 + .../elements/dracut-ramdisk/pkg-map | 5 +- .../elements/zypper/bin/install-packages | 47 ++++--------- .../elements/zypper/bin/map-packages | 68 ------------------- .../elements/zypper/bin/map-services | 66 ------------------ 6 files changed, 20 insertions(+), 170 deletions(-) delete mode 100755 diskimage_builder/elements/zypper/bin/map-packages delete mode 100755 diskimage_builder/elements/zypper/bin/map-services diff --git a/diskimage_builder/elements/base/pkg-map b/diskimage_builder/elements/base/pkg-map index 316bd849..c8e0d94e 100644 --- a/diskimage_builder/elements/base/pkg-map +++ b/diskimage_builder/elements/base/pkg-map @@ -23,6 +23,9 @@ "syslinux-common": "", "tftp": "net-ftp/tftp-hpa", "tgt": "sys-block/tgt" + }, + "suse": { + "qemu-utils": "qemu-tools" } }, "default": { diff --git a/diskimage_builder/elements/bootloader/pkg-map b/diskimage_builder/elements/bootloader/pkg-map index 4094feb6..95751956 100644 --- a/diskimage_builder/elements/bootloader/pkg-map +++ b/diskimage_builder/elements/bootloader/pkg-map @@ -7,6 +7,7 @@ }, "suse": { "dkms_package": "", + "extlinux": "syslinux", "grub-pc": "grub2" }, "redhat": { diff --git a/diskimage_builder/elements/dracut-ramdisk/pkg-map b/diskimage_builder/elements/dracut-ramdisk/pkg-map index e3f83163..2759236a 100644 --- a/diskimage_builder/elements/dracut-ramdisk/pkg-map +++ b/diskimage_builder/elements/dracut-ramdisk/pkg-map @@ -6,10 +6,13 @@ }, "redhat":{ "ncat":"nmap-ncat" + }, + "suse":{ + "arping": "iputils" } }, "default":{ "ncat":"ncat", "tftp":"tftp" } -} \ No newline at end of file +} diff --git a/diskimage_builder/elements/zypper/bin/install-packages b/diskimage_builder/elements/zypper/bin/install-packages index 7728b2e4..6d61d616 100755 --- a/diskimage_builder/elements/zypper/bin/install-packages +++ b/diskimage_builder/elements/zypper/bin/install-packages @@ -21,7 +21,7 @@ set -eu set -o pipefail EXTRA_ARGS="--no-recommends" -MAP_ELEMENT="" +MAP_ELEMENT= ACTION=install SCRIPTNAME=$(basename $0) @@ -57,39 +57,16 @@ while true ; do esac done -# Packages that aren't available in the distro but requested for installation -# can be ignored by adding them to the exclude list -BLACKLIST=('') -WHITELIST=('') - -for i in "$@" -do - PKG_NAME=$i - if [ -n "$MAP_ELEMENT" ]; then - if ! PKG_NAME=$(pkg-map --element $MAP_ELEMENT $i); then - echo "bin/pkg-map error. $PKG_NAME" - exit 1 - fi - fi - if [[ ! ${BLACKLIST[*]} =~ $PKG_NAME ]]; then - WHITELIST+="$i " - else - echo "The package $i is not available and will not be installed" - fi -done - -if [ -n "$WHITELIST" ]; then - if [ -n "$MAP_ELEMENT" ]; then - if ! PKGS=$(pkg-map --element $MAP_ELEMENT $WHITELIST); then - echo "bin/pkg-map error. $PKGS" - exit 1 - fi - else - PKGS=$(map-packages $WHITELIST) - fi - if [ -z "${PKGS}" ]; then - echo 'No packages need to be installed' - else - run_zypper $ACTION $EXTRA_ARGS $PKGS +PKGS=$@ +if [ -n "$MAP_ELEMENT" ]; then + if ! PKGS=$(pkg-map --element $MAP_ELEMENT $@); then + echo "bin/pkg-map error. $PKGS" + exit 1 fi fi + +if [ -z "${PKGS}" ]; then + echo "Not running install-packages $ACTION with empty packages list" +else + run_zypper $ACTION $EXTRA_ARGS $PKGS +fi diff --git a/diskimage_builder/elements/zypper/bin/map-packages b/diskimage_builder/elements/zypper/bin/map-packages deleted file mode 100755 index 1e2f5428..00000000 --- a/diskimage_builder/elements/zypper/bin/map-packages +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# dib-lint: disable=indent -# dib-lint indent requirements causes issue with pep8 - -# Copyright 2013 SUSE Linux Products GmbH -# -# 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 -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# 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 -# distromatch or other rich data sources. -# Debian name on the left, openSUSE on the right. -package_map = { - 'arping': 'iputils', - 'augeas-tools': 'augeas', - 'build-essential': 'make automake gcc gcc-c++ kernel-devel', - 'default-jre': 'java', - 'extlinux': 'syslinux', - 'grub-pc': 'grub2', - 'libapache2-mod-wsgi': 'apache2-mod_wsgi', - 'libc6-dev': 'glibc-devel', - 'libffi-dev': 'libffi-devel', - 'libmysql-java': 'mysql-connector-java', - 'libmysqlclient-dev': 'libmysqlclient-devel', - 'libssl-dev': 'openssl-devel', - 'libvirt-bin': 'libvirt', - 'libxml2-dev': 'libxml2-devel', - 'libxslt-dev': 'libxslt-devel', - 'libz-dev': 'zlib-devel', - 'linux-image-generic': 'kernel-default', - 'mysql-client-5.5': 'mariadb-client', - 'mysql-server-5.5': 'mariadb', - 'openjdk-7-jre-headless': 'java-1_7_0-openjdk-headless', - 'openssh-client': 'openssh', - 'openvswitch-common': 'openvswitch', - 'openvswitch-datapath-dkms': 'openvswitch-kmp', - 'openvswitch-switch': 'openvswitch-switch', - 'python-dev': 'python-devel', - 'python-libvirt': 'libvirt-python', - 'python-memcache': 'python-python-memcached', - 'python-mysqldb': 'python-mysql', - 'python-pyopenssl': 'python-pyOpenSSL', - 'qemu-utils': 'qemu-tools', - 'tftpd-hpa': 'tftp', - # openstack related package remappings - 'openstack-heat-common': 'openstack-heat', - 'openstack-neutron-ml2': 'openstack-neutron', - '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/diskimage_builder/elements/zypper/bin/map-services b/diskimage_builder/elements/zypper/bin/map-services deleted file mode 100755 index 76162e0f..00000000 --- a/diskimage_builder/elements/zypper/bin/map-services +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# dib-lint: disable=indent -# Copyright 2012 Hewlett-Packard Development Company, L.P. -# Copyright 2014 SUSE, Inc. -# -# 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 -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from __future__ import print_function -import os -import sys - -# Manually maintained for brevity; consider making this compiled from -# distromatch or other rich data sources. -# Debian name on the left, openSUSE on the right. -service_map = { - # openstack mapping - 'cinder-api': 'openstack-cinder-api', - 'cinder-backup': 'openstack-cinder-backup', - 'cinder-scheduler': 'openstack-cinder-scheduler', - 'cinder-volume': 'openstack-cinder-volume', - 'glance-api': 'openstack-glance-api', - 'glance-reg': 'openstack-glance-registry', - 'heat-api-cfn': 'openstack-heat-api-cfn', - 'heat-api-cloudwatch': 'openstack-heat-api-cloudwatch', - 'heat-api': 'openstack-heat-api', - 'heat-engine': 'openstack-heat-engine', - 'keystone': 'openstack-keystone', - 'libvirt-bin': 'libvirtd', - 'neutron-dhcp-agent': 'openstack-neutron-dhcp-agent', - 'neutron-openvswitch-agent': 'openstack-neutron-openvswitch-agent', - 'neutron-l3-agent': 'openstack-neutron-l3-agent', - 'neutron-metadata-agent': 'openstack-neutron-metadata-agent', - 'neutron-ovs-cleanup': 'openstack-neutron-ovs-cleanup', - 'neutron-server': 'openstack-neutron', - 'nova-api': 'openstack-nova-api', - 'nova-cert': 'openstack-nova-cert', - 'nova-compute': 'openstack-nova-compute', - 'nova-conductor': 'openstack-nova-conductor', - 'nova-consoleauth': 'openstack-nova-console', - 'nova-baremetal-deploy-helper': 'openstack-nova-baremetal-deploy-helper', - 'nova-novncproxy': 'openstack-nova-novncproxy', - 'nova-scheduler': 'openstack-nova-scheduler', -} - -print("WARNING: map-services has been deprecated. " - "Please use the svc-map element.", file=sys.stderr) - -for arg in sys.argv[1:]: - # We need to support the service name being different when installing from - # source vs. packages. So, if the requested service file already exists, - # just use that. - if os.path.exists('/usr/lib/systemd/system/%s.service' % arg): - print(arg) - else: - print(service_map.get(arg, arg)) -sys.exit(0)