a007b861 |
import platform |
b5e09fac |
from Logger import Logger |
2820c61a |
class constants(object): |
87815216 |
specPath = ""
sourcePath = ""
rpmPath = ""
logPath = "" |
26b55679 |
logLevel = "info" |
87815216 |
topDirPath = ""
buildRootPath = "/mnt"
prevPublishRPMRepo = ""
prevPublishXRPMRepo = "" |
aac331d9 |
pullsourcesURL = ""
extrasourcesURLs = {} |
87815216 |
buildPatch = False
inputRPMSPath = ""
rpmCheck = False
sourceRpmPath = ""
publishBuildDependencies = False
packageWeightsPath = None
dockerUnixSocket = "/var/run/docker.sock" |
8f56b626 |
buildContainerImage = "photon_build_container:latest" |
87815216 |
userDefinedMacros = {} |
accc8120 |
dist = None
buildNumber = None
releaseVersion = None
katBuild = None
testForceRPMS = []
tmpDirPath = "/dev/shm" |
085306ae |
buildOptions = {} |
f93ef2b0 |
# will be extended later from listMakeCheckRPMPkgtoInstall
listMakeCheckRPMPkgWithVersionstoInstall = None |
a007b861 |
buildArch = platform.machine()
targetArch = platform.machine()
crossCompiling = False
currentArch = buildArch |
7418d2bf |
|
87815216 |
noDepsPackageList = [ |
7418d2bf |
"texinfo",
"bzip2",
"bzip2-libs",
"gettext",
"nspr",
"bison",
"go",
"sqlite",
"sqlite-devel",
"sqlite-libs"]
|
fb300e7c |
# These packages will be built in first order as build-core-toolchain stage |
87815216 |
listCoreToolChainPackages = [ |
21a45f16 |
"filesystem", |
55dba468 |
"linux-api-headers",
"glibc",
"zlib",
"file",
"binutils",
"gmp",
"mpfr",
"mpc",
"gcc",
"pkg-config",
"ncurses",
"readline",
"bash"]
|
fb300e7c |
# These packages will be built in a second stage to replace publish RPMS |
87815216 |
listToolChainPackages = [ |
21a45f16 |
"filesystem", |
55dba468 |
"linux-api-headers",
"glibc",
"zlib",
"file",
"binutils",
"gmp",
"mpfr",
"mpc",
"gcc",
"pkg-config",
"ncurses",
"bash",
"bzip2",
"sed",
"procps-ng",
"coreutils",
"m4",
"grep",
"readline",
"diffutils",
"gawk",
"findutils",
"gettext",
"gzip",
"make",
"patch",
"util-linux",
"tar",
"xz",
"libtool",
"flex",
"bison",
"popt",
"nspr", |
7418d2bf |
"nspr-devel", |
9874e684 |
"sqlite", |
55dba468 |
"nss", |
fb300e7c |
"elfutils",
"expat",
"libffi", |
55dba468 |
"libpipeline",
"gdbm",
"perl",
"texinfo",
"autoconf",
"automake", |
fb300e7c |
"openssl", |
7418d2bf |
"openssl-devel", |
b3ee0bbc |
"libdb", |
a75dbe8f |
"rpm"] |
55dba468 |
|
fb300e7c |
# List or RPMS that will be installed in a chroot prior to build each |
7f9d2e12 |
# package. This list should be ordered by install order. On a stage1
# and stage2 published rpms will/might be used after stage2 only local
# RPMS will be used |
87815216 |
listToolChainRPMsToInstall = [ |
21a45f16 |
"filesystem", |
55dba468 |
"linux-api-headers",
"glibc",
"glibc-devel", |
42e8b7da |
"glibc-iconv",
"glibc-tools", |
55dba468 |
"zlib",
"zlib-devel", |
a8ab4187 |
"file-libs", |
55dba468 |
"file",
"binutils",
"binutils-devel",
"gmp",
"gmp-devel",
"mpfr",
"mpfr-devel",
"mpc",
"libgcc",
"libgcc-devel", |
f0831978 |
"libgcc-atomic", |
55dba468 |
"libstdc++",
"libstdc++-devel",
"libgomp",
"libgomp-devel",
"gcc",
"pkg-config",
"ncurses", |
f5cac196 |
"ncurses-libs",
"ncurses-devel", |
55dba468 |
"bash",
"bzip2", |
7fbd3a1e |
"bzip2-libs", |
fb300e7c |
"bzip2-devel", |
55dba468 |
"sed",
"procps-ng",
"coreutils",
"m4",
"grep",
"readline",
"diffutils",
"gawk",
"findutils",
"gettext",
"gzip",
"make",
"patch",
"util-linux", |
42e8b7da |
"util-linux-libs", |
55dba468 |
"util-linux-devel",
"tar",
"xz", |
7fbd3a1e |
"xz-libs", |
55dba468 |
"libtool",
"flex",
"flex-devel",
"bison",
"readline-devel",
"popt",
"popt-devel",
"nspr", |
7fbd3a1e |
"nspr-devel", |
9874e684 |
"sqlite", |
fb300e7c |
"sqlite-libs", |
55dba468 |
"nss", |
7fbd3a1e |
"nss-libs", |
55dba468 |
"nss-devel",
"elfutils-libelf",
"elfutils",
"elfutils-libelf-devel",
"elfutils-devel",
"expat", |
7fbd3a1e |
"expat-libs", |
55dba468 |
"libffi",
"libpipeline",
"gdbm",
"perl",
"texinfo",
"autoconf",
"automake",
"openssl",
"openssl-devel",
"libcap", |
ec017e0f |
"libdb",
"libdb-devel", |
55dba468 |
"rpm",
"rpm-build",
"rpm-devel", |
fb300e7c |
"rpm-libs", |
8f56b626 |
"cpio"] |
8a2c2c4e |
|
fb300e7c |
# List of RPMs which are not published. They will be created during the
# build process |
87815216 |
listOfRPMsProvidedAfterBuild = [ |
fb300e7c |
"util-linux-devel",
"flex-devel", |
7fbd3a1e |
"nspr-devel", |
42e8b7da |
"glibc-iconv",
"glibc-tools", |
7fbd3a1e |
"bzip2-libs",
"expat-libs", |
f5cac196 |
"ncurses-libs", |
42e8b7da |
"util-linux-libs", |
7fbd3a1e |
"nss-libs",
"xz-libs", |
9874e684 |
"sqlite", |
fb300e7c |
"sqlite-libs", |
a8ab4187 |
"file-libs", |
fb300e7c |
"rpm-libs"] |
55dba468 |
|
fb300e7c |
# List of packages that will be installed in addition for each
# package to make check |
87815216 |
listMakeCheckRPMPkgtoInstall = [ |
b5e09fac |
"python2",
"python2-devel",
"python2-libs",
"python2-tools", |
202dd1d6 |
"PyYAML",
"libyaml", |
b5e09fac |
"libffi",
"python-setuptools", |
14b9b3bb |
"python3-setuptools", |
b5e09fac |
"ca-certificates",
"linux", |
dd6e479c |
"createrepo_c", |
b5e09fac |
"sudo",
"ruby",
"curl",
"pcre-devel",
"boost-devel",
"which",
"go",
"e2fsprogs-devel",
"shadow",
"check",
"libacl-devel",
"device-mapper",
"wget",
"tar",
"pkg-config",
"git",
"openssl", |
2a807a3e |
"openssl-devel", |
b5e09fac |
"net-tools",
"less", |
9874e684 |
"iana-etc", |
ec017e0f |
"libdb", |
b5e09fac |
"rpm-devel",
"rpm",
"libxml2",
"python-xml", |
14b9b3bb |
"python3-xml", |
b5e09fac |
"libacl",
"tzdata", |
2a807a3e |
"libgcrypt-devel", |
98f63cc4 |
"Linux-PAM", |
99f94a68 |
"unzip",
"systemd-devel", |
a9c2129a |
"gnupg", |
87815216 |
"ncurses-terminfo"] |
a5e4be9f |
|
ba2f92e6 |
# List of packages that requires privileged docker
# to run make check. |
87815216 |
listReqPrivilegedDockerForTest = [ |
83bd478f |
"elfutils", # SYS_PTRACE |
96a6c448 |
"gdb", |
c9535d05 |
"glibc",
"tar"] |
ba2f92e6 |
|
49937623 |
# List of Packages which causes "Makecheck" job
# to stuck indefinately or getting failed.
# Until these pkgs %check is fixed, these pkgs will be
# skip to run makecheck.
listMakeCheckPkgToSkip = [
"gtk-doc",
"libmspack",
"socat"]
|
45c9260c |
# .spec file might contain lines such as
# Requires(post):/sbin/useradd
# Build system should interpret it as
# Requires: shadow |
87815216 |
providedBy = { |
7f9d2e12 |
"/usr/sbin/useradd":"shadow", |
a75dbe8f |
"/usr/sbin/userdel":"shadow", |
7f9d2e12 |
"/usr/sbin/groupadd":"shadow", |
a75dbe8f |
"/sbin/service":"initscripts", |
7f9d2e12 |
"/usr/bin/which":"which", |
a75dbe8f |
"/usr/bin/python":"python2",
"/bin/python":"python2",
"/bin/python2":"python2",
"/bin/python3":"python3",
"/bin/awk":"gawk",
"/bin/gawk":"gawk",
"/bin/sed":"sed",
"/bin/grep":"grep",
"/bin/sh":"bash",
"/bin/bash":"bash",
"/bin/zsh":"zsh",
"/bin/tcsh":"tcsh",
"/bin/csh":"csh",
"/bin/perl":"perl",
"/bin/mergerepo":"createrepo_c",
"/bin/modifyrepo":"createrepo_c",
"/bin/false":"coreutils",
"/bin/ln":"coreutils",
"/bin/chown":"coreutils",
"/bin/cp":"coreutils",
"/bin/rm":"coreutils",
"/bin/mv":"coreutils" |
45c9260c |
}
|
2820c61a |
@staticmethod |
accc8120 |
def setSpecPath(specPath):
constants.specPath = specPath
@staticmethod
def setSourcePath(sourcePath):
constants.sourcePath = sourcePath
@staticmethod
def setRpmPath(rpmPath):
constants.rpmPath = rpmPath
@staticmethod
def setSourceRpmPath(sourceRpmPath):
constants.sourceRpmPath = sourceRpmPath
@staticmethod
def setTopDirPath(topDirPath):
constants.topDirPath = topDirPath
@staticmethod |
26b55679 |
def setLogLevel(logLevel):
constants.logLevel = logLevel
@staticmethod |
accc8120 |
def setLogPath(logPath):
constants.logPath = logPath
@staticmethod
def setPrevPublishRPMRepo(prevPublishRPMRepo):
constants.prevPublishRPMRepo = prevPublishRPMRepo
@staticmethod
def setPrevPublishXRPMRepo(prevPublishXRPMRepo):
constants.prevPublishXRPMRepo = prevPublishXRPMRepo
@staticmethod
def setBuildRootPath(buildRootPath):
constants.buildRootPath = buildRootPath
@staticmethod |
aac331d9 |
def setPullSourcesURL(url):
constants.pullsourcesURL = url
@staticmethod
def setExtraSourcesURLs(packageName, urls):
constants.extrasourcesURLs[packageName] = urls
@staticmethod
def getPullSourcesURLs(packageName):
urls=[]
urls.append(constants.pullsourcesURL) |
75b32bae |
if packageName in constants.extrasourcesURLs:
urls.extend(constants.extrasourcesURLs[packageName]) |
aac331d9 |
return urls |
accc8120 |
@staticmethod
def setInputRPMSPath(inputRPMSPath):
constants.inputRPMSPath = inputRPMSPath
@staticmethod
def setRPMCheck(rpmCheck):
constants.rpmCheck = rpmCheck
@staticmethod
def setRpmCheckStopOnError(rpmCheckStopOnError):
constants.rpmCheckStopOnError = rpmCheckStopOnError
@staticmethod
def setPublishBuildDependencies(publishBuildDependencies):
constants.publishBuildDependencies = publishBuildDependencies
@staticmethod
def setPackageWeightsPath(packageWeightsPath):
constants.packageWeightsPath = packageWeightsPath
@staticmethod
def setDist(dist):
constants.dist = dist
@staticmethod
def setBuildNumber(buildNumber):
constants.buildNumber = buildNumber
@staticmethod
def setReleaseVersion(releaseVersion):
constants.releaseVersion = releaseVersion
@staticmethod
def setKatBuild(katBuild):
constants.katBuild = katBuild
@staticmethod
def initialize(): |
b5e09fac |
if constants.rpmCheck: |
26b55679 |
constants.testLogger = Logger.getLogger("MakeCheckTest",
constants.logPath, constants.logLevel) |
87815216 |
constants.addMacro("with_check", "1") |
343d89e8 |
else: |
87815216 |
constants.addMacro("with_check", "0") |
343d89e8 |
|
accc8120 |
# adding distribution rpm macro
if constants.dist is not None:
constants.addMacro("dist", constants.dist) |
343d89e8 |
|
accc8120 |
# adding buildnumber rpm macro
if constants.buildNumber is not None:
constants.addMacro("photon_build_number", constants.buildNumber) |
343d89e8 |
|
accc8120 |
# adding releasenumber rpm macro
if constants.releaseVersion is not None:
constants.addMacro("photon_release_version", constants.releaseVersion) |
343d89e8 |
|
accc8120 |
if constants.katBuild is not None:
constants.addMacro("kat_build", constants.katBuild) |
9b2f8b85 |
|
e2512398 |
@staticmethod
def setTestForceRPMS(listsPackages): |
87815216 |
constants.testForceRPMS = listsPackages |
343d89e8 |
@staticmethod
def addMacro(macroName, macroValue): |
87815216 |
constants.userDefinedMacros[macroName] = macroValue |
085306ae |
@staticmethod |
9bc3518e |
def setBuildOptions(options): |
085306ae |
constants.buildOptions = options |
aac331d9 |
@staticmethod
def getAdditionalMacros(package):
macros = {}
if package in constants.buildOptions.keys():
pkg = constants.buildOptions[package]
for m in pkg["macros"]:
k, v = m.split(' ', 1)
macros[k] = v
return macros |