Logo Search packages:      
Sourcecode: falcon version File versions  Download package

def falcon::pocket::MetaComponent::export (   self  ) 

Create Packages/Sources lists

Definition at line 365 of file pocket.py.

00365                     :
        """Create Packages/Sources lists"""
        self.sources = []
        for c in self.components.all():
            self.sources += c.sources.all()

        # Copied from Component
        sources = ''
        binaries = dict(zip(falcon.conf.architectures, ['']*len(falcon.conf.architectures)))
        for s in self.sources:
            if not s.is_fake:
                sources += s.control + "\n\n"
            for p in s.binaries.all():
                if p.architecture == 'all':
                    for arch in falcon.conf.architectures:
                        binaries[arch] += p.control + "\n\n"
                else:
                    binaries[p.architecture] += p.control + "\n\n"

        # Write exports
        self.releasefiles.clear()
        sf = os.path.join(self.distpath, 'source', 'Sources')
        sf2 = '%s/source/Sources' % self.name
        if falcon.util.writefile(sf, sources):
            falcon.util.run(['gzip', '-c', sf], outfile='%s.gz' % sf)
            falcon.util.run(['bzip2', '-k','-f', sf])

        self.releasefiles[sf2] = (len(sources), apt_pkg.md5sum(sources), apt_pkg.sha1sum(sources), apt_pkg.sha256sum(sources))
        fd = open(sf + '.gz')
        md5 = apt_pkg.md5sum(fd); fd.seek(0)
        sha1 = apt_pkg.sha1sum(fd); fd.seek(0)
        sha256 = apt_pkg.sha256sum(fd); fd.close()
        self.releasefiles[sf2+'.gz'] = (os.path.getsize(sf+'.gz'), md5, sha1, sha256)
        fd = open(sf + '.bz2')
        md5 = apt_pkg.md5sum(fd); fd.seek(0)
        sha1 = apt_pkg.sha1sum(fd); fd.seek(0)
        sha256 = apt_pkg.sha256sum(fd); fd.close()
        self.releasefiles[sf2+'.bz2'] = (os.path.getsize(sf+'.bz2'), md5, sha1, sha256)

        rf = os.path.join(self.distpath, 'source', 'Release')
        rf2 = '%s/source/Release' % self.name
        rel = component_release_template.render(Context({'c': self, 'arch': 'source', 'conf': falcon.conf}))
        falcon.util.writefile(rf, rel)
        self.releasefiles[rf2] = (len(rel), apt_pkg.md5sum(rel), apt_pkg.sha1sum(rel), apt_pkg.sha256sum(rel))

        for a in binaries:
            bf = os.path.join(self.distpath, 'binary-%s' % a, 'Packages')
            bf2 = '%s/binary-%s/Packages' % (self.name, a)
            if falcon.util.writefile(bf, binaries[a]):
                falcon.util.run(['gzip', '-c', bf], outfile='%s.gz' % bf)
                falcon.util.run(['bzip2', '-k', '-f', bf])

            self.releasefiles[bf2] = (len(binaries[a]), apt_pkg.md5sum(binaries[a]), apt_pkg.sha1sum(binaries[a]), apt_pkg.sha256sum(binaries[a]))
            fd = open(bf + '.gz')
            md5 = apt_pkg.md5sum(fd); fd.seek(0)
            sha1 = apt_pkg.sha1sum(fd); fd.seek(0)
            sha256 = apt_pkg.sha256sum(fd); fd.close()
            self.releasefiles[bf2+'.gz'] = (os.path.getsize(bf+'.gz'), md5, sha1, sha256)
            fd = open(bf + '.bz2')
            md5 = apt_pkg.md5sum(fd); fd.seek(0)
            sha1 = apt_pkg.sha1sum(fd); fd.seek(0)
            sha256 = apt_pkg.sha256sum(fd); fd.close()
            self.releasefiles[bf2+'.bz2'] = (os.path.getsize(bf+'.bz2'), md5, sha1, sha256)

            rf = os.path.join(self.distpath, 'binary-%s' % a, 'Release')
            rf2 = '%s/binary-%s/Release' % (self.name, a)
            rel = component_release_template.render({'c': self, 'arch': a, 'conf': falcon.conf})
            falcon.util.writefile(rf, rel)
            self.releasefiles[rf2] = (len(rel), apt_pkg.md5sum(rel), apt_pkg.sha1sum(rel), apt_pkg.sha256sum(rel))

        self.save()

        if falcon.conf.webbase:
            template = falcon.util.get_template('component.html')
            context = Context({'c': self, 'conf': falcon.conf, 'dots': '../../../', 
                               'sources': sorted(self.sources, lambda x,y: cmp(x.packagename, y.packagename))})
            falcon.util.writefile(os.path.join(self.distpath, 'index.html'), template.render(context))

    def __str__(self):


Generated by  Doxygen 1.6.0   Back to index