Exemplo n.º 1
0
def create_pkg_list(request):
    create_app(request)

    pkg_list = []

    for i in range(0, 33):
        pkg = Package(
            metadata=request.instance.app_data['metadata'],
            application=request.instance.app,
            interpreter_name=request.instance.app.interpreter_name,
            interpreter_version=request.instance.app.interpreter_version,
            filename='pkg%d' % i, bytes=1024, checksum='abcdefg',
            builder='fake builder', distro_name=distro_name(),
            distro_version=distro_version(), distro_arch=distro_arch())
        pkg.save()
        pkg_list.append(pkg)

    def cleanup():
        for pkg in pkg_list:
            pkg.delete()
    request.addfinalizer(cleanup)

    request.instance.app.current_package = pkg_list[0]
    request.instance.app.packages = pkg_list
    request.instance.app.save()

    request.instance.pkg_list = pkg_list
Exemplo n.º 2
0
 def parse_packages(self, meta):
     """
     Parse and merge all config files (builder and app meta), then return
     final list of all packages to install.
     """
     ret = set()
     try:
         for pkg in self.config.interpreters["packages"]:
             ret.add(pkg)
             log.debug("Will install package '%s' from builder config "
                       "for all interpreters" % pkg)
     except KeyError:
         pass
     for version in ["any"] + [self.interpreter_version]:
         try:
             for pkg in self.config.interpreters[meta.interpreter.type][
                     version]["packages"]:
                 ret.add(pkg)
                 log.debug("Will install package '%s' from builder config "
                           "for interpreter version '%s'" % (pkg, version))
         except KeyError:
             pass
         try:
             for pkg in meta.os[distro.distro_name()]["packages"]:
                 ret.add(pkg)
                 log.debug("Will install package '%s' from metadata for "
                           "distribution %s" % (pkg, distro.distro_name()))
         except (KeyError, TypeError):
             pass
         try:
             for pkg in meta.os[distro.distro_name()][
                     distro.distro_version()]["packages"]:
                 ret.add(pkg)
                 log.debug("Will install package '%s' from metadata for "
                           "distribution %s, version "
                           "%s" % (pkg, distro.distro_name(),
                                   distro.distro_version()))
         except (KeyError, TypeError):
             pass
     return ret
Exemplo n.º 3
0
def create_pkg(request):
    create_app(request)

    pkg = Package(metadata=request.instance.app_data['metadata'],
                  application=request.instance.app,
                  interpreter_name=request.instance.app.interpreter_name,
                  interpreter_version=request.instance.app.interpreter_version,
                  filename='pkg', bytes=1024, checksum='abcdefg',
                  builder='fake builder', distro_name=distro_name(),
                  distro_version=distro_version(), distro_arch=distro_arch())
    pkg.save()

    def cleanup():
        pkg.delete()
    request.addfinalizer(cleanup)

    request.instance.app.current_package = pkg
    request.instance.app.packages = [pkg]
    request.instance.app.save()

    request.instance.pkg = pkg
Exemplo n.º 4
0
    def __init__(self):
        # % progress
        self.progress = 0

        # filename of the package used to build this package
        self.parent = None

        # selected interpreter version
        self.interpreter_version = None

        # package filename
        self.filename = None
        # package checksum
        self.checksum = None
        # package size
        self.bytes = 0

        self.distro_name = distro.distro_name()
        self.distro_version = distro.distro_version()
        self.distro_arch = distro.distro_arch()

        # information about last commit in VCS (if available)
        self.vcs_revision = {}