chiark / gitweb /
Add COMMIT, VERSION and VERCODE recipe vars. Fixes #69
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 10 May 2015 11:53:06 +0000 (13:53 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Sun, 10 May 2015 11:55:16 +0000 (13:55 +0200)
fdroidserver/build.py
fdroidserver/common.py

index e44dd5bb4d6e2687adba80e448c03663d4dd1cdf..ffff08e48866338705d9a025f7653ee41a6006af 100644 (file)
@@ -575,7 +575,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
     # Run a build command if one is required...
     if thisbuild['build']:
         logging.info("Running 'build' commands in %s" % root_dir)
-        cmd = common.replace_config_vars(thisbuild['build'])
+        cmd = common.replace_config_vars(thisbuild['build'], thisbuild)
 
         # Substitute source library paths into commands...
         for name, number, libpath in srclibpaths:
index 928f1d6d414f262005fdd2a5360b4cc7d1698679..9618727ae19a41e74e8ee348a4507270a0a560c6 100644 (file)
@@ -1169,7 +1169,7 @@ def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None,
     if prepare:
 
         if srclib["Prepare"]:
-            cmd = replace_config_vars(srclib["Prepare"])
+            cmd = replace_config_vars(srclib["Prepare"], None)
 
             p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=libdir)
             if p.returncode != 0:
@@ -1220,7 +1220,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
 
     # Run an init command if one is required
     if build['init']:
-        cmd = replace_config_vars(build['init'])
+        cmd = replace_config_vars(build['init'], build)
         logging.info("Running 'init' commands in %s" % root_dir)
 
         p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
@@ -1406,7 +1406,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
     if build['prebuild']:
         logging.info("Running 'prebuild' commands in %s" % root_dir)
 
-        cmd = replace_config_vars(build['prebuild'])
+        cmd = replace_config_vars(build['prebuild'], build)
 
         # Substitute source library paths into prebuild commands
         for name, number, libpath in srclibpaths:
@@ -1874,12 +1874,16 @@ def add_to_env_path(path):
     env['PATH'] = os.pathsep.join(paths)
 
 
-def replace_config_vars(cmd):
+def replace_config_vars(cmd, build):
     global env
     cmd = cmd.replace('$$SDK$$', config['sdk_path'])
     # env['ANDROID_NDK'] is set in build_local right before prepare_source
     cmd = cmd.replace('$$NDK$$', env['ANDROID_NDK'])
     cmd = cmd.replace('$$MVN3$$', config['mvn3'])
+    if build is not None:
+        cmd = cmd.replace('$$COMMIT$$', build['commit'])
+        cmd = cmd.replace('$$VERSION$$', build['version'])
+        cmd = cmd.replace('$$VERCODE$$', build['vercode'])
     return cmd