当前位置: 首页>>代码示例>>Python>>正文


Python CommandUtils.findFile方法代码示例

本文整理汇总了Python中CommandUtils.CommandUtils.findFile方法的典型用法代码示例。如果您正苦于以下问题:Python CommandUtils.findFile方法的具体用法?Python CommandUtils.findFile怎么用?Python CommandUtils.findFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommandUtils.CommandUtils的用法示例。


在下文中一共展示了CommandUtils.findFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: findRPMFileForGivenPackage

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
 def findRPMFileForGivenPackage(self, package,version="*", index=0):
     cmdUtils = CommandUtils()
     release = "*"
     if version == "*":
             version = SPECS.getData().getVersion(package, index)
             release = SPECS.getData().getRelease(package, index)
     listFoundRPMFiles = sum([cmdUtils.findFile(package + "-" + version + "-" + release + "." +
                                                platform.machine()+".rpm",
                                                constants.rpmPath),
                              cmdUtils.findFile(package + "-" + version + "-" + release +
                                                ".noarch.rpm",
                                                constants.rpmPath)], [])
     if constants.inputRPMSPath is not None:
         listFoundRPMFiles = sum([cmdUtils.findFile(package + "-" + version + "-" + release +
                                                    "." + platform.machine()+".rpm",
                                                    constants.inputRPMSPath),
                                  cmdUtils.findFile(package + "-" + version + "-" + release +
                                                    ".noarch.rpm", constants.inputRPMSPath)],
                                 listFoundRPMFiles)
     if len(listFoundRPMFiles) == 1:
         return listFoundRPMFiles[0]
     if len(listFoundRPMFiles) == 0:
         return None
     if len(listFoundRPMFiles) > 1:
         self.logger.error("Found multiple rpm files for given package in rpm directory." +
                           "Unable to determine the rpm file for package:" + package)
         raise Exception("Multiple rpm files found")
开发者ID:TiejunChina,项目名称:photon,代码行数:29,代码来源:PackageUtils.py

示例2: _verifyShaAndGetSourcePath

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
    def _verifyShaAndGetSourcePath(self, source, package, index=0):
        cmdUtils = CommandUtils()
        # Fetch/verify sources if sha1 not None.
        sha1 = SPECS.getData().getSHA1(package, source, index)
        if sha1 is not None:
            PullSources.get(package, source, sha1, constants.sourcePath,
                            constants.pullsourcesConfig, self.logger)

        sourcePath = cmdUtils.findFile(source, constants.sourcePath)
        if not sourcePath:
            sourcePath = cmdUtils.findFile(source, constants.specPath)
            if not sourcePath:
                if sha1 is None:
                    self.logger.error("No sha1 found or missing source for " + source)
                    raise Exception("No sha1 found or missing source for " + source)
                else:
                    self.logger.error("Missing source: " + source +
                                      ". Cannot find sources for package: " + package)
                    raise Exception("Missing source")
        else:
            if sha1 is None:
                self.logger.error("No sha1 found for "+source)
                raise Exception("No sha1 found")
        if len(sourcePath) > 1:
            self.logger.error("Multiple sources found for source:" + source + "\n" +
                              ",".join(sourcePath) +"\nUnable to determine one.")
            raise Exception("Multiple sources found")
        return sourcePath
开发者ID:TiejunChina,项目名称:photon,代码行数:30,代码来源:PackageUtils.py

示例3: copySourcesTobuildroot

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
    def copySourcesTobuildroot(self,listSourceFiles,package,destDir):
        cmdUtils = CommandUtils()
        for source in listSourceFiles:
            # Fetch/verify sources if sha1 not None.
            sha1 = constants.specData.getSHA1(package, source)
            if sha1 is not None:
                PullSources.get(source, sha1, constants.sourcePath, constants.pullsourcesConfig)

            sourcePath = cmdUtils.findFile(source,constants.sourcePath)
            if sourcePath is None or len(sourcePath) == 0:
                sourcePath = cmdUtils.findFile(source,constants.specPath)
                if sourcePath is None or len(sourcePath) == 0:
                    if sha1 is None:
                        self.logger.error("No sha1 found or missing source for "+source)
                        raise Exception("No sha1 found or missing source")
                    else:
                        self.logger.error("Missing source: "+source+". Cannot find sources for package: "+package)
                        raise Exception("Missing source")
            else:
                if sha1 is None:
                    self.logger.error("No sha1 found for "+source)
                    raise Exception("No sha1 found")
            if len(sourcePath) > 1:
                self.logger.error("Multiple sources found for source:"+source+"\n"+ ",".join(sourcePath) +"\nUnable to determine one.")
                raise Exception("Multiple sources found")
            self.logger.info("Copying... Source path :" + source + " Source filename: " + sourcePath[0])
            shutil.copy2(sourcePath[0], destDir)
开发者ID:BillTheBest,项目名称:photon,代码行数:29,代码来源:PackageUtils.py

示例4: loadPackagesData

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
 def loadPackagesData(self):
     listPackages = SPECS.getData().getListPackages()
     listPackages.sort()
     cmdUtils = CommandUtils()
     for package in listPackages:
         for version in SPECS.getData().getVersions(package):
             release = SPECS.getData().getRelease(package, version)
             listRPMPackages = SPECS.getData().getRPMPackages(package, version)
             srpmFileName = package + "-" + version + "-" + release + ".src.rpm"
             srpmFiles = cmdUtils.findFile(srpmFileName, constants.sourceRpmPath)
             srpmFile = None
             if len(srpmFiles) == 1:
                 srpmFile = srpmFiles[0]
             debugrpmFileName = package + "-debuginfo-" + version + "-" + release + "*"
             debugrpmFiles = cmdUtils.findFile(debugrpmFileName, constants.rpmPath)
             debugrpmFile = None
             if len(debugrpmFiles) == 1:
                 debugrpmFile = debugrpmFiles[0]
             pkgUtils = PackageUtils(self.logName, self.logPath)
             for rpmPkg in listRPMPackages:
                 rpmFile = pkgUtils.findRPMFile(rpmPkg, version)
                 if rpmFile is not None:
                     listPkgAttributes = {"sourcerpm":srpmFile, "rpm":rpmFile,
                                          "debugrpm":debugrpmFile}
                     self.pkgList[rpmPkg+"-"+version] = listPkgAttributes
                     self.logger.debug("Added " + rpmPkg + "-" + version + " to the package info json")
                 else:
                     self.logger.debug("Missing rpm file for package:" + rpmPkg)
开发者ID:frapposelli,项目名称:photon,代码行数:30,代码来源:PackageInfo.py

示例5: loadPackagesData

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
 def loadPackagesData(self):
     listPackages =  constants.specData.getListPackages()
     listPackages.sort()
     listRPMFiles = []
     cmdUtils = CommandUtils()
     for package in listPackages:
         release = constants.specData.getRelease(package)
         version = constants.specData.getVersion(package)
         listRPMPackages = constants.specData.getRPMPackages(package)
         srpmFileName = package+"-"+version+"-"+release+".src.rpm"
         srpmFiles = cmdUtils.findFile(srpmFileName, constants.sourceRpmPath)
         srpmFile = None
         if len(srpmFiles) == 1:
             srpmFile = srpmFiles[0]
         debugrpmFileName = package+"-debuginfo-"+version+"-"+release+"*"
         debugrpmFiles = cmdUtils.findFile(debugrpmFileName, constants.rpmPath)
         debugrpmFile = None
         if len(debugrpmFiles) == 1:
             debugrpmFile = debugrpmFiles[0]
         pkgUtils = PackageUtils(self.logName,self.logPath)
         for rpmPkg in listRPMPackages:
             rpmFile = pkgUtils.findRPMFileForGivenPackage(rpmPkg)
             if rpmFile is not None:
                 listRPMFiles.append(rpmFile)
                 listPkgAttributes = {"sourcerpm":srpmFile, "rpm":rpmFile, "debugrpm":debugrpmFile}
                 self.pkgList[rpmPkg] = listPkgAttributes
                 self.logger.debug("Added "+rpmPkg +" rpm package to the list")
             else:
                 self.logger.error("Missing rpm file for package:"+rpmPkg)
开发者ID:megacoder,项目名称:photon,代码行数:31,代码来源:PackageInfo.py

示例6: findRPMFileForGivenPackage

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
 def findRPMFileForGivenPackage(self,package):
     cmdUtils = CommandUtils()
     version = constants.specData.getVersion(package)
     release = constants.specData.getRelease(package)
     listFoundRPMFiles = sum([cmdUtils.findFile(package+"-"+version+"-"+release+".x86_64.rpm",constants.rpmPath),
                         cmdUtils.findFile(package+"-"+version+"-"+release+".noarch.rpm",constants.rpmPath)], [])
     if len(listFoundRPMFiles) == 1 :
         return listFoundRPMFiles[0]
     if len(listFoundRPMFiles) == 0 :
         return None
     if len(listFoundRPMFiles) > 1 :
         self.logger.error("Found multiple rpm files for given package in rpm directory.Unable to determine the rpm file for package:"+package)
         raise Exception("Multiple rpm files found")
开发者ID:sabertail,项目名称:photon,代码行数:15,代码来源:PackageUtils.py

示例7: prepareBuildRoot

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
    def prepareBuildRoot(self,chrootID):
        self.logger.info("Preparing build environment")
        cmdUtils = CommandUtils()
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+"/tmp")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath)
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/RPMS/x86_64")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/RPMS/noarch")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/SOURCES")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/SPECS")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/LOGS")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/BUILD")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/BUILDROOT")

        package="filesystem"
        pkgUtils=PackageUtils(self.logName,self.logPath)
        rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
        if rpmFile is None:
            specFile=constants.specData.getSpecFile(package)
            cmd=self.rpmbuildCommand+" -ba --nocheck --define \'_topdir "+chrootID+constants.topDirPath+"\' --define \'_dbpath "+chrootID+"/var/lib/rpm\' --define \'dist "+constants.dist+"\' "+specFile
            self.logger.info(cmd)
            cmdUtils.runCommandInShell(cmd,self.logPath+"/filesystem.log")
            filesystemrpmFile = cmdUtils.findFile(package+"-[0-9]*.rpm", chrootID+constants.topDirPath+"/RPMS")
            filesystemsrpmFile = cmdUtils.findFile(package+"-[0-9]*.src.rpm", chrootID+constants.topDirPath+"/SRPMS")
            if len(filesystemrpmFile) > 0:
                shutil.copy2(filesystemrpmFile[0],constants.rpmPath+"/x86_64/")
            if len(filesystemsrpmFile) > 0:
                shutil.copy2(filesystemsrpmFile[0],constants.sourceRpmPath+"/")
            rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
            if rpmFile is None:
                self.logger.error("Cannot find filesystem rpm")
                raise Exception("Cannot find filesystem rpm")
        
        self.logger.debug("Installing filesystem rpms:" + package)
        if os.geteuid()==0:
            cmd=self.rpmCommand + " -i --nodeps --root "+chrootID+" --define '_dbpath /var/lib/rpm' "+ rpmFile
        else:
            cmd=self.rpmCommand + " -i --nodeps --badreloc --relocate /="+chrootID+" --define '_dbpath "+chrootID+"/var/lib/rpm' "+ rpmFile
        process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
        retval = process.wait()
        if retval != 0:
            self.logger.error("Installing filesystem rpm failed")
            raise Exception("RPM installation failed")
        
        prepareChrootCmd=self.prepareBuildRootCmd+" "+chrootID
        logFile=constants.logPath+"/prepareBuildRoot.log"
        returnVal=cmdUtils.runCommandInShell(prepareChrootCmd,logFile)
        if not returnVal:
            self.logger.error("Prepare build root script failed.Unable to prepare chroot.")
            raise Exception("Prepare build root script failed")

        self.logger.info("Successfully prepared chroot:"+chrootID)
开发者ID:MrScriptMaster,项目名称:photon,代码行数:53,代码来源:ToolChainUtils.py

示例8: get

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
def get(package, source, sha1, sourcesPath, URLs, logger):
    cmdUtils = CommandUtils()
    sourcePath = cmdUtils.findFile(source, sourcesPath)
    if sourcePath is not None and len(sourcePath) > 0:
        if len(sourcePath) > 1:
            raise Exception("Multiple sources found for source:" + source + "\n" +
                            ",".join(sourcePath) +"\nUnable to determine one.")
        if sha1 == getFileHash(sourcePath[0]):
            # Use file from sourcesPath
            return
        else:
            logger.info("sha1 of " + sourcePath[0] + " does not match. " + sha1 +
                        " vs " + getFileHash(sourcePath[0]))
    for baseurl in URLs:
        #form url: https://dl.bintray.com/vmware/photon_sources/1.0/<filename>.
        url = '%s/%s' % (baseurl, source)
        destfile = os.path.join(sourcesPath, source)
        logger.debug("Downloading: " + url)
        try:
            downloadFile(url, destfile)
            if sha1 != getFileHash(destfile):
                raise Exception('Invalid sha1 for package %s file %s' % package, source)
            return
        except requests.exceptions.HTTPError as e:
            logger.exception(e)
            # on any HTTP errors - try next config
            continue
        except Exception as e:
            logger.exception(e)
    raise Exception("Missing source: " + source)
开发者ID:frapposelli,项目名称:photon,代码行数:32,代码来源:PullSources.py

示例9: copySourcesTobuildroot

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
 def copySourcesTobuildroot(self, listSourceFiles, package, destDir):
     cmdUtils = CommandUtils()
     for source in listSourceFiles:
         sourcePath = cmdUtils.findFile(source, constants.sourcePath)
         if sourcePath is None or len(sourcePath) == 0:
             sourcePath = cmdUtils.findFile(source, constants.specPath)
         if sourcePath is None or len(sourcePath) == 0:
             self.logger.error("Missing source: " + source + ". Cannot find sources for package: " + package)
             raise Exception("Missing source")
         if len(sourcePath) > 1:
             self.logger.error(
                 "Multiple sources found for source:"
                 + source
                 + "\n"
                 + ",".join(sourcePath)
                 + "\nUnable to determine one."
             )
             raise Exception("Multiple sources found")
         self.logger.info("Copying... Source path :" + source + " Source filename: " + sourcePath[0])
         shutil.copy2(sourcePath[0], destDir)
开发者ID:johnt337,项目名称:photon,代码行数:22,代码来源:PackageUtils.py

示例10: buildSRPMList

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
def buildSRPMList(srpmPath, yamlDir, blackListPkgs, dist_tag, logger, singleFile=True):
    cmdUtils = CommandUtils()
    yamlSrpmDir = os.path.join(yamlDir, "yaml_srpms")
    if not os.path.isdir(yamlSrpmDir):
        cmdUtils.runCommandInShell("mkdir -p " + yamlSrpmDir)
    if singleFile:
        yamlFile = open(yamlSrpmDir + "/srpm_list.yaml", "w")
    listPackages = SPECS.getData().getListPackages()
    listPackages.sort()
    for package in listPackages:
        if package in blackListPkgs:
            continue
        ossname = package
        for ossversion in SPECS.getData().getVersions(package):
            ossrelease = SPECS.getData().getRelease(package, ossversion)
            srpm_file_name = "%s-%s-%s%s.src.rpm" % (ossname, ossversion, ossrelease, dist_tag)
            logger.info("srpm name is %s" % (srpm_file_name))
            listFoundSRPMFiles = cmdUtils.findFile(srpm_file_name, srpmPath)

            srpmName = None
            if len(listFoundSRPMFiles) == 1:
                srpmFullPath = listFoundSRPMFiles[0]
                srpmName = os.path.basename(srpmFullPath)
                cpcmd = "cp " + srpmFullPath + " " + yamlSrpmDir + "/"
                returnVal = cmdUtils.runCommandInShell(cpcmd)
                if returnVal != 0:
                    logger.error("Copy SRPM File is failed for package:" + ossname)
            else:
                logger.error("SRPM file is not found:" + ossname)

            if not singleFile:
                yamlFile = open(yamlSrpmDir + "/" + ossname + "-" + ossversion + "-"
                                + ossrelease + ".yaml", "w")

            yamlFile.write("baseos:" + ossname + ":" + ossversion + "-" + ossrelease + dist_tag +  ":\n")
            yamlFile.write("  repository: BaseOS\n")
            yamlFile.write("  name: '" + ossname + "'\n")
            yamlFile.write("  version: '" + ossversion + "-" + ossrelease + dist_tag +"'\n")
            yamlFile.write("  url: 'http://www.vmware.com'\n")
            yamlFile.write("  baseos-style: rpm\n")
            yamlFile.write("  baseos-source: '" + str(srpmName) + "'\n")
            yamlFile.write("  baseos-osname: 'photon'\n")
            yamlFile.write("\n")
            if not singleFile:
                yamlFile.close()

    if singleFile:
        yamlFile.close()
    logger.debug("Generated SRPM yaml files for all packages")
开发者ID:vmware,项目名称:photon,代码行数:51,代码来源:GenerateOSSFiles.py

示例11: findRPMFileInGivenLocation

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
 def findRPMFileInGivenLocation(self,package,rpmdirPath):
     cmdUtils = CommandUtils()
     listFoundRPMFiles = cmdUtils.findFile(package+"-*.rpm",rpmdirPath)
     listFilterRPMFiles=[]
     for f in listFoundRPMFiles:
         rpmFileName=os.path.basename(f)
         checkRPMName=rpmFileName.replace(package,"")
         rpmNameSplit = checkRPMName.split("-")
         if len(rpmNameSplit) == 3:
             listFilterRPMFiles.append(f)
     if len(listFilterRPMFiles) == 1 :
         return listFilterRPMFiles[0]
     if len(listFilterRPMFiles) == 0 :
         return None
     if len(listFilterRPMFiles) > 1 :
         self.logger.error("Found multiple rpm files for given package in rpm directory.Unable to determine the rpm file for package:"+package)
         return None
开发者ID:jacob-vmware,项目名称:photon,代码行数:19,代码来源:ToolChainUtils.py

示例12: buildSRPMList

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
def buildSRPMList(srpmPath, yamlDir, blackListPkgs, logger, singleFile=True):
    cmdUtils = CommandUtils()
    yamlSrpmDir = os.path.join(yamlDir, "yaml_srpms")
    if not os.path.isdir(yamlSrpmDir):
        cmdUtils.runCommandInShell("mkdir -p "+yamlSrpmDir)
    if singleFile:
        yamlFile = open(yamlSrpmDir+"/srpm_list.yaml", "w")
    listPackages =  constants.specData.getListPackages()
    listPackages.sort()
    for package in listPackages:
        if package in blackListPkgs:
            continue
        ossname = package
        ossversion = constants.specData.getVersion(package)
        ossrelease = constants.specData.getRelease(package)

        listFoundSRPMFiles = cmdUtils.findFile(ossname+"-"+ossversion+"-"+ossrelease+".src.rpm",srpmPath)
        srpmName = None
        if len(listFoundSRPMFiles) == 1:
            srpmFullPath = listFoundSRPMFiles[0];
            srpmName = os.path.basename(srpmFullPath)
            cpcmd = "cp "+ srpmFullPath +" "+yamlDir+"/"
            returnVal = cmdUtils.runCommandInShell(cpcmd)
            if not returnVal:
                logger.error("Copy SRPM File is failed for package:"+ossname)
        else:
             logger.error("SRPM file is not found:" +ossname)

        if not singleFile:
            yamlFile = open(yamlSrpmDir+"/"+ossname+"-"+ossversion+"-"+ossrelease+".yaml", "w")

        yamlFile.write("baseos:"+ossname+":"+ossversion+"-"+ossrelease+":\n")
        yamlFile.write("  repository: BaseOS\n")
        yamlFile.write("  name: '"+ossname+"'\n")
        yamlFile.write("  version: '"+ossversion+"-"+ossrelease+"'\n")
        yamlFile.write("  baseos-style: rpm\n")
        yamlFile.write("  baseos-source: '"+str(srpmName)+"'\n")
        yamlFile.write("  baseos-osname: 'photon'\n")
        yamlFile.write("\n")
        if not singleFile:
            yamlFile.close()

    if singleFile:
        yamlFile.close()
    logger.info("Generated srpm yaml files for all packages")
开发者ID:megacoder,项目名称:photon,代码行数:47,代码来源:builder.py

示例13: buildSRPMList

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
def buildSRPMList(specPath,srpmPath, yamlDir, logger, singleFile=False):
    strUtils = StringUtils()
    if singleFile:
        yamlFile = open(yamlDir+"srpm_list.yaml", "w")
    lst = os.listdir(specPath)
    lst.sort()
    cmdUtils = CommandUtils()
    for dirEntry in lst:
        specDir = os.path.join(specPath, dirEntry)
        if os.path.isdir(specDir):
            for specEntry in os.listdir(specDir):
                specFile = os.path.join(specDir, specEntry)
                if os.path.isfile(specFile) and specFile.endswith(".spec"):
                    spec=Specutils(specFile)
                    ossname = spec.getBasePackageName()
                    ossversion = spec.getVersion()
                    ossrelease = spec.getRelease()
                    listFoundSRPMFiles = cmdUtils.findFile(ossname+"-"+ossversion+"-"+ossrelease+".src.rpm",srpmPath)
                    srpmName = None
                    if len(listFoundSRPMFiles) == 1:
                        srpmFullPath = listFoundSRPMFiles[0];
                        srpmName = os.path.basename(srpmFullPath)
                        cpcmd = "cp "+ srpmFullPath +" "+yamlDir+"/"
                        returnVal = cmdUtils.runCommandInShell(cpcmd)
                        if not returnVal:
                            logger.error("Copy SRPM File is failed for package:"+ossname)
                    else:
                         logger.error("SRPM file is not found:" +ossname)
                    if not singleFile:
                        yamlFile = open(yamlDir+"/"+ossname+"-"+ossversion+"-"+ossrelease+".yaml", "w")
                    yamlFile.write("baseos:"+ossname+":"+ossversion+"-"+ossrelease+":\n")
                    yamlFile.write("  repository: BaseOS\n")
                    yamlFile.write("  name: '"+ossname+"'\n")
                    yamlFile.write("  version: '"+ossversion+"-"+ossrelease+"'\n")
                    yamlFile.write("  baseos-style: rpm\n")
                    yamlFile.write("  baseos-source: '"+str(srpmName)+"'\n")
                    yamlFile.write("  baseos-osname: 'Photon OS'\n")
                    yamlFile.write("\n")
                    if not singleFile:
                        yamlFile.close()
    if singleFile:
        yamlFile.close()
    logger.info("Generated srpm yaml files for all packages")
开发者ID:pbidkar,项目名称:photon,代码行数:45,代码来源:builder.py

示例14: get

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
def get(source, sha1, sourcesPath, configs):
    cmdUtils = CommandUtils()
    sourcePath = cmdUtils.findFile(source, sourcesPath)
    if sourcePath is not None and len(sourcePath) > 0:
        if len(sourcePath) > 1:
            raise Exception("Multiple sources found for source:"+source+"\n"+ ",".join(sourcePath) +"\nUnable to determine one.")
        if sha1 == getFileHash(sourcePath[0]):
            # Use file from sourcesPath
            return
    configFiles=configs.split(":")
    for config in configFiles:
        p = pullSources(config)
        package_path = os.path.join(sourcesPath, source)
        try: 
            p.downloadFileHelper(source, package_path, sha1)
            return
        except Exception as e:
            print e
    raise Exception("Missing source: "+source)
开发者ID:BillTheBest,项目名称:photon,代码行数:21,代码来源:PullSources.py

示例15: get

# 需要导入模块: from CommandUtils import CommandUtils [as 别名]
# 或者: from CommandUtils.CommandUtils import findFile [as 别名]
def get(package, source, sha1, sourcesPath, configs, logger):
    cmdUtils = CommandUtils()
    sourcePath = cmdUtils.findFile(source, sourcesPath)
    if sourcePath is not None and len(sourcePath) > 0:
        if len(sourcePath) > 1:
            raise Exception("Multiple sources found for source:" + source + "\n" +
                            ",".join(sourcePath) +"\nUnable to determine one.")
        if sha1 == getFileHash(sourcePath[0]):
            # Use file from sourcesPath
            return
        else:
            logger.info("sha1 of " + sourcePath[0] + " does not match. " + sha1 +
                        " vs " + getFileHash(sourcePath[0]))
    configFiles = configs.split(":")
    for config in configFiles:
        p = pullSources(config, logger)
        package_path = os.path.join(sourcesPath, source)
        try:
            p.downloadFileHelper(package, source, package_path, sha1)
            return
        except Exception as e:
            logger.exception(e)
    raise Exception("Missing source: " + source)
开发者ID:TiejunChina,项目名称:photon,代码行数:25,代码来源:PullSources.py


注:本文中的CommandUtils.CommandUtils.findFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。