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

58 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
c9aa26d89e add index V1 format, a direct translation of internal dict
Python encode/decode libs work directly with dicts, so the internal dict
can just be passed directly to any of these libs (pyyaml, pyjson, msgpack,
simplejson, etc).  This still generates the exact same index.xml as before.

This converts the internal format for the repo timestamp to a datetime
instance, which can be easily converted to UNIX time in seconds for XML
and UNIX time in milliseconds for the new index formats.  UNIX time in
milliseconds is directly serialized into a java.util.Date instance by
Jackson.
2017-03-17 13:55:40 +01:00
Hans-Christoph Steiner
03ec590989 new repo-wide config option for a Binary Transparency Log
A Binary Transparency Log is a append only log of all binaries published by
a repo.  This is useful for people to find whether the binary they have
matches what F-Droid has published, and also makes it more difficult for
the published history to be changed without notice, or for a server to give
specific users custom malware binaries.

https://www.eff.org/deeplinks/2014/02/open-letter-to-tech-companies
2017-03-15 22:12:04 +01:00
thez3ro
f76ef0b3a8
upload release apk to virustotal 2017-03-03 13:44:55 +01:00
thez3ro
d5e2d6f57a
upload release apk to AndroidObservatory 2017-03-01 22:34:55 +01:00
thez3ro
5a9bcfbbf4
add git repo mirroring 2017-02-17 16:05:57 +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
Daniel Martí
920ae4692f Port all imports to python3 2016-03-10 16:43:37 +00:00
Daniel Martí
ee9a296b64 Make pre-commit hook pass after python3 switch 2016-03-10 16:43:37 +00:00
Daniel Martí
99edd64372 Switch all headers to python3 2016-03-10 16:43:36 +00:00
Daniel Martí
576da1d048 all: deduplicate -v/-q setup 2015-09-11 23:42:50 -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
3af38569a2 server: switch Amazon AWS S3 upload to streaming mode
This keeps memory usage low because it only has to read a chunk at a time
into memory while before it read the whole file into memory before
uploading it.

This also seems to handle setting the permissions ACL better.
2015-08-25 16:55:52 +02:00
Hans-Christoph Steiner
b5cbb4382f new config option: per-app repos to support nightly build repos
For devs that want to build and distribute nightly builds of their apps
using the fdroid tools.  The core idea here is to make the fdroidserver
tool suite the single set of tools for all types of builds and releases.
That will hopefully drive more free software developers to make f-droid.org
an core channel for official releases.
2015-08-25 16:55:52 +02:00
Hans-Christoph Steiner
c941bf3215 server: support plain paths as a serverwebroot
For use cases where there is a web server running on the same machine where
the `fdroid update` is being run, allow plain paths in the serverwebroot
list.  This is useful for debug repos from build servers, like:

https://dev.guardianproject.info/fdroid
2015-05-08 16:11:29 -04:00
Hans-Christoph Steiner
463bfc5639 server: delay deleting on the server for as long as possible
In order to keep things working as much as possible during the update, the
rsync should only delete the obsolete APKs after it has finished uploading
the new APKs.
2015-05-08 16:11:29 -04:00
Ciaran Gultnieks
f63ea5cb86 Use --safe-links with rsync 2015-05-08 14:55:50 +01:00
Ciaran Gultnieks
6a780a5a27 Fix no-checksum option type for local sync (fixes #67) 2015-01-21 09:16:08 +00:00
Ciaran Gultnieks
75aa384e80 Correction to no-checksum 2015-01-11 17:46:42 +00:00
Ciaran Gultnieks
e8d7e69630 Add option to not use rsync --checksum 2015-01-11 15:35:04 +00:00
Hans-Christoph Steiner
7a07f59731 server: always use same rsync destination path to allow for strict setups
for more info on how:
http://positon.org/rsync-command-restriction-over-ssh
http://ramblings.narrabilis.com/using-rsync-with-ssh
2014-11-11 15:06:53 +01:00
Hans-Christoph Steiner
8e9e17892d server: upload "current version" symlinks if requested
If `fdroid update` generates the "current version" symlinks, then
`fdroid server update` should upload them to the server.
2014-11-11 15:06:53 +01:00
Hans-Christoph Steiner
e8e94e1020 add debug message to mark when syncing to Amazon S3 starts 2014-10-23 14:26:11 -04:00
Hans-Christoph Steiner
d2b5b86ed5 fix rsync's chmod on local copy
rsync's --chmod works a bit oddly, it only affects the source files. To
make it set the destintation with the perms set in --chmod, the --perms
flag must also be included.
2014-10-23 14:26:11 -04:00
Hans-Christoph Steiner
8c8fb8b156 support lists/tuples in 'serverwebroot' config item
This allows the user to specify multiple servers to put the repo to, and
`fdroid server update` will automatically push to them all.

fixes #22 https://gitlab.com/fdroid/fdroidserver/issues/22
2014-07-14 15:04:30 -04:00
Hans-Christoph Steiner
35ee4b1bc5 update local_copy_dir rsync to handle FAT and filesystems with perms
With FAT filesystems, the user, group, and permissions will not be at all
preserved.  With file systems like ext4 that have perms, the umask might
not be set to something that makes sense for the public repo files, which
are meant to be published and therefore readible by all.

If need be, it would be easy enough to add a config option for rsync's
chmod string, to address setups that have specific permissions needs.

fixes #23 https://gitlab.com/fdroid/fdroidserver/issues/23
2014-07-14 15:02:20 -04:00
Hans-Christoph Steiner
c7962e7c6d server init: replace ssh subprocess with paramiko
It is easier to handle programming with python rather than subprocess calls
so I replaced the subprocess call to 'ssh' with paramiko.  This also makes
fdroid more portable since it no longer relies on the local system having
ssh installed.
2014-07-14 15:01:57 -04:00
Hans-Christoph Steiner
9dd138b253 fix bad syncing from local copy, force trailing slash to make rsync happy
It seems that paths for rsync must have a trailing slash in order to sync
rather than make a subdir, i.e. this makes a duplicate subdir:

  rsync /tmp/fdroid/repo repo

While this syncs the dirs

  rsync /tmp/fdroid/repo/ repo/
2014-06-30 23:01:47 -04:00
Hans-Christoph Steiner
0466d4aa4f server update: mkdir 'archive' if it does not exist
If `fdroid server update` is run with config that includes an archive, but
the 'archive' subdir does not exist, create it.  This mirrors the code that
is in `fdroid update`.  Seems to trivial to move to common.py.
2014-06-26 20:47:36 -04:00
Hans-Christoph Steiner
25f6b0c246 server: --sync-from-local-copy-dir for updating from offline signing repo
To support a fully offline build/signing machine, there is the "local copy
dir".  The repo is generated on the offline machine and then copied to a
local dir where a thumb drive or SD Card is mounted.  Then on the online
machine, using `fdroid server update --sync-from-local-copy-dir` allows
the whole server update process to happen in a single command:

0. read config.py on online machine's repo
1. rsync from the local_copy_dir to the current dir
2. copy to serverwebroot, awsbucket, etc.
2014-06-26 20:47:36 -04:00
Hans-Christoph Steiner
fd24416f4e switch serverwebroot rsync to --archive for guaranteed full sync
In `fdroid server update`, the rsync command used --update, which
`man rsync` says: "skip files that are newer on the receiver".  That could
cause issues of the public repo getting out of sync with the private,
master repo.  --archive is a better sync method since it aims to exactly
reproduce the sending dir to the receiving dir.
2014-06-26 20:47:36 -04:00
Hans-Christoph Steiner
d73b43c5fc server: 'local_copy_dir' config/options to automate offline repo signing
This allows a dir to be specified in config.py that `fdroid server update`
will automatically rsync the repo to.  The idea is that the path would
point to an SD card on a fully offline machine that serves as the secure
repo signing machine.
2014-06-26 20:47:36 -04:00
Daniel Martí
14f865a5b1 Don't use logging.info with verbose ifs 2014-06-22 21:28:33 +02:00
Hans-Christoph Steiner
e68413a752 server: specify an identity file for SSH when rsyncing
This allows the SSH key used to sync with the server to be specified via
the config.py or the command line.  I need it for running automated tests
and setups.
2014-06-05 16:21:12 -04:00
Hans-Christoph Steiner
0adb2575fe update: add stricter checking when updating repo index using rsync
rsync uses the modification time and size of the file when deciding whether
to update a file.  These are relatively easy to control in malicious code,
so instead make rsync use a full MD5 checksum when decided whether the
index needs to be updated.  I suppose we could add an option to use
checksum checking on all files, but since the signed repo already provides
a checksum check, it seems not worth the added load on the process.

Also, renamed 'index' to 'indexxml' to make it clear what is the XML and
what is the JAR.
2014-06-05 15:50:21 -04:00
Daniel Martí
17a4f5c00f A few more PEP8 fixes 2014-05-07 16:17:46 +02: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
fcca0ddb1f fix PEP8 "E712 comparison to True should be 'if cond is True:' or 'if cond:'" 2014-05-06 11:45:03 -04:00
Hans-Christoph Steiner
62204d1fe5 fix PEP8 "E202 whitespace before ']' or '}'" 2014-05-06 11:45:02 -04:00
Hans-Christoph Steiner
4af2e0004f fix PEP8 "E201 whitespace after '(' or '[' or '{'" 2014-05-06 11:45:02 -04:00
Hans-Christoph Steiner
a66bf2037c server: fix logging of file upload to awsbucket
Thanks to Adam Pritchard for reporting this
2014-04-23 20:10:02 -04:00
Hans-Christoph Steiner
21769e9f0a server: test using config.get() in case dict value is None
If a key 'foo' is set to None, `if config.get('foo'):` will be false while
`if 'foo' in config:` will be true.  A None value is not useful here, so
config.get() is the better check.

Thanks to Adam Pritchard for the suggestion.
2014-04-23 20:10:02 -04:00
Hans-Christoph Steiner
7248432d2d make awsbucket upload only new or changed files, ignore existing
Since it is possible to check the file size and MD5 hash of the file up on
the AWS S3 bucket, `fdroid server update` can check that a file needs to be
updated before actually deleting and uploading the new file.

fixes #3137 https://dev.guardianproject.info/issues/3137
2014-04-22 23:13:38 -04:00
Hans-Christoph Steiner
98033f3270 if the AWS S3 bucket does not exist, create it
This makes the AWS S3 setup dead simple: just put in a awsbucket name of
your choosing, set the AWS credentials, and it'll do the rest, whether the
bucket exists already or not.  S3 buckets are trivial to delete too, in
case of error: `s3cmd rb s3://mybadbucketname`.
2014-04-22 23:13:38 -04:00
Hans-Christoph Steiner
f0def08add support cloud storage with libcloud, starting with Amazon AWS S3
apache-libcloud enables uploading to basically any cloud storage service.
This is the first implementation that allows `fdroid server` to push a repo
up to a AWS S3 'bucket'.  Supporting other cloud storage services should
mostly be a matter of finding the libcloud "Provider" and setting the
access creditials.

fixes #3137 https://dev.guardianproject.info/issues/3137
2014-04-22 23:13:37 -04:00
Hans-Christoph Steiner
d1cd817759 implement -q and -v for fdroid server
The --quiet and --verbose options that are standard with the fdroid tools
were not implemented yet with the `server` command.
2014-04-22 22:59:27 -04:00
Hans-Christoph Steiner
5ce3b61a2a reorg fdroid server to allow for multiple server types
Right now, ssh+rsync is the only supported server upload type.  Things like
cloud storage services are useful storage bins for fdroid repos since they
are often not blocked while specific websites like Google Play are.
2014-04-22 22:59:27 -04:00
Hans-Christoph Steiner
6b65257516 make fdroid server check whether serverwebroot is set
Having serverwebroot optional in `fdroid server` means that it can support
multiple methods of hosting, like cloud storage services.  `fdroid server`
can also then support multiple repo hosting options at the same time.
2014-04-22 22:59:27 -04:00
Ciaran Gultnieks
37dda9414c Add --quiet option, restricting output to warnings/errors 2014-02-22 09:46:24 +00:00
Daniel Martí
1e3c2eee25 More logging switching 2014-01-27 21:49:29 +01:00
Hans-Christoph Steiner
71020a9e6d update sample and add error to reflect the default basedir: .*/fdroid/repo
For user-generated repos, the default path/URL is .*/fdroid/repo, with
fdroid/ as the root where the 'fdroid' tool operates.  This makes for a URL
that is quite unique and easily matched automatically using patterns, like
in fdroidclient.

For those who don't like the standard, they can override the errror from
config.py using nonstandardwebroot = True
2013-12-04 15:28:41 -05:00