By not setting sdk_path when /usr/bin/aapt is found, sdk_path then defaults
to $ANDROID_HOME when its used. Since in this case, aapt will be used from
the system path, using aapt entirely ignores sdk_path. If the user runs
`fdroid build` in this setup, sdk_path will be $ANDROID_HOME, so it should
check the env vars for it, but maybe that doesn't actually work like that
yet.
This is a more flexible approach than testing for the complete SDK and
build-tools up front. This will only test for the commands that are
actually being run, so that if you only have `aapt` installed, you can do
`fdroid update` without errors, but other commands will still give
appropriate errors.
This also makes the build_tools item in config.py optional, it is only
needed if you want to force a specific version of the build-tools.
* Default paths are not expanded
* When writing to config.py in "fdroid init", don't write expanded paths
either
* Support changes in e.g. $ANDROID_HOME after a config.py is generated thanks
to the fix above
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.
* 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
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.
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.
`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.
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.
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.
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.
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.
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.
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.
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
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.
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.