def debianize(self): 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)) st = os.stat(os.path.join('debian', 'rules')) os.chmod(os.path.join('debian', 'rules'), st.st_mode | stat.S_IEXEC) 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'])
def debianize(self): self.deb['imgtype_install'] = Kernel.imgtype_to_install(self.deb['imgtype']) 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)) st = os.stat(os.path.join('debian', 'rules')) os.chmod(os.path.join('debian', 'rules'), st.st_mode | stat.S_IEXEC) 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') copyfile(os.path.join(self.tmpl_dir, 'linux-libc-dev.install'), 'debian/linux-libc-dev-' + pkg_name + '.install') self.hint = "use 'dpkg-buildpackage -a%s' to build the package" % ( self.deb['p_arch'])
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('COPYING', '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)
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()
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)) 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'])