chiark / gitweb /
update sample and add error to reflect the default basedir: .*/fdroid/repo
authorHans-Christoph Steiner <hans@eds.org>
Wed, 4 Dec 2013 20:28:41 +0000 (15:28 -0500)
committerHans-Christoph Steiner <hans@eds.org>
Wed, 4 Dec 2013 20:28:41 +0000 (15:28 -0500)
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

config.sample.py
fdroidserver/init.py
fdroidserver/server.py

index 712167b3b0dffc9fcbdfc11d9371746c867e3585..47e66bad6d153870644b0d8d3e4d3566cf263460 100644 (file)
@@ -87,9 +87,15 @@ keyaliases['com.example.app'] = 'example'
 #the @ prefix.
 keyaliases['com.example.another.plugin'] = '@com.example.another'
 
-#The ssh path to the server's public web root directory. This is used for
-#uploading data, etc.
-serverwebroot = 'user@example:/var/www/repo'
+# The full path to the root of the repository.  It must be specified in
+# rsync/ssh format for a remote host/path. This is used for syncing a locally
+# generated repo to the server that is it hosted on.  It must end in the
+# standard public repo name of "/fdroid", but can be in up to three levels of
+# sub-directories (i.e. /var/www/packagerepos/fdroid).
+serverwebroot = 'user@example:/var/www/fdroid'
+
+# If you want to force 'fdroid server' to use a non-standard serverwebroot
+#nonstandardwebroot = True
 
 #Wiki details
 wiki_protocol = "http"
index 091255517670bcf8678af6bb07360d60cba0c031..26bc897d15e63637cd8eabbbe545a44e0ab3a1ee 100644 (file)
@@ -102,12 +102,12 @@ def main():
         prefix = tmp
         examplesdir = prefix
 
-    repodir = os.getcwd()
+    fdroiddir = os.getcwd()
 
     if not os.path.exists('config.py') and not os.path.exists('repo'):
         # 'metadata' and 'tmp' are created in fdroid
         os.mkdir('repo')
-        shutil.copy(os.path.join(examplesdir, 'fdroid-icon.png'), repodir)
+        shutil.copy(os.path.join(examplesdir, 'fdroid-icon.png'), fdroiddir)
         shutil.copyfile(os.path.join(examplesdir, 'config.sample.py'), 'config.py')
         os.chmod('config.py', 0o0600)
     else:
@@ -206,13 +206,14 @@ def main():
             write_to_config('keydname', keydname)
         genkey(keystore, repo_keyalias, password, keydname)
 
-    print('Built repo in "' + repodir + '" with this config:')
+    print('Built repo based in "' + fdroiddir + '"')
+    print('with this config:')
     print('  Android SDK:\t\t\t' + sdk_path)
     print('  Android SDK Build Tools:\t' + os.path.dirname(aapt))
     print('  Android NDK (optional):\t' + ndk_path)
     print('  Keystore for signing key:\t' + keystore)
     print('\nTo complete the setup, add your APKs to "' +
-          os.path.join(repodir, 'repo') + '"' +
+          os.path.join(fdroiddir, 'repo') + '"' +
 '''
 then run "fdroid update -c; fdroid update".  You might also want to edit
 "config.py" to set the URL, repo name, and more.  You should also set up
index 3ed2a59eb2b15c503b5434ea11c5849f8275b0d5..43ea05fd4e7117288773778d53a7a7415a07ddc8 100644 (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: