1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 11:00:10 +01:00
Commit Graph

4364 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
a88771cf30 buildserver: run tests with verbose logs 2016-06-21 10:29:56 +02:00
Hans-Christoph Steiner
ecab81d69d buildserver: suppress unzip file list when unpacking SDK/NDK
Just too much pointless info in the log.
2016-06-21 10:29:56 +02:00
Hans-Christoph Steiner
323ad5e0ad Merge branch 'fix-buildserver' into 'master'
Fix buildserver, broken by e449d2f

Switching to a script /etc/profile.d to set up the environment is all
well and good, except that doesn't get run when you directly execute a
command directly via ssh, which means that the buildserver didn't work
at all (at least for anything that used gradle, or relied on the
environment variables.

This fix doesn't look very nice, but it works - it just forces the
appropriate script to run before build.py is executed on the server.

(Side note, I thought we had tests for this, how did it get past them?)

See merge request !135
2016-06-21 08:22:34 +00:00
Hans-Christoph Steiner
8aacbb6b4f Merge branch 'master' into 'master'
Tone down makebuildserver terminal spamming

The progress bar updating at each 1k chunk spams the terminal to such an
extent it stops responding to keypresses (at least with a fast
connection). It also seems extremely inefficient to be writing the file
in 1k chunks. This makes it 64k, which is more reasonable but quite
probably still too small.

See merge request !134
2016-06-21 06:34:20 +00:00
Ciaran Gultnieks
d7e6e335f3 Fix buildserver, broken by e449d2f
Switching to a script /etc/profile.d to set up the environment is all
well and good, except that doesn't get run when you directly execute a
command directly via ssh, which means that the buildserver didn't work
at all (at least for anything that used gradle, or relied on the
environment variables.

This fix doesn't look very nice, but it works - it just forces the
appropriate script to run before build.py is executed on the server.

(Side note, I thought we had tests for this, how did it get past them?)
2016-06-18 12:15:16 +01:00
Ciaran Gultnieks
9a2e06fd5c Tone down makebuildserver terminal spamming
The progress bar updating at each 1k chunk spams the terminal to such an
extent it stops responding to keypresses (at least with a fast
connection). It also seems extremely inefficient to be writing the file
in 1k chunks. This makes it 64k, which is more reasonable but quite
probably still too small.
2016-06-17 13:39:01 +01:00
Hans-Christoph Steiner
d6ab05c567 Merge branch 'add-sig-algs-1' into 'master'
Adding support for DSA and ECDSA signatures in binaries

Before this patch only RSA signature files was supported when using the Binaries metadata directive as described in https://f-droid.org/wiki/page/Deterministic,_Reproducible_Builds.

This patch simply makes .DSA and .EC files also be recognised as signature files.

See merge request !133
2016-06-17 12:05:22 +00:00
Markus Kilås
cf320f2e9a Adding support for DSA and ECDSA signatures. 2016-06-17 12:58:52 +02:00
Daniel Martí
3e88b7444d lint: only check unused exlibs if using all apps 2016-06-17 11:35:44 +01:00
Ciaran Gultnieks
720d40ac1c Merge branch 'use-android-update-sdk' into 'master'
switch SDK/NDK/gradle buildserver provisioning to shell scripts

This converts the SDK, NDK, and gradle chef recipes to vagrant provisioning shell scripts.   Those recipes were just shell scripts anyway, forced into that ugly ruby/chef syntax.  Hopefully this will make things easier to maintain since simple bash is easier for most devs than ruby/chef. Also, it might speed up the provisioning a little bit since the whole script is sent to the VM then executed, rather than sent line-by-line.  Additionally, the SDK components are now installed using `android update sdk` so we do not need to duplicate Google's crazy kludges with that stuff.

See merge request !132
2016-06-17 09:15:33 +00:00
Daniel Martí
882afebf76 common: always set android ndk env vars
Also, add the ndk to PATH at the beginning, in case any other ndks are
already in it.

Fixes #176.
2016-06-16 21:36:31 +01:00
Hans-Christoph Steiner
8e57f2737d invalidate apkcache if the metadata version is different
When the metadata changes, different things will be stored about each APK.
So invalidate the cached info parsed from APKs if the cache's metadata
version does not match the metadata version of the currently running tools.
2016-06-15 16:35:00 +02:00
Hans-Christoph Steiner
c11edc3022 include new provisioning shell scripts in syntax checks 2016-06-15 16:35:00 +02:00
Hans-Christoph Steiner
d0bb6f73bf buildserver: /vagrant/cache writeable only by root
Prevent build processes from modifying the cache, it is only needed
during provisioning anyway. A malicious build could still use sudo to
change the cache, but this is more to prevent mistaken modifications.
2016-06-15 16:35:00 +02:00
Hans-Christoph Steiner
6ea2508127 buildserver: unpack gradle versions with provisioning shell script
This was not using anything special from chef, so do it in a shell script
instead.  This makes the script easier for the python/shell people, and
probably uses less memory, since chef is a memory hog.  This might even
make the provision go faster since it uploads the whole script as a file to
the VM, then runs it there.  I think chef sends each command via SSH.
2016-06-15 16:35:00 +02:00
Hans-Christoph Steiner
02a835ff95 buildserver: unpack NDK with a provisioning shell script
This makes the process closer to ./jenkins-build scripts and .gitlab-ci.yml
files.  Hopefully it uses less RAM than chef too.
2016-06-15 16:35:00 +02:00
Hans-Christoph Steiner
e47396b403 buildserver: use android update sdk to install Android SDK
`android update sdk --no-ui` is the standard command line tool for
installing the Android SDK.  By symlinking into the $ANDROID_HOME/temp dir,
the cached files can still be used.  This converts the chef recipe to a
vagrant shell provisioning script since it was all bash anyway.

Some file names no longer officially have a -linux in them, so those were
changed to keep the cache working with the default filename.
2016-06-15 15:26:35 +02:00
Hans-Christoph Steiner
e449d2f583 buildserver: setup env vars using standard script
bash provides a standard file location for a script to be run when the
shell starts: /etc/profile.d/  This converts the scattered bits of code for
making ~/.bsenv into a single provisioning script to generate
/etc/profile.d/bsenv.sh, which gets automatically executed when bash starts
2016-06-15 15:26:35 +02:00
Hans-Christoph Steiner
721b3b79a6 buildserver: extract NDK rather than executing it
Then the NDK archive doesn't need execute permissions.
2016-06-15 15:26:35 +02:00
Hans-Christoph Steiner
14b702b23b githooks: do not run syntax checks on files being deleted 2016-06-15 14:59:56 +02:00
Ciaran Gultnieks
90ac5d3fa8 Merge branch 'fix-makebuildserver' into 'master'
Fix ./makebuildserver CI build

In order to get reproducible builds work reliably, we need to have buildserver create be fully automatic, and be able to run in VMs.  It should also handle caching downloads well, so that people can easily rebuild their buildserver, and CI builds don't have to download gigs and gigs for each run.  These are some related fixes.

See merge request !131
2016-06-15 09:30:42 +00:00
Hans-Christoph Steiner
51e8776a88 REBASE buildserver: handle loops in bash, not ruby, to save memory 2016-06-14 23:21:53 +02:00
Hans-Christoph Steiner
85b65f0941 tests: pyvenv --system-site-packages is too buggy on python 3.4
It always wants to install packages into /usr/lib/python3.4/site-packages

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 295, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 672, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 902, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 214, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 176, in clobber
    os.makedirs(dest)
  File "/usr/lib/python3.4/os.py", line 237, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.4/site-packages'
2016-06-14 22:40:50 +02:00
Hans-Christoph Steiner
a4615b1def buildserver: handle loops in bash, not ruby, to save memory
Apparently, ruby is quite a memory hog when it forks.  I've been getting
errors like this with ./makebuildserver:

Errno::ENOMEM - script[add_btools_17] (android-sdk::default line 72) had an
  error: Errno::ENOMEM: Cannot allocate memory - fork(2)

So instead of looping in ruby and forking for each loop, handle the looping
in the bash script, so ruby is just calling a single bash script.
2016-06-14 16:34:13 +02:00
Hans-Christoph Steiner
fc0df30404 remove app.openconnect from ./makebuildserver tests
Turns out this one is a pain to get running on the locked down Guardian
Project Jenkins box since it uses git:// rather than https:// for the git
submodules.
2016-06-14 14:22:00 +02:00
Hans-Christoph Steiner
714b3b9ff6 makebuildserver: use original names for downloaded SDK components
It will make it a lot easier to manage the cache if we use the original
file names, which often include the file version.  This also changes the
download process to be resumable if there is a partial file in the cache,
and switches from calling wget on the command line to using the python libs
'requests' and 'clint' to provide a similar experience.  While its not so
important for this particular bit of code to use those libraries, I think
those two will allow us to provide a better user experience throughout the
whole of fdroidserver.

In this case, it is already doing special tricks fetching the file size
from the server before trying to download it.  I suppose this code could
instead check if the file exists, and if so, check the hash sum.  I think
that would be slower for most people since checking the hash on large files
takes a noticeable about of time, while a HTTP HEAD request is pretty tiny.
2016-06-14 14:21:59 +02:00
Hans-Christoph Steiner
2fab013393 Merge branch 'targetSdkVersion' into 'master'
support targetSdkVersion

In order to provide the proper Android-6 permissions experience, the client needs to know which `targetSdkVersion` any APK has before it downloads it.  So this adds it to the metadata.

https://gitlab.com/fdroid/fdroidclient/issues/682

See merge request !128
2016-06-14 10:39:50 +00:00
Hans-Christoph Steiner
1b7a8f85fc parse targetSdkVersion from APKs
The default targetSdkVersion is minSdkVersion, according to the docs:
https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#target

https://gitlab.com/fdroid/fdroidclient/issues/682
2016-06-14 11:43:07 +02:00
Hans-Christoph Steiner
032dbc3e8d official Android default minSdkVersion is 1 not 0
https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#min
2016-06-14 10:06:02 +02:00
Hans-Christoph Steiner
1feccf9eb8 rename 'sdkversion' var to 'minSdkVersion' to avoid confusion
'sdkversion' is confusing when there is also 'targetSdkVersion' and
'maxSdkVersion'.
2016-06-14 10:06:02 +02:00
Hans-Christoph Steiner
0ae257db15 rename maxSdkVersion variables to match Android
Since this variable is already different than the XML name ('maxsdkver'),
this eliminates one more name for the same thing.
2016-06-14 10:06:02 +02:00
Hans-Christoph Steiner
547a57e693 fix "DeprecationWarning: Please use assertEqual instead."
They've been deprecated since python 3.2, which was released a long time
ago.
2016-06-14 10:06:02 +02:00
Daniel Martí
f68830127e CI: bump docker image 2016-06-13 19:45:12 +01:00
Daniel Martí
4ed95b1fa6 CI: remove debug ls 2016-06-13 19:44:52 +01:00
Daniel Martí
83a0be960d Merge branch 'fix-file-read-write-encoding' into 'master'
Fix file read/write encoding

This hopefully provides a reasonably complete set of fixes for handling file encoding when reading and writing files.  It is not perfect since it does not handle _.java_, _.gradle_, or _pom.xml_ in any encoding, as is allowed.  But I think it should only be an improvement of the current state, and at worst, should work only as bad as the current setup for most language setups 

See merge request !129
2016-06-09 15:13:27 +00:00
Hans-Christoph Steiner
733ef52424 gitlab-ci: make sure pip3 install dirs exist
It doesn't want to create them itself.
2016-06-09 12:15:11 +02:00
Hans-Christoph Steiner
2b6d692f06 use UTF8 as default instead of ASCII for .java .gradle pom.xml
.java .gradle and XML files all can use any encoding.  Most code is ASCII,
but authors' names, etc. can easily be non-ASCII.  UTF-8 is by far the most
common file encoding.  While UTF-8 is the default encoding inside the code
in Python 3, it still has to deal with the real world, so the encoding
needs to be explicitly set when reading and writing files. So this switches
fdroidserver to expect UTF-8 instead of ASCII when parsing these files. For
now, this commit means that we only support UTF-8 encoded *.java, pom.xml
or *.gradle files.  Ideally, the code would detect the encoding and use the
actual one, but that's a lot more work, and its something that will not
happen often. We can cross that bridge when we come to it.

One approach, which is taken in the commit when possible, is to keep the
data as `bytes`, in which case the encoding doesn't matter.

This also fixes this crash when parsing gradle and maven files with
non-ASCII chars:

ERROR: test_adapt_gradle (__main__.BuildTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/fdroidserver-eighthave/tests/build.TestCase", line 59, in test_adapt_gradle
    fdroidserver.build.adapt_gradle(testsdir)
  File "/var/lib/jenkins/workspace/fdroidserver-eighthave/fdroidserver/build.py", line 445, in adapt_gradle
    path)
  File "/var/lib/jenkins/workspace/fdroidserver-eighthave/fdroidserver/common.py", line 188, in regsub_file
    text = f.read()
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9460: ordinal not in range(128)
2016-06-07 20:13:54 +02:00
Hans-Christoph Steiner
afd528731a read/write F-Droid files always as UTF-8
This makes UTF-8 the sole supported encoding for F-Droid's files. This is
mostly codifying the already existing practice for config.py and index.xml.
The other files where always just ASCII before.

* config.py
* metadata/*.txt
* known_apks.txt
* categories.txt
* latestapps.txt
* latestapps.dat
* index.xml

Note: this does not change the read/write encoding of stats files.  That is
still ASCII.
2016-06-07 14:10:04 +02:00
Hans-Christoph Steiner
444e8ad982 read/write Java .properties files in proper encoding
They are officially defined as always in ISO 8859-1:
https://docs.oracle.com/javase/6/docs/api/java/util/Properties.html
2016-06-07 13:37:32 +02:00
Daniel Martí
3eca9dd773 README: fix badge 2016-06-03 16:59:24 +01:00
Ciaran Gultnieks
401649e036 Add extra debug logging for move to/from archive 2016-05-29 15:36:58 +01:00
Ciaran Gultnieks
e410e7018e Merge branch 'bs-updates' into 'master'
buildserver updates



See merge request !127
2016-05-27 13:14:52 +00:00
Daniel Martí
ec7beb8388 Bump platform-23 to r03 2016-05-27 14:08:57 +01:00
Daniel Martí
fa9aa5d10f Do not install extra-android-support in the VM
It's m2repository that is actually used by maven-based builds. This one
is pretty much useless.
2016-05-27 14:08:57 +01:00
Daniel Martí
d5d22dbc99 Update android sdk version
Install version 25 now. Also use the smaller tools zip. While at it,
also remove the tools re-install - it's not worth it, as long as we keep
the initial tools zip up to date.
2016-05-27 14:08:57 +01:00
Daniel Martí
1edd9cde3c Add gradle 2.13 2016-05-27 14:08:57 +01:00
Daniel Martí
a7e227d0e3 Merge branch 'libtool' into 'master'
Add libtool to deps list



See merge request !126
2016-05-26 16:33:39 +00:00
Boris Kraut
3a45f6ebe0 Add libtool to deps list 2016-05-17 23:04:20 +02:00
Daniel Martí
bad9c3e804 Merge branch 'lint-unused-files' into 'master'
lint: error on unused files

For now, this is just patch files.

See merge request !124
2016-05-05 23:31:04 +00:00
Daniel Martí
3aeea6fc90 lint: Add check for missing and unused extlibs 2016-05-05 13:42:07 +01:00