[condor: 23/31] Update the RPM and include a build script.

Brian Bockelman bbockelm at fedoraproject.org
Fri Mar 8 01:21:34 UTC 2013


commit a7cfd51dfa6b1e6d50405f4e3b305fa18e3303fe
Author: Brian Bockelman <bbockelm at cse.unl.edu>
Date:   Thu Dec 6 10:54:44 2012 -0600

    Update the RPM and include a build script.

 .gitignore                                         |    1 +
 ...ser-s-condor_config-last-rather-than-firs.patch |   22 ++---
 condor.spec                                        |    8 +-
 hcc-condor-build                                   |   93 ++++++++++++++++++++
 4 files changed, 109 insertions(+), 15 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 0e0fc6d..34a694b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 .*.swp
 /condor-7.7.3-c39a8b84-GIT.tar.gz
+_build
diff --git a/0001-Apply-the-user-s-condor_config-last-rather-than-firs.patch b/0001-Apply-the-user-s-condor_config-last-rather-than-firs.patch
index 2fcf042..82906b5 100644
--- a/0001-Apply-the-user-s-condor_config-last-rather-than-firs.patch
+++ b/0001-Apply-the-user-s-condor_config-last-rather-than-firs.patch
@@ -1,14 +1,14 @@
-From 9cdc4723117927ecac26cc1ceca977063bf5de77 Mon Sep 17 00:00:00 2001
+From 47a7bb8fb64885d46c995a18d2c4601fbf9609f9 Mon Sep 17 00:00:00 2001
 From: Brian Bockelman <bbockelm at cse.unl.edu>
 Date: Tue, 24 Jul 2012 09:40:06 -0500
 Subject: [PATCH] Apply the user's condor_config last, rather than first.
 
 ---
- src/condor_utils/condor_config.cpp |   57 +++++++++++++++++++++++++++++-------
- 1 files changed, 46 insertions(+), 11 deletions(-)
+ src/condor_utils/condor_config.cpp |   55 +++++++++++++++++++++++++++++------
+ 1 files changed, 45 insertions(+), 10 deletions(-)
 
 diff --git a/src/condor_utils/condor_config.cpp b/src/condor_utils/condor_config.cpp
-index fc760fa..72ad7b8 100644
+index ef35572..455bdfa 100644
 --- a/src/condor_utils/condor_config.cpp
 +++ b/src/condor_utils/condor_config.cpp
 @@ -110,6 +110,7 @@ void check_params();
@@ -19,12 +19,10 @@ index fc760fa..72ad7b8 100644
  
  // Global variables
  BUCKET	*ConfigTab[TABLESIZE];
-@@ -708,7 +709,15 @@ real_config(char* host, int wantsQuiet, bool wantExtraInfo)
-     if ( param_boolean("NET_REMAP_ENABLE", false) ) {
-         condor_net_remap_config();
-     }
--			
-+
+@@ -654,6 +655,14 @@ real_config(char* host, int wantsQuiet, bool wantExtraInfo)
+ 	if(dirlist) { free(dirlist); dirlist = NULL; }
+ 	if(newdirlist) { free(newdirlist); newdirlist = NULL; }
+ 
 +		// Now, insert overrides from the user config file
 +	std::string file_location;
 +	if (find_user_file(file_location))
@@ -36,7 +34,7 @@ index fc760fa..72ad7b8 100644
  		// Now, insert any macros defined in the environment.
  	char **my_environ = GetEnviron();
  	for( int i = 0; my_environ[i]; i++ ) {
-@@ -1051,6 +1060,38 @@ find_global()
+@@ -996,6 +1005,38 @@ find_global()
  }
  
  
@@ -75,7 +73,7 @@ index fc760fa..72ad7b8 100644
  // Find location of specified file
  char*
  find_file(const char *env_name, const char *file_name)
-@@ -1107,21 +1148,15 @@ find_file(const char *env_name, const char *file_name)
+@@ -1052,21 +1093,15 @@ find_file(const char *env_name, const char *file_name)
  	if (!config_source) {
  			// List of condor_config file locations we'll try to open.
  			// As soon as we find one, we'll stop looking.
diff --git a/condor.spec b/condor.spec
index 6993959..274e2ea 100644
--- a/condor.spec
+++ b/condor.spec
@@ -1,4 +1,4 @@
-%define tarball_version 7.9.1
+%define tarball_version 7.9.3
 
 %define _default_patch_fuzz 2
 
@@ -31,7 +31,7 @@
 # Things not turned on, or don't have Fedora packages yet
 %define blahp 1
 %define glexec 1
-%define cream 1
+%define cream 0
 
 # These flags are meant for developers; it allows one to build Condor
 # based upon a git-derived tarball, instead of an upstream release tarball
@@ -47,7 +47,7 @@
 
 Summary: Condor: High Throughput Computing
 Name: condor
-Version: 7.9.2
+Version: %{tarball_version}
 %define condor_base_release 0.4
 %if %git_build
 	%define condor_release %condor_base_release.%{git_rev}.git
@@ -493,6 +493,8 @@ find src -perm /a+x -type f -name "*.[Cch]" -exec chmod a-x {} \;
 %endif
 %if %cream
        -DWITH_CREAM:BOOL=TRUE \
+%else
+       -DWITH_CREAM:BOOL=FALSE \
 %endif
 %if %glexec
        -DWANT_GLEXEC:BOOL=TRUE \
diff --git a/hcc-condor-build b/hcc-condor-build
new file mode 100755
index 0000000..4100113
--- /dev/null
+++ b/hcc-condor-build
@@ -0,0 +1,93 @@
+#!/usr/bin/python
+
+import os
+import sys
+import shutil
+import optparse
+
+def prep_dirs(base_dir):
+    for i in ["BUILD", "INSTALL", "RPMS", "SOURCES", "SPECS", "SRPMS"]:
+        new_dir = os.path.join(base_dir, i)
+        if not os.path.exists(new_dir):
+            os.makedirs(new_dir)
+
+def prep_source(base_dir):
+    source_dir = os.path.join(base_dir, "_build", "SOURCES")
+    for file in os.listdir(base_dir):
+        if file == "_build":
+            continue
+        full_name = os.path.join(base_dir, file)
+        if not os.path.isfile(full_name):
+            continue
+        shutil.copy(full_name, os.path.join(source_dir, file))
+
+def prepare_condor_tarball(build_dir, source_dir, branch):
+    cur_dir = os.getcwd()
+    tarball_dir = os.path.join(build_dir, "SOURCES")
+    fd = open(os.path.join(tarball_dir, "condor.tar.gz"), "w")
+    fdnum = fd.fileno()
+    try:
+        os.chdir(source_dir)
+        pid = os.fork()
+        if not pid:
+            try:
+                os.dup2(fdnum, 1)
+                os.execvp("/bin/sh", ["sh", "-c", "git archive %s | gzip -7" % branch])
+            finally:
+                os._exit(1)
+        else:
+            (pid, status) = os.waitpid(pid, 0)
+            if status:
+                raise Exception("git archive failed")
+    finally:
+        os.chdir(cur_dir)
+
+def get_rpmbuild_defines(results_dir):
+    results_dir = os.path.abspath(results_dir)
+    defines = []
+    defines += ["--define=_topdir %s" % results_dir]
+    return defines
+
+def parse_opts():
+    parser = optparse.OptionParser()
+    parser.add_option("-s", "--source-dir", help="Location of the Condor git repo clone.", dest="source_dir", default="~/projects/condor")
+    parser.add_option("-b", "--branch", help="Name of the git branch to use for the condor build.", dest="branch", default="master")
+
+    opts, args = parser.parse_args()
+
+    opts.source_dir = os.path.expanduser(opts.source_dir)
+
+    return args, opts
+
+def main():
+
+    args, opts = parse_opts()
+
+    if len(args) != 2:
+        print "Usage: hcc_make_condor <action> <directory>"
+        print "Valid commands are 'build', 'prep', and 'srpm'"
+        print "<directory> should point at the fedpkg-condor-hcc clone."
+        return 1
+
+    build_dir = os.path.join(args[1], "_build")
+
+    prep_dirs(build_dir)
+    defines = get_rpmbuild_defines(build_dir)
+    prep_source(args[1])
+
+    prepare_condor_tarball(build_dir, opts.source_dir, opts.branch)
+
+    if args[0] == 'build':
+        os.execvp("rpmbuild", ["rpmbuild"] + defines + ["-ba", "condor.spec"])
+    elif args[0] == 'srpm':
+        os.execvp("rpmbuild", ["rpmbuild"] + defines + ["-bs", "condor.spec"])
+    elif args[0] == "prep":
+        os.execvp("rpmbuild", ["rpmbuild"] + defines + ["-bp", "condor.spec"])
+    else:
+        print "Unknown action: %s" % args[0]
+
+    return 1
+        
+
+if __name__ == '__main__':
+    sys.exit(main())


More information about the scm-commits mailing list