mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-13 18:50:29 +03:00
Merge branch 'buildbot-subcommands-fetch_repo-fetch_srclibs' into 'master'
subcommands: fetch_repo and fetch_srclibs See merge request fdroid/fdroidserver!1716
This commit is contained in:
commit
40f411d417
5 changed files with 135 additions and 0 deletions
|
|
@ -69,6 +69,8 @@ COMMANDS_INTERNAL = [
|
||||||
"destroy",
|
"destroy",
|
||||||
"exec",
|
"exec",
|
||||||
"execute_sudo",
|
"execute_sudo",
|
||||||
|
"fetch_repo",
|
||||||
|
"fetch_srclibs",
|
||||||
"install_ndk",
|
"install_ndk",
|
||||||
"make_source_tarball",
|
"make_source_tarball",
|
||||||
"prepare_source",
|
"prepare_source",
|
||||||
|
|
|
||||||
61
fdroidserver/fetch_repo.py
Normal file
61
fdroidserver/fetch_repo.py
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# fetch_repo.py - part of the F-Droid server tools
|
||||||
|
# Copyright (C) 2024-2025, Michael Pöhn <michael@poehn.at>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Subcommand for fetching Repo: to set up source code to build."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
from fdroidserver import common, metadata
|
||||||
|
|
||||||
|
|
||||||
|
def fetch_repo_wrapper(app, build):
|
||||||
|
vcs, _ignored = common.setup_vcs(app)
|
||||||
|
vcs.gotorevision(build.commit, refresh=True)
|
||||||
|
if build.submodules: # TODO move to separate subcommand: fetch_submodules
|
||||||
|
vcs.initsubmodules()
|
||||||
|
else:
|
||||||
|
vcs.deinitsubmodules()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
common.setup_global_opts(parser)
|
||||||
|
parser.add_argument(
|
||||||
|
"APPID:VERCODE",
|
||||||
|
help="Application ID with Version Code in the form APPID:VERCODE",
|
||||||
|
)
|
||||||
|
options = common.parse_args(parser)
|
||||||
|
common.set_console_logging(options.verbose)
|
||||||
|
|
||||||
|
try:
|
||||||
|
appid, vercode = common.split_pkg_arg(options.__dict__['APPID:VERCODE'])
|
||||||
|
app, build = metadata.get_single_build(appid, vercode)
|
||||||
|
fetch_repo_wrapper(app, build)
|
||||||
|
except Exception as e:
|
||||||
|
if options.verbose:
|
||||||
|
logging.error(traceback.format_exc())
|
||||||
|
else:
|
||||||
|
logging.error(e)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
61
fdroidserver/fetch_srclibs.py
Normal file
61
fdroidserver/fetch_srclibs.py
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# fetch_srclibs.py - part of the F-Droid server tools
|
||||||
|
# Copyright (C) 2024-2025, Michael Pöhn <michael@poehn.at>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Subcommand for setting up source code from srclibs:."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
from fdroidserver import common, metadata
|
||||||
|
|
||||||
|
|
||||||
|
def fetch_srclibs_wrapper(build):
|
||||||
|
srclib_dir = os.path.join('build', 'srclib')
|
||||||
|
os.makedirs(srclib_dir, exist_ok=True)
|
||||||
|
|
||||||
|
for lib in build.srclibs:
|
||||||
|
common.getsrclib(lib, srclib_dir, prepare=False, build=build)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
common.setup_global_opts(parser)
|
||||||
|
parser.add_argument(
|
||||||
|
"APPID:VERCODE",
|
||||||
|
help="Application ID with Version Code in the form APPID:VERCODE",
|
||||||
|
)
|
||||||
|
options = common.parse_args(parser)
|
||||||
|
common.set_console_logging(options.verbose)
|
||||||
|
|
||||||
|
try:
|
||||||
|
appid, vercode = common.split_pkg_arg(options.__dict__['APPID:VERCODE'])
|
||||||
|
_ignored, build = metadata.get_single_build(appid, vercode)
|
||||||
|
fetch_srclibs_wrapper(build)
|
||||||
|
except Exception as e:
|
||||||
|
if options.verbose:
|
||||||
|
logging.error(traceback.format_exc())
|
||||||
|
else:
|
||||||
|
logging.error(e)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
@ -191,6 +191,15 @@ def full_push_sequence(appid, vercode, virt_container_type):
|
||||||
vercode,
|
vercode,
|
||||||
virt_container_type,
|
virt_container_type,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# fix owner after pushing files
|
||||||
|
common.inside_exec(
|
||||||
|
appid,
|
||||||
|
vercode,
|
||||||
|
['chown', '-R', 'vagrant:vagrant', '/home/vagrant'],
|
||||||
|
virt_container_type,
|
||||||
|
as_root=True,
|
||||||
|
)
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class Push_main(PushTest):
|
||||||
@mock.patch('sys.argv', ['fdroid push', APPID_VERCODE])
|
@mock.patch('sys.argv', ['fdroid push', APPID_VERCODE])
|
||||||
@mock.patch('fdroidserver.push.create_build_dirs')
|
@mock.patch('fdroidserver.push.create_build_dirs')
|
||||||
@mock.patch('fdroidserver.push.podman_push')
|
@mock.patch('fdroidserver.push.podman_push')
|
||||||
|
@mock.patch('fdroidserver.common.inside_exec', mock.Mock())
|
||||||
def test_podman(self, podman_push, create_build_dirs):
|
def test_podman(self, podman_push, create_build_dirs):
|
||||||
common.config['virt_container_type'] = 'podman'
|
common.config['virt_container_type'] = 'podman'
|
||||||
push.main()
|
push.main()
|
||||||
|
|
@ -44,6 +45,7 @@ class Push_main(PushTest):
|
||||||
@mock.patch('sys.argv', ['fdroid push', APPID_VERCODE])
|
@mock.patch('sys.argv', ['fdroid push', APPID_VERCODE])
|
||||||
@mock.patch('fdroidserver.push.create_build_dirs')
|
@mock.patch('fdroidserver.push.create_build_dirs')
|
||||||
@mock.patch('fdroidserver.push.vagrant_push')
|
@mock.patch('fdroidserver.push.vagrant_push')
|
||||||
|
@mock.patch('fdroidserver.common.inside_exec', mock.Mock())
|
||||||
def test_vagrant(self, vagrant_push, create_build_dirs):
|
def test_vagrant(self, vagrant_push, create_build_dirs):
|
||||||
common.config['virt_container_type'] = 'vagrant'
|
common.config['virt_container_type'] = 'vagrant'
|
||||||
push.main()
|
push.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue