Source

appliancekit-ng / ak-convert

William Pitcock f07f220 























#!/usr/bin/env python

import json
import sys
from appliancekit.axml import get_appliance_config_from_xml_file

axmlconfig = get_appliance_config_from_xml_file(sys.argv[1])

distMap = {
	'lenny': 'debian-5',
	'squeeze': 'debian-6',
	'wheezy': 'debian-7',
	'sid': 'debian-base',

	'lucid': 'ubuntu-10.04',
}

def get_distname(name):
    if distMap.has_key(name):
        return distMap[name]
    return name

print '{% extends "' + get_distname(axmlconfig['distribution']) + '.spec" %}'
if axmlconfig.has_key('packageList') and len(axmlconfig['packageList']) > 0:
    print "{% " + "set packages={}".format(json.dumps(axmlconfig['packageList'])) + " %}"