예제 #1
0
    def debianize(self):

        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))

        st = os.stat(os.path.join('debian', 'rules'))
        os.chmod(os.path.join('debian', 'rules'), st.st_mode | stat.S_IEXEC)

        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')

        TUI.printf("use 'dpkg-buildpackage -a%s' to build the package" %
                   self.deb['p_arch'])
예제 #2
0
 def confirm(self):
     data = self.get_form_data()
     sanitize = self.sanitize_inputs(data)
     if sanitize:
         # TODO - Better sanitization handling
         buf = []
         for key, value in sanitize.items():
             buf.append("{}: {}".format(key, value))
         TUI.printf('\n'.join(buf))
     else:
         self.on_submit(data)
예제 #3
0
    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'):
            TUI.printf("Only U-Boot >= 2014.04 is supported.\n"
                       "This is version '%s'" % self.verstr)

        if V(self.verstr) >= V('2017.09'):
            self.deb['envtools'] = 'envtools'
        else:
            self.deb['envtools'] = 'env'
예제 #4
0
def run_command(_args):

    if os.path.exists('debian'):
        print("debian folder already exists, nothing to do")
        sys.exit(10)
    try:
        TUI(detect_panel())()
    except KeyError:
        print("This creates a debianization of a source directory.\n"
              "The software was not able to identify the current directory.\n"
              "Please run the command from a valid source directory")
        sys.exit(20)
예제 #5
0
    def on_submit(self, datas):

        for key, value in datas.items():
            self.deb[key] = str(value)

        self.deb['k_arch'] = self.get_k_arch()

        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')

        TUI.quit()
예제 #6
0
 def abort(self):
     emit_signal(self, TUISignal.QUIT)
     TUI.quit()