from icbuild.utils.sxml import sxml class SystemRepository(Repository): branch_xml_attrs = ['version'] def branch(self, name, version = None): instance = SystemBranch(self, version) return instance def to_sxml(self): return [sxml.repository(type='system', name=self.name)] class SystemBranch(Branch): def __init__(self, repository, version): Branch.__init__(self, repository, module = None, checkoutdir = None) self.version = version def branchname(self): return self.version branchname = property(branchname) def to_sxml(self): return ([sxml.branch(module=self.module, repo=self.repository, version=self.version)]) register_repo_type('system', SystemRepository)
def may_checkout(self, buildscript): if os.path.exists(self._local_tarball): return True elif buildscript.config.nonetwork: return False return True def tree_id(self): md5sum = hashlib.md5() if self.patches: for patch in self.patches: md5sum.update(patch[0]) if self.quilt: md5sum.update(get_output("quilt files", cwd=self.srcdir, extra_env={"QUILT_PATCHES": self.quilt.srcdir})) return "%s-%s" % (self.version, md5sum.hexdigest()) def to_sxml(self): return [ sxml.branch( module=self.module, repo=self.repository.name, version=self.version, size=str(self.source_size), hash=self.source_hash, ) ] + [[sxml.patch(file=patch, strip=str(strip))] for patch, strip in self.patches] register_repo_type("tarball", TarballRepository)