def getManifest(self, product, version, flavor, noaction=False): if noaction: return Manifest() if version is None: raise RuntimeError("Unspecified version for %s" % product) tablefile = self.getTableFile(product, version, flavor) table = Table(tablefile) deps = table.dependencies(self.Eups, recursive=True) deps.reverse() manifest = Manifest(product, version) for p, optional, depth in deps: if not optional or self.Eups.findProduct(p.name, p.version): manifest.addDependency(p.name, p.version, p.flavor, None, None, None, optional) distId = "build:%s-%s.build" % (product, version) tableName = "%s.table" % product manifest.addDependency(product, version, flavor, tableName, os.path.join(product, version), distId, False) return manifest
def _createDeps(self, productName, versionName, flavor=None, tag=None, recursive=False, exact=False, mapping=server.Mapping()): """return a list of product dependencies for a given project. This function returns a proto-dependency list providing only as much generic information as is possible without knowing the details of how the data is organized on the server. Thus, the dependency list will not include """ if flavor is None: flavor = self.flavor if tag is None: tag = self.tag productList = Manifest(productName, versionName, self.Eups, self.verbose-1, log=self.log) # add a record for the top product productList.addDependency(productName, versionName, flavor, None, None, None, False) dependencies = None tablefile = None if self.noeups: if recursive and self.verbose > 0: print >> self.log, "Warning dependencies are not guaranteed", \ "to be recursive when using noeups option" def getTableFile(product, version, flavor): tablefile = self.findTableFile(product, version, flavor) # use the server as source of package information if not tablefile and self.distServer: try: tablefile = self.distServer.getTableFile(product, version, self.flavor) except RemoteFileNotFound, e: pass return tablefile tablefile = getTableFile(productName, versionName, self.flavor) if not tablefile: buildProduct, buildVersion = mapping.apply(productName, versionName, self.flavor) if buildProduct == productName and buildVersion != versionName: tablefile = getTableFile(productName, buildVersion, self.flavor) if not tablefile and self.verbose > 0: print >> self.log, "Failed to find %s's table file; trying eups" % productName
def writeManifest(self, serverDir, productDeps, product, version, flavor=None, force=False): """write out a manifest file for a given product with the given dependencies. See getManifestPath() for an explanation of where manifests are deployed. @param serverDir a local directory representing the root of the package distribution tree @param productDeps the list of product dependencies. Each item in the list is a Dependency instance @param product the name of the product to create the package distribution for @param version the name of the product version @param flavor the flavor of the target platform; this may be ignored by the implentation """ self.initServerTree(serverDir) out = self.getManifestPath(serverDir, product, version, self.flavor) mandir = os.path.dirname(out) if not os.path.exists(mandir): os.makedirs(mandir) man = Manifest(product, version, self.Eups, verbosity=self.verbose-1, log=self.log) for dep in productDeps: man.addDepInst(dep) def getTableFile(product, version): fulltablename = dep.tablefile tabledir = os.path.join(serverDir, "tables") dep.tablefile = "%s-%s.table" % (dep.product, dep.version) tablefile_for_distrib = os.path.join(tabledir, dep.tablefile) return fulltablename, tablefile_for_distrib def copyTableFile(fulltablename, tablefile_for_distrib): if os.access(tablefile_for_distrib, os.R_OK) and not force: if self.Eups.verbose > 1: print >> sys.stderr, "Not recreating", tablefile_for_distrib return True if not os.path.exists(fulltablename): return False print >> sys.stderr, "Tablefile %s doesn't exist; omitting" % (fulltablename) if self.Eups.verbose > 1: print >> sys.stderr, "Copying %s to %s" % (fulltablename, tablefile_for_distrib) # We need to update the versions in the table file after mapping. # We'll use this process to copy the file instead of "server.copyfile()" inTable = open(fulltablename) outTable = open(tablefile_for_distrib, "w") productList = dict([(p.product, p.version) for p in productDeps]) eups.table.expandTableFile(self.Eups, outTable, inTable, productList, toplevelName=product, recurse=False) return True # # Go through that manifest copying table files into the distribution tree # for dep in productDeps: if not dep.tablefile: dep.tablefile = "none" if dep.tablefile == "none": continue fulltablename, tablefile_for_distrib = getTableFile(product, version) if not copyTableFile(fulltablename, tablefile_for_distrib): # Try the repository version haveTable = False repoVersion = hooks.config.Eups.repoVersioner(product, version) if repoVersion != version: fulltablename, tablefile_for_distrib = getTableFile(product, repoVersion) if copyTableFile(fulltablename, tablefile_for_distrib): haveTable = True if not haveTable: print >> sys.stderr, "Tablefile %s doesn't exist; omitting" % (fulltablename) # # Finally write the manifest file itself # man.write(out, flavor=flavor, noOptional=False) self.setGroupPerms(out)