summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorErnie Hershey <ernie.hershey@10gen.com>2014-01-29 18:16:34 -0500
committerErnie Hershey <ernie.hershey@10gen.com>2014-02-07 19:12:17 -0500
commitdacc99596ed466494c7d9a09c3ea7f04bfe08d4a (patch)
tree0f45ffc87900bbf80966899646d713bba5335c1d /buildscripts
parent1c2af9a7e3b80fde43a345942c9092dc7d1c42a6 (diff)
downloadmongo-dacc99596ed466494c7d9a09c3ea7f04bfe08d4a.tar.gz
SERVER-9987 Include platform in RPM Release field
The "Release" rpm field has previous been 'mongodb_1' in all RPM's but to support separate RHEL/CentOS 5.7+ and 6.2+ rpms, the release will now be '1.el5' and '1.el6'.
Diffstat (limited to 'buildscripts')
-rwxr-xr-xbuildscripts/packager-enterprise.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/buildscripts/packager-enterprise.py b/buildscripts/packager-enterprise.py
index a7c1937e21b..3824afedf62 100755
--- a/buildscripts/packager-enterprise.py
+++ b/buildscripts/packager-enterprise.py
@@ -156,6 +156,12 @@ class Distro(object):
return [ "rhel57", "rhel62" ]
else:
raise Exception("BUG: unsupported platform?")
+
+ def release_dist(self, build_os):
+ """Return the release distribution to use in the rpm - "el5" for rhel 5.x,
+ "el6" for rhel 6.x, return anything else unchanged"""
+
+ return re.sub(r'^rh(el\d).*$', r'\1', build_os)
def main(argv):
(flags, specs) = parse_args(argv[1:])
distros=[Distro(distro) for distro in DISTROS]
@@ -278,7 +284,7 @@ def ensure_dir(filename):
def tarfile(build_os, arch, spec):
"""Return the location where we store the downloaded tarball for
this package"""
- return "dl/mongodb-linux-%s-subscription-%s-%s.tar.gz" % (spec.version(), build_os, arch)
+ return "dl/mongodb-linux-%s-enterprise-%s-%s.tar.gz" % (spec.version(), build_os, arch)
def setupdir(distro, build_os, arch, spec):
# The setupdir will be a directory containing all inputs to the
@@ -299,9 +305,9 @@ def unpack_binaries_into(build_os, arch, spec, where):
# thing and chdir into where and run tar there.
os.chdir(where)
try:
- sysassert(["tar", "xvzf", rootdir+"/"+tarfile(build_os, arch, spec), "mongodb-linux-%s-subscription-%s-%s/bin" % (arch, build_os, spec.version())])
- os.rename("mongodb-linux-%s-subscription-%s-%s/bin" % (arch, build_os, spec.version()), "bin")
- os.rmdir("mongodb-linux-%s-subscription-%s-%s" % (arch, build_os, spec.version()))
+ sysassert(["tar", "xvzf", rootdir+"/"+tarfile(build_os, arch, spec), "mongodb-linux-%s-enterprise-%s-%s/bin" % (arch, build_os, spec.version())])
+ os.rename("mongodb-linux-%s-enterprise-%s-%s/bin" % (arch, build_os, spec.version()), "bin")
+ os.rmdir("mongodb-linux-%s-enterprise-%s-%s" % (arch, build_os, spec.version()))
except Exception:
exc=sys.exc_value
os.chdir(rootdir)
@@ -572,7 +578,8 @@ def make_rpm(distro, build_os, arch, spec, srcdir):
macrofiles=[l for l in backtick(["rpm", "--showrc"]).split("\n") if l.startswith("macrofiles")]
flags=[]
macropath=os.getcwd()+"/macros"
- write_rpm_macros_file(macropath, topdir)
+
+ write_rpm_macros_file(macropath, topdir, distro.release_dist(build_os))
if len(macrofiles)>0:
macrofiles=macrofiles[0]+":"+macropath
rcfile=os.getcwd()+"/rpmrc"
@@ -618,10 +625,11 @@ def write_rpmrc_file(path, string):
finally:
f.close()
-def write_rpm_macros_file(path, topdir):
+def write_rpm_macros_file(path, topdir, release_dist):
f=open(path, 'w')
try:
- f.write("%%_topdir %s" % topdir)
+ f.write("%%_topdir %s\n" % topdir)
+ f.write("%%dist .%s\n" % release_dist)
finally:
f.close()