diff options
author | Ernie Hershey <ernie.hershey@10gen.com> | 2014-08-20 17:17:06 -0400 |
---|---|---|
committer | Ernie Hershey <ernie.hershey@10gen.com> | 2014-09-15 16:14:05 -0400 |
commit | 2e9a9a607bae5763092a6f0ec42fda44e5aacb74 (patch) | |
tree | 35aaa0de4c6cc427318f89811313a44fa7a99cba | |
parent | c4ee7f76da25672cba1fd4191d29796fd2414565 (diff) | |
download | mongo-2e9a9a607bae5763092a6f0ec42fda44e5aacb74.tar.gz |
SERVER-10642 Generate SUSE RPM's
(cherry picked from commit d70194786886cea722d316d07122c71e3403a801)
Conflicts:
buildscripts/packager-enterprise.py
-rwxr-xr-x | buildscripts/consolidate-repos-enterprise.sh | 6 | ||||
-rwxr-xr-x | buildscripts/consolidate-repos.sh | 6 | ||||
-rwxr-xr-x | buildscripts/packager-enterprise.py | 32 | ||||
-rw-r--r-- | buildscripts/packager.py | 23 |
4 files changed, 45 insertions, 22 deletions
diff --git a/buildscripts/consolidate-repos-enterprise.sh b/buildscripts/consolidate-repos-enterprise.sh index fc39b5c7687..0311d1e0ddc 100755 --- a/buildscripts/consolidate-repos-enterprise.sh +++ b/buildscripts/consolidate-repos-enterprise.sh @@ -132,9 +132,9 @@ do fi done -for redhat_dir in $(find "$repodir"/yum/redhat -type d -name x86_64 -o -name i386) +for rpm_dir in $(find "$repodir"/yum/redhat "$repodir"/zypper/suse -type d -name x86_64 -o -name i386) do - echo "Generating redhat repo metadata under $redhat_dir" - cd "$redhat_dir" + echo "Generating redhat repo metadata under $rpm_dir" + cd "$rpm_dir" createrepo . done diff --git a/buildscripts/consolidate-repos.sh b/buildscripts/consolidate-repos.sh index 71aa1d4e9f9..6c52508aa85 100755 --- a/buildscripts/consolidate-repos.sh +++ b/buildscripts/consolidate-repos.sh @@ -70,9 +70,9 @@ do gpg -r "$gpg_recip" --no-secmem-warning -abs --output Release.gpg Release done -for redhat_dir in "$repodir"/redhat/os/* +for rpm_dir in "$repodir"/redhat/os/* "$repodir"/suse/os/* do - echo "Generating redhat repo metadata under $redhat_dir" - cd "$redhat_dir" + echo "Generating rpm repo metadata under $redhat_dir" + cd "$rpm_dir" createrepo . done diff --git a/buildscripts/packager-enterprise.py b/buildscripts/packager-enterprise.py index e8de184412c..d30bb222f01 100755 --- a/buildscripts/packager-enterprise.py +++ b/buildscripts/packager-enterprise.py @@ -49,7 +49,7 @@ REPOPATH="/var/www/repo" ARCHES=["x86_64"] # Made up names for the flavors of distribution we package for. -DISTROS=["redhat","ubuntu"] +DISTROS=["suse","redhat","ubuntu"] class Spec(object): @@ -93,7 +93,7 @@ class Spec(object): # our upstream version too). if re.search("^(debian|ubuntu)", distro.name()): return re.sub("-", "~", self.ver) - elif re.search("(redhat|fedora|centos)", distro.name()): + elif re.search("(suse|redhat|fedora|centos)", distro.name()): return re.sub("\\d+-", "", self.ver) else: raise Exception("BUG: unsupported platform?") @@ -122,7 +122,7 @@ class Distro(object): def archname(self, arch): if re.search("^(debian|ubuntu)", self.n): return "i386" if arch.endswith("86") else "amd64" - elif re.search("^(centos|redhat|fedora)", self.n): + elif re.search("^(suse|centos|redhat|fedora)", self.n): return "i686" if arch.endswith("86") else "x86_64" else: raise Exception("BUG: unsupported platform?") @@ -141,19 +141,26 @@ class Distro(object): repo/yum/redhat/6/mongodb-enterprise/2.5/x86_64 yum/redhat/6/mongodb-enterprise/2.5/i386 + repo/zypper/suse/11/mongodb-enterprise/2.5/x86_64 + zypper/suse/11/mongodb-enterprise/2.5/i386 + """ if re.search("^(debian|ubuntu)", self.n): return "repo/apt/%s/dists/%s/mongodb-enterprise/%s/multiverse/binary-%s/" % (self.n, self.repo_os_version(build_os), spec.branch(), self.archname(arch)) elif re.search("(redhat|fedora|centos)", self.n): return "repo/yum/%s/%s/mongodb-enterprise/%s/%s/RPMS/" % (self.n, self.repo_os_version(build_os), spec.branch(), self.archname(arch)) + elif re.search("(suse)", self.n): + return "repo/zypper/%s/%s/mongodb-enterprise/%s/%s/RPMS/" % (self.n, self.repo_os_version(build_os), spec.branch(), self.archname(arch)) else: raise Exception("BUG: unsupported platform?") def repo_os_version(self, build_os): """Return an OS version suitable for package repo directory naming - e.g. 5, 6 or 7 for redhat/centos, "precise," "wheezy," etc. - for Ubuntu/Debian""" + for Ubuntu/Debian, 11 for suse""" + if self.n == 'suse': + return re.sub(r'^suse(\d+)$', r'\1', build_os) if self.n == 'redhat': return re.sub(r'^rhel(\d).*$', r'\1', build_os) elif self.n == 'ubuntu': @@ -167,16 +174,18 @@ class Distro(object): def make_pkg(self, build_os, arch, spec, srcdir): if re.search("^(debian|ubuntu)", self.n): return make_deb(self, build_os, arch, spec, srcdir) - elif re.search("^(centos|redhat|fedora)", self.n): + elif re.search("^(suse|centos|redhat|fedora)", self.n): return make_rpm(self, build_os, arch, spec, srcdir) else: raise Exception("BUG: unsupported platform?") def build_os(self): """Return the build os label in the binary package to download ("rhel57" and "rhel62" - for redhat, "ubuntu1204" for Ubuntu and Debian)""" + for redhat, "ubuntu1204" for Ubuntu and Debian, and "suse11" for SUSE)""" - if re.search("^(debian|ubuntu)", self.n): + if re.search("(suse)", self.n): + return [ "suse11" ] + elif re.search("^(debian|ubuntu)", self.n): return [ "ubuntu1204" ] elif re.search("(redhat|fedora|centos)", self.n): return [ "rhel62", "rhel57" ] @@ -366,7 +375,7 @@ def make_package(distro, build_os, arch, spec, srcdir): def make_repo(repodir, distro, build_os, spec): if re.search("(debian|ubuntu)", repodir): make_deb_repo(repodir, distro, build_os, spec) - elif re.search("(centos|redhat|fedora)", repodir): + elif re.search("(suse|centos|redhat|fedora)", repodir): make_rpm_repo(repodir) else: raise Exception("BUG: unsupported platform?") @@ -576,6 +585,13 @@ def make_rpm(distro, build_os, arch, spec, srcdir): # Create the specfile. suffix=spec.suffix() sdir=setupdir(distro, build_os, arch, spec) + + # Use special suse init script if we're building for SUSE + # + if distro.name() == "suse": + os.unlink(sdir+"rpm/init.d-mongod") + os.link(sdir+"rpm/init.d-mongod.suse", sdir+"rpm/init.d-mongod") + specfile=srcdir+"rpm/mongodb%s.spec" % suffix topdir=ensure_dir('%s/rpmbuild/%s/' % (os.getcwd(), build_os)) for subdir in ["BUILD", "RPMS", "SOURCES", "SPECS", "SRPMS"]: diff --git a/buildscripts/packager.py b/buildscripts/packager.py index fb6c5695ba2..36b8b809d76 100644 --- a/buildscripts/packager.py +++ b/buildscripts/packager.py @@ -48,13 +48,13 @@ REPOPATH="/var/www/repo" ARCHES=["i686", "x86_64"] # Made up names for the flavors of distribution we package for. -DISTROS=["debian-sysvinit", "ubuntu-upstart", "redhat"] +DISTROS=["suse", "debian-sysvinit", "ubuntu-upstart", "redhat"] # When we're preparing a directory containing packaging tool inputs # and our binaries, use this relative subdirectory for placing the # binaries. BINARYDIR="BINARIES" - + class Spec(object): def __init__(self, specstr): tup = specstr.split(":") @@ -96,7 +96,7 @@ class Spec(object): # our upstream version too). if re.search("^(debian|ubuntu)", distro.name()): return re.sub("-", "~", self.ver) - elif re.search("(redhat|fedora|centos)", distro.name()): + elif re.search("(suse|redhat|fedora|centos)", distro.name()): return re.sub("\\d+-", "", self.ver) else: raise Exception("BUG: unsupported platform?") @@ -116,13 +116,13 @@ class Distro(object): def pkgbase(self): # pkgbase is the first part of the package's name on # this distro (pre-2.5.3 was "mongo" for redhat and - # "mongodb" for debian" + # "mongodb" for debian") return "mongodb" def archname(self, arch): if re.search("^(debian|ubuntu)", self.n): return "i386" if arch.endswith("86") else "amd64" - elif re.search("^(centos|redhat|fedora)", self.n): + elif re.search("^(suse|centos|redhat|fedora)", self.n): return "i686" if arch.endswith("86") else "x86_64" else: raise Exception("BUG: unsupported platform?") @@ -134,7 +134,7 @@ class Distro(object): tools place the package files).""" if re.search("^(debian|ubuntu)", self.n): return "repo/%s/dists/dist/10gen/binary-%s/" % (self.n, self.archname(arch)) - elif re.search("(redhat|fedora|centos)", self.n): + elif re.search("(suse|redhat|fedora|centos)", self.n): return "repo/%s/os/%s/RPMS/" % (self.n, self.archname(arch)) else: raise Exception("BUG: unsupported platform?") @@ -142,7 +142,7 @@ class Distro(object): def make_pkg(self, arch, spec, srcdir): if re.search("^(debian|ubuntu)", self.n): return make_deb(self, arch, spec, srcdir) - elif re.search("^(centos|redhat|fedora)", self.n): + elif re.search("^(suse|centos|redhat|fedora)", self.n): return make_rpm(self, arch, spec, srcdir) else: raise Exception("BUG: unsupported platform?") @@ -346,7 +346,7 @@ def make_package(distro, arch, spec, srcdir): def make_repo(repodir): if re.search("(debian|ubuntu)", repodir): make_deb_repo(repodir) - elif re.search("(centos|redhat|fedora)", repodir): + elif re.search("(suse|centos|redhat|fedora)", repodir): make_rpm_repo(repodir) else: raise Exception("BUG: unsupported platform?") @@ -557,6 +557,13 @@ def make_rpm(distro, arch, spec, srcdir): # Create the specfile. suffix=spec.suffix() sdir=setupdir(distro, arch, spec) + + # Use special suse init script if we're building for SUSE + # + if distro.name() == "suse": + os.unlink(sdir+"rpm/init.d-mongod") + os.link(sdir+"rpm/init.d-mongod.suse", sdir+"rpm/init.d-mongod") + specfile=srcdir+"rpm/mongodb%s.spec" % suffix topdir=ensure_dir(os.getcwd()+'/rpmbuild/') for subdir in ["BUILD", "RPMS", "SOURCES", "SPECS", "SRPMS"]: |