mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
import: ignore results if build/appid dir already exists
This commit is contained in:
parent
32a29b3304
commit
202602937d
1 changed files with 15 additions and 9 deletions
|
|
@ -24,6 +24,7 @@ import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import yaml
|
import yaml
|
||||||
|
|
@ -231,7 +232,7 @@ def main():
|
||||||
apps = metadata.read_metadata()
|
apps = metadata.read_metadata()
|
||||||
app = None
|
app = None
|
||||||
|
|
||||||
build_dir = None
|
tmp_importer_dir = None
|
||||||
|
|
||||||
local_metadata_files = common.get_local_metadata_files()
|
local_metadata_files = common.get_local_metadata_files()
|
||||||
if local_metadata_files != []:
|
if local_metadata_files != []:
|
||||||
|
|
@ -257,7 +258,7 @@ def main():
|
||||||
write_local_file = True
|
write_local_file = True
|
||||||
elif options.url:
|
elif options.url:
|
||||||
app = get_app_from_url(options.url)
|
app = get_app_from_url(options.url)
|
||||||
build_dir = clone_to_tmp_dir(app)
|
tmp_importer_dir = clone_to_tmp_dir(app)
|
||||||
git_repo = git.repo.Repo(tmp_importer_dir)
|
git_repo = git.repo.Repo(tmp_importer_dir)
|
||||||
build.disable = 'Generated by import.py - check/set version fields and commit id'
|
build.disable = 'Generated by import.py - check/set version fields and commit id'
|
||||||
write_local_file = False
|
write_local_file = False
|
||||||
|
|
@ -270,8 +271,8 @@ def main():
|
||||||
build.commit = binascii.hexlify(bytearray(git_repo.head.commit.binsha)).decode()
|
build.commit = binascii.hexlify(bytearray(git_repo.head.commit.binsha)).decode()
|
||||||
|
|
||||||
# Extract some information...
|
# Extract some information...
|
||||||
paths = get_all_gradle_and_manifests(build_dir)
|
paths = get_all_gradle_and_manifests(tmp_importer_dir)
|
||||||
subdir = get_gradle_subdir(build_dir, paths)
|
subdir = get_gradle_subdir(tmp_importer_dir, paths)
|
||||||
if paths:
|
if paths:
|
||||||
versionName, versionCode, package = common.parse_androidmanifests(paths, app)
|
versionName, versionCode, package = common.parse_androidmanifests(paths, app)
|
||||||
if not package:
|
if not package:
|
||||||
|
|
@ -305,8 +306,8 @@ def main():
|
||||||
or os.path.exists(os.path.join(subdir, 'build.gradle')):
|
or os.path.exists(os.path.join(subdir, 'build.gradle')):
|
||||||
build.gradle = ['yes']
|
build.gradle = ['yes']
|
||||||
|
|
||||||
package_json = os.path.join(build_dir, 'package.json') # react-native
|
package_json = os.path.join(tmp_importer_dir, 'package.json') # react-native
|
||||||
pubspec_yaml = os.path.join(build_dir, 'pubspec.yaml') # flutter
|
pubspec_yaml = os.path.join(tmp_importer_dir, 'pubspec.yaml') # flutter
|
||||||
if os.path.exists(package_json):
|
if os.path.exists(package_json):
|
||||||
build.sudo = ['apt-get install npm', 'npm install -g react-native-cli']
|
build.sudo = ['apt-get install npm', 'npm install -g react-native-cli']
|
||||||
build.init = ['npm install']
|
build.init = ['npm install']
|
||||||
|
|
@ -316,7 +317,7 @@ def main():
|
||||||
app.License = data.get('license', app.License)
|
app.License = data.get('license', app.License)
|
||||||
app.Description = data.get('description', app.Description)
|
app.Description = data.get('description', app.Description)
|
||||||
app.WebSite = data.get('homepage', app.WebSite)
|
app.WebSite = data.get('homepage', app.WebSite)
|
||||||
app_json = os.path.join(build_dir, 'app.json')
|
app_json = os.path.join(tmp_importer_dir, 'app.json')
|
||||||
if os.path.exists(app_json):
|
if os.path.exists(app_json):
|
||||||
with open(app_json) as fp:
|
with open(app_json) as fp:
|
||||||
data = json.load(fp)
|
data = json.load(fp)
|
||||||
|
|
@ -345,8 +346,13 @@ def main():
|
||||||
# Keep the repo directory to save bandwidth...
|
# Keep the repo directory to save bandwidth...
|
||||||
if not os.path.exists('build'):
|
if not os.path.exists('build'):
|
||||||
os.mkdir('build')
|
os.mkdir('build')
|
||||||
if build_dir is not None:
|
build_dir = os.path.join('build', package)
|
||||||
shutil.move(build_dir, os.path.join('build', package))
|
if os.path.exists(build_dir):
|
||||||
|
logging.warning(_('{path} already exists, ignoring import results!')
|
||||||
|
.format(path=build_dir))
|
||||||
|
sys.exit(1)
|
||||||
|
elif tmp_importer_dir is not None:
|
||||||
|
shutil.move(tmp_importer_dir, build_dir)
|
||||||
with open('build/.fdroidvcs-' + package, 'w') as f:
|
with open('build/.fdroidvcs-' + package, 'w') as f:
|
||||||
f.write(app.RepoType + ' ' + app.Repo)
|
f.write(app.RepoType + ' ' + app.Repo)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue