... | ... |
@@ -6,7 +6,7 @@ from CommandUtils import CommandUtils |
6 | 6 |
from Logger import Logger |
7 | 7 |
from constants import constants |
8 | 8 |
from PackageManager import PackageManager |
9 |
-from ChrootUtils import ChrootUtils |
|
9 |
+import json |
|
10 | 10 |
|
11 | 11 |
def main(): |
12 | 12 |
usage = "Usage: %prog [options] <package name>" |
... | ... |
@@ -14,15 +14,46 @@ def main(): |
14 | 14 |
parser.add_option("-s", "--spec-path", dest="specPath", default="/workspace1/myrepos/photon/SPECS") |
15 | 15 |
parser.add_option("-x", "--source-path", dest="sourcePath", default="/workspace1/mysources") |
16 | 16 |
parser.add_option("-r", "--rpm-path", dest="rpmPath", default="/workspace1/mystage/RPMS") |
17 |
- parser.add_option("-t", "--install-tool-chain", dest="installToolChain", default=False, action ="store_true") |
|
18 | 17 |
parser.add_option("-i", "--install-package", dest="installPackage", default=False, action ="store_true") |
19 | 18 |
parser.add_option("-p", "--publish-RPMS-path", dest="publishRPMSPath", default="/workspace1/testTP1RPMS/RPMS") |
20 | 19 |
parser.add_option("-l", "--log-path", dest="logPath", default="/workspace1/LOGS") |
21 |
- parser.add_option("-o", "--build-option", dest="buildOption", default=False, action ="store_true") |
|
20 |
+ parser.add_option("-o", "--build-option", dest="buildOption", default="full") |
|
22 | 21 |
parser.add_option("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") |
23 | 22 |
parser.add_option("-j", "--json-file", dest="inputJSONFile", default="input.json") |
24 | 23 |
|
25 | 24 |
(options, args) = parser.parse_args() |
25 |
+ logger=Logger.getLogger(options.logPath+"/Main") |
|
26 |
+ |
|
27 |
+ errorFlag=False |
|
28 |
+ if not os.path.isdir(options.sourcePath): |
|
29 |
+ logger.error("Given Sources Path is not a directory:"+options.sourcePath) |
|
30 |
+ errorFlag = True |
|
31 |
+ if not os.path.isdir(options.specPath): |
|
32 |
+ logger.error("Given Specs Path is not a directory:"+options.specPath) |
|
33 |
+ errorFlag = True |
|
34 |
+ if not os.path.isdir(options.publishRPMSPath): |
|
35 |
+ logger.error("Given RPMS Path is not a directory:"+options.publishRPMSPath) |
|
36 |
+ errorFlag = True |
|
37 |
+ if not os.path.isdir(options.publishRPMSPath+"/x86_64"): |
|
38 |
+ logger.error("Given RPMS Path is missing x86_64 sub-directory:"+options.publishRPMSPath) |
|
39 |
+ errorFlag = True |
|
40 |
+ if not os.path.isdir(options.publishRPMSPath+"/noarch"): |
|
41 |
+ logger.error("Given RPMS Path is missing noarch sub-directory:"+options.publishRPMSPath) |
|
42 |
+ errorFlag = True |
|
43 |
+ |
|
44 |
+ if not os.path.isfile(options.inputJSONFile) and not options.installPackage: |
|
45 |
+ logger.error("Given JSON File is not a file:"+options.inputJSONFile) |
|
46 |
+ errorFlag = True |
|
47 |
+ |
|
48 |
+ if len(args) != 1 and options.installPackage : |
|
49 |
+ logger.error("Please provide package name") |
|
50 |
+ errorFlag = True |
|
51 |
+ |
|
52 |
+ package=args[0] |
|
53 |
+ |
|
54 |
+ if errorFlag: |
|
55 |
+ logger.error("Found some errors. Please fix input options and re-run it.") |
|
56 |
+ return False |
|
26 | 57 |
|
27 | 58 |
cmdUtils=CommandUtils() |
28 | 59 |
if not os.path.isdir(options.logPath): |
... | ... |
@@ -32,15 +63,19 @@ def main(): |
32 | 32 |
cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/x86_64") |
33 | 33 |
cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/noarch") |
34 | 34 |
|
35 |
- logger=Logger.getLogger(options.logPath+"/Main") |
|
35 |
+ |
|
36 | 36 |
logger.info("Source Path :"+options.sourcePath) |
37 | 37 |
logger.info("Spec Path :" + options.specPath) |
38 | 38 |
logger.info("Rpm Path :" + options.rpmPath) |
39 |
- logger.info("Tools Path :" + options.toolsPath) |
|
40 | 39 |
logger.info("Log Path :" + options.logPath) |
41 | 40 |
logger.info("Top Dir Path :" + options.topDirPath) |
41 |
+ logger.info("Publish RPMS Path :" + options.publishRPMSPath) |
|
42 |
+ if not options.installPackage: |
|
43 |
+ logger.info("JSON File :" + options.inputJSONFile) |
|
44 |
+ else: |
|
45 |
+ logger.info("Package to build:"+package) |
|
42 | 46 |
|
43 |
- |
|
47 |
+ ''' |
|
44 | 48 |
listPackages=["acl","attr","autoconf","automake","bash","bc","bindutils","binutils","bison","boost","btrfs-progs","bzip2","ca-certificates","cdrkit","check", |
45 | 49 |
"cloud-init","cmake","coreutils","cpio","cracklib","createrepo","curl","cyrus-sasl","db","dbus","deltarpm","diffutils","docbook-xml","docbook-xsl", |
46 | 50 |
"docker","dparted","dracut","e2fsprogs","elfutils","etcd","expat","file","filesystem","findutils","flex","gawk","gcc","gdb","gdbm","gettext","git", |
... | ... |
@@ -56,9 +91,31 @@ def main(): |
56 | 56 |
"python-six","PyYAML","readline","rocket","rpm","rpm-ostree","rpm-ostree-toolbox","ruby","sed","shadow","sqlite-autoconf","strace","sudo", |
57 | 57 |
"swig","systemd","tar","tcpdump","tcsh","tdnf","texinfo","thin-provisioning-tools","tzdata","unzip","urlgrabber","util-linux","vim","wget", |
58 | 58 |
"which","xerces-c","XML-Parser","xml-security-c","xz","yum","yum-metadata-parser","zlib"] |
59 |
+ ''' |
|
60 |
+ try: |
|
61 |
+ constants.initialize(options) |
|
62 |
+ if options.installPackage: |
|
63 |
+ buildAPackage(package) |
|
64 |
+ else: |
|
65 |
+ buildPackagesFromGivenJSONFile(options.inputJSONFile, options.buildOption,logger) |
|
66 |
+ except Exception as e: |
|
67 |
+ logger.error("Caught an exception") |
|
68 |
+ logger.error(str(e)) |
|
69 |
+ return False |
|
59 | 70 |
|
60 |
- constants.initialize(options) |
|
61 |
- |
|
71 |
+ return True |
|
72 |
+ |
|
73 |
+def buildAPackage(package): |
|
74 |
+ listPackages=[] |
|
75 |
+ listPackages.append(package) |
|
76 |
+ pkgManager = PackageManager() |
|
77 |
+ pkgManager.buildPackages(listPackages) |
|
78 |
+ |
|
79 |
+def buildPackagesFromGivenJSONFile(inputJSONFile,buildOption,logger): |
|
80 |
+ jsonObj = json.load(inputJSONFile) |
|
81 |
+ listPackages=jsonObj[buildOption] |
|
82 |
+ logger.info("List of packages to build:") |
|
83 |
+ logger.info(listPackages) |
|
62 | 84 |
pkgManager = PackageManager() |
63 | 85 |
pkgManager.buildPackages(listPackages) |
64 | 86 |
|
65 | 87 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,76 @@ |
0 |
+{ |
|
1 |
+ "micro":["glibc","zlib", "filesystem", |
|
2 |
+ "gmp", "mpfr", "libgcc", "libstdc++", |
|
3 |
+ "bzip2", "pkg-config", "ncurses", "cracklib", "cracklib-dicts", "shadow", "procps-ng", "e2fsprogs", |
|
4 |
+ "iana-etc", "readline", "coreutils", "bash", "bc", "libtool", |
|
5 |
+ "inetutils", |
|
6 |
+ "xz", "grub", "iproute2", "kbd", "kmod", "libpipeline", |
|
7 |
+ "util-linux", |
|
8 |
+ "openssl", "libffi", "expat", |
|
9 |
+ "linux", "curl", |
|
10 |
+ "iptables", "ca-certificates", |
|
11 |
+ "Linux-PAM", "attr", "libcap", "systemd", "dbus", |
|
12 |
+ "sqlite-autoconf", "elfutils-libelf", "elfutils-libelf-devel", |
|
13 |
+ "nspr", "nss", "popt", "lua", "rpm", "openssh", |
|
14 |
+ "db", "libsolv", "libgpg-error", "hawkey", "libassuan", "gpgme", "librepo", "pcre", "glib", "tdnf", |
|
15 |
+ "photon-release" |
|
16 |
+ ], |
|
17 |
+ |
|
18 |
+ "minimal":["glibc", "zlib", "filesystem", "binutils", "gmp", "mpfr", "libgcc", "libstdc++","libgomp", |
|
19 |
+ "pkg-config", "ncurses", "bash", "bzip2", "cracklib", "cracklib-dicts", "shadow", "procps-ng", "iana-etc", |
|
20 |
+ "readline", "coreutils", "bc", "libtool", "inetutils", |
|
21 |
+ "findutils", "xz", "grub", "iproute2", "util-linux", "openssl", "linux", "ca-certificates", "curl", "iptables", "Linux-PAM", |
|
22 |
+ "attr", "libcap", "kmod", "systemd", "expat", "dbus", "file", "e2fsprogs", "elfutils-libelf", "lua", "popt", |
|
23 |
+ "sqlite-autoconf", "nspr", "nss", "rpm", |
|
24 |
+ "openssh", "libffi", "gdbm", "python2", "python2-libs", "pcre", "glib", "libxml2", |
|
25 |
+ "photon-release", |
|
26 |
+ "sed", "grep", "cpio", "gzip", "nano", "db", "libsolv", "libgpg-error", "hawkey", "libassuan", "gpgme", "librepo", "tdnf", |
|
27 |
+ "libdnet", "xerces-c", "xml-security-c", "libmspack", "open-vm-tools", |
|
28 |
+ "docker","bridge-utils", |
|
29 |
+ "libyaml", "PyYAML", "python-requests", "python-prettytable", "python-jsonpointer", "python-jsonpatch", "python-six", |
|
30 |
+ "python-configobj", "cloud-init", |
|
31 |
+ "krb5", "e2fsprogs-devel"], |
|
32 |
+ |
|
33 |
+ "full":["glibc", "zlib", "filesystem", "binutils", "gmp", "mpfr", "libgcc", "libstdc++","libgomp", |
|
34 |
+ "pkg-config", "ncurses", "bash", "bzip2", "cracklib", "cracklib-dicts", "shadow", "procps-ng", "iana-etc", "readline", |
|
35 |
+ "coreutils", "bc", "libtool", "inetutils", |
|
36 |
+ "findutils", "xz", "grub", "iproute2", "util-linux", "openssl", "linux", "ca-certificates", "curl", "iptables", "Linux-PAM", |
|
37 |
+ "attr", "libcap", "kmod", "systemd", "expat", "dbus", "file", "e2fsprogs", "elfutils-libelf", "lua", "popt", |
|
38 |
+ "sqlite-autoconf", "nspr", "nss", "rpm", |
|
39 |
+ "openssh", "libffi", "gdbm", "python2", "python2-libs", "pcre", "glib", "libxml2", |
|
40 |
+ "photon-release", |
|
41 |
+ "sed", "grep", "cpio", "gzip", "nano", "db", "libsolv", "libgpg-error", "hawkey", "libassuan", "gpgme", "librepo", "tdnf", |
|
42 |
+ "libdnet", "xerces-c", "xml-security-c", "libmspack", "open-vm-tools", |
|
43 |
+ "docker","bridge-utils", |
|
44 |
+ "libyaml", "PyYAML", "python-requests", "python-prettytable", "python-jsonpointer", "python-jsonpatch", "python-six", |
|
45 |
+ "python-configobj", "cloud-init", |
|
46 |
+ "krb5", "e2fsprogs-devel","unzip", "gmp-devel", "sudo", "bzip2-devel", "XML-Parser", "intltool", "mercurial", "libsigc++", "boost", |
|
47 |
+ "libgomp-devel", "libstdc++-devel", "libgcc-devel", "gcc", "bison", "gdb", "libpipeline", "python2-devel", |
|
48 |
+ "python2-tools", "linux-api-headers","gawk","check", "libltdl", "libltdl-devel", "pcre-devel", "glib-devel", |
|
49 |
+ "glibc-devel", "glibc-lang", "zlib-devel", "gettext", "git", "git-lang", "autoconf", "perl", "perl-DBI","perl-Config-IniFiles", |
|
50 |
+ "perl-DBIx-Simple", "perl-DBD-SQLite","perl-Exporter-Tiny","perl-JSON-XS","perl-List-MoreUtils","perl-Module-Install", |
|
51 |
+ "perl-Module-ScanDeps","perl-Types-Serialiser","perl-WWW-Curl","perl-YAML-Tiny","perl-YAML","perl-common-sense", |
|
52 |
+ "perl-libintl","tcsh", |
|
53 |
+ "gobject-introspection", "gobject-introspection-devel", "gobject-introspection-python", "procps-ng-devel", |
|
54 |
+ "bash-lang", "kbd", "coreutils-lang", "libxslt", "docbook-xml", "docbook-xsl", "gtk-doc", "popt-devel", "texinfo", "tar", |
|
55 |
+ "kubernetes", "cyrus-sasl", "openldap", "binutils-devel", "python-iniparse", "psmisc", "etcd", "openssl-devel", |
|
56 |
+ "util-linux-lang", "db-docs", "linux-dev", "linux-docs", "mpc", "json-glib", "json-glib-devel", |
|
57 |
+ "automake", "libpcap", "tcpdump", "elfutils-libelf-devel", "elfutils", "elfutils-devel", "elfutils-devel-static", |
|
58 |
+ "elfutils-libelf-devel-static", |
|
59 |
+ "go", "grub-lang", "diffutils", "groff", "man-db", "mpfr-devel", "man-pages", |
|
60 |
+ "hawkey-devel", "python-hawkey", "busybox", "libxml2-devel", "ruby", "readline-devel", "wget", "cifs-utils", |
|
61 |
+ "Linux-PAM-lang", "make", "bindutils", "gperf", "lua-devel", "which", "less", |
|
62 |
+ "cmake", "gpgme-devel", "parted", "vim", "xz-devel", "xerces-c-devel", "xml-security-c-devel", |
|
63 |
+ "nss-devel", "ncurses-devel", "tzdata", "itstool", "sed-lang", "gptfdisk", "ntp", "flex", "patch", "m4", "dracut", "dracut-tools", |
|
64 |
+ "ostree", "tdnf-devel", "rpm-ostree", "createrepo", "glibmm", "deltarpm", "cdrkit", "dparted", "libgsystem", |
|
65 |
+ "rpm-ostree-toolbox","libsepol","libselinux","device-mapper-libs","device-mapper", |
|
66 |
+ "acl","btrfs-progs","btrfs-progs-devel","device-mapper-devel","device-mapper-event","device-mapper-event-devel", |
|
67 |
+ "device-mapper-event-libs","libacl","libacl-devel","libselinux-devel","libselinux-python","libselinux-utils","libsepol-devel", |
|
68 |
+ "libaio","libaio-devel","thin-provisioning-tools","lvm2","lvm2-devel","lvm2-libs","lvm2-python-libs","lzo","lzo-devel", |
|
69 |
+ "lzo-minilzo","swig", |
|
70 |
+ "rpm-devel","pycurl","urlgrabber","yum-metadata-parser","yum", "rocket", "strace", "cracklib-python", |
|
71 |
+ "haveged", "haveged-devel", |
|
72 |
+ "postgresql", "openjdk", "apr", "apr-util", "httpd", "openvswitch"] |
|
73 |
+} |
|
74 |
+ |
|
75 |
+ |