1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 00:40:11 +01:00

import: do set root_dir if running from a repo

This commit is contained in:
Daniel Martí 2015-09-14 17:40:44 -07:00
parent eda0c965e9
commit 2c0be49124

View File

@ -137,10 +137,7 @@ def get_metadata_from_url(app, url):
shutil.rmtree(src_dir) shutil.rmtree(src_dir)
vcs = common.getvcs(repotype, repo, src_dir) vcs = common.getvcs(repotype, repo, src_dir)
vcs.gotorevision(options.rev) vcs.gotorevision(options.rev)
if options.subdir: root_dir = get_subdir(src_dir)
root_dir = os.path.join(src_dir, options.subdir)
else:
root_dir = src_dir
app['Repo Type'] = repotype app['Repo Type'] = repotype
app['Repo'] = repo app['Repo'] = repo
@ -152,6 +149,13 @@ config = None
options = None options = None
def get_subdir(src_dir):
if options.subdir:
return os.path.join(src_dir, options.subdir)
return src_dir
def main(): def main():
global config, options global config, options
@ -173,9 +177,13 @@ def main():
package, app = metadata.get_default_app_info_list(apps) package, app = metadata.get_default_app_info_list(apps)
app['Update Check Mode'] = "Tags" app['Update Check Mode'] = "Tags"
root_dir = None
src_dir = None
if os.path.isdir('.git'): if os.path.isdir('.git'):
if options.url: if options.url:
app['Web Site'] = options.url app['Web Site'] = options.url
root_dir = get_subdir(os.getcwd())
elif options.url: elif options.url:
root_dir, src_dir = get_metadata_from_url(app, options.url) root_dir, src_dir = get_metadata_from_url(app, options.url)
else: else: