def main(): usage = "Usage: %prog [options]" parser = ArgumentParser(usage) parser.add_argument("-i", "--input-type", dest="input_type", default=DEFAULT_INPUT_TYPE) parser.add_argument("-p", "--pkg", dest="pkg") parser.add_argument("-f", "--file", dest="json_file", default="packages_minimal.json") parser.add_argument("-d", "--disp", dest="display_option", default=DEFAULT_DISPLAY_OPTION) parser.add_argument("-s", "--spec-dir", dest="spec_dir", default=SPEC_FILE_DIR) parser.add_argument("-l", "--log-dir", dest="log_dir", default=LOG_FILE_DIR) parser.add_argument("-t", "--stage-dir", dest="stage_dir", default="../../stage") parser.add_argument("-a", "--input-data-dir", dest="input_data_dir", default="../../common/data/") parser.add_argument("-o", "--output-dir", dest="output_dir", default="../../stage/common/data") options = parser.parse_args() constants.setSpecPath(options.spec_dir) constants.setLogPath(options.log_dir) constants.initialize() cmdUtils = CommandUtils() if not os.path.isdir(options.output_dir): cmdUtils.runCommandInShell2("mkdir -p "+options.output_dir) if not options.input_data_dir.endswith('/'): options.input_data_dir += '/' try: specDeps = SpecDependencyGenerator() # To display/print package dependencies on console if (options.input_type == "pkg" or options.input_type == "who-needs" or options.input_type == "who-needs-build"): specDeps.process(options.input_type, options.pkg, options.display_option) elif options.input_type == "json": list_json_files = options.json_file.split("\n") # Generate the expanded package dependencies json file based on package_list_file for json_file in list_json_files: shutil.copy2(json_file, options.output_dir) json_wrapper_option_list = JsonWrapper(json_file) option_list_json = json_wrapper_option_list.read() options_sorted = option_list_json.items() for install_option in options_sorted: output_file = None input_value = os.path.join(os.path.dirname(json_file), install_option[1]["file"]) if options.display_option == "tree" and install_option[1]["title"] == "ISO Packages": continue if options.display_option == "json": output_file = os.path.join(options.output_dir, install_option[1]["file"]) print ("Generating the install time dependency list for " + json_file) specDeps.process(options.input_type, input_value, options.display_option, output_file) except Exception as e: traceback.print_exc() sys.stderr.write(str(e)) sys.stderr.write("Failed to generate dependency lists from spec files\n") sys.exit(1) sys.stderr.write("Successfully generated dependency lists from spec files\n") sys.exit(0)
def main(): usage = "Usage: %prog [options] <package name>" parser = ArgumentParser(usage) parser.add_argument("-s", "--spec-path", dest="specPath", default="../../SPECS") parser.add_argument("-l", "--log-path", dest="logPath", default="../../stage/LOGS") parser.add_argument("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS") parser.add_argument("-j", "--output-dir", dest="outputDirPath", default="../../stage/") parser.add_argument("-z", "--log-level", dest="logLevel", default="info") parser.add_argument("-c", "--pullsources-config", dest="pullsourcesConfig", default="pullsources.conf") parser.add_argument("-f", "--pkg-blacklist-file", dest="pkgBlacklistFile", default=None) parser.add_argument("-p", "--generate-pkg-list", dest="generatePkgList", default=False, action="store_true") parser.add_argument("-y", "--generate-yaml-files", dest="generateYamlFiles", default=False, action="store_true") parser.add_argument("-d", "--dist-tag", dest="dist", default="") options = parser.parse_args() errorFlag = False cmdUtils = CommandUtils() try: logName = "GenerateYamlFiles" logger = Logger.getLogger(logName, options.logPath, options.logLevel) if options.generateYamlFiles: if (options.pkgBlacklistFile is not None and options.pkgBlacklistFile != "" and not os.path.isfile(options.pkgBlacklistFile)): logger.error("Given package blacklist file is not valid:" + options.pkgBlacklistFile) errorFlag = True if not os.path.isdir(options.specPath): logger.error("Given Specs Path is not a directory:" + options.specPath) errorFlag = True if not os.path.isdir(options.sourceRpmPath): logger.error("Given SRPM Path is not a directory:" + options.sourceRpmPath) errorFlag = True if options.generateYamlFiles and not os.path.isfile(options.pullsourcesConfig): logger.error("Given Source config file is not a valid file:" + options.pullsourcesConfig) errorFlag = True if options.dist: dist_tag = options.dist logger.info("release tag is %s" % (dist_tag)) if errorFlag: logger.error("Found some errors. Please fix input options and re-run it.") sys.exit(1) if options.generateYamlFiles: if not os.path.isdir(options.outputDirPath): cmdUtils.runCommandInShell("mkdir -p "+options.outputDirPath) constants.setSpecPath(options.specPath) constants.setSourceRpmPath(options.sourceRpmPath) constants.setLogPath(options.logPath) constants.setLogLevel(options.logLevel) constants.setPullSourcesURL(get_baseurl(options.pullsourcesConfig)) constants.initialize() # parse SPECS folder SPECS() if options.generatePkgList: buildPackagesList(options.outputDirPath + "/packages_list.csv") elif options.generateYamlFiles: blackListPkgs = readBlackListPackages(options.pkgBlacklistFile) buildSourcesList(options.outputDirPath, blackListPkgs, logger) buildSRPMList(options.sourceRpmPath, options.outputDirPath, blackListPkgs, dist_tag, logger) except Exception as e: print("Caught Exception: " + str(e)) traceback.print_exc() sys.exit(1) sys.exit(0)
def main(): usage = "Usage: %prog [options] <package name>" parser = OptionParser(usage) parser.add_option("-s", "--spec-path", dest="specPath", default="../../SPECS") parser.add_option("-x", "--source-path", dest="sourcePath", default="../../stage/SOURCES") parser.add_option("-r", "--rpm-path", dest="rpmPath", default="../../stage/RPMS") parser.add_option("-i", "--install-package", dest="installPackage", default=False, action ="store_true") parser.add_option("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="../../stage/PUBLISHRPMS") parser.add_option("-l", "--log-path", dest="logPath", default="../../stage/LOGS") parser.add_option("-o", "--build-option", dest="buildOption", default="full") parser.add_option("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") parser.add_option("-j", "--json-file", dest="inputJSONFile", default="../../common/data/build_install_options_all.json") parser.add_option("-b", "--build-root-path", dest="buildRootPath", default="/mnt") parser.add_option("-t", "--threads", dest="buildThreads", default=1, type="int", help="Number of working threads") parser.add_option("-m", "--tool-chain-stage", dest="toolChainStage", default="None") parser.add_option("-c", "--pullsources-config", dest="pullsourcesConfig", default="pullsources.conf") parser.add_option("-d", "--dist", dest="dist", default="") parser.add_option("-k", "--input-RPMS-path", dest="inputRPMSPath", default=None) parser.add_option("-n", "--build-number", dest="buildNumber", default="0000000") parser.add_option("-v", "--release-version", dest="releaseVersion", default="NNNnNNN") parser.add_option("-u", "--enable-rpmcheck", dest="rpmCheck", default=False, action ="store_true") parser.add_option("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS") parser.add_option("-w", "--pkginfo-file", dest="pkgInfoFile", default="../../common/data/pkg_info.json") parser.add_option("-g", "--pkg-build-option-file", dest="pkgBuildOptionFile", default="../../common/data/pkg_build_options.json") parser.add_option("-q", "--rpmcheck-stop-on-error", dest="rpmCheckStopOnError", default=False, action ="store_true") (options, args) = parser.parse_args() cmdUtils=CommandUtils() if not os.path.isdir(options.logPath): cmdUtils.runCommandInShell("mkdir -p "+options.logPath) logger=Logger.getLogger(options.logPath+"/Main") errorFlag=False package = None pkgInfoJsonFile=options.pkgInfoFile if not os.path.isdir(options.sourcePath): logger.error("Given Sources Path is not a directory:"+options.sourcePath) errorFlag = True if not os.path.isdir(options.specPath): logger.error("Given Specs Path is not a directory:"+options.specPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath): logger.error("Given RPMS Path is not a directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath+"/x86_64"): logger.error("Given RPMS Path is missing x86_64 sub-directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath+"/noarch"): logger.error("Given RPMS Path is missing noarch sub-directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isfile(options.inputJSONFile) and not options.installPackage: logger.error("Given JSON File is not a file:"+options.inputJSONFile) errorFlag = True if not os.path.isfile(options.pkgBuildOptionFile): logger.warning("Given JSON File is not a file:"+options.pkgBuildOptionFile) if options.inputRPMSPath is not None and not os.path.isdir(options.inputRPMSPath): logger.error("Given input RPMS Path is not a directory:"+options.publishRPMSPath) errorFlag = True if options.installPackage : if len(args) != 1: logger.error("Please provide package name") errorFlag = True else: package=args[0] if errorFlag: logger.error("Found some errors. Please fix input options and re-run it.") return False if not os.path.isdir(options.rpmPath): cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/x86_64") cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/noarch") if not os.path.isdir(options.sourceRpmPath): cmdUtils.runCommandInShell("mkdir -p "+options.sourceRpmPath) if not os.path.isdir(options.buildRootPath): cmdUtils.runCommandInShell("mkdir -p "+options.buildRootPath) logger.info("Source Path :"+options.sourcePath) logger.info("Spec Path :" + options.specPath) logger.info("Rpm Path :" + options.rpmPath) logger.info("Log Path :" + options.logPath) logger.info("Top Dir Path :" + options.topDirPath) logger.info("Publish RPMS Path :" + options.publishRPMSPath) if not options.installPackage: logger.info("JSON File :" + options.inputJSONFile) else: logger.info("Package to build:"+package) listBuildOptionPackages = get_packages_with_build_options(options.pkgBuildOptionFile) try: constants.initialize(options) SourcePackageInfo.setLogging() SourcePackageInfo.loadPkgInfoFromFile(pkgInfoJsonFile) if package == "packages_list": buildPackagesList(options.specPath, options.buildRootPath+"/../packages_list.csv") elif package == "sources_list": if not os.path.isdir("../../stage/yaml_sources"): cmdUtils.runCommandInShell("mkdir -p ../../stage/yaml_sources") buildSourcesList(options.specPath,"../../stage/yaml_sources", options.buildRootPath+"/../",logger) elif package == "srpms_list": if not os.path.isdir("../../stage/yaml_srpms"): cmdUtils.runCommandInShell("mkdir -p ../../stage/yaml_srpms") buildSRPMList(options.specPath,options.sourceRpmPath,"../../stage/yaml_srpms",logger) elif options.toolChainStage == "stage1": pkgManager = PackageManager() pkgManager.buildToolChain() elif options.toolChainStage == "stage2": pkgManager = PackageManager() pkgManager.buildToolChainPackages(options.buildThreads) elif options.installPackage: buildAPackage(package, listBuildOptionPackages, options.pkgBuildOptionFile, options.buildThreads) else: buildPackagesFromGivenJSONFile(options.inputJSONFile, options.buildOption, listBuildOptionPackages, options.pkgBuildOptionFile, logger, options.buildThreads) except Exception as e: logger.error("Caught an exception") logger.error(str(e)) # print stacktrace traceback.print_exc() sys.exit(1) logger.info("Writing Package info to the file:"+pkgInfoJsonFile) SourcePackageInfo.writePkgListToFile(pkgInfoJsonFile) sys.exit(0)
def main(): usage = "Usage: %prog [options] <package name>" parser = ArgumentParser(usage) parser.add_argument("-s", "--spec-path", dest="specPath", default="../../SPECS") parser.add_argument("-x", "--source-path", dest="sourcePath", default="../../stage/SOURCES") parser.add_argument("-r", "--rpm-path", dest="rpmPath", default="../../stage/RPMS") parser.add_argument("-i", "--install-package", dest="installPackage", default=False, action ="store_true") parser.add_argument("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="../../stage/PUBLISHRPMS") parser.add_argument("-e", "--publish-XRPMS-path", dest="publishXRPMSPath", default="../../stage/PUBLISHXRPMS") parser.add_argument("-l", "--log-path", dest="logPath", default="../../stage/LOGS") parser.add_argument("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") parser.add_argument("-b", "--build-root-path", dest="buildRootPath", default="/mnt") parser.add_argument("-t", "--threads", dest="buildThreads", default=1, type=int, help="Number of working threads") parser.add_argument("-m", "--tool-chain-stage", dest="toolChainStage", default="None") parser.add_argument("-c", "--pullsources-config", dest="pullsourcesConfig", default="pullsources.conf") parser.add_argument("-d", "--dist", dest="dist", default="") parser.add_argument("-k", "--input-RPMS-path", dest="inputRPMSPath", default=None) parser.add_argument("-n", "--build-number", dest="buildNumber", default="0000000") parser.add_argument("-v", "--release-version", dest="releaseVersion", default="NNNnNNN") parser.add_argument("-u", "--enable-rpmcheck", dest="rpmCheck", default=False, action ="store_true") parser.add_argument("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS") parser.add_argument("-w", "--pkginfo-file", dest="pkgInfoFile", default="../../stage/pkg_info.json") parser.add_argument("-g", "--pkg-build-option-file", dest="pkgBuildOptionFile", default="../../common/data/pkg_build_options.json") parser.add_argument("-q", "--rpmcheck-stop-on-error", dest="rpmCheckStopOnError", default=False, action ="store_true") parser.add_argument("PackageName", nargs='?') options = parser.parse_args() cmdUtils=CommandUtils() if not os.path.isdir(options.logPath): cmdUtils.runCommandInShell("mkdir -p "+options.logPath) logger=Logger.getLogger(options.logPath+"/Main") errorFlag=False package = None pkgInfoJsonFile = options.pkgInfoFile if not os.path.isdir(options.sourcePath): logger.error("Given Sources Path is not a directory:"+options.sourcePath) errorFlag = True if not os.path.isdir(options.specPath): logger.error("Given Specs Path is not a directory:"+options.specPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath): logger.error("Given RPMS Path is not a directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath): logger.error("Given X RPMS Path is not a directory:"+options.publishXRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath+"/x86_64"): logger.error("Given RPMS Path is missing x86_64 sub-directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath+"/x86_64"): logger.error("Given X RPMS Path is missing x86_64 sub-directory:"+options.publishXRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath+"/noarch"): logger.error("Given RPMS Path is missing noarch sub-directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath+"/noarch"): logger.error("Given X RPMS Path is missing noarch sub-directory:"+options.publishXRPMSPath) errorFlag = True if not os.path.isfile(options.pkgBuildOptionFile): logger.warning("Given JSON File is not a file:"+options.pkgBuildOptionFile) if options.inputRPMSPath is not None and not os.path.isdir(options.inputRPMSPath): logger.error("Given input RPMS Path is not a directory:"+options.inputRPMSPath) errorFlag = True if options.installPackage : if not options.PackageName: logger.error("Please provide package name") errorFlag = True else: package=options.PackageName if errorFlag: logger.error("Found some errors. Please fix input options and re-run it.") return False if not os.path.isdir(options.rpmPath): cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/x86_64") cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/noarch") if not os.path.isdir(options.sourceRpmPath): cmdUtils.runCommandInShell("mkdir -p "+options.sourceRpmPath) if not os.path.isdir(options.buildRootPath): cmdUtils.runCommandInShell("mkdir -p "+options.buildRootPath) logger.info("Source Path :"+options.sourcePath) logger.info("Spec Path :" + options.specPath) logger.info("Rpm Path :" + options.rpmPath) logger.info("Log Path :" + options.logPath) logger.info("Top Dir Path :" + options.topDirPath) logger.info("Publish RPMS Path :" + options.publishRPMSPath) logger.info("Publish X RPMS Path :" + options.publishXRPMSPath) if options.installPackage: logger.info("Package to build:"+package) listBuildOptionPackages = get_packages_with_build_options(options.pkgBuildOptionFile) try: constants.initialize(options) if package == "packages_list": buildPackagesList(options.buildRootPath+"/../packages_list.csv") elif package == "sources_list": if not os.path.isdir("../../stage/yaml_sources"): cmdUtils.runCommandInShell("mkdir -p ../../stage/yaml_sources") buildSourcesList('../../stage/yaml_sources',logger) elif package == "srpms_list": if not os.path.isdir("../../stage/yaml_srpms"): cmdUtils.runCommandInShell("mkdir -p ../../stage/yaml_srpms") buildSRPMList(options.sourceRpmPath,"../../stage/yaml_srpms",logger) elif options.toolChainStage == "stage1": pkgManager = PackageManager() pkgManager.buildToolChain() elif options.toolChainStage == "stage2": pkgManager = PackageManager() pkgManager.buildToolChainPackages(options.buildThreads) elif options.installPackage: buildAPackage(package, listBuildOptionPackages, options.pkgBuildOptionFile, options.buildThreads) else: buildPackagesForAllSpecs(listBuildOptionPackages, options.pkgBuildOptionFile, logger, options.buildThreads, pkgInfoJsonFile) except Exception as e: logger.error("Caught an exception") logger.error(str(e)) # print stacktrace traceback.print_exc() sys.exit(1) sys.exit(0)
def main(): usage = "Usage: %prog [options] <package name>" parser = OptionParser(usage) parser.add_option("-s", "--spec-path", dest="specPath", default="../../SPECS") parser.add_option("-x", "--source-path", dest="sourcePath", default="../../stage/SOURCES") parser.add_option("-r", "--rpm-path", dest="rpmPath", default="../../stage/RPMS") parser.add_option("-i", "--install-package", dest="installPackage", default=False, action="store_true") parser.add_option("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="../../stage/PUBLISHRPMS") parser.add_option("-l", "--log-path", dest="logPath", default="../../stage/LOGS") parser.add_option("-o", "--build-option", dest="buildOption", default="full") parser.add_option("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") parser.add_option( "-j", "--json-file", dest="inputJSONFile", default="../../common/data/build_install_options_all.json") parser.add_option("-b", "--build-root-path", dest="buildRootPath", default="/mnt") parser.add_option("-t", "--threads", dest="buildThreads", default=1, type="int", help="Numbeer of working threads") parser.add_option("-m", "--tool-chain-stage", dest="toolChainStage", default="None") parser.add_option("-c", "--pullsources-config", dest="pullsourcesConfig", default="pullsources.conf") parser.add_option("-d", "--dist", dest="dist", default="") parser.add_option("-k", "--input-RPMS-path", dest="inputRPMSPath", default=None) parser.add_option("-n", "--build-number", dest="buildNumber", default="0000000") parser.add_option("-v", "--release-version", dest="releaseVersion", default="NNNnNNN") parser.add_option("-u", "--enable-rpmcheck", dest="rpmCheck", default=False, action="store_true") parser.add_option("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS") (options, args) = parser.parse_args() cmdUtils = CommandUtils() if not os.path.isdir(options.logPath): cmdUtils.runCommandInShell("mkdir -p " + options.logPath) logger = Logger.getLogger(options.logPath + "/Main") errorFlag = False package = None if not os.path.isdir(options.sourcePath): logger.error("Given Sources Path is not a directory:" + options.sourcePath) errorFlag = True if not os.path.isdir(options.specPath): logger.error("Given Specs Path is not a directory:" + options.specPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath): logger.error("Given RPMS Path is not a directory:" + options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath + "/x86_64"): logger.error("Given RPMS Path is missing x86_64 sub-directory:" + options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath + "/noarch"): logger.error("Given RPMS Path is missing noarch sub-directory:" + options.publishRPMSPath) errorFlag = True if not os.path.isfile( options.inputJSONFile) and not options.installPackage: logger.error("Given JSON File is not a file:" + options.inputJSONFile) errorFlag = True if options.inputRPMSPath is not None and not os.path.isdir( options.inputRPMSPath): logger.error("Given input RPMS Path is not a directory:" + options.publishRPMSPath) errorFlag = True if options.installPackage: if len(args) != 1: logger.error("Please provide package name") errorFlag = True else: package = args[0] if errorFlag: logger.error( "Found some errors. Please fix input options and re-run it.") return False if not os.path.isdir(options.rpmPath): cmdUtils.runCommandInShell("mkdir -p " + options.rpmPath + "/x86_64") cmdUtils.runCommandInShell("mkdir -p " + options.rpmPath + "/noarch") if not os.path.isdir(options.sourceRpmPath): cmdUtils.runCommandInShell("mkdir -p " + options.sourceRpmPath) if not os.path.isdir(options.buildRootPath): cmdUtils.runCommandInShell("mkdir -p " + options.buildRootPath) logger.info("Source Path :" + options.sourcePath) logger.info("Spec Path :" + options.specPath) logger.info("Rpm Path :" + options.rpmPath) logger.info("Log Path :" + options.logPath) logger.info("Top Dir Path :" + options.topDirPath) logger.info("Publish RPMS Path :" + options.publishRPMSPath) if not options.installPackage: logger.info("JSON File :" + options.inputJSONFile) else: logger.info("Package to build:" + package) ''' listPackages=["acl","attr","autoconf","automake","bash","bc","bindutils","binutils","bison","boost","btrfs-progs","bzip2","ca-certificates","cdrkit","check", "cloud-init","cmake","coreutils","cpio","cracklib","createrepo","curl","cyrus-sasl","db","dbus","deltarpm","diffutils","docbook-xml","docbook-xsl", "docker","dracut","e2fsprogs","elfutils","etcd","expat","file","filesystem","findutils","flex","gawk","gcc","gdb","gdbm","gettext","git", "glib","glibc","glibmm","gmp","go","gobject-introspection","google-daemon","google-startup-scripts","gperf","gpgme","gptfdisk","grep","groff", "grub","gtk-doc","gzip","haveged","hawkey","iana-etc","inetutils","intltool","iproute2","iptables","itstool","json-glib","kbd","kmod","krb5", "kubernetes","less","libaio","libassuan","libcap","libdnet","libffi","libgpg-error","libgsystem","libhif","libmspack","libpcap","libpipeline", "librepo","libselinux","libsepol","libsigc++","libsolv","libtool","libxml2","libxslt","libyaml","linux","linux-api-headers","Linux-PAM","lua", "lvm2","lzo","m4","make","man-db","man-pages","mercurial","mpc","mpfr","nano","ncurses","nspr","nss","ntp","openldap","openssh","openssl", "open-vm-tools","ostree","parted","patch","pcre","perl","perl-common-sense","perl-Config-IniFiles","perl-DBD-SQLite","perl-DBI","perl-DBIx-Simple", "perl-Exporter-Tiny","perl-JSON-XS","perl-libintl","perl-List-MoreUtils","perl-Module-Install","perl-Module-ScanDeps","perl-Types-Serialiser", "perl-WWW-Curl","perl-YAML","perl-YAML-Tiny","photon-release","pkg-config","popt","procps-ng","psmisc","pycurl","pygobject","python2", "python-configobj","python-iniparse","python-jsonpatch","python-jsonpointer","python-prettytable","python-requests","python-setuptools", "python-six","PyYAML","readline","rocket","rpm","rpm-ostree","rpm-ostree-toolbox","ruby","sed","shadow","sqlite-autoconf","strace","sudo", "swig","systemd","tar","tcpdump","tcsh","tdnf","texinfo","thin-provisioning-tools","tzdata","unzip","urlgrabber","util-linux","vim","wget", "which","xerces-c","XML-Parser","xml-security-c","xz","yum","yum-metadata-parser","zlib"] ''' try: constants.initialize(options) if package == "packages_list": buildPackagesList(options.specPath, options.buildRootPath + "/../packages_list.csv") elif package == "sources_list": buildSourcesList(options.specPath, options.buildRootPath + "/../") elif options.toolChainStage == "stage1": pkgManager = PackageManager() pkgManager.buildToolChain() elif options.toolChainStage == "stage2": pkgManager = PackageManager() pkgManager.buildToolChainPackages(options.buildThreads) elif options.installPackage: buildAPackage(package, options.buildThreads) else: buildPackagesFromGivenJSONFile(options.inputJSONFile, options.buildOption, logger, options.buildThreads) except Exception as e: logger.error("Caught an exception") logger.error(str(e)) # print stacktrace traceback.print_exc() sys.exit(1) sys.exit(0)
def main(): usage = "Usage: %prog [options] <package name>" parser = OptionParser(usage) parser.add_option("-s", "--spec-path", dest="specPath", default="../../SPECS") parser.add_option("-x", "--source-path", dest="sourcePath", default="../../stage/SOURCES") parser.add_option("-r", "--rpm-path", dest="rpmPath", default="../../stage/RPMS") parser.add_option("-i", "--install-package", dest="installPackage", default=False, action ="store_true") parser.add_option("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="../../stage/PUBLISHRPMS") parser.add_option("-l", "--log-path", dest="logPath", default="../../stage/LOGS") parser.add_option("-o", "--build-option", dest="buildOption", default="full") parser.add_option("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") parser.add_option("-j", "--json-file", dest="inputJSONFile", default="../../common/data/build_install_options_all.json") parser.add_option("-b", "--build-root-path", dest="buildRootPath", default="/mnt") parser.add_option("-t", "--threads", dest="buildThreads", default=1, type="int", help="Numbeer of working threads") parser.add_option("-m", "--tool-chain-stage", dest="toolChainStage", default="None") parser.add_option("-c", "--pullsources-config", dest="pullsourcesConfig", default="pullsources.conf") parser.add_option("-d", "--dist", dest="dist", default="") (options, args) = parser.parse_args() cmdUtils=CommandUtils() if not os.path.isdir(options.logPath): cmdUtils.runCommandInShell("mkdir -p "+options.logPath) logger=Logger.getLogger(options.logPath+"/Main") errorFlag=False package = None if not os.path.isdir(options.sourcePath): logger.error("Given Sources Path is not a directory:"+options.sourcePath) errorFlag = True if not os.path.isdir(options.specPath): logger.error("Given Specs Path is not a directory:"+options.specPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath): logger.error("Given RPMS Path is not a directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath+"/x86_64"): logger.error("Given RPMS Path is missing x86_64 sub-directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath+"/noarch"): logger.error("Given RPMS Path is missing noarch sub-directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isfile(options.inputJSONFile) and not options.installPackage: logger.error("Given JSON File is not a file:"+options.inputJSONFile) errorFlag = True if options.installPackage : if len(args) != 1: logger.error("Please provide package name") errorFlag = True else: package=args[0] if errorFlag: logger.error("Found some errors. Please fix input options and re-run it.") return False if not os.path.isdir(options.rpmPath): cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/x86_64") cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/noarch") if not os.path.isdir(options.buildRootPath): cmdUtils.runCommandInShell("mkdir -p "+options.buildRootPath) logger.info("Source Path :"+options.sourcePath) logger.info("Spec Path :" + options.specPath) logger.info("Rpm Path :" + options.rpmPath) logger.info("Log Path :" + options.logPath) logger.info("Top Dir Path :" + options.topDirPath) logger.info("Publish RPMS Path :" + options.publishRPMSPath) if not options.installPackage: logger.info("JSON File :" + options.inputJSONFile) else: logger.info("Package to build:"+package) ''' listPackages=["acl","attr","autoconf","automake","bash","bc","bindutils","binutils","bison","boost","btrfs-progs","bzip2","ca-certificates","cdrkit","check", "cloud-init","cmake","coreutils","cpio","cracklib","createrepo","curl","cyrus-sasl","db","dbus","deltarpm","diffutils","docbook-xml","docbook-xsl", "docker","dracut","e2fsprogs","elfutils","etcd","expat","file","filesystem","findutils","flex","gawk","gcc","gdb","gdbm","gettext","git", "glib","glibc","glibmm","gmp","go","gobject-introspection","google-daemon","google-startup-scripts","gperf","gpgme","gptfdisk","grep","groff", "grub","gtk-doc","gzip","haveged","hawkey","iana-etc","inetutils","intltool","iproute2","iptables","itstool","json-glib","kbd","kmod","krb5", "kubernetes","less","libaio","libassuan","libcap","libdnet","libffi","libgpg-error","libgsystem","libhif","libmspack","libpcap","libpipeline", "librepo","libselinux","libsepol","libsigc++","libsolv","libtool","libxml2","libxslt","libyaml","linux","linux-api-headers","Linux-PAM","lua", "lvm2","lzo","m4","make","man-db","man-pages","mercurial","mpc","mpfr","nano","ncurses","nspr","nss","ntp","openldap","openssh","openssl", "open-vm-tools","ostree","parted","patch","pcre","perl","perl-common-sense","perl-Config-IniFiles","perl-DBD-SQLite","perl-DBI","perl-DBIx-Simple", "perl-Exporter-Tiny","perl-JSON-XS","perl-libintl","perl-List-MoreUtils","perl-Module-Install","perl-Module-ScanDeps","perl-Types-Serialiser", "perl-WWW-Curl","perl-YAML","perl-YAML-Tiny","photon-release","pkg-config","popt","procps-ng","psmisc","pycurl","pygobject","python2", "python-configobj","python-iniparse","python-jsonpatch","python-jsonpointer","python-prettytable","python-requests","python-setuptools", "python-six","PyYAML","readline","rocket","rpm","rpm-ostree","rpm-ostree-toolbox","ruby","sed","shadow","sqlite-autoconf","strace","sudo", "swig","systemd","tar","tcpdump","tcsh","tdnf","texinfo","thin-provisioning-tools","tzdata","unzip","urlgrabber","util-linux","vim","wget", "which","xerces-c","XML-Parser","xml-security-c","xz","yum","yum-metadata-parser","zlib"] ''' try: constants.initialize(options) if package == "packages_list": buildPackagesList(options.specPath, options.buildRootPath+"/../packages_list.csv") elif package == "sources_list": buildSourcesList(options.specPath, options.buildRootPath+"/../") elif options.toolChainStage == "stage1": pkgManager = PackageManager() pkgManager.buildToolChain() elif options.toolChainStage == "stage2": pkgManager = PackageManager() pkgManager.buildToolChainPackages(options.buildThreads) elif options.installPackage: buildAPackage(package, options.buildThreads) else: buildPackagesFromGivenJSONFile(options.inputJSONFile, options.buildOption,logger, options.buildThreads) except Exception as e: logger.error("Caught an exception") logger.error(str(e)) # print stacktrace traceback.print_exc() sys.exit(1) sys.exit(0)
def main(): parser = ArgumentParser() parser.add_argument("-s", "--spec-path", dest="specPath", default="../../SPECS") parser.add_argument("-x", "--source-path", dest="sourcePath", default="../../stage/SOURCES") parser.add_argument("-r", "--rpm-path", dest="rpmPath", default="../../stage/RPMS") parser.add_argument("-i", "--install-package", dest="installPackage", default=False, action="store_true") parser.add_argument("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="../../stage/PUBLISHRPMS") parser.add_argument("-e", "--publish-XRPMS-path", dest="publishXRPMSPath", default="../../stage/PUBLISHXRPMS") parser.add_argument("-l", "--log-path", dest="logPath", default="../../stage/LOGS") parser.add_argument("-y", "--log-level", dest="logLevel", default="error") parser.add_argument("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") parser.add_argument("-b", "--build-root-path", dest="buildRootPath", default="/mnt") parser.add_argument("-t", "--threads", dest="buildThreads", default=1, type=int, help="Number of working threads") parser.add_argument("-m", "--tool-chain-stage", dest="toolChainStage", default="None") parser.add_argument("-c", "--pullsources-config", dest="pullsourcesConfig", default="pullsources.conf") parser.add_argument("-d", "--dist-tag", dest="dist", default="") parser.add_argument("-k", "--input-RPMS-path", dest="inputRPMSPath", default=None) parser.add_argument("-n", "--build-number", dest="buildNumber", default="0000000") parser.add_argument("-v", "--release-version", dest="releaseVersion", default="NNNnNNN") parser.add_argument("-u", "--enable-rpmcheck", dest="rpmCheck", default=False, action="store_true") parser.add_argument("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS") parser.add_argument("-w", "--pkginfo-file", dest="pkgInfoFile", default="../../stage/pkg_info.json") parser.add_argument("-g", "--pkg-build-option-file", dest="pkgBuildOptionFile", default="../../common/data/pkg_build_options.json") parser.add_argument("-q", "--rpmcheck-stop-on-error", dest="rpmCheckStopOnError", default=False, action="store_true") parser.add_argument("-bd", "--publish-build-dependencies", dest="publishBuildDependencies", default=False) parser.add_argument("-pw", "--package-weights-path", dest="packageWeightsPath", default="../../common/data/packageWeights.json") parser.add_argument("-bt", "--build-type", dest="pkgBuildType", choices=['chroot', 'container'], default="chroot") parser.add_argument("-F", "--kat-build", dest="katBuild", default=None) parser.add_argument("-pj", "--packages-json-input", dest="pkgJsonInput", default=None) parser.add_argument("PackageName", nargs='?') options = parser.parse_args() cmdUtils = CommandUtils() if not os.path.isdir(options.logPath): cmdUtils.runCommandInShell("mkdir -p " + options.logPath) logger = Logger.getLogger("Main", options.logPath, options.logLevel) errorFlag = False package = None pkgInfoJsonFile = options.pkgInfoFile if not os.path.isdir(options.sourcePath): logger.error("Given Sources Path is not a directory:" + options.sourcePath) errorFlag = True if not os.path.isdir(options.specPath): logger.error("Given Specs Path is not a directory:" + options.specPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath): logger.error("Given RPMS Path is not a directory:" + options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath): logger.error("Given X RPMS Path is not a directory:" + options.publishXRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath + "/" + platform.machine()): logger.error("Given RPMS Path is missing " + platform.machine()+ " sub-directory:"+options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath+"/" + platform.machine()): logger.error("Given X RPMS Path is missing "+platform.machine()+ " sub-directory:"+options.publishXRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath+"/noarch"): logger.error("Given RPMS Path is missing noarch sub-directory:"+ options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath+"/noarch"): logger.error("Given X RPMS Path is missing noarch sub-directory:"+ options.publishXRPMSPath) errorFlag = True if options.inputRPMSPath is not None and not os.path.isdir(options.inputRPMSPath): logger.error("Given input RPMS Path is not a directory:"+options.inputRPMSPath) errorFlag = True if options.packageWeightsPath is not None and not os.path.isfile(options.packageWeightsPath): logger.error("Given input Weights file is not a file:"+options.packageWeightsPath) errorFlag = True if options.pkgJsonInput is not None and not os.path.isfile(options.pkgJsonInput): logger.error("Given input packages file is not a file:"+options.pkgJsonInput) errorFlag = True if options.installPackage: if not options.PackageName: logger.error("Please provide package name") errorFlag = True else: package = options.PackageName if errorFlag: logger.error("Found some errors. Please fix input options and re-run it.") return False cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/"+platform.machine()) cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/noarch") if not os.path.isdir(options.sourceRpmPath): cmdUtils.runCommandInShell("mkdir -p "+options.sourceRpmPath) if not os.path.isdir(options.buildRootPath): cmdUtils.runCommandInShell("mkdir -p " + options.buildRootPath) logger.debug("Source Path :"+options.sourcePath) logger.debug("Spec Path :" + options.specPath) logger.debug("Rpm Path :" + options.rpmPath) logger.debug("Log Path :" + options.logPath) logger.debug("Log Level :" + options.logLevel) logger.debug("Top Dir Path :" + options.topDirPath) logger.debug("Publish RPMS Path :" + options.publishRPMSPath) logger.debug("Publish X RPMS Path :" + options.publishXRPMSPath) if options.installPackage: logger.debug("Package to build:" + package) get_packages_with_build_options(options.pkgBuildOptionFile) try: constants.setSpecPath(options.specPath) constants.setSourcePath(options.sourcePath) constants.setRpmPath(options.rpmPath) constants.setSourceRpmPath(options.sourceRpmPath) constants.setTopDirPath(options.topDirPath) constants.setLogPath(options.logPath) constants.setLogLevel(options.logLevel) constants.setDist(options.dist) constants.setBuildNumber(options.buildNumber) constants.setReleaseVersion(options.releaseVersion) constants.setPrevPublishRPMRepo(options.publishRPMSPath) constants.setPrevPublishXRPMRepo(options.publishXRPMSPath) constants.setBuildRootPath(options.buildRootPath) constants.setPullSourcesURL(get_baseurl(options.pullsourcesConfig)) constants.setInputRPMSPath(options.inputRPMSPath) constants.setRPMCheck(options.rpmCheck) constants.setRpmCheckStopOnError(options.rpmCheckStopOnError) constants.setPublishBuildDependencies(options.publishBuildDependencies) constants.setPackageWeightsPath(options.packageWeightsPath) constants.setKatBuild(options.katBuild) constants.initialize() # parse SPECS folder SPECS() if options.toolChainStage == "stage1": pkgManager = PackageManager() pkgManager.buildToolChain() elif options.toolChainStage == "stage2": pkgManager = PackageManager() pkgManager.buildToolChainPackages(options.buildThreads) elif options.installPackage: buildSpecifiedPackages([package], options.buildThreads, options.pkgBuildType) elif options.pkgJsonInput: buildPackagesInJson(options.pkgJsonInput, options.buildThreads, options.pkgBuildType, pkgInfoJsonFile, logger) else: buildPackagesForAllSpecs(options.buildThreads, options.pkgBuildType, pkgInfoJsonFile, logger) except Exception as e: logger.error("Caught an exception") logger.error(str(e)) # print stacktrace traceback.print_exc() sys.exit(1) sys.exit(0)
def main(): usage = "Usage: %prog [options] <package name>" parser = ArgumentParser(usage) parser.add_argument("-s", "--spec-path", dest="specPath", default="../../SPECS") parser.add_argument("-x", "--source-path", dest="sourcePath", default="../../stage/SOURCES") parser.add_argument("-r", "--rpm-path", dest="rpmPath", default="../../stage/RPMS") parser.add_argument("-i", "--install-package", dest="installPackage", default=False, action="store_true") parser.add_argument("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="../../stage/PUBLISHRPMS") parser.add_argument("-e", "--publish-XRPMS-path", dest="publishXRPMSPath", default="../../stage/PUBLISHXRPMS") parser.add_argument("-l", "--log-path", dest="logPath", default="../../stage/LOGS") parser.add_argument("-y", "--log-level", dest="logLevel", default="error") parser.add_argument("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") parser.add_argument("-b", "--build-root-path", dest="buildRootPath", default="/mnt") parser.add_argument("-t", "--threads", dest="buildThreads", default=1, type=int, help="Number of working threads") parser.add_argument("-m", "--tool-chain-stage", dest="toolChainStage", default="None") parser.add_argument("-c", "--pullsources-config", dest="pullsourcesConfig", default="pullsources.conf") parser.add_argument("-d", "--dist-tag", dest="dist", default="") parser.add_argument("-k", "--input-RPMS-path", dest="inputRPMSPath", default=None) parser.add_argument("-n", "--build-number", dest="buildNumber", default="0000000") parser.add_argument("-v", "--release-version", dest="releaseVersion", default="NNNnNNN") parser.add_argument("-u", "--enable-rpmcheck", dest="rpmCheck", default=False, action="store_true") parser.add_argument("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS") parser.add_argument("-w", "--pkginfo-file", dest="pkgInfoFile", default="../../stage/pkg_info.json") parser.add_argument("-g", "--pkg-build-option-file", dest="pkgBuildOptionFile", default="../../common/data/pkg_build_options.json") parser.add_argument("-q", "--rpmcheck-stop-on-error", dest="rpmCheckStopOnError", default=False, action="store_true") parser.add_argument("-bd", "--publish-build-dependencies", dest="publishBuildDependencies", default=False) parser.add_argument("-pw", "--package-weights-path", dest="packageWeightsPath", default=None) parser.add_argument("-bt", "--build-type", dest="pkgBuildType", default="chroot") parser.add_argument("-F", "--kat-build", dest="katBuild", default=None) parser.add_argument("-pj", "--packages-json-input", dest="pkgJsonInput", default=None) parser.add_argument("PackageName", nargs='?') options = parser.parse_args() cmdUtils = CommandUtils() if not os.path.isdir(options.logPath): cmdUtils.runCommandInShell("mkdir -p " + options.logPath) logger = Logger.getLogger("Main", options.logPath, options.logLevel) errorFlag = False package = None pkgInfoJsonFile = options.pkgInfoFile if not os.path.isdir(options.sourcePath): logger.error("Given Sources Path is not a directory:" + options.sourcePath) errorFlag = True if not os.path.isdir(options.specPath): logger.error("Given Specs Path is not a directory:" + options.specPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath): logger.error("Given RPMS Path is not a directory:" + options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath): logger.error("Given X RPMS Path is not a directory:" + options.publishXRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath + "/" + platform.machine()): logger.error("Given RPMS Path is missing " + platform.machine() + " sub-directory:" + options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath + "/" + platform.machine()): logger.error("Given X RPMS Path is missing " + platform.machine() + " sub-directory:" + options.publishXRPMSPath) errorFlag = True if not os.path.isdir(options.publishRPMSPath + "/noarch"): logger.error("Given RPMS Path is missing noarch sub-directory:" + options.publishRPMSPath) errorFlag = True if not os.path.isdir(options.publishXRPMSPath + "/noarch"): logger.error("Given X RPMS Path is missing noarch sub-directory:" + options.publishXRPMSPath) errorFlag = True if not os.path.isfile(options.pkgBuildOptionFile): logger.warning("Given JSON File is not a file:" + options.pkgBuildOptionFile) if options.inputRPMSPath is not None and not os.path.isdir( options.inputRPMSPath): logger.error("Given input RPMS Path is not a directory:" + options.inputRPMSPath) errorFlag = True if options.packageWeightsPath is not None and not os.path.isfile( options.packageWeightsPath): logger.error("Given input Weights file is not a file:" + options.packageWeightsPath) errorFlag = True if options.pkgJsonInput is not None and not os.path.isfile( options.pkgJsonInput): logger.error("Given input packages file is not a file:" + options.pkgJsonInput) errorFlag = True if options.installPackage: if not options.PackageName: logger.error("Please provide package name") errorFlag = True else: package = options.PackageName if errorFlag: logger.error( "Found some errors. Please fix input options and re-run it.") return False if not os.path.isdir(options.rpmPath): cmdUtils.runCommandInShell("mkdir -p " + options.rpmPath + "/" + platform.machine()) cmdUtils.runCommandInShell("mkdir -p " + options.rpmPath + "/noarch") if not os.path.isdir(options.sourceRpmPath): cmdUtils.runCommandInShell("mkdir -p " + options.sourceRpmPath) if not os.path.isdir(options.buildRootPath): cmdUtils.runCommandInShell("mkdir -p " + options.buildRootPath) logger.debug("Source Path :" + options.sourcePath) logger.debug("Spec Path :" + options.specPath) logger.debug("Rpm Path :" + options.rpmPath) logger.debug("Log Path :" + options.logPath) logger.debug("Log Level :" + options.logLevel) logger.debug("Top Dir Path :" + options.topDirPath) logger.debug("Publish RPMS Path :" + options.publishRPMSPath) logger.debug("Publish X RPMS Path :" + options.publishXRPMSPath) if options.installPackage: logger.debug("Package to build:" + package) get_packages_with_build_options(options.pkgBuildOptionFile) try: constants.setSpecPath(options.specPath) constants.setSourcePath(options.sourcePath) constants.setRpmPath(options.rpmPath) constants.setSourceRpmPath(options.sourceRpmPath) constants.setTopDirPath(options.topDirPath) constants.setLogPath(options.logPath) constants.setLogLevel(options.logLevel) constants.setDist(options.dist) constants.setBuildNumber(options.buildNumber) constants.setReleaseVersion(options.releaseVersion) constants.setPrevPublishRPMRepo(options.publishRPMSPath) constants.setPrevPublishXRPMRepo(options.publishXRPMSPath) constants.setBuildRootPath(options.buildRootPath) constants.setPullSourcesURL(get_baseurl(options.pullsourcesConfig)) constants.setInputRPMSPath(options.inputRPMSPath) constants.setRPMCheck(options.rpmCheck) constants.setRpmCheckStopOnError(options.rpmCheckStopOnError) constants.setPublishBuildDependencies(options.publishBuildDependencies) constants.setPackageWeightsPath(options.packageWeightsPath) constants.setKatBuild(options.katBuild) constants.initialize() # parse SPECS folder SPECS() if options.toolChainStage == "stage1": pkgManager = PackageManager() pkgManager.buildToolChain() elif options.toolChainStage == "stage2": pkgManager = PackageManager() pkgManager.buildToolChainPackages(options.buildThreads) elif options.installPackage: buildSpecifiedPackages([package], options.buildThreads, options.pkgBuildType) elif options.pkgJsonInput: buildPackagesInJson(options.pkgJsonInput, options.buildThreads, options.pkgBuildType, pkgInfoJsonFile, logger) else: buildPackagesForAllSpecs(options.buildThreads, options.pkgBuildType, pkgInfoJsonFile, logger) except Exception as e: logger.error("Caught an exception") logger.error(str(e)) # print stacktrace traceback.print_exc() sys.exit(1) sys.exit(0)
def main(): usage = "Usage: %prog [options]" parser = ArgumentParser(usage) parser.add_argument("-i", "--input-type", dest="input_type", default=DEFAULT_INPUT_TYPE) parser.add_argument("-p", "--pkg", dest="pkg") parser.add_argument("-f", "--file", dest="json_file", default="packages_minimal.json") parser.add_argument("-d", "--disp", dest="display_option", default=DEFAULT_DISPLAY_OPTION) parser.add_argument("-s", "--spec-dir", dest="spec_dir", default=SPEC_FILE_DIR) parser.add_argument("-l", "--log-dir", dest="log_dir", default=LOG_FILE_DIR) parser.add_argument("-t", "--stage-dir", dest="stage_dir", default="../../stage") parser.add_argument("-a", "--input-data-dir", dest="input_data_dir", default="../../common/data/") parser.add_argument("-o", "--output-dir", dest="output_dir", default="../../stage/common/data") options = parser.parse_args() constants.setSpecPath(options.spec_dir) constants.setLogPath(options.log_dir) constants.initialize() cmdUtils = CommandUtils() if not os.path.isdir(options.output_dir): cmdUtils.runCommandInShell2("mkdir -p " + options.output_dir) if not options.input_data_dir.endswith('/'): options.input_data_dir += '/' try: specDeps = SpecDependencyGenerator() # To display/print package dependencies on console if (options.input_type == "pkg" or options.input_type == "who-needs" or options.input_type == "who-needs-build"): specDeps.process(options.input_type, options.pkg, options.display_option) elif options.input_type == "json": list_json_files = options.json_file.split("\n") # Generate the expanded package dependencies json file based on package_list_file for json_file in list_json_files: shutil.copy2(json_file, options.output_dir) json_wrapper_option_list = JsonWrapper(json_file) option_list_json = json_wrapper_option_list.read() options_sorted = option_list_json.items() for install_option in options_sorted: output_file = None input_value = os.path.join(os.path.dirname(json_file), install_option[1]["file"]) if options.display_option == "tree" and install_option[1][ "title"] == "ISO Packages": continue if options.display_option == "json": output_file = os.path.join(options.output_dir, install_option[1]["file"]) print("Generating the install time dependency list for " + json_file) specDeps.process(options.input_type, input_value, options.display_option, output_file) except Exception as e: traceback.print_exc() sys.stderr.write(str(e)) sys.stderr.write( "Failed to generate dependency lists from spec files\n") sys.exit(1) sys.stderr.write( "Successfully generated dependency lists from spec files\n") sys.exit(0)
def main(): usage = "Usage: %prog [options]" parser = ArgumentParser(usage) parser.add_argument("-i", "--input-type", dest="input_type", default=DEFAULT_INPUT_TYPE) parser.add_argument("-p", "--pkg", dest="pkg") parser.add_argument("-f", "--file", dest="json_file", default="packages_minimal.json") parser.add_argument("-d", "--display-option", dest="display_option", default=DEFAULT_DISPLAY_OPTION) parser.add_argument("-s", "--spec-path", dest="spec_path", default=SPEC_FILE_DIR) parser.add_argument("-l", "--log-path", dest="log_path", default=LOG_FILE_DIR) parser.add_argument("-y", "--log-level", dest="log_level", default="info") parser.add_argument("-t", "--stage-dir", dest="stage_dir", default="../../stage") parser.add_argument("-a", "--input-data-dir", dest="input_data_dir", default="../../common/data/") parser.add_argument("-o", "--output-dir", dest="output_dir", default="../../stage/common/data") options = parser.parse_args() constants.setSpecPath(options.spec_path) constants.setLogPath(options.log_path) constants.setLogLevel(options.log_level) constants.initialize() cmdUtils = CommandUtils() logger = Logger.getLogger("SpecDeps", options.log_path, options.log_level) if not os.path.isdir(options.output_dir): cmdUtils.runCommandInShell("mkdir -p "+options.output_dir) if not options.input_data_dir.endswith('/'): options.input_data_dir += '/' try: specDeps = SpecDependencyGenerator(options.log_path, options.log_level) if options.input_type == "remove-upward-deps": isToolChainPkg = specDeps.process("is-toolchain-pkg", options.pkg, options.display_option) if isToolChainPkg: logger.info("Removing all staged RPMs since toolchain packages were modified") cmdUtils.runCommandInShell("rm -rf stage/RPMS/") else: whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option) logger.info("Removing upward dependencies: " + str(whoNeedsList)) for pkg in whoNeedsList: package, version = StringUtils.splitPackageNameAndVersion(pkg) release = SPECS.getData().getRelease(package, version) for p in SPECS.getData().getPackages(package,version): buildarch=SPECS.getData().getBuildArch(p, version) rpmFile = "stage/RPMS/" + buildarch + "/" + p + "-" + version + "-" + release + ".*" + buildarch+".rpm" cmdUtils.runCommandInShell("rm -f "+rpmFile) elif options.input_type == "print-upward-deps": whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option) logger.info("Upward dependencies: " + str(whoNeedsList)) # To display/print package dependencies on console elif (options.input_type == "pkg" or options.input_type == "who-needs"): specDeps.process(options.input_type, options.pkg, options.display_option) elif options.input_type == "json": list_json_files = options.json_file.split("\n") # Generate the expanded package dependencies json file based on package_list_file logger.info("Generating the install time dependency list for all json files") if list_json_files: shutil.copy2(os.path.dirname(list_json_files[0]) + "/build_install_options_all.json", options.output_dir) for json_file in list_json_files: output_file = None if options.display_option == "json": output_file = os.path.join(options.output_dir, os.path.basename(json_file)) specDeps.process(options.input_type, json_file, options.display_option, output_file) except Exception as e: traceback.print_exc() sys.stderr.write(str(e)) sys.stderr.write("Failed to generate dependency lists from spec files\n") sys.exit(1) sys.exit(0)
def main(): usage = "Usage: %prog [options]" parser = ArgumentParser(usage) parser.add_argument("-i", "--input-type", dest="input_type", default=DEFAULT_INPUT_TYPE) parser.add_argument("-p", "--pkg", dest="pkg") parser.add_argument("-f", "--file", dest="json_file", default="packages_minimal.json") parser.add_argument("-d", "--display-option", dest="display_option", default=DEFAULT_DISPLAY_OPTION) parser.add_argument("-s", "--spec-path", dest="spec_path", default=SPEC_FILE_DIR) parser.add_argument("-l", "--log-path", dest="log_path", default=LOG_FILE_DIR) parser.add_argument("-y", "--log-level", dest="log_level", default="info") parser.add_argument("-t", "--stage-dir", dest="stage_dir", default="../../stage") parser.add_argument("-a", "--input-data-dir", dest="input_data_dir", default="../../common/data/") parser.add_argument("-o", "--output-dir", dest="output_dir", default="../../stage/common/data") options = parser.parse_args() constants.setSpecPath(options.spec_path) constants.setLogPath(options.log_path) constants.setLogLevel(options.log_level) constants.initialize() cmdUtils = CommandUtils() logger = Logger.getLogger("SpecDeps", options.log_path, options.log_level) if not os.path.isdir(options.output_dir): cmdUtils.runCommandInShell2("mkdir -p "+options.output_dir) if not options.input_data_dir.endswith('/'): options.input_data_dir += '/' try: specDeps = SpecDependencyGenerator(options.log_path, options.log_level) if options.input_type == "remove-upward-deps": whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option) logger.info("Removing upward dependencies: " + str(whoNeedsList)) for pkg in whoNeedsList: package, version = StringUtils.splitPackageNameAndVersion(pkg) release = SPECS.getData().getRelease(package, version) for p in SPECS.getData().getPackages(package,version): buildarch=SPECS.getData().getBuildArch(p, version) rpmFile = "stage/RPMS/" + buildarch + "/" + p + "-" + version + "-" + release + ".*" + buildarch+".rpm" cmdUtils.runCommandInShell2("rm -f "+rpmFile) elif options.input_type == "print-upward-deps": whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option) logger.info("Upward dependencies: " + str(whoNeedsList)) # To display/print package dependencies on console elif (options.input_type == "pkg" or options.input_type == "who-needs"): specDeps.process(options.input_type, options.pkg, options.display_option) elif options.input_type == "json": list_json_files = options.json_file.split("\n") # Generate the expanded package dependencies json file based on package_list_file logger.info("Generating the install time dependency list for all json files") for json_file in list_json_files: shutil.copy2(json_file, options.output_dir) json_wrapper_option_list = JsonWrapper(json_file) option_list_json = json_wrapper_option_list.read() options_sorted = option_list_json.items() for install_option in options_sorted: output_file = None input_value = os.path.join(os.path.dirname(json_file), install_option[1]["file"]) if options.display_option == "tree" and install_option[1]["title"] == "ISO Packages": continue if options.display_option == "json": output_file = os.path.join(options.output_dir, install_option[1]["file"]) specDeps.process(options.input_type, input_value, options.display_option, output_file) except Exception as e: traceback.print_exc() sys.stderr.write(str(e)) sys.stderr.write("Failed to generate dependency lists from spec files\n") sys.exit(1) sys.exit(0)
if i not in constants.cams_in_use: to_be_deleted.append(i) for i in to_be_deleted: del cams[i] # pre-process for the grabbed frames for i in constants.cams_in_use: if grabbed[i]: frames[i] = imutils.resize(frames[i], width=640) frames[i] = cv2.flip(frames[i], 1) if helper is None: h, w, _ = frames[i].shape helper = Helper(width=w, height=h) if not init: # initialize the ordered dicts in the constants module constants.initialize() # initialize the centroid tracker constants.ct.initialize() init = True # register the recognized staffs and show their bounding boxes helper.show_recognized_faces(frames) # show on the screen yolo bounding boxes that are generated by the pre-trained yolo head model helper.show_yolo_bboxes(frames) # track staffs by using detected faces and detected heads centroids helper.track() # draw the screen borders in white color, put room id and time variables as a text on the screen helper.draw_to_screen()
def main(): usage = "Usage: %prog [options]" parser = ArgumentParser(usage) parser.add_argument("-i", "--input-type", dest="input_type", default=DEFAULT_INPUT_TYPE) parser.add_argument("-p", "--pkg", dest="pkg") parser.add_argument("-f", "--file", dest="json_file", default="packages_minimal.json") parser.add_argument("-d", "--display-option", dest="display_option", default=DEFAULT_DISPLAY_OPTION) parser.add_argument("-s", "--spec-path", dest="spec_path", default=SPEC_FILE_DIR) parser.add_argument("-l", "--log-path", dest="log_path", default=LOG_FILE_DIR) parser.add_argument("-y", "--log-level", dest="log_level", default="info") parser.add_argument("-t", "--stage-dir", dest="stage_dir", default="../../stage") parser.add_argument("-a", "--input-data-dir", dest="input_data_dir", default="../../common/data/") parser.add_argument("-o", "--output-dir", dest="output_dir", default="../../stage/common/data") options = parser.parse_args() constants.setSpecPath(options.spec_path) constants.setLogPath(options.log_path) constants.setLogLevel(options.log_level) constants.initialize() cmdUtils = CommandUtils() logger = Logger.getLogger("SpecDeps", options.log_path, options.log_level) if not os.path.isdir(options.output_dir): cmdUtils.runCommandInShell("mkdir -p " + options.output_dir) if not options.input_data_dir.endswith('/'): options.input_data_dir += '/' try: specDeps = SpecDependencyGenerator(options.log_path, options.log_level) if options.input_type == "print-upward-deps": whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option) logger.info("Upward dependencies: " + str(whoNeedsList)) # To display/print package dependencies on console elif (options.input_type == "pkg" or options.input_type == "who-needs" or options.input_type == "all-requires"): specDeps.process(options.input_type, options.pkg, options.display_option) elif options.input_type == "json": list_json_files = options.json_file.split("\n") # Generate the expanded package dependencies json file based on package_list_file logger.info( "Generating the install time dependency list for all json files" ) if list_json_files: shutil.copy2( os.path.dirname(list_json_files[0]) + "/build_install_options_all.json", options.output_dir) for json_file in list_json_files: output_file = None if options.display_option == "json": output_file = os.path.join( options.output_dir, os.path.splitext(os.path.basename(json_file))[0] + "_expanded.json") specDeps.process(options.input_type, json_file, options.display_option, output_file) shutil.copyfile( json_file, os.path.join(options.output_dir, os.path.basename(json_file))) except Exception as e: traceback.print_exc() sys.stderr.write(str(e)) sys.stderr.write( "Failed to generate dependency lists from spec files\n") sys.exit(1) sys.exit(0)