chiark / gitweb /
Merge branch 'master' into 'master'
authorCiaran Gultnieks <ciaran@ciarang.com>
Thu, 14 May 2015 16:09:40 +0000 (16:09 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Thu, 14 May 2015 16:09:40 +0000 (16:09 +0000)
make it really easy to upgrade unsigned repos to signed

As a key step to removing support for unsigned repos from fdroidclient (https://gitlab.com/fdroid/fdroidclient/issues/12), this merge request makes `fdroid update` require a signing key.  If there is no keystore, it'll prompt the user to create one using `fdroid update --create-key`.

This closes #13

See merge request !48

docs/fdroid.texi
fdroidserver/build.py
fdroidserver/common.py
fdroidserver/metadata.py
fdroidserver/update.py

index ad5765f83b799e1b9b371b52baf2f71d7db0c52f..26689477de4c87aa9ba7db28ffb13b547ced536a 100644 (file)
@@ -829,7 +829,9 @@ As for 'prebuild', but runs on the source code BEFORE any other processing
 takes place.
 
 You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the
-android SDK and NDK directories, and maven 3 executable respectively.
+android SDK and NDK directories, and maven 3 executable respectively. The
+following per-build variables are available likewise: $$VERSION$$,
+$$VERCODE$$ and $$COMMIT$$.
 
 @item oldsdkloc=yes
 The sdk location in the repo is in an old format, or the build.xml is
@@ -943,7 +945,9 @@ the @code{srclib} directory for details of this.
 
 You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the
 android SDK and NDK directories, and Maven 3 executable respectively e.g.
-for when you need to run @code{android update project} explicitly.
+for when you need to run @code{android update project} explicitly. The
+following per-build variables are available likewise: $$VERSION$$, $$VERCODE$$
+and $$COMMIT$$.
 
 @item scanignore=<path1>[,<path2>,...]
 Enables one or more files/paths to be excluded from the scan process.
@@ -967,7 +971,9 @@ mvn or gradle will be executed to clean the build environment right before
 build= (or the final build) is run.
 
 You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the
-android SDK and NDK directories, and Maven 3 executable respectively.
+android SDK and NDK directories, and maven 3 executable respectively. The
+following per-build variables are available likewise: $$VERSION$$,
+$$VERCODE$$ and $$COMMIT$$.
 
 @item buildjni=[yes|no|<dir list>]
 Enables building of native code via the ndk-build script before doing
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 f44e80a2f564987b43625d6f794485c73cd692bb..985afb4abe2627158bb042ac4a6cf2f38b19cf86 100644 (file)
@@ -1172,7 +1172,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:
@@ -1223,7 +1223,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)
@@ -1409,7 +1409,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:
@@ -1877,12 +1877,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
 
 
index 2e29cd796eba016135d0810720defe8d978c5bc3..0bf9f6028913e406c354b49e2361b3e62b48025d 100644 (file)
@@ -339,6 +339,8 @@ class DescriptionFormatter:
                 else:
                     urltxt = url[index2 + 1:]
                     url = url[:index2]
+                if ':' not in url:
+                    raise MetaDataException("'%s' doesn't look like an URL" % url)
                 linkified_html += '<a href="' + url + '">' + cgi.escape(urltxt) + '</a>'
                 linkified_plain += urltxt
                 if urltxt != url:
index a122bf631e0ceea105bd20755f2b4a47a5006e77..48ac7c563217ca90f1384d6c2d4fb7b2bf9c8b96 100644 (file)
@@ -887,10 +887,6 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
                 addElement('maxsdkver', str(apk['maxsdkversion']), doc, apkel)
             if 'added' in apk:
                 addElement('added', time.strftime('%Y-%m-%d', apk['added']), doc, apkel)
-            if app['Requires Root']:
-                if 'ACCESS_SUPERUSER' not in apk['permissions']:
-                    apk['permissions'].add('ACCESS_SUPERUSER')
-
             if len(apk['permissions']) > 0:
                 addElement('permissions', ','.join(apk['permissions']), doc, apkel)
             if 'nativecode' in apk and len(apk['nativecode']) > 0: