chiark / gitweb /
Merge branch 'p1' into 'master'
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 28 Feb 2016 13:37:17 +0000 (13:37 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Sun, 28 Feb 2016 13:37:17 +0000 (13:37 +0000)
Fix pubkey extraction on update

Replacement of !86.

Fix pubkey extraction in case of non-empty _JAVA_OPTIONS. Fixes #133.

I didn't actually run the test suite (it looks like there are some preparations to be done for that), but I checked the commands from `test_fdroid_popen_stderr_redirect` in ipython.

See merge request !103

.gitlab-ci.yml
buildserver/config.buildserver.py
completion/bash-completion
docs/fdroid.texi
fdroidserver/build.py
fdroidserver/common.py
fdroidserver/scanner.py
fdroidserver/update.py
setup.cfg
setup.py

index a1b3148a073d97cb7dbd6ebc510af074194c029f..9e2470bd3595f6ea3ee622ed56dbc10d7e0df5d3 100644 (file)
@@ -14,18 +14,17 @@ before_script:
   - apt-get -q install -y python-dev libjpeg-dev zlib1g-dev
   - echo " == Installing OpenJDK 7"
   - apt-get -q install -y openjdk-7-jdk
-  - echo " == Installing packages required by the 32-bit SDK"
-  - apt-get -q install -y lib32stdc++6 lib32z1
-  - echo " == Installing the Android SDK"
-  - wget -q -O android-sdk.tgz https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
-  - tar -x -z -f android-sdk.tgz
-  - mv android-sdk-linux android-sdk
-  - export ANDROID_HOME=$PWD/android-sdk
-  - export PATH="$ANDROID_HOME/tools:$PATH"
-  - echo " == Installing Android SDK components"
-  - echo y | android -s update sdk --no-ui -a -t platform-tools,tools,build-tools-23.0.2
-  - export PATH="$ANDROID_HOME/platform-tools:$PATH"
-  - export PATH="$ANDROID_HOME/build-tools/23.0.2:$PATH"
+  - test -z "$ANDROID_HOME" &&
+        echo " == Installing Android SDK" &&
+        apt-get -q install -y lib32stdc++6 lib32z1 &&
+        wget -q -O android-sdk.tgz https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz &&
+        tar -xzf android-sdk.tgz &&
+        export ANDROID_HOME=$PWD/android-sdk-linux &&
+        export PATH="$ANDROID_HOME/tools:$PATH" &&
+        echo y | android -s update sdk --no-ui -a -t platform-tools,tools,build-tools-23.0.2 &&
+        export PATH="$ANDROID_HOME/platform-tools:$PATH" &&
+        export PATH="$ANDROID_HOME/build-tools/23.0.2:$PATH" &&
+        echo y | android -s update sdk --no-ui -a -t android-10
 
 test:
   script:
index 61c57a3914ff93f9930489cde36acaa54f2f6a18..b14d6869290085bc5b7723786b633bd15854e519 100644 (file)
@@ -4,6 +4,6 @@ ndk_paths = {
     'r10e': "/home/vagrant/android-ndk/r10e",
 }
 java_paths = {
-    '1.7': "/usr/lib/jvm/java-7-openjdk-i386",
-    '1.8': "/usr/lib/jvm/java-8-openjdk-i386",
+    '7': "/usr/lib/jvm/java-7-openjdk-i386",
+    '8': "/usr/lib/jvm/java-8-openjdk-i386",
 }
index f0ce84a355305a84b1a83c7f1b6b889cd4d7deed..f2632d676baf797e55bd082f87a54d5667a00b86 100644 (file)
@@ -136,7 +136,7 @@ __complete_update() {
        opts="-c -v -q -b -i -I -e -w"
        lopts="--create-metadata --verbose --quiet --buildreport
  --interactive --icons --editor --wiki --pretty --clean --delete-unknown
- --nosign"
+ --nosign --use-date-from-apk"
        case "${prev}" in
                -e|--editor)
                        _filedir
index 7d3470706ab8e84d34fa9664771f08007612420f..6e2434c9abd1ed2b23d47aab25e1a047e3bb3847 100644 (file)
@@ -1006,6 +1006,12 @@ repository focuses on hosting services for open source project binaries.
 they do not provide any option to reproduce or verify the resulting
 binaries. Builds pre-release versions in some cases.
 
+@item
+@samp{Clojars} - Clojure libraries repo.
+
+@item
+@samp{CommonsWare} - repo holding a collection of open-source libs.
+
 @end itemize
 
 @item patch=x
index 2add23a745237a01a88baad0e3f13efcb061f4ee..216de06f7e28480bff220f95b5681e293304b42d 100644 (file)
@@ -1009,13 +1009,14 @@ def main():
     options, parser = parse_commandline()
 
     metadata_files = glob.glob('.fdroid.*[a-z]')  # ignore files ending in ~
-    if len(metadata_files) > 1:
+    if os.path.isdir('metadata'):
+        pass
+    elif len(metadata_files) == 0:
+        raise FDroidException("No app metadata found, nothing to process!")
+    elif 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 5ea9e549a34d6edd6b659ca56e48c6dddbf8684a..0b4c2dd007c3f201cedcb2bdbf309a9a4db9ea79 100644 (file)
@@ -139,22 +139,25 @@ def fill_config_defaults(thisconfig):
                 continue
             j = os.path.basename(d)
             # the last one found will be the canonical one, so order appropriately
-            for regex in (r'1\.([6-9])\.0\.jdk',  # OSX
-                          r'jdk1\.([6-9])\.0_[0-9]+.jdk',  # OSX and Oracle tarball
-                          r'jdk([6-9])-openjdk',  # Arch
-                          r'java-([6-9])-openjdk',  # Arch
-                          r'java-([6-9])-jdk',  # Arch (oracle)
-                          r'java-1\.([6-9])\.0-.*',  # RedHat
-                          r'java-([6-9])-oracle',  # Debian WebUpd8
-                          r'jdk-([6-9])-oracle-.*',  # Debian make-jpkg
-                          r'java-([6-9])-openjdk-[^c][^o][^m].*'):  # Debian
+            for regex in [
+                    r'^1\.([6-9])\.0\.jdk$',  # OSX
+                    r'^jdk1\.([6-9])\.0_[0-9]+.jdk$',  # OSX and Oracle tarball
+                    r'^jdk([6-9])-openjdk$',  # Arch
+                    r'^java-([6-9])-openjdk$',  # Arch
+                    r'^java-([6-9])-jdk$',  # Arch (oracle)
+                    r'^java-1\.([6-9])\.0-.*$',  # RedHat
+                    r'^java-([6-9])-oracle$',  # Debian WebUpd8
+                    r'^jdk-([6-9])-oracle-.*$',  # Debian make-jpkg
+                    r'^java-([6-9])-openjdk-[^c][^o][^m].*$',  # Debian
+                    ]:
                 m = re.match(regex, j)
-                if m:
-                    osxhome = os.path.join(d, 'Contents', 'Home')
-                    if os.path.exists(osxhome):
-                        thisconfig['java_paths'][m.group(1)] = osxhome
-                    else:
-                        thisconfig['java_paths'][m.group(1)] = d
+                if not m:
+                    continue
+                osxhome = os.path.join(d, 'Contents', 'Home')
+                if os.path.exists(osxhome):
+                    thisconfig['java_paths'][m.group(1)] = osxhome
+                else:
+                    thisconfig['java_paths'][m.group(1)] = d
 
     for java_version in ('7', '8', '9'):
         if java_version not in thisconfig['java_paths']:
index e41e557057a8da4d9d5a71f5095504fedeed6819..98e3421b72ed55936b55ec066783b5131ddf816f 100644 (file)
@@ -83,6 +83,8 @@ def scan_source(build_dir, root_dir, build):
         'oss.sonatype.org/content/repositories/releases',
         'oss.sonatype.org/content/groups/public',
         'clojars.org/repo',  # Clojure free software libs
+        's3.amazonaws.com/repo.commonsware.com',  # CommonsWare
+        'plugins.gradle.org/m2',  # Gradle plugin repo
         ]
     ]
 
index 9de647172b6eac11e2d199530fc8c51ac44ec441..38a61c8b3aae245ff22b135041ade42068217c96 100644 (file)
@@ -405,7 +405,7 @@ def getsig(apkpath):
     return md5(cert_encoded.encode('hex')).hexdigest()
 
 
-def scan_apks(apps, apkcache, repodir, knownapks):
+def scan_apks(apps, apkcache, repodir, knownapks, use_date_from_apk=False):
     """Scan the apks in the given repo directory.
 
     This also extracts the icons.
@@ -414,6 +414,8 @@ def scan_apks(apps, apkcache, repodir, knownapks):
     :param apkcache: current apk cache information
     :param repodir: repo directory to scan
     :param knownapks: known apks info
+    :param use_date_from_apk: use date from APK (instead of current date)
+                              for newly added APKs
     :returns: (apks, cachechanged) where apks is a list of apk information,
               and cachechanged is True if the apkcache got changed.
     """
@@ -568,12 +570,16 @@ def scan_apks(apps, apkcache, repodir, knownapks):
             # has to be more than 24 hours newer because ZIP/APK files do not
             # store timezone info
             manifest = apkzip.getinfo('AndroidManifest.xml')
-            dt_obj = datetime(*manifest.date_time)
-            checkdt = dt_obj - timedelta(1)
-            if datetime.today() < checkdt:
-                logging.warn('System clock is older than manifest in: '
-                             + apkfilename + '\nSet clock to that time using:\n'
-                             + 'sudo date -s "' + str(dt_obj) + '"')
+            if manifest.date_time[1] == 0:  # month can't be zero
+                logging.debug('AndroidManifest.xml has no date')
+            else:
+                dt_obj = datetime(*manifest.date_time)
+                checkdt = dt_obj - timedelta(1)
+                if datetime.today() < checkdt:
+                    logging.warn('System clock is older than manifest in: '
+                                 + apkfilename
+                                 + '\nSet clock to that time using:\n'
+                                 + 'sudo date -s "' + str(dt_obj) + '"')
 
             iconfilename = "%s.%s.png" % (
                 apk['id'],
@@ -685,6 +691,10 @@ def scan_apks(apps, apkcache, repodir, knownapks):
             # Record in known apks, getting the added date at the same time..
             added = knownapks.recordapk(apk['apkname'], apk['id'])
             if added:
+                if use_date_from_apk and manifest.date_time[1] != 0:
+                    added = datetime(*manifest.date_time).timetuple()
+                    logging.debug("Using date from APK")
+
                 apk['added'] = added
 
             apkcache[apkfilename] = apk
@@ -1131,6 +1141,8 @@ def main():
                         help="Clean update - don't uses caches, reprocess all apks")
     parser.add_argument("--nosign", action="store_true", default=False,
                         help="When configured for signed indexes, create only unsigned indexes at this stage")
+    parser.add_argument("--use-date-from-apk", action="store_true", default=False,
+                        help="Use date from apk instead of current time for newly added apks")
     options = parser.parse_args()
 
     config = common.read_config(options)
@@ -1205,7 +1217,7 @@ def main():
     delete_disabled_builds(apps, apkcache, repodirs)
 
     # Scan all apks in the main repo
-    apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
+    apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks, options.use_date_from_apk)
 
     # Generate warnings for apk's with no metadata (or create skeleton
     # metadata files, if requested on the command line)
@@ -1247,7 +1259,7 @@ def main():
 
     # Scan the archive repo for apks as well
     if len(repodirs) > 1:
-        archapks, cc = scan_apks(apps, apkcache, repodirs[1], knownapks)
+        archapks, cc = scan_apks(apps, apkcache, repodirs[1], knownapks, options.use_date_from_apk)
         if cc:
             cachechanged = True
     else:
index b88034e414bc7b80d686e3c94d516305348053ea..bbd3a2abec669c49ce66de5f5cfd27f13e006459 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,2 +1,6 @@
 [metadata]
 description-file = README.md
+
+[aliases]
+release = register sdist --sign upload
+
index 4a266e7cb6d661bc44f4b009f290f6217a5555b9..947112f9a4e961af407bb4ffdc2e1b12660824ea 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ else:
     data_prefix = sys.prefix
 
 setup(name='fdroidserver',
-      version='0.5.0',
+      version='0.6.0',
       description='F-Droid Server Tools',
       long_description=open('README.md').read(),
       author='The F-Droid Project',
@@ -39,7 +39,7 @@ setup(name='fdroidserver',
       classifiers=[
           'Development Status :: 3 - Alpha',
           'Intended Audience :: Developers',
-          'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)'
+          'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
           'Operating System :: POSIX',
           'Topic :: Utilities',
       ],