Merge "Target map-packages deprecation message"

This commit is contained in:
Jenkins 2017-02-07 06:24:41 +00:00 committed by Gerrit Code Review
commit ab478545b1
2 changed files with 50 additions and 9 deletions

View file

@ -22,6 +22,13 @@ import sys
# Manually maintained for brevity; consider making this compiled from
# distromatch or other rich data sources.
# Debian name on the left, Fedora/RHEL on the right.
#
# !!! DO NOT ADD ANY ENTRIES TO THIS FILE !!!
#
# This global list has been deprecated by the pkg-map element. New
# package mappings should go in pkg-map files inside each element.
#
package_map = {
'apache2': 'httpd',
'arping': 'iputils',
@ -81,13 +88,30 @@ package_map = {
'openstack-neutron-dhcp-agent': 'openstack-neutron',
}
print("WARNING: map-packages is deprecated. Please use the pkg-map element.",
file=sys.stderr)
deprecated = []
for arg in sys.argv[1:]:
if arg not in package_map and arg.endswith('-dev'):
# convert -dev into devel
print('%s%s' % (arg, 'el'))
converted = '%s%s' % (arg, 'el')
deprecated.append((arg, converted))
print(converted)
else:
print(package_map.get(arg, arg))
converted = package_map.get(arg, arg)
if converted != arg:
deprecated.append((arg, converted))
print(converted)
if deprecated:
print("WARNING: The following packages were re-mapped by "
"redhat-common map-packages\n"
"They should be converted to pkg-map:", file=sys.stderr)
for arg, converted in deprecated:
print(" %s -> %s" % (arg, converted), file=sys.stderr)
sys.exit(0)
# Tell emacs to use python-mode
# Local variables:
# mode: python
# End:

View file

@ -18,6 +18,14 @@ import sys
# Manually maintained for brevity; consider making this compiled from
# distromatch or other rich data sources.
# Debian name on the left, RHEL on the right.
#
# !!! DO NOT ADD ANY ENTRIES TO THIS FILE !!!
#
# This global list has been deprecated by the pkg-map element. New
# package mappings should go in pkg-map files inside each element.
#
package_map = {
'augeas-tools': 'augeas',
'build-essential': 'make automake gcc gcc-c++ kernel-devel',
@ -40,9 +48,18 @@ package_map = {
'vlan': 'vconfig',
}
print("WARNING: map-packages is deprecated. Please use the pkg-map element.",
file=sys.stderr)
deprecated = []
for arg in sys.argv[1:]:
print(package_map.get(arg, arg))
mapped = package_map.get(arg, arg)
if mapped != arg:
deprecated.append((arg, mapped))
print(mapped)
if deprecated:
print("WARNING: The following packages were re-mapped by "
"rhel map-packages.\n"
"They should be converted to pkg-map:\n", file=sys.stderr)
for arg, converted in deprecated:
print(" %s -> %s" % (arg, converted), file=sys.stderr)
sys.exit(0)