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
This commit is contained in:
Hans-Christoph Steiner 2013-12-04 15:28:41 -05:00
parent c21ab7dbdf
commit 71020a9e6d
3 changed files with 27 additions and 8 deletions

View file

@ -47,7 +47,19 @@ def main():
print "The only commands currently supported are 'init' and 'update'"
sys.exit(1)
host, fdroiddir = config['serverwebroot'].split(':')
serverwebroot = config['serverwebroot'].rstrip('/').replace('//', '/')
host, fdroiddir = serverwebroot.split(':')
serverrepobase = os.path.basename(fdroiddir)
if 'nonstandardwebroot' in config and config['nonstandardwebroot'] == True:
standardwebroot = False
else:
standardwebroot = True
if serverrepobase != 'fdroid' and standardwebroot:
print('ERROR: serverwebroot does not end with "fdroid", '
+ 'perhaps you meant one of these:\n\t'
+ serverwebroot.rstrip('/') + '/fdroid\n\t'
+ serverwebroot.rstrip('/').rstrip(serverrepobase) + 'fdroid')
sys.exit(1)
repodirs = ['repo']
if config['archive_older'] != 0: