mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-11 15:13:27 +02:00
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
This commit is contained in:
parent
b53dd5708a
commit
c21ab7dbdf
@ -26,6 +26,7 @@ import common
|
|||||||
config = None
|
config = None
|
||||||
options = None
|
options = None
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
global config, options
|
global config, options
|
||||||
@ -42,30 +43,38 @@ def main():
|
|||||||
print "Specify a single command"
|
print "Specify a single command"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args[0] != 'update':
|
if args[0] != 'init' and args[0] != 'update':
|
||||||
print "The only command currently supported is 'update'"
|
print "The only commands currently supported are 'init' and 'update'"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
host, fdroiddir = config['serverwebroot'].split(':')
|
||||||
|
|
||||||
repodirs = ['repo']
|
repodirs = ['repo']
|
||||||
if config['archive_older'] != 0:
|
if config['archive_older'] != 0:
|
||||||
repodirs.append('archive')
|
repodirs.append('archive')
|
||||||
|
|
||||||
for repodir in repodirs:
|
for repodir in repodirs:
|
||||||
index = os.path.join(repodir, 'index.xml')
|
if args[0] == 'init':
|
||||||
indexjar = os.path.join(repodir, 'index.jar')
|
if subprocess.call(['ssh', '-v', host,
|
||||||
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
'mkdir -p', fdroiddir + '/' + repodir]) != 0:
|
||||||
'--exclude', index, '--exclude', indexjar, repodir, config['serverwebroot']]) != 0:
|
sys.exit(1)
|
||||||
sys.exit(1)
|
elif args[0] == 'update':
|
||||||
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
index = os.path.join(repodir, 'index.xml')
|
||||||
index, config['serverwebroot'] + '/' + repodir]) != 0:
|
indexjar = os.path.join(repodir, 'index.jar')
|
||||||
sys.exit(1)
|
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
||||||
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
'--exclude', index, '--exclude', indexjar,
|
||||||
indexjar, config['serverwebroot'] + '/' + repodir]) != 0:
|
repodir, config['serverwebroot']]) != 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
||||||
|
index,
|
||||||
|
config['serverwebroot'] + '/' + repodir]) != 0:
|
||||||
|
sys.exit(1)
|
||||||
|
if subprocess.call(['rsync', '-u', '-v', '-r', '--delete',
|
||||||
|
indexjar,
|
||||||
|
config['serverwebroot'] + '/' + repodir]) != 0:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user