Commit graph

35 commits

Author SHA1 Message Date
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
Hans-Christoph Steiner
c21ab7dbdf add new fdroid server init command for setting up the dir on the server
This is quite simple, but makes the user experience consistent when setting
up repos: run init then update locally, then run init then update on the
server.

This patch also includes PEP8 formatting fixes
2013-12-04 15:27:13 -05:00
Daniel Martí
7c5be575c6 Fix server.py NoneType error 2013-11-04 15:16:30 +01:00
Daniel Martí
c3be06fb1d Start rewriting options and config as common.py globals 2013-11-01 13:55:38 +01:00
Ciaran Gultnieks
08287a1fa8 Handle repo config in a more sensible way 2013-10-31 15:37:39 +00:00
Daniel Martí
2c804ef88a Switch all shebangs to 'env python2' 2013-10-31 13:27:24 +01:00
Ciaran Gultnieks
48296df5b0 Create archive repo (configurable option) 2013-05-09 20:09:17 +01:00
Ciaran Gultnieks
fdc04fe64e Push index to server last 2013-04-04 18:43:35 +01:00
Ciaran Gultnieks
3680beca30 Moved the upload scripts to a proper command 2012-03-11 13:17:37 +00:00