1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-16 03:40:33 +01:00
Commit Graph

5408 Commits

Author SHA1 Message Date
Daniel Martí
37c802d323 common: don't assume build script output is utf-8
FDroidPopen is used for running many commands - from git to gradle to
custom commands via flags like build=. When any of these invoke calls to
custom build systems or upstream programs/scripts, it's not safe to
assume that the output will be utf8.

Unfortunately, this currently leads to crashes and failed builds:

	ERROR: Could not build app org.kiwix.kiwixmobile due to unknown error: Traceback (most recent call last):
	  File "/home/vagrant/fdroidserver/fdroidserver/build.py", line 1155, in main
	    options.onserver, options.refresh):
	  File "/home/vagrant/fdroidserver/fdroidserver/build.py", line 951, in trybuild
	    build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver, refresh)
	  File "/home/vagrant/fdroidserver/fdroidserver/build.py", line 648, in build_local
	    p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
	  File "/home/vagrant/fdroidserver/fdroidserver/common.py", line 1786, in FDroidPopen
	    result.output = result.output.decode('utf-8')
	UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb7 in position 5397290: invalid start byte

One way to fix this would be to use one of the python libraries that
guess an encoding. But a much safer option is to tell the decode method
to ignore non-utf8 bytes, as opposed to crashing on them.
2017-03-12 19:36:44 +00:00
Hans-Christoph Steiner
001d3b1fbb Merge branch 'include-ota-zip-in-index-xml' into 'master'
fix OTA ZIP inclusion in index.xml

See merge request !223
2017-03-10 23:06:22 +00:00
Hans-Christoph Steiner
6fe27ad75e fix source tarball filename for media files
bug from 07ce948809
2017-03-10 19:05:51 +01:00
Hans-Christoph Steiner
6aca906863 include non-APKs that match metadata and fdroid-generated filenames
Since it is now possible to build and include arbitrary files, like OTA
update ZIP files, the update procedure needs to look for non-APK files that
match the packageName_versionCode pattern of fdroid-generated files.

!193
admin#14
privileged-extension#9
2017-03-10 18:37:18 +01:00
Hans-Christoph Steiner
9d363b91f4 update: do not include fdroid-generated tarballs as "media" files
`fdroid build` will generate source tarballs, and now with support for
adding any file to a repo, we need to explicitly ignore the fdroid-
generated source tarballs.  If people want to include source tarballs in a
repo, they still can, as long as that source tarball doesn't use the
`fdroid build` tarball naming scheme.
2017-03-10 18:37:18 +01:00
Hans-Christoph Steiner
6207ee7878 Merge branch 'gradle341' into 'master'
makebs: add gradle 3.4.1

See merge request !222
2017-03-10 15:23:41 +00:00
Boris Kraut
e8d0a8ede8 makebs: add gradle 3.4.1 2017-03-10 14:29:36 +01:00
Hans-Christoph Steiner
19b3d7f00d Merge branch 'pre-indexv1-fixes' into 'master'
pre index-v1 fixes

See merge request !220
2017-03-07 10:39:41 +00:00
Hans-Christoph Steiner
650d52fb0a uses-permission maxSdkVersion as int, and enforces int string in XML
This forces <uses-permission maxSdkVersion=""> to be an integer in the
internal dict, and forces it to have no decimal point in XML.  Having it as
an integer in the internal dict means data will pass directly through to
the fdroidclient Apk instance, where it is ultimately an integer.
2017-03-06 22:04:14 +01:00
Hans-Christoph Steiner
7bae1075ba non-APK files will not have minSdkVersion, so don't force it
fdroidclient should handle no minSdkVersion fine, since it just parses the
text in <sdkver></sdkver> as an int, and uses a default value if there is
an Exception.
2017-03-06 22:03:20 +01:00
Hans-Christoph Steiner
0be58c2dca update: do not include PGP signatures as "media" files
A .asc or .sig file is a detached PGPG signature, `fdroid gpgsign`
generates them.  It makes no sense for them to be ever treated as a file
for distribution.

This also adds to forgotten forms of index files.
2017-03-06 11:55:17 +01:00
Hans-Christoph Steiner
f79f08a1c1 update bash completion commenting to match standards 2017-03-06 11:53:58 +01:00
Hans-Christoph Steiner
d4060bbaa2 Merge branch 'master' into 'master'
upload release apk to virustotal

Closes #17

See merge request !218
2017-03-06 09:13:15 +00:00
thez3ro
f76ef0b3a8
upload release apk to virustotal 2017-03-03 13:44:55 +01:00
Hans-Christoph Steiner
c352c02557 Merge branch 'master' into 'master'
upload release apk to AndroidObservatory

Closes #142

See merge request !217
2017-03-01 22:36:53 +00:00
Hans-Christoph Steiner
f68d811e64 Merge branch 'master' into 'master'
upload release apk to AndroidObservatory

Closes #142

See merge request !217
2017-03-01 22:36:26 +00:00
thez3ro
d5e2d6f57a
upload release apk to AndroidObservatory 2017-03-01 22:34:55 +01:00
Hans-Christoph Steiner
2242bb232b Merge branch 'skip-scan' into 'master'
Pass on --skip-scan flag to build server VM when running fdroid build --server.

Closes #130

See merge request !216
2017-03-01 17:35:02 +00:00
Michael Pöhn
c5bd8d9582 Pass on --skip-scan flag to build server VM when running fdroid build --server. 2017-03-01 17:27:17 +01:00
Hans-Christoph Steiner
0025adf566 Merge branch 'metadata-fixes-and-tests' into 'master'
metadata fixes and tests

Closes #261

See merge request !215
2017-02-28 13:28:55 +00:00
Hans-Christoph Steiner
4e8e297944 metadata: port .fdroid.yml handling to App dict subclass
This got overlooked in b7fc7f2228, then
caught in the ./makebuildserver tests, where it builds Checkey.
2017-02-28 12:08:04 +01:00
Hans-Christoph Steiner
5214889bbd fix bug including media files
'name' is not the full path, so it'll always fail common.is_repo_file()'s
os.path.isfile() check.

Introduced in 56d51fcd6b
2017-02-28 12:08:04 +01:00
Hans-Christoph Steiner
f06e336904 improve rewritemeta error msg about formats 2017-02-28 12:08:04 +01:00
Hans-Christoph Steiner
564cfb1089 match versionCode/versionName when set as gradle variable
For example, see org.kontalk:

allprojects {
    ext {
        appVersionCode = 221
        appVersionName = '4.0.1-preview'
    }
}
2017-02-28 12:08:04 +01:00
Hans-Christoph Steiner
507ed4a170 do not crash if no versionCode is found while parsing
if vercode is None and max_vercode is None, then it gave None as an arg to
the regexp pattern in ignoresearch().

closes #261
2017-02-28 12:08:04 +01:00
Hans-Christoph Steiner
d92ac1e8f6 fix metadata dump test to run on CI servers 2017-02-28 12:08:04 +01:00
Hans-Christoph Steiner
8b85c860a6 rename lastupdated to lastUpdated to match fdroid client
This lets index-v1 be parsed directly into class instances because the
field/instance var names match exactly.  The original index v0 element
must retain the 'lastupdated' name for backwards compatibility.
2017-02-28 12:08:04 +01:00
Hans-Christoph Steiner
73bb2cf1ba Merge branch 'gradle34' into 'master'
makebs: add gradle 3.4

See merge request !214
2017-02-27 09:10:11 +00:00
Boris Kraut
add1ad6eb5 makebs: add gradle 3.4 2017-02-26 03:23:49 +01:00
Hans-Christoph Steiner
b2a432db7e Merge branch 'remove-manual' into 'master'
remove TeX manual, it moved to https://gitlab.com/fdroid/fdroid-website

See merge request !209
2017-02-24 15:18:43 +01:00
Hans-Christoph Steiner
584841a775 jenkins-build-makebuildserver: add rudimentary rewritemeta test
This will show if rewritemeta changed anything.  fdroiddata requires all
files to be rewritten with rewritemeta before they are accepted.
2017-02-24 14:01:31 +01:00
Hans-Christoph Steiner
8decd3b504 remove TeX manual, it moved to https://gitlab.com/fdroid/fdroid-website
The whole TeX manual has been folded into the new Jekyll-based website, so
this is no longer needed at all.
2017-02-24 14:01:31 +01:00
Hans-Christoph Steiner
7a25dbc081 rewritemeta: fix silly bug of using == for =
This was introduced in c0bc3afda9
2017-02-24 13:36:41 +01:00
Torsten Grote
2a421d653c Merge branch 'make-Build-App-act-like-dicts' into 'master'
make Build and App classes act like dicts

See merge request !210
2017-02-24 11:11:11 +00:00
Hans-Christoph Steiner
4e39621601 provide warning if config items will not preserve order
If a group of items are enclosed in {}, then that will be a Python set,
which does not preserve order.  To preserve order, the data must be either
a tuple () or list [].
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
388c336e76 build: ensure test is running on git commit that this code works with
Since https://gitlab.com/fdroid/ci-test-app is a separate git repo, things
with incompatible changes could get out of sync.  Therefore, this test
should specify which git commit is runs against.

For example, the .fdroid.yml file is still a moving target.  Just now, the
keys had the spaces removed as part of this MR.
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
593613043e normalize Build TYPE_STRING data based on .txt
Unfortunately, things like versionCode must be strings.  That should be
converted to be ints throughout.
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
c178cfb843 normalize Build TYPE_LIST data based on .txt
In the future, we should have better internal datatypes for this stuff,
i.e. instead of gradle: ['yes'] for True, actually use a boolean.  For now,
make the YAML and JSON metadata produce the same internal data as .txt.
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
f7ae398aae add script for mass testing metadata parsing after changes
This requires manually running it.  I suppose it would be possible to
include a snapshot of the dumped internal representation for each release,
then make the tests run automatically against that.  Right now, the dump is
17megs of YAML.  Seems large to include in this git repo.
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
e0f39a7e7b rename Build fields: version -> versionName, vercode -> versionCode
Since the YAML/JSON/etc. field names are now exactly the same as the field
names used in the internal dict in the Build class, this is a global rename

This keeps with the standard names used in Android:
https://developer.android.com/guide/topics/manifest/manifest-element.html
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
c0bc3afda9 convert metadata.Build to a subclass of dict
Like with the App class in the commit before, this makes it a lot
easier to work with this data when converting between the internal
formats and external formats like YAML, JSON, MsgPack, protobuf, etc.

The one unfortunate thing here is Build.update. It becomes
dict.update(), which is a method not an attribute.
build.get('update') or build['update'] could be used, but that would
be oddly inconsistent. So instead the field is renamed to
'androidupdate', except for in the .txt v0 metadata files. This better
describes what field does anyway, since it runs `android update`.

Build.update is only referenced in two places right next to each other
for the ant builds, so this change still seems worthwhile.
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
b7fc7f2228 convert App to subclass of dict to support parsing/dumping libs
Python is heavily based on its core data types, and dict is one of the more
important ones.  Even classes are basically a wrapper around a dict. This
converts metadata.App to be a subclass of dict so it can behave like a dict
when being dumped and loaded.  This makes its drastically easier to use
different data formats for build metadata and for sending data to the
client.  This approach will ultimately mean we no longer have to maintain
custom parsing and dumping code.

This also means then that the YAML/JSON field names will not have spaces in
them, and they will match exactly what it used as the dict keys once the
data is parsed, as well as matching exactly the instance attribute names:

* CurrentVersion: 1.2.6
* app['CurrentVersion'] == '1.2.6'
* app.CurrentVersion == '1.2.6'

Inspired by:
https://goodcode.io/articles/python-dict-object/
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
4625651192 make Build class act more like a dict
This makes it a lot easier to work with Build instances with parsing and
dumping libraries, since they expect only core Python types (dict, list,
tuple, str, etc)
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
14f204cfe1 sort repo index data to make index.xml generation reproducible
This makes it easy to test that the code is still generating the exact same
index.xml.  It also might help the ZIP compression work better in index.jar
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
56ef716a4e test for original "v0" index XML compatibility
The original index.xml format needs to stay around for backwards
compatibility, but we shouldn't touch it anymore once the new format is in
place.  This is a test to make sure `fdroid update` can still generate the
correct XML.

install_list and uninstall_list should be tuples or lists in order to
ensure that the order is preserved.

These tests also check that the added and lastupdated dates are
working correct, based on the dates in tests/stats/known_apks.txt. I
could see no useful way to test the timestamp, it is just hardcoded
using a regexp search-and-replace.  Running these tests manually might
require deleting tmp/apkcache.
2017-02-24 11:01:01 +01:00
Hans-Christoph Steiner
327ba335a7 Merge branch 'support-v44' into 'master'
makebs: update support repo to r44, closes fdroid/rfp#49

Closes rfp#49

See merge request !213
2017-02-23 11:48:01 +00:00
Hans-Christoph Steiner
ed3af92cbd Merge branch 'firebase' into 'master'
scanner: add firebase to usual suspect list, closes #259

Closes #259

See merge request !212
2017-02-23 11:46:56 +00:00
Boris Kraut
687061f47e makebs: update support repo to r43, closes fdroid/rfp#49 2017-02-23 01:27:10 +01:00
Boris Kraut
daafc422ae scanner: add firebase to usual suspect list, closes #259 2017-02-23 00:41:00 +01:00
Hans-Christoph Steiner
284e272f48 Merge branch 'name' into 'master'
update: add name to skeleton, closes #258

See merge request !211
2017-02-21 14:08:47 +00:00