|
61 | 61 | VERSION=None |
62 | 62 | DEBVERSION=None |
63 | 63 | RPMRELEASE="1" |
| 64 | +GIT_COMMIT=None |
64 | 65 | P3DSUFFIX=None |
65 | 66 | MAJOR_VERSION=None |
66 | 67 | COREAPI_VERSION=None |
@@ -121,7 +122,7 @@ def keyboardInterruptHandler(x,y): |
121 | 122 | def usage(problem): |
122 | 123 | if (problem): |
123 | 124 | print("") |
124 | | - print("Error parsing commandline input", problem) |
| 125 | + print("Error parsing command-line input: %s" % (problem)) |
125 | 126 |
|
126 | 127 | print("") |
127 | 128 | print("Makepanda generates a 'built' subdirectory containing a") |
@@ -164,15 +165,15 @@ def usage(problem): |
164 | 165 | def parseopts(args): |
165 | 166 | global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION |
166 | 167 | global COMPRESSOR,THREADCOUNT,OSXTARGET,UNIVERSAL,HOST_URL |
167 | | - global DEBVERSION,RPMRELEASE,P3DSUFFIX |
| 168 | + global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX |
168 | 169 | global STRDXSDKVERSION, STRMSPLATFORMVERSION, BOOUSEINTELCOMPILER |
169 | 170 | longopts = [ |
170 | 171 | "help","distributor=","verbose","runtime","osxtarget=", |
171 | 172 | "optimize=","everything","nothing","installer","rtdist","nocolor", |
172 | 173 | "version=","lzma","no-python","threads=","outputdir=","override=", |
173 | 174 | "static","host=","debversion=","rpmrelease=","p3dsuffix=", |
174 | 175 | "directx-sdk=", "platform-sdk=", "use-icl", |
175 | | - "universal", "target=", "arch="] |
| 176 | + "universal", "target=", "arch=", "git-commit="] |
176 | 177 | anything = 0 |
177 | 178 | optimize = "" |
178 | 179 | target = None |
@@ -208,6 +209,7 @@ def parseopts(args): |
208 | 209 | elif (option=="--host"): HOST_URL=value |
209 | 210 | elif (option=="--debversion"): DEBVERSION=value |
210 | 211 | elif (option=="--rpmrelease"): RPMRELEASE=value |
| 212 | + elif (option=="--git-commit"): GIT_COMMIT=value |
211 | 213 | elif (option=="--p3dsuffix"): P3DSUFFIX=value |
212 | 214 | # Backward compatibility, OPENGL was renamed to GL |
213 | 215 | elif (option=="--use-opengl"): PkgEnable("GL") |
@@ -259,6 +261,9 @@ def parseopts(args): |
259 | 261 | except: |
260 | 262 | usage("Invalid setting for OPTIMIZE") |
261 | 263 |
|
| 264 | + if GIT_COMMIT is not None and not re.match("^[a-f0-9]{40}$", GIT_COMMIT): |
| 265 | + usage("Invalid SHA-1 hash given for --git-commit option!") |
| 266 | + |
262 | 267 | if target is not None or target_arch is not None: |
263 | 268 | SetTarget(target, target_arch) |
264 | 269 |
|
@@ -2399,6 +2404,9 @@ def CreatePandaVersionFiles(): |
2399 | 2404 | else: |
2400 | 2405 | pandaversion_h += "\n#undef PANDA_OFFICIAL_VERSION\n" |
2401 | 2406 |
|
| 2407 | + if GIT_COMMIT: |
| 2408 | + pandaversion_h += "\n#define PANDA_GIT_COMMIT_STR \"%s\"\n" % (GIT_COMMIT) |
| 2409 | + |
2402 | 2410 | if not RUNTIME: |
2403 | 2411 | checkpandaversion_cxx = CHECKPANDAVERSION_CXX.replace("$VERSION1",str(version1)) |
2404 | 2412 | checkpandaversion_cxx = checkpandaversion_cxx.replace("$VERSION2",str(version2)) |
|
0 commit comments