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

4300 Commits

Author SHA1 Message Date
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
Daniel Martí
0711ddb376 lint: make the check for format a regular check 2016-05-05 13:23:30 +01:00
Daniel Martí
0c6269bb67 lint: error on unused files
For now, this is just patch files.
2016-05-05 12:40:16 +01:00
Daniel Martí
736391d3d9 Merge branch 'ci-bump' into 'master'
CI: Bump image

This is basically just an SDK update. We're now using the tools zip,
which is about 200MB smaller. Not entirely sure why, but things still
work.

See merge request !123
2016-05-05 11:14:27 +00:00
Daniel Martí
38790830f4 CI: Update image, not using base anymore
Since base is now 200MB smaller, this one is smaller too. The
fdroidserver-only deps are now in the client image - mainly python3-dev,
gcc and all the build deps for stuff like pillow.
2016-04-29 20:27:39 +01:00
Daniel Martí
5117562df4 lint: gradle does have target= support 2016-04-20 11:23:27 +01:00
Daniel Martí
a2edc9da43 Merge branch 'fix-ci' into 'master'
CI: Install venv instead of virtualenv



See merge request !122
2016-04-15 10:30:24 +00:00
Daniel Martí
8dea6b896c gradle: forgot to actually install 2.12 2016-04-14 16:19:35 +01:00
Daniel Martí
bf0e5dde71 CI: Install venv instead of virtualenv 2016-04-14 16:16:58 +01:00
Daniel Martí
fd9ac1ad36 Merge branch 'defaults' into 'master'
docs: add archive-policy default



See merge request !121
2016-04-14 08:35:54 +00:00
Boris Kraut
00f940e937 docs: add archive-policy default 2016-04-14 10:28:24 +02:00
Daniel Martí
1539b67537 Merge branch 'fix-virtualenv' into 'master'
Prefer pyvenv instead of virtualenv for Python 3.3+

`virtualenv` uses python2 by default on my machine.
Using `pyvenv` (see https://docs.python.org/3/library/venv.html#module-venv) instead of `virtualenv` fixes the problem and let's me perform `python3 setup.py install` in the virtual environment.

See merge request !119
2016-04-14 08:04:28 +00:00
Lode Hoste
0da94fbf58 Prefer pyvenv instead of virtualenv for Python 3.3+ 2016-04-13 08:30:41 +02:00
Daniel Martí
e2ea213887 Merge branch 'apkcache_compatibility' into 'master'
Add a workaround to open apkcache created with Py2

A workaround for #163.
*May* help in some rare cases, should not break anything.

See merge request !120
2016-04-12 18:35:23 +00:00
Dmitriy Bogdanov
3f75c95e5f Add an encoding parameter to open apkcache created with Py2 2016-04-12 12:42:41 +04:00