Commit Graph

73 Commits

Author SHA1 Message Date
Michael Pöhn f2a80ffa3d fix tests on old python version 2020-01-28 11:43:09 +01:00
Michael Pöhn b25eeb66a1 fix code style 2020-01-28 11:43:09 +01:00
Michael Pöhn 7a4254efa2 make main script pythonic 2020-01-28 11:43:09 +01:00
Pablo Castellano 4ec6958e33 do not crash when returned system encoding is None 2019-08-30 19:45:23 +02:00
Michael Pöhn 5a1c6cf2de log a warning when encoding is not set to utf-8 2019-02-01 13:26:31 +01:00
Hans-Christoph Steiner 1f346b3149 force_exit() to make exit work with all `fdroid build` conditions
The build command has to use some threading stuff to handle the timeout and
locks.  This seems to prevent the command from exiting, unless this hack is
used.
2018-11-14 14:27:32 +01:00
Hans-Christoph Steiner fb02073cab fix "local variable 'e' is assigned to but never used" 2018-05-25 12:32:34 +02:00
Hans-Christoph Steiner 0a15a9b65b tests: fix and test `fdroid deploy` 2018-05-25 10:32:09 +02:00
Hans-Christoph Steiner 1725e09f7e rename `fdroid server` to `fdroid deploy` and deprecate 'init'
`fdroid server init` is has not been needed for a long time.  And 'server'
is the only subcommand that has its own subsubcommands.  This turns it into
only `fdroid deploy`, which does what `fdroid server update` does. This
also changes the bash completion to use `fdroid deploy`.  But the old
`fdroid server update` and `fdroid server init` commands remain working.

closes #264
2018-02-13 12:54:48 +01:00
Marcus Hoffmann a1a88e1c6a
main: force exit on keyboard interrupt
This applies the same workaround as b8ed892ad9.
2018-01-22 16:02:49 +01:00
Izzy 0a1fe3dc7e correct "usage" output (--help; see #405) 2017-12-07 14:51:27 +01:00
Hans-Christoph Steiner 2162703a1a mirror: new command to make a mirror of a repo
This creates a mirror of a full repo by downloading all files listed in
the index, and the ones that are generated based on that data, e.g. icons
of different resolutions.  This could be useful for setting up mirrors of
small repositories, instead of having to learn and manage rsync or
something else for mirroring.  This just needs a working repo.

It uses wget in a batch mode with the aim as being as efficient as
possible.  wget mirroring over HTTP is always going to be less efficient
than rsync, but it shouldn't be so bad since it uses --continue to check
whether it has already downloaded a file.  I suppose it could be extended
to use ETags for a little more efficiency.

I developed this creating a test mirror of f-droid.org, which is now a bit
ironic, since I added a specific check to prevent people from using this
on f-droid.org.
2017-11-29 12:40:04 +01:00
Hans-Christoph Steiner f670634450 nightly: new command to setup nightly builds in CI systems
This lets people using CI systems easily setup a nightly build repo hosted
for free in github or gitlab.

https://github.com/zom/Zom-Android/pull/355
https://gitlab.com/fdroid/fdroidclient/merge_requests/594

environment variables:
* https://docs.gitlab.com/ce/ci/variables/README.html
* https://docs.travis-ci.com/user/environment-variables
* https://circleci.com/docs/1.0/environment-variables
2017-11-22 23:27:07 +01:00
Hans-Christoph Steiner 927104a4e3 update: make strings translatable 2017-10-19 23:16:58 +02:00
Hans-Christoph Steiner 53e4ec47a7 English source string corrections
From @monolifed <monolifed@gmail.com>
2017-09-16 13:19:38 +02:00
Hans-Christoph Steiner 278d67d960 implement gettext localization
This allows all the text to be localized via Weblate.  This is a quick
overview of all the strings, but there are certainly some that were left
out.

closes #342
2017-09-15 11:39:00 +02:00
Michael Pöhn 3e6dfacf6c added signatures subcommand 2017-09-07 00:03:35 +02:00
Michael Pöhn 0df95ce7e6 dont list fdroid subcommands in random order 2017-09-04 14:29:30 +02:00
Hans-Christoph Steiner c591a4cd89 `fdroid btlog` external binary transparency logger
This complements the binary transparency logging that happens on the
server side !226.  Anyone can set up an efficient tracker of any
F-Droid repo which stores all index files that it sees.  It uses HEAD
requests and ETag checking to be as efficient as possible, so that
this can be automatically run at a frequent pace.
2017-04-03 20:24:21 +02:00
Kevin C. Krinke df27bae6a0 dscanner - Drozer based post-build dynamic vulnerability scanner command
* New command `dscanner`, enables one to scan signed APKs with Drozer
 * Drozer is a dynamic vulnerability scanner for Android
 * Drozer runs in a emulator or on-device, this new `dscanner` command...
  * starts a docker image with Drozer and the Android Emulator pre-installed,
  * loads the signed APK into the emulator
  * activates Drozer automated tests for the APK
  * gathers the report output and places it next to the original APK
 * The Drozer docker image can be:
  * cached locally for re-use (just don't run --clean*)
  * retrieved from dockerhub.com for more efficient runtime
  * or be built from scratch (in the new "./docker" directory)
 * New "Vulnerability Scanning" documentation section (run gendocs.sh)
2016-12-06 14:00:44 +01:00
Daniel Martí 82b1d7ad14 all: make newer pycodestyle happy
Apparently the "two empty lines" rule is now stricter.
2016-11-15 20:55:06 +00:00
Hans-Christoph Steiner 7039d16046 always parse versions as strings, not bytes
Fixes a couple errors like:
  File "./makebuildserver", line 30, in vagrant
    out += line
  TypeError: Can't convert 'bytes' object to str implicitly

If universal_newlines=False, the default, then Popen will return bytes if
the newlines in the data do not match the system's newlines.  Setting it to
true enables auto-conversion, and then guarantees that the data is always
str.

"If universal_newlines is True, the file objects stdin, stdout and stderr
are opened as text streams in universal newlines mode, as described above
in Frequently Used Arguments, otherwise they are opened as binary streams."
https://docs.python.org/3/library/subprocess.html#subprocess.Popen
2016-03-14 12:49:38 +01:00
Daniel Martí 99edd64372 Switch all headers to python3 2016-03-10 16:43:36 +00:00
Daniel Martí 0be343273d Apparently Python cannot handle Unicode
I really hope I can revert this in the near future. Having to mutilate
my name just so that pip will work is a terrible workaround.

For better or worse, this only affects scripts defined in setup.py.
2016-01-14 23:15:05 +01:00
Daniel Martí 309660423c fdroid: python2 doesn't like print()
It just prints "()", which is stupid.
2016-01-09 13:24:13 +01:00
NeroBurner 5ca182a20d except named exception handling 2015-12-29 20:09:27 +01:00
NeroBurner af38f151a2 Change print-function to have brackets 2015-12-29 20:06:46 +01:00
Daniel Martí 73f9c1d1c2 Always use the same logging format
This helps differentiate errors, warnings and regular messages.
2015-10-05 21:43:08 +02:00
Daniel Martí 9c3fd97530 fdroid: don't treat MetaDataException as unknown
Up until now, if it was thrown, fdroid would crash with a full stacktrace as
if the program had stopped unexpectedly. Now it just prints the metadata
error, as intended.
2015-09-26 16:53:08 -07:00
nero-tux d23ecf1b35 replace deprecated optparse with argparse
following guidelines from:
https://docs.python.org/2/library/argparse.html#upgrading-optparse-code
except, still using option = parse.parse_args() instead of args = ...

- using the following script in folder fdroidserver:
	for i in *.py; do
		sed -i -e 's/optparse/argparse/' \
			-e 's/OptionParser/ArgumentParser/' \
			-e 's/OptionError/ArgumentError/' \
			-e 's/add_option/add_argument/' \
			-e 's/(options, args) = parser/options = parser/' \
			-e 's/options, args = parser/options = parser/' \
			-e 's/Usage: %prog/%(prog)s/' $i;
	done
- use ArgumentParser argument to replace (option, args) = parser.parse()
  call
- use parser.error(msg) instead of raise ArgumentException as suggested
  in https://docs.python.org/2/library/argparse.html#exiting-methods
- in fdroid catch ArgumentError instead of OptionError
2015-09-06 10:34:50 +02:00
Hans-Christoph Steiner 3fc2a99d71 `fdroid --version` for installed releases and running from git
This will report the version embedded in the module if it is installed, and
will report `git describe` if being run from git.  If someone installs from
git using pip, this will probably report the version in setup.py, which
will be wrong.  But that is not a documented install method, and I haven't
heard of anyone using it.  The recommended way is to run straight from git.
2015-09-01 19:45:00 +02:00
Ciaran Gultnieks ba177472da Add fdroid signindex to sign previously unsigned indexes 2015-01-11 08:20:14 +00:00
Daniel Martí 14f654fabc Apply some autopep8-python2 suggestions 2014-12-31 16:44:06 +01:00
Ciaran Gultnieks 102cbd20b3 Don't print tracebacks for option errors 2014-08-25 16:48:31 +01:00
Daniel Martí 4814238baf Use logging with proper format when warning about improper verbose/quiet usage 2014-07-05 14:17:02 +02:00
Daniel Martí 5bf5ba04a6 Using $(levelname) in --quiet makes no sense 2014-07-05 14:15:31 +02:00
Daniel Martí ec8291ba77 No need to print a trace when the user did a ^C 2014-07-03 18:26:49 +02:00
Daniel Martí 73142c740b Make use of FDroidException in the main fdroid script
This should improve the output shown when exceptions are found
2014-07-03 14:01:22 +02:00
Ciaran Gultnieks e29da6b023 Restore friendly error messages
Use --verbose if you really want a full traceback with your 'you made a
typo in an package ID' messages.

It would be better to do this based on exception types (i.e. our own
exceptions - MetadataException, BuildException, VCSException) would not
print a traceback, but unexpected exceptions would. But the types are
not available at the 'fdroid' level currently.
2014-05-20 22:14:19 +01:00
Ciaran Gultnieks ffdebd9516 Add 'fdroid gpgsign' command
Creates detached gpg signatures for any apks that don't have them
yet. Relevant configuration fields need to be set first.
2014-05-12 21:57:09 +01:00
Hans-Christoph Steiner 37d6d87ff7 fix PEP8 "E226 missing whitespace around arithmetic operator" 2014-05-06 14:36:33 -04:00
Hans-Christoph Steiner 0e00b36db5 fix PEP8 E124/E125/126/127/128 indentation issues
* E124 closing bracket does not match visual indentation
* E125 continuation line does not distinguish itself from next logical line
* E126 continuation line over-indented for hanging indent
* E127 continuation line over-indented for visual indent
* E128 continuation line under-indented for visual indent
2014-05-06 14:36:33 -04:00
Hans-Christoph Steiner aa5f317c26 fix PEP8 "W391 blank line at end of file" 2014-05-06 11:45:03 -04:00
Hans-Christoph Steiner 3f4f7a544b fix PEP8 "E302 expected 2 blank lines, found 1" 2014-05-06 11:45:03 -04:00
Hans-Christoph Steiner 998011d535 fix PEP8 "E231 missing whitespace after ','" 2014-05-06 11:45:02 -04:00
Ciaran Gultnieks 37dda9414c Add --quiet option, restricting output to warnings/errors 2014-02-22 09:46:24 +00:00
Daniel Martí 9d8c576cb1 Don't use logging before it's set up 2014-02-19 01:14:40 +01:00
Daniel Martí 687057a473 Implement proper fdroid --help 2014-02-19 00:38:09 +01:00
Daniel Martí d949b9ffbb Don't show INFO: when not doing verbose runs 2014-02-09 12:39:43 +01:00
Daniel Martí 9a4fe8c7cd Merge branch 'master' into logging 2014-02-02 19:45:17 +01:00