コード例 #1
0
ファイル: buildpkg.py プロジェクト: papyros/builder
def create_pkgbuild(workdir):
    build_filename = os.path.join(workdir, 'build.yml')
    pkgbuild_filename = os.path.join(workdir, 'PKGBUILD')

    print(pkgbuild_filename)

    config = load_yaml(build_filename)
    config['optdepends'] = OrderedDict(sorted(config.get('optdepends', {}).items(),
                                       key=lambda t: t[0]))

    template = env.get_template('PKGBUILD.{}.in'.format(config.get('type', 'base')))

    version = '0'
    rel = 1

    if os.path.exists(pkgbuild_filename):
        try:
            version = pkgversion(config['name'], workdir=workdir, latest=False,
                                     include_rel=False)
        except Exception as ex:
            version = pkgversion(config['name'], workdir=workdir, latest=True,
                                 include_rel=False)
        rel = int(pkgrel(config['name'], workdir=workdir))

        with open(pkgbuild_filename) as f:
            old_pkgbuild = f.read()
        pkgbuild = template.render(**config, version=version, pkgrel=rel)

        if pkgbuild != old_pkgbuild:
            # from difflib import Differ
            # from pprint import pprint
            # d = Differ()
            # result = list(d.compare(old_pkgbuild.split('\n'), pkgbuild.split('\n')))
            # pprint(result)
            rel += 1

    pkgbuild = template.render(version=version, pkgrel=rel, **config)

    with open(pkgbuild_filename, 'w') as f:
        f.write(pkgbuild)
    if version == '0':
        pkgversion(config['name'], workdir=workdir, latest=True, include_rel=False)
コード例 #2
0
ファイル: __init__.py プロジェクト: jjardon/builder
 def config(self):
     filename = os.path.join(self.workdir, '.builder.yml')
     if os.path.exists(filename):
         return load_yaml(filename)
コード例 #3
0
ファイル: iso.py プロジェクト: jjardon/builder
        append_to_file(self.path('packages.both'), self.packages)
        append_to_file(self.path('packages.i686'), self.packages_i686)
        append_to_file(self.path('packages.x86_64'), self.packages_x86_64)

        # Add customizations
        append_to_file(self.path('airootfs/root/customize_airootfs.sh'), self.customizations)

        if self.graphical_target:
            replace_in_file(self.path('airootfs/root/customize_airootfs.sh'),
                            r'multi-user.target', 'graphical.target')

        print('>>>>> Building...')
        cmd = 'sudo ' + self.path('build.sh')
        args = ['v']

        if self.name:
            args += ['-N ' + self.name]
        if self.version:
            args += ['-V ' + self.version]
        if self.label:
            args += ['-L ' + self.label]

        cmd += ' ' + ' '.join(args)
        subprocess.call(cmd, shell=True, cwd=self.build_dir)


if __name__ == '__main__':
    yaml = load_yaml(sys.argv[1])
    iso = ArchISO.from_dict(yaml, sys.argv[2])
    iso.build()
コード例 #4
0
ファイル: __init__.py プロジェクト: jjardon/builder
 def config(self):
     filename = os.path.join(self.workdir, self.config_filename)
     if os.path.exists(filename):
         return ISOBuild(load_yaml(filename), os.path.join(self.workdir, 'build'))
コード例 #5
0
ファイル: __init__.py プロジェクト: jjardon/builder
 def __init__(self, filename):
     self.config = load_yaml(filename)
     self.continuous = ContinuousIntegration(self.config.get('continuous', []))
     self.isos = ISOContainer(self.config.get('isos', []))
     self.repositories = RepositoryContainer(self.config.get('repositories', []))