Commit graph

92 commits

Author SHA1 Message Date
Hans-Christoph Steiner
bc8ad37249 init: make prompt for SDK path exit cleanly on Ctrl-C
This just makes a clean exit rather than showing a python stacktrace.
2014-06-04 21:54:55 -04:00
Hans-Christoph Steiner
6ca060e10d add more SDK checks: build-tools/19.0.3 and presense of aapt
Make sure that fdroid can find aapt in the current config, otherwise exit
with an error.  Some users don't have build_tools set, and their SDK does
not include the build-tools in the default versioned dir, so this should
warn them of what is wrong.
2014-06-04 21:54:55 -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
6abb390547 fix PEP8 "E261 at least two spaces before inline comment" 2014-05-06 11:45:04 -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
fccb990521 fix PEP8 "E711 comparison to None should be 'if cond is None:'" 2014-05-06 11:45:02 -04:00
Hans-Christoph Steiner
ef7c9d89d2 init: --no-prompt to skip sdk_path prompt
For running the tests and in other scripted setups, the user prompt is an
annoying. Using --no-prompt means the script can test for failure.
2014-04-23 20:10:02 -04:00
Hans-Christoph Steiner
66df02d5f8 init: --android-home for forcing the path to the Android SDK
This allows the user to set the path to their Android SDK from the command
line. This option is named after the standard env var ANDROID_HOME, as used
in the build.xml generated by `android update project`.  --android-home
takes precendence over the ANDROID_HOME env var if it is set.
2014-04-23 19:33:10 -04:00
Hans-Christoph Steiner
cc089b49b1 init: only overwrites config.py, so run even if repo/ exists
Previously, `fdroid init` would exit if a repo/ subdir existed.  Since it
only changes config.py, that test just caused confusion. Now, only exit if
config.py exists, and if repo/ does not exist, create it.
2014-04-23 19:33:01 -04:00
Hans-Christoph Steiner
186aec46ba init: split out defconfig and sdk test to run before config is loaded
`fdroid init` runs before any config.py exists, but it still needs to have
the default config and the SDK path tests.  So split those two bits out of
common.read_config() so that they can be run separately before config.py
is in place.
2014-04-23 19:32:04 -04:00
Hans-Christoph Steiner
0dd8116059 add note about automatically generated signing key after init 2014-04-07 16:00:18 -04:00
Hans-Christoph Steiner
00b89c05c5 warn user if smartcard keystore is set but opensc is not installed 2014-04-07 16:00:18 -04:00
Hans-Christoph Steiner
3829d37d34 support repo signing with a key on a smartcard
This assumes that the smartcard is already setup with a signing key.  init
does not generate a key on the smartcard, and skips genkey() if things are
configured to use a smartcard.

This also does not touch APK signing because that is a much more elaborate
question, since each app is signed by its own key.
2014-04-07 16:00:18 -04:00
Hans-Christoph Steiner
9945045f1b fix bug setting repo_keyalias in init 2014-04-07 16:00:18 -04:00
Hans-Christoph Steiner
f582cd7a9e fix bug listing new key created in init
Oops, a typo with a ] in e53092cffa
2014-04-07 16:00:18 -04:00
Hans-Christoph Steiner
b41f9e67a9 if keystore is given as arg to init, create keystore if it does not exist
Previously, `fdroid init --keystore /tmp/foo` expected the keystore to
exist, or it quit with an error.  But I've changed my mind, I think it is
useful to have it generate a new keystore at that location if it does not
exist.  For example, in tests/run-tests.sh. It still will not clobber an
existing file at that location.
2014-04-07 16:00:18 -04:00
Hans-Christoph Steiner
f1ae3d3fd0 use default keystore path when generating a new setup with init
Before, the path to the keystore was also hardcoded in init.py, this makes
init now get it from the defaults set in common.py.
2014-04-07 16:00:17 -04:00
Hans-Christoph Steiner
0736367675 when generating config.py during init, uncomment changed options
The defaults are set in config.py and are often commented out.  Before, the
regex would only change the value, but leave it commented out.  Now, it
will also uncomment it.
2014-04-07 16:00:17 -04:00
Daniel Martí
8e87feff26 Fix output naming, remove redundant lstrip() 2014-04-02 01:05:33 +02:00
Hans-Christoph Steiner
e53092cffa fix genkey key listing in fdroid init
FDroidPopen() does not have a way to send to stdin, so we will use the
password file for now.  In the long run, at least the keypass should always
be sent via stdin rather than via a file.  Ideally, storepass would be too,
but if they are different, then storepass is less important.
2014-04-01 18:04:36 -04:00
Hans-Christoph Steiner
ed3bd25bb5 oops, include common. to call write_password_file() 2014-04-01 18:04:36 -04:00
Hans-Christoph Steiner
8ef6546f81 move fdroid-icon.png to examples/ 2014-04-01 18:04:36 -04:00
Hans-Christoph Steiner
d21bddc159 improved warning when trying to init a dir with stuff in it 2014-04-01 17:51:54 -04:00
Hans-Christoph Steiner
a31f4571c2 fix example files install in setup.py
This also makes the file layout in git basically the same as the installed
file layout, using an examples/ dir.  I'm not sure if config.buildserver.py
is an example conf file, or a conf file that is actually in use, so I did
not move it.
2014-03-31 21:29:51 -04:00
Hans-Christoph Steiner
525759b235 stop passing passphrases via args, instead use prepared files
Any process can read the process table, and can therefore see the entire
command line of any other process.  That means its a bad idea to ever put
passwords as part of a command line.  Python is executing keytool and
jarsigner command lines here, so now instead of putting the password on the
command line, a file is passed instead with suitable file permissions.
This should reduce the exposure a lot.  But still, sensitive passwords
should not be written to any text file.

This change requires OpenJDK-7 since the :file option to -storepass and
-keypass was only added in Java 7's keytool and jarsigner.
2014-03-31 21:02:42 -04:00
Ciaran Gultnieks
37dda9414c Add --quiet option, restricting output to warnings/errors 2014-02-22 09:46:24 +00:00
Daniel Martí
f6ffbb5997 Small config fixes 2014-02-17 20:01:55 +01:00
Daniel Martí
2f93ba9bd6 Merge branch 'master' into logging
Conflicts:
	fdroidserver/common.py
2014-01-28 14:14:59 +01:00
Daniel Martí
3687147997 Update my own copyright notices 2014-01-28 14:07:19 +01:00
Daniel Martí
dbb6db5bb5 Add logging to init.py, remove silly options.verbose code 2014-01-27 22:22:30 +01:00
Daniel Martí
62c3663df3 Lots more FDroidPopen replacements 2014-01-27 21:48:22 +01:00
Ciaran Gultnieks
874565fb73 Don't split stdout/stderr
For the most part, doing this just makes build output incomprehensible,
with errors appearing out of context.
2014-01-16 10:17:22 +00: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
5f06fba591 init set config.py perms to 0600, otherwise warn user if config.py is not
Since config.py contains passwords in it, it should be protected as much as
possible.  At the very least, the file permissions should be 0600 to
restrict access to user that actually edits and runs 'fdroid' commands.
2013-11-05 17:27:08 -05:00
Daniel Martí
2b0badd4c4 Fix init with common, don't require cwd in FDroidPopen 2013-11-05 09:26:56 +01:00
Hans-Christoph Steiner
633103b1b6 add options to 'fdroid init': --distinguished-name and --repo-keyalias
These allow the user to set these config.py options from the command line
when initing a new repo.
2013-11-05 09:26:56 +01:00
Hans-Christoph Steiner
3ea4e08135 in 'fdroid init' if no keystore exists or was given, then generate it 2013-11-05 09:26:55 +01:00
Daniel Martí
145b38252a Basic completion for init, add --verbose to it 2013-11-04 20:28:32 +01:00
Daniel Martí
de0986e77d Avoid init.py crash due to options being None 2013-11-04 20:21:24 +01:00
Daniel Martí
5cdca44b69 Use the new read_config in init.py 2013-11-04 20:03:45 +01:00
Daniel Martí
e2bcf4304d Don't override built-in 'dir' 2013-11-04 20:01:30 +01:00
Hans-Christoph Steiner
9344bca245 implement 'fdroid init' to set up a barebones repo from scratch
This tries to auto-detect the SDK and NDK.  If it can't find the SDK, it
prompts the user to type in the path.  It also tries to find the most
recent version of the build-tools, and should also support the old
unversioned layout.
2013-11-04 12:22:58 -05:00