chiark / gitweb /
Merge branch 'master' into 'master'
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 12 Feb 2016 09:13:53 +0000 (09:13 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 12 Feb 2016 09:13:53 +0000 (09:13 +0000)
a couple fixes

these are three fixes, one related to my previous merge request, as discussed with @mvdan in IRC

See merge request !99

fdroidserver/build.py
fdroidserver/common.py
fdroidserver/signindex.py
hooks/pre-commit
tests/run-tests

index 021e1041910ce4398a480cada6cbb3a5efc1ddbc..12cc61c144d57894fda53d8be57ad9e2f62d5ea1 100644 (file)
@@ -1001,6 +1001,15 @@ def main():
     global options, config
 
     options, parser = parse_commandline()
+
+    metadata_files = glob.glob('.fdroid.*[a-z]')  # ignore files ending in ~
+    if len(metadata_files) > 1:
+        raise FDroidException("Only one local metadata file allowed! Found: "
+                              + " ".join(metadata_files))
+
+    if not os.path.isdir('metadata') and len(metadata_files) == 0:
+        raise FDroidException("No app metadata found, nothing to process!")
+
     if not options.appid and not options.all:
         parser.error("option %s: If you really want to build all the apps, use --all" % "all")
 
index 120ef2aa0134f4f9de5d481e4c6d8c7e034da51c..0463db29ad4d7c238db7e6f7edbe0eb341d4e47f 100644 (file)
@@ -157,6 +157,8 @@ def fill_config_defaults(thisconfig):
                         thisconfig['java_paths'][m.group(1)] = d
 
     for java_version in ('7', '8', '9'):
+        if java_version not in thisconfig['java_paths']:
+            continue
         java_home = thisconfig['java_paths'][java_version]
         jarsigner = os.path.join(java_home, 'bin', 'jarsigner')
         if os.path.exists(jarsigner):
index 82f2216acf501a8cb791e4df03ae4c4100bcf9fe..1d0c320067714f1f1c25d8cc79ba75e075f1d222 100644 (file)
@@ -40,7 +40,7 @@ def main():
 
     config = common.read_config(options)
 
-    if not 'jarsigner' in config:
+    if 'jarsigner' not in config:
         logging.critical('Java jarsigner not found! Install in standard location or set java_paths!')
         sys.exit(1)
 
index d33c701815c2e5475a9e5aec8376b62982ba7539..6dd0049d5ee3ae7ffc832b54fd90cc0a679aaf9e 100755 (executable)
@@ -83,13 +83,13 @@ else
        err "pep8 is not installed!"
 fi
 
-if [ ! -z $PY_FILES $PY_TEST_FILES ]; then
+if [ "$PY_FILES $PY_TEST_FILES" != " " ]; then
     if ! $PYFLAKES $PY_FILES $PY_TEST_FILES; then
        err "pyflakes tests failed!"
     fi
 fi
 
-if [ ! -z $PY_FILES ]; then
+if [ "$PY_FILES" != "" ]; then
     if ! $PEP8 --ignore=$PEP8_IGNORE $PY_FILES; then
        err "pep8 tests failed!"
     fi
@@ -98,7 +98,7 @@ fi
 # The tests use a little hack in order to cleanly import the fdroidserver
 # package locally like a regular package.  pep8 doesn't see that, so this
 # makes pep8 skip E402 on the test files that need that hack.
-if [ ! -z $PY_TEST_FILES ]; then
+if [ "$PY_TEST_FILES" != "" ]; then
     if ! $PEP8 --ignore=$PEP8_IGNORE,E402 $PY_TEST_FILES; then
        err "pep8 tests failed!"
     fi
index c770091f2339583932a3702d550c5727fa250d34..7629f431bb107db1f5dd070ec4f7225c6d6f77ad 100755 (executable)
@@ -156,6 +156,41 @@ fi
 set -e
 
 
+#------------------------------------------------------------------------------#
+echo_header "ensure commands that don't need the JDK work without a JDK configed"
+
+REPOROOT=`create_test_dir`
+cd $REPOROOT
+mkdir repo
+mkdir metadata
+echo "License:GPL" >> metadata/fake.txt
+echo "Summary:Yup still fake" >> metadata/fake.txt
+echo "Categories:Internet" >> metadata/fake.txt
+echo "Description:" >> metadata/fake.txt
+echo "this is fake" >> metadata/fake.txt
+echo "." >> metadata/fake.txt
+
+# fake that no JDKs are available
+echo 'java_paths = {}' > config.py
+
+LOCAL_COPY_DIR=`create_test_dir`/fdroid
+mkdir -p $LOCAL_COPY_DIR/repo
+echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
+
+$fdroid checkupdates
+$fdroid gpgsign
+$fdroid lint
+$fdroid readmeta
+$fdroid rewritemeta fake
+$fdroid server update
+$fdroid scanner
+
+# run these to get their output, but the are not setup, so don't fail
+$fdroid build || true
+$fdroid import || true
+$fdroid install || true
+
+
 #------------------------------------------------------------------------------#
 echo_header "create a source tarball and use that to build a repo"