[elbe-devel] [PATCH 12/14] Debianize - Delete old code

Bastian Germann bage at linutronix.de
Thu Aug 1 15:49:15 CEST 2019


> From: Olivier Dion <dion at linutronix.de>
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>

Reviewed-by: Bastian Germann <bage at linutronix.de>

> ---
>  elbepack/debianize/__init__.py  |   0
>  elbepack/debianize/barebox.py   |  79 ---------------------
>  elbepack/debianize/base.py      | 151 ----------------------------------------
>  elbepack/debianize/debianize.py |  21 ------
>  elbepack/debianize/kernel.py    |  98 --------------------------
>  elbepack/debianize/uboot.py     | 105 ----------------------------
>  6 files changed, 454 deletions(-)
>  delete mode 100644 elbepack/debianize/__init__.py
>  delete mode 100644 elbepack/debianize/barebox.py
>  delete mode 100644 elbepack/debianize/base.py
>  delete mode 100644 elbepack/debianize/debianize.py
>  delete mode 100644 elbepack/debianize/kernel.py
>  delete mode 100644 elbepack/debianize/uboot.py
> 
> diff --git a/elbepack/debianize/__init__.py b/elbepack/debianize/__init__.py
> deleted file mode 100644
> index e69de29b..00000000
> diff --git a/elbepack/debianize/barebox.py b/elbepack/debianize/barebox.py
> deleted file mode 100644
> index fa8336a3..00000000
> --- a/elbepack/debianize/barebox.py
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -# ELBE - Debian Based Embedded Rootfilesystem Builder
> -# Copyright (c) 2017 Torben Hohn <torben.hohn at linutronix.de>
> -# Copyright (c) 2017 Manuel Traut <manut at linutronix.de>
> -#
> -# SPDX-License-Identifier: GPL-3.0-or-later
> -
> -import os
> -
> -from shutil import copyfile
> -
> -from npyscreen import TitleText
> -
> -from elbepack.directories import mako_template_dir
> -from elbepack.debianize.base import DebianizeBase, template
> -from elbepack.shellhelper import system
> -
> -
> -class BareBox (DebianizeBase):
> -
> -    # pylint: disable=too-many-ancestors
> -
> -    name = "barebox"
> -    files = ['Kbuild', 'Kconfig', 'README', 'TODO']
> -
> -    def __init__(self):
> -        self.defconfig = None
> -        self.imgname = None
> -        self.cross = None
> -        self.k_version = None
> -
> -        DebianizeBase.__init__(self)
> -
> -    def gui(self):
> -        self.defconfig = self.add_widget_intelligent(
> -            TitleText, name="defconfig:", value="imx_v7_defconfig")
> -
> -        self.imgname = self.add_widget_intelligent(
> -            TitleText,
> -            name="Imagename:",
> -            value="barebox-phytec-phycore-imx6dl-som-nand-256mb.img")
> -
> -        self.cross = self.add_widget_intelligent(
> -            TitleText, name="CROSS_COMPILE:", value="arm-linux-gnueabihf-")
> -
> -        self.k_version = self.add_widget_intelligent(
> -            TitleText, name="BareboxVersion:", value="2016.10")
> -
> -    def debianize(self):
> -        self.deb['k_arch'] = self.get_k_arch()
> -
> -        self.deb['defconfig'] = self.defconfig.get_value()
> -        self.deb['cross_compile'] = self.cross.get_value()
> -        self.deb['k_version'] = self.k_version.get_value()
> -        self.deb['imgname'] = self.imgname.get_value()
> -
> -        self.tmpl_dir = os.path.join(mako_template_dir, 'debianize/barebox')
> -        pkg_name = self.deb['p_name'] + '-' + self.deb['k_version']
> -
> -        for tmpl in ['control', 'rules']:
> -            with open(os.path.join('debian/', tmpl), 'w') as f:
> -                mako = os.path.join(self.tmpl_dir, tmpl + '.mako')
> -                f.write(template(mako, self.deb))
> -
> -        cmd = 'dch --package barebox-' + pkg_name + \
> -            ' -v ' + self.deb['p_version'] + \
> -            ' --create -M -D ' + self.deb['release'] + \
> -            ' "generated by elbe debianize"'
> -        system(cmd)
> -
> -        copyfile(os.path.join(self.tmpl_dir, 'barebox-image.install'),
> -                 'debian/barebox-image-' + pkg_name + '.install')
> -        copyfile(os.path.join(self.tmpl_dir, 'barebox-tools.install'),
> -                 'debian/barebox-tools-' + pkg_name + '.install')
> -
> -        self.hint = "use 'dpkg-buildpackage -a%s' to build the package" % (
> -                self.deb['p_arch'])
> -
> -
> -DebianizeBase.register(BareBox)
> diff --git a/elbepack/debianize/base.py b/elbepack/debianize/base.py
> deleted file mode 100644
> index dbe0536c..00000000
> --- a/elbepack/debianize/base.py
> +++ /dev/null
> @@ -1,151 +0,0 @@
> -# ELBE - Debian Based Embedded Rootfilesystem Builder
> -# Copyright (c) 2016-2017 Manuel Traut <manut at linutronix.de>
> -# Copyright (c) 2017 Torben Hohn <torben.hohn at linutronix.de>
> -# Copyright (c) 2017 Martin Kaistra <martin.kaistra at linutronix.de>
> -#
> -# SPDX-License-Identifier: GPL-3.0-or-later
> -
> -import os
> -import sys
> -
> -from time import sleep
> -from shutil import copyfile
> -
> -from npyscreen import FormMultiPage
> -from npyscreen import TitleText, TitleSelectOne, ButtonPress, notify
> -
> -from elbepack.templates import template
> -
> -
> -class DebianizeBase (FormMultiPage):
> -
> -    # pylint: disable=too-many-instance-attributes
> -    # pylint: disable=too-many-ancestors
> -
> -    srctypes = {}
> -    copyright_fname = 'COPYING'
> -
> -    @classmethod
> -    def register(cls, srctype):
> -        cls.srctypes[srctype.name] = srctype
> -
> -    @classmethod
> -    def get_debianizer(cls):
> -        for t in cls.srctypes.values():
> -            match = True
> -            for f in t.files:
> -                if not os.path.exists(f):
> -                    match = False
> -            if match:
> -                return t
> -
> -        raise KeyError
> -
> -    def __init__(self):
> -        self.deb = {}
> -        self.tmpl_dir = None
> -
> -        self.archs = ["arm64", "armhf", "armel", "amd64", "i386", "powerpc"]
> -        self.formats = ["native", "git", "quilt"]
> -        self.releases = [
> -            "stable",
> -            "oldstable",
> -            "testing",
> -            "unstable",
> -            "experimental"]
> -
> -        self.hint = None
> -
> -        FormMultiPage.__init__(self)
> -
> -    def gui(self):
> -        raise NotImplementedError('gui() not implemented')
> -
> -    def debianize(self):
> -        raise NotImplementedError('gui() not implemented')
> -
> -    def get_k_arch(self):
> -        """ get_k_arch() may be used in debianize() """
> -        if self.deb['p_arch'] == 'armhf':
> -            return 'arm'
> -        elif self.deb['p_arch'] == 'armel':
> -            return 'arm'
> -        elif self.deb['p_arch'] == 'amd64':
> -            return 'x86_64'
> -        else:
> -            return self.deb['p_arch']
> -
> -    def create(self):
> -        self.p_name = self.add_widget_intelligent(TitleText,
> -                                                  name="Name:", value="elbe")
> -
> -        self.p_version = self.add_widget_intelligent(
> -            TitleText, name="Version:", value="1.0")
> -
> -        self.p_arch = self.add_widget_intelligent(TitleSelectOne,
> -                                                  name="Arch:",
> -                                                  values=self.archs,
> -                                                  value=[0],
> -                                                  scroll_exit=True)
> -
> -        self.source_format = self.add_widget_intelligent(TitleSelectOne,
> -                                                         name="Format:",
> -                                                         values=self.formats,
> -                                                         value=[0],
> -                                                         scroll_exit=True)
> -
> -        self.release = self.add_widget_intelligent(TitleSelectOne,
> -                                                   name="Release:",
> -                                                   values=self.releases,
> -                                                   value=[0],
> -                                                   scroll_exit=True)
> -
> -        fullname = os.environ.get('DEBFULLNAME', failobj="Max Mustermann")
> -        self.m_name = self.add_widget_intelligent(
> -            TitleText, name="Maintainer:", value=fullname)
> -
> -        email = os.environ.get('DEBEMAIL', failobj="max at mustermann.org")
> -        self.m_mail = self.add_widget_intelligent(TitleText,
> -                                                  name="Mail:", value=email)
> -
> -        self.add_page()
> -        self.gui()
> -
> -        self.add_widget_intelligent(ButtonPress, name="Save",
> -                                    when_pressed_function=self.on_ok)
> -
> -        self.add_widget_intelligent(ButtonPress, name="Cancel",
> -                                    when_pressed_function=self.on_cancel)
> -
> -    def on_ok(self):
> -        self.deb['p_name'] = self.p_name.get_value()
> -        self.deb['p_version'] = self.p_version.get_value()
> -        self.deb['p_arch'] = self.archs[self.p_arch.get_value()[0]]
> -        self.deb['m_name'] = self.m_name.get_value()
> -        self.deb['m_mail'] = self.m_mail.get_value()
> -        self.deb['source_format'] = self.formats[
> -                self.source_format.get_value()[0]]
> -        self.deb['release'] = self.releases[self.release.get_value()[0]]
> -
> -        os.mkdir('debian')
> -        os.mkdir('debian/source')
> -
> -        self.debianize()
> -
> -        with open('debian/source/format', 'w') as f:
> -            mako = os.path.join(self.tmpl_dir, 'format.mako')
> -            f.write(template(mako, self.deb))
> -
> -        copyfile(self.copyright_fname, 'debian/copyright')
> -        with open('debian/compat', 'w') as f:
> -            f.write('9')
> -
> -        if self.hint:
> -            notify(self.hint, title='Hint')
> -            sleep(10)
> -
> -        sys.exit(0)
> -
> -    # pylint: disable=no-self-use
> -    def on_cancel(self):
> -        sys.exit(-2)
> diff --git a/elbepack/debianize/debianize.py b/elbepack/debianize/debianize.py
> deleted file mode 100644
> index 0f51cb61..00000000
> --- a/elbepack/debianize/debianize.py
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -# ELBE - Debian Based Embedded Rootfilesystem Builder
> -# Copyright (c) 2016-2017 Manuel Traut <manut at linutronix.de>
> -#
> -# SPDX-License-Identifier: GPL-3.0-or-later
> -
> -from npyscreen import NPSAppManaged
> -
> -from .kernel import Kernel       # pylint: disable=unused-import
> -from .uboot import UBoot         # pylint: disable=unused-import
> -from .barebox import BareBox     # pylint: disable=unused-import
> -
> -from .base import DebianizeBase  # pylint: disable=unused-import
> -
> -
> -class Debianize (NPSAppManaged):
> -    def __init__(self, debianizer):
> -        self.debianizer = debianizer
> -        NPSAppManaged.__init__(self)
> -
> -    def onStart(self):
> -        self.registerForm('MAIN', self.debianizer())
> diff --git a/elbepack/debianize/kernel.py b/elbepack/debianize/kernel.py
> deleted file mode 100644
> index aad2cc5e..00000000
> --- a/elbepack/debianize/kernel.py
> +++ /dev/null
> @@ -1,98 +0,0 @@
> -# ELBE - Debian Based Embedded Rootfilesystem Builder
> -# Copyright (c) 2016-2017 John Ogness <john.ogness at linutronix.de>
> -# Copyright (c) 2016-2017 Manuel Traut <manut at linutronix.de>
> -# Copyright (c) 2017 Torben Hohn <torben.hohn at linutronix.de>
> -#
> -# SPDX-License-Identifier: GPL-3.0-or-later
> -
> -import os
> -
> -from shutil import copyfile
> -
> -from npyscreen import TitleText, TitleSelectOne
> -
> -from elbepack.directories import mako_template_dir
> -from elbepack.debianize.base import DebianizeBase, template
> -from elbepack.shellhelper import system
> -
> -
> -class Kernel (DebianizeBase):
> -
> -    # pylint: disable=too-many-instance-attributes
> -    # pylint: disable=too-many-ancestors
> -
> -    name = "kernel"
> -    files = ['Kbuild', 'Kconfig', 'MAINTAINERS', 'kernel/futex.c']
> -
> -    def __init__(self):
> -        self.imgtypes = ["bzImage", "zImage", "uImage", "Image"]
> -        self.imgtypes_install = ["install", "zinstall", "uinstall", "install"]
> -
> -        self.loadaddr = None
> -        self.defconfig = None
> -        self.imgtype = None
> -        self.cross = None
> -        self.k_version = None
> -        DebianizeBase.__init__(self)
> -
> -    def gui(self):
> -        self.loadaddr = self.add_widget_intelligent(
> -            TitleText, name="Loadaddress:", value="0x800800")
> -
> -        self.defconfig = self.add_widget_intelligent(
> -            TitleText, name="defconfig:", value="omap2plus_defconfig")
> -
> -        self.imgtype = self.add_widget_intelligent(
> -            TitleSelectOne,
> -            name="Image Format:",
> -            values=self.imgtypes,
> -            value=[0],
> -            scroll_exit=True)
> -
> -        self.cross = self.add_widget_intelligent(
> -            TitleText, name="CROSS_COMPILE", value="arm-linux-gnueabihf-")
> -
> -        self.k_version = self.add_widget_intelligent(
> -            TitleText, name="Kernelversion", value="4.4")
> -
> -    def debianize(self):
> -        self.deb['k_arch'] = self.get_k_arch()
> -
> -        self.deb['loadaddr'] = self.loadaddr.get_value()
> -        self.deb['defconfig'] = self.defconfig.get_value()
> -        self.deb['imgtype'] = self.imgtypes[self.imgtype.get_value()[0]]
> -        self.deb['imgtype_install'] = self.imgtypes_install[
> -                self.imgtype.get_value()[0]]
> -        self.deb['cross_compile'] = self.cross.get_value()
> -        self.deb['k_version'] = self.k_version.get_value()
> -
> -        self.tmpl_dir = os.path.join(mako_template_dir, 'debianize/kernel')
> -        pkg_name = self.deb['k_version'] + '-' + self.deb['p_name']
> -
> -        for tmpl in [
> -            'control',
> -            'rules',
> -            'preinst',
> -            'postinst',
> -            'prerm',
> -                'postrm']:
> -            with open(os.path.join('debian/', tmpl), 'w') as f:
> -                mako = os.path.join(self.tmpl_dir, tmpl + '.mako')
> -                f.write(template(mako, self.deb))
> -
> -        cmd = 'dch --package linux-' + pkg_name + \
> -            ' -v ' + self.deb['p_version'] + \
> -            ' --create -M -D ' + self.deb['release'] + \
> -            ' "generated by elbe debianize"'
> -        system(cmd)
> -
> -        copyfile(os.path.join(self.tmpl_dir, 'linux-image.install'),
> -                 'debian/linux-image-' + pkg_name + '.install')
> -        copyfile(os.path.join(self.tmpl_dir, 'linux-headers.install'),
> -                 'debian/linux-headers-' + pkg_name + '.install')
> -
> -        self.hint = "use 'dpkg-buildpackage -a%s' to build the package" % (
> -                self.deb['p_arch'])
> -
> -
> -DebianizeBase.register(Kernel)
> diff --git a/elbepack/debianize/uboot.py b/elbepack/debianize/uboot.py
> deleted file mode 100644
> index 4f53d254..00000000
> --- a/elbepack/debianize/uboot.py
> +++ /dev/null
> @@ -1,105 +0,0 @@
> -# ELBE - Debian Based Embedded Rootfilesystem Builder
> -# Copyright (c) 2018 Philipp Rosenberger <p.rosenberger at linutronix.de>
> -# Copyright (c) 2018 Torben Hohn <torben.hohn at linutronix.de>
> -#
> -# SPDX-License-Identifier: GPL-3.0-or-later
> -
> -import os
> -
> -from time import sleep
> -from shutil import copyfile
> -
> -from npyscreen import TitleText, notify
> -
> -from elbepack.directories import mako_template_dir
> -from elbepack.debianize.base import DebianizeBase, template
> -from elbepack.shellhelper import system
> -
> -from pkg_resources import parse_version as V
> -
> -
> -class UBoot (DebianizeBase):
> -
> -    name = "uboot"
> -    files = ['Makefile', 'Kbuild', 'Kconfig', 'MAINTAINERS', 'config.mk']
> -    copyright_fname = 'Licenses/README'
> -
> -    def __init__(self):
> -        self.verstr = None
> -        self.defconfig = None
> -        self.imgname = None
> -        self.cross = None
> -        self.k_version = None
> -
> -        DebianizeBase.__init__(self)
> -
> -    def get_version(self):
> -        with open('Makefile', 'r') as f:
> -            for line in f:
> -                if line.startswith('VERSION = '):
> -                    version = line.split('=')[1].strip()
> -                elif line.startswith('PATCHLEVEL = '):
> -                    patchlevel = line.split('=')[1].strip()
> -                    break
> -
> -        self.verstr = version + '.' + patchlevel
> -        # With v2014.04 the u-boot Makefile knows the 'tools-only' target.
> -        if V(self.verstr) < V('2014.04'):
> -            notify("Only U-Boot >= 2014.04 is supported.\n"
> -                   "This is version '%s'" % self.verstr,
> -                   title='Warning')
> -            sleep(10)
> -
> -        if V(self.verstr) >= V('2017.09'):
> -            self.deb['envtools'] = 'envtools'
> -        else:
> -            self.deb['envtools'] = 'env'
> -
> -    def gui(self):
> -        self.get_version()
> -        self.defconfig = self.add_widget_intelligent(
> -            TitleText, name="defconfig:", value="mx7dsabresd_defconfig")
> -
> -        self.imgname = self.add_widget_intelligent(
> -            TitleText,
> -            name="Imagename:",
> -            value="u-boot-dtb.imx")
> -
> -        self.cross = self.add_widget_intelligent(
> -            TitleText, name="CROSS_COMPILE:", value="arm-linux-gnueabihf-")
> -
> -        self.k_version = self.add_widget_intelligent(
> -            TitleText, name="U-Boot Version:", value=self.verstr)
> -
> -    def debianize(self):
> -        self.deb['k_arch'] = self.get_k_arch()
> -
> -        self.deb['defconfig'] = self.defconfig.get_value()
> -        self.deb['cross_compile'] = self.cross.get_value()
> -        self.deb['k_version'] = self.k_version.get_value()
> -        self.deb['imgname'] = self.imgname.get_value()
> -
> -        self.tmpl_dir = os.path.join(mako_template_dir, 'debianize/u-boot')
> -        pkg_name = self.deb['p_name'] + '-' + self.deb['k_version']
> -
> -        for tmpl in ['control', 'rules']:
> -            with open(os.path.join('debian/', tmpl), 'w') as f:
> -                mako = os.path.join(self.tmpl_dir, tmpl + '.mako')
> -                f.write(template(mako, self.deb))
> -
> -        cmd = 'dch --package u-boot-' + pkg_name + \
> -            ' -v ' + self.deb['p_version'] + \
> -            ' --create -M -D ' + self.deb['release'] + \
> -            ' "generated by elbe debianize"'
> -        system(cmd)
> -
> -        copyfile(os.path.join(self.tmpl_dir, 'u-boot-image.install'),
> -                 'debian/u-boot-image-' + pkg_name + '.install')
> -        copyfile(os.path.join(self.tmpl_dir, 'u-boot-tools.install'),
> -                 'debian/u-boot-tools-' + pkg_name + '.install')
> -
> -        self.hint = "use 'dpkg-buildpackage -a%s' to build the package" % (
> -                self.deb['p_arch'])
> -
> -
> -DebianizeBase.register(UBoot)
> 



More information about the elbe-devel mailing list