From ff24e235b9e9fbbde3978adbda374e132c407ca6 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 23 Dec 2023 16:02:39 +0100 Subject: [PATCH 1/3] Drop tito integration We have moved away from tito and everything runs with direct koji commands now. --- docs/source/actions.rst | 3 - obal/data/module_utils/tito_wrapper.py | 11 -- obal/data/modules/tito_build.py | 64 ------- obal/data/modules/tito_release.py | 59 ------ obal/data/playbooks/nightly/nightly.yaml | 2 - obal/data/playbooks/release/release.yaml | 4 +- obal/data/playbooks/setup/setup.yaml | 1 - .../roles/build_package/defaults/main.yaml | 5 - obal/data/roles/build_package/tasks/koji.yml | 14 +- .../build_package/tasks/tito_release.yml | 42 ----- obal/data/roles/build_srpm/defaults/main.yaml | 3 - obal/data/roles/setup_sources/tasks/git.yml | 5 - obal/tito_extensions/__init__.py | 0 .../tito_extensions/git_annex_spec_builder.py | 172 ------------------ tests/fixtures/mockbin/mockbin | 37 +--- tests/fixtures/mockbin/tito | 1 - .../testrepo/upstream/package_manifest.yaml | 4 +- .../upstream_with_epoch/package_manifest.yaml | 4 +- 18 files changed, 8 insertions(+), 423 deletions(-) delete mode 100644 obal/data/module_utils/tito_wrapper.py delete mode 100644 obal/data/modules/tito_build.py delete mode 100644 obal/data/modules/tito_release.py delete mode 100644 obal/data/roles/build_package/tasks/tito_release.yml delete mode 100644 obal/tito_extensions/__init__.py delete mode 100644 obal/tito_extensions/git_annex_spec_builder.py delete mode 120000 tests/fixtures/mockbin/tito diff --git a/docs/source/actions.rst b/docs/source/actions.rst index ffb382e0..41abe9f8 100644 --- a/docs/source/actions.rst +++ b/docs/source/actions.rst @@ -12,10 +12,7 @@ Options can be either set on the command line via `-e key=val` or in the `packag * `build_package_build_system`: which build system should be used, default: `koji`, supported: `koji`, `copr` * `build_package_koji_command`: when using `koji` build system, which command to use to call it, default: `koji`, supported: `koji`, `brew`, anything else -* `build_package_tito_args`: any args that should be passed to `tito`, default: `''` * `build_package_scratch`: when building a package, should a scratch build be done, default: `false` (unless you run `obal scratch`, of course) -* `build_package_test`: when building a package with `tito`, should `--test` be passed to it, default: `false` -* `build_package_tito_releaser_args`: any args that should be passed to `tito release`, default: `[]` * `build_package_wait`: wait for package to be built on the build system, default: `true` * `build_package_download_logs`: download build logs from the build system after the build has finished, default: `false` * `diff_package_type`: which build system to query for built packages, default: `koji`, supported: `koji`, `copr` diff --git a/obal/data/module_utils/tito_wrapper.py b/obal/data/module_utils/tito_wrapper.py deleted file mode 100644 index 51fdbc17..00000000 --- a/obal/data/module_utils/tito_wrapper.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -A tito wrapper -""" -from subprocess import STDOUT, check_output - - -def tito(command, directory): - """ - Run a tito command - """ - return check_output(command, stderr=STDOUT, universal_newlines=True, cwd=directory) diff --git a/obal/data/modules/tito_build.py b/obal/data/modules/tito_build.py deleted file mode 100644 index d34a15f1..00000000 --- a/obal/data/modules/tito_build.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python -""" -Release a package using tito -""" - -import re -from subprocess import CalledProcessError - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.tito_wrapper import tito # pylint:disable=import-error,no-name-in-module - - -def main(): - """ - Build a package using tito - """ - module = AnsibleModule( - argument_spec=dict( - directory=dict(type='path', required=True), - arguments=dict(type='list', required=False), - build_arguments=dict(type='list', required=False), - srpm=dict(type='bool', required=False, default=False), - offline=dict(type='bool', required=False, default=False), - dist=dict(type='str', required=False), - scl=dict(rtype='str', equired=False), - output=dict(type='path', required=False), - builder=dict(type='str', required=False), - ) - ) - - command = ['tito', 'build'] - - for param in ('srpm', 'offline'): - if module.params[param]: - command.append('--' + param) - - for param in ('dist', 'scl', 'output', 'builder'): - value = module.params[param] - if value: - command += ['--' + param, value] - - if module.params['build_arguments']: - for argument in module.params['build_arguments']: - command += ['--arg', argument] - - if module.params['arguments']: - command += module.params['arguments'] - - directory = module.params['directory'] - - try: - output = tito(command, directory) - except CalledProcessError as error: - module.fail_json(msg='Failed to tito build', command=error.cmd, output=error.output, - directory=directory, code=error.returncode) - - match = re.search(r'^Wrote: (?P.+)', output, re.MULTILINE) - path = match.group('path') if match else None - - module.exit_json(changed=True, path=path, output=output) - - -if __name__ == '__main__': - main() diff --git a/obal/data/modules/tito_release.py b/obal/data/modules/tito_release.py deleted file mode 100644 index 7a2c229f..00000000 --- a/obal/data/modules/tito_release.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/python -""" -Release a package using tito -""" - -import re -from subprocess import CalledProcessError - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.tito_wrapper import tito # pylint:disable=import-error,no-name-in-module - - -def main(): - """ - Release a package using tito - """ - module = AnsibleModule( - argument_spec=dict( - directory=dict(type='path', required=True), - arguments=dict(type='list', required=False), - scratch=dict(type='bool', required=False, default=False), - test=dict(type='bool', required=False, default=False), - releasers=dict(type='list', required=True), - releaser_arguments=dict(type='list', required=False), - ) - ) - - command = ['tito', 'release', '--yes'] - - for param in ('scratch', 'test'): - if module.params[param]: - command.append('--' + param) - - command += module.params['releasers'] - - if module.params['releaser_arguments']: - for argument in module.params['releaser_arguments']: - command += ['--arg', argument] - - if module.params['arguments']: - command += module.params['arguments'] - - directory = module.params['directory'] - - try: - output = tito(command, directory) - except CalledProcessError as error: - module.fail_json(msg='Failed to tito release', command=error.cmd, directory=directory, - output=error.output, code=error.returncode) - - tasks = re.findall(r'^Created task:\s(\d+)', output, re.MULTILINE) - task_urls = re.findall(r'^Task info:\s(.+)', output, re.MULTILINE) - builds = re.findall(r'^Created builds:\s(\d+)', output, re.MULTILINE) - - module.exit_json(changed=True, output=output, tasks=tasks, task_urls=task_urls, builds=builds) - - -if __name__ == '__main__': - main() diff --git a/obal/data/playbooks/nightly/nightly.yaml b/obal/data/playbooks/nightly/nightly.yaml index bbca923e..8c95b4bc 100644 --- a/obal/data/playbooks/nightly/nightly.yaml +++ b/obal/data/playbooks/nightly/nightly.yaml @@ -4,8 +4,6 @@ - packages serial: 1 gather_facts: false - vars: - build_package_tito_releaser_args: "{{ nightly_package_tito_releaser_args | default([]) }}" roles: - package_variables tasks: diff --git a/obal/data/playbooks/release/release.yaml b/obal/data/playbooks/release/release.yaml index 3f8f5c20..aeff4704 100644 --- a/obal/data/playbooks/release/release.yaml +++ b/obal/data/playbooks/release/release.yaml @@ -5,7 +5,5 @@ serial: 1 gather_facts: false roles: - - role: diff_package - when: not build_package_use_koji_build - role: build_package - when: (build_package_use_koji_build or diff_package_changed is not defined or diff_package_changed|bool) + when: (diff_package_changed is not defined or diff_package_changed|bool) diff --git a/obal/data/playbooks/setup/setup.yaml b/obal/data/playbooks/setup/setup.yaml index c653b795..7116adcf 100644 --- a/obal/data/playbooks/setup/setup.yaml +++ b/obal/data/playbooks/setup/setup.yaml @@ -12,7 +12,6 @@ - rpm-build - koji - "{{ 'git-annex' if ansible_distribution_major_version == '7' else 'git-annex-standalone' }}" - - tito - scl-utils - scl-utils-build - rpmlint diff --git a/obal/data/roles/build_package/defaults/main.yaml b/obal/data/roles/build_package/defaults/main.yaml index 9f811261..f3802b8b 100644 --- a/obal/data/roles/build_package/defaults/main.yaml +++ b/obal/data/roles/build_package/defaults/main.yaml @@ -1,17 +1,12 @@ --- build_package_build_system: koji build_package_koji_command: koji -build_package_tito_args: [] build_package_scratch: false -build_package_test: false -build_package_tito_releaser_args: [] build_package_wait: true build_package_download_logs: false build_package_download_rpms: false build_package_waitrepo: false build_package_koji_whitelist_check: false -build_package_tito_builder: -build_package_use_koji_build: false build_package_copr_rebuild: false build_package_skip_failed_build: false build_package_archive_build_info: false diff --git a/obal/data/roles/build_package/tasks/koji.yml b/obal/data/roles/build_package/tasks/koji.yml index 553af335..6197567e 100644 --- a/obal/data/roles/build_package/tasks/koji.yml +++ b/obal/data/roles/build_package/tasks/koji.yml @@ -1,11 +1,5 @@ --- -- name: 'Use tito to build package' - include_tasks: tito_release.yml - when: not build_package_use_koji_build - -- when: build_package_use_koji_build - block: - - include_tasks: koji_build.yml - loop: "{{ koji_tags }}" - loop_control: - loop_var: tag +- include_tasks: koji_build.yml + loop: "{{ koji_tags }}" + loop_control: + loop_var: tag diff --git a/obal/data/roles/build_package/tasks/tito_release.yml b/obal/data/roles/build_package/tasks/tito_release.yml deleted file mode 100644 index 96fb01d1..00000000 --- a/obal/data/roles/build_package/tasks/tito_release.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- name: "Confirm package is whitelisted" - package_whitelist_check: - releasers_conf: "{{ inventory_dir }}/rel-eng/releasers.conf" - spec_file_path: "{{ spec_file_path }}" - releasers: "{{ releasers }}" - build_command: "{{ build_package_koji_command }}" - when: build_package_koji_whitelist_check | bool - -- name: 'Set tito_releasers for brew scratch' - set_fact: - build_package_tito_releasers: "{{ releasers | map('replace', 'dist-git', 'scratch') | list }}" - when: build_package_koji_command == 'brew' and build_package_scratch - -- name: 'Set tito_releasers' - set_fact: - build_package_tito_releasers: "{{ releasers }}" - when: build_package_koji_command != 'brew' or not build_package_scratch - -- name: 'Release to {{ build_package_koji_command }}' - tito_release: - directory: "{{ inventory_dir }}/{{ package_base_dir }}/{{ inventory_hostname }}" - arguments: "{{ build_package_tito_args }}" - scratch: "{{ build_package_scratch and build_package_koji_command != 'brew' }}" - test: "{{ build_package_test }}" - releasers: "{{ build_package_tito_releasers }}" - releaser_arguments: "{{ build_package_tito_releaser_args }}" - register: build_package_tito_release - -- name: 'Created tasks' - debug: - var: build_package_tito_release.task_urls - -- name: 'Wait for tasks to finish' - include_tasks: wait.yml - when: build_package_wait|bool - vars: - koji_tasks: "{{ build_package_tito_release.tasks }}" - -- name: 'Download task results' - include_tasks: download_rpms.yml - when: build_package_download_rpms|bool diff --git a/obal/data/roles/build_srpm/defaults/main.yaml b/obal/data/roles/build_srpm/defaults/main.yaml index 111c34be..d94868f6 100644 --- a/obal/data/roles/build_srpm/defaults/main.yaml +++ b/obal/data/roles/build_srpm/defaults/main.yaml @@ -1,7 +1,4 @@ --- build_srpm_dist: build_srpm_scl: -build_srpm_tito_build_args: "{{ build_package_tito_releaser_args | default([]) }}" build_srpm_output_dir: "{{ inventory_dir }}/SRPMs" -build_srpm_tito_args: "{{ build_package_tito_args | default([]) }}" -build_srpm_tito_builder: "{{ build_package_tito_builder | default() }}" diff --git a/obal/data/roles/setup_sources/tasks/git.yml b/obal/data/roles/setup_sources/tasks/git.yml index c14b7e58..eb0db3e1 100644 --- a/obal/data/roles/setup_sources/tasks/git.yml +++ b/obal/data/roles/setup_sources/tasks/git.yml @@ -10,8 +10,3 @@ version: "{{ git_branch | default(omit) }}" force: true depth: 1 - -- name: 'Register source dir tito argument' - set_fact: - build_package_tito_releaser_args: - - 'source_dir={{ setup_sources_git_checkout_dir }}' diff --git a/obal/tito_extensions/__init__.py b/obal/tito_extensions/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/obal/tito_extensions/git_annex_spec_builder.py b/obal/tito_extensions/git_annex_spec_builder.py deleted file mode 100644 index 280d5319..00000000 --- a/obal/tito_extensions/git_annex_spec_builder.py +++ /dev/null @@ -1,172 +0,0 @@ -""" -A tito plugin to build using git-annex -""" - -# pylint: disable=E0401,R0902,R0903,R0913 - -import os -import shutil -from distutils.version import LooseVersion as loose_version # pylint: disable=E0611,deprecated-module -from pkg_resources import require - -from tito.compat import getstatusoutput -from tito.config_object import ConfigObject -from tito.builder import GitAnnexBuilder -from tito.builder.main import BuilderBase -from tito.common import error_out, debug, run_command, get_spec_version_and_release, \ - find_spec_like_file, get_relative_project_dir_cwd, warn_out, get_build_commit - - -class GitAnnexSpecBuilder(GitAnnexBuilder): - """ - A tito builder that uses git annex - """ - - def __init__(self, name=None, tag=None, build_dir=None, - config=None, user_config=None, - args=None, **kwargs): - - """ - name - Package name that is being built. - - version - Version and release being built. - - tag - The git tag being built. - - build_dir - Temporary build directory where we can safely work. - - config - Merged configuration. (global plus package specific) - - user_config - User configuration from ~/.titorc. - - args - Optional arguments specific to each builder. Can be passed - in explicitly by user on the CLI, or via a release target config - entry. Only for things which vary on invocations of the builder, - avoid using these if possible. *Given in the format of a dictionary - of lists.* - """ - ConfigObject.__init__(self, config=config) - BuilderBase.__init__(self, name=name, build_dir=build_dir, config=config, - user_config=user_config, args=args, **kwargs) - self.build_tag = tag - - self.build_version = self._get_build_version() - self.git_commit_id = get_build_commit(tag=self.build_tag, test=True) - - if kwargs and 'options' in kwargs: - warn_out("'options' no longer a supported builder constructor argument.") - - if self.config.has_option("requirements", "tito"): - if loose_version(self.config.get("requirements", "tito")) > \ - loose_version(require('tito')[0].version): - error_out([ - "tito version %s or later is needed to build this project." % - self.config.get("requirements", "tito"), - "Your version: %s" % require('tito')[0].version - ]) - - self.display_version = self._get_display_version() - - self.relative_project_dir = get_relative_project_dir_cwd(self.git_root) - - tgz_base = self._get_tgz_name_and_ver() - self.tgz_filename = tgz_base + ".tar.gz" - self.tgz_dir = tgz_base - self.artifacts = [] - - self.rpmbuild_gitcopy = os.path.join(self.rpmbuild_sourcedir, - self.tgz_dir) - - # Used to make sure we only modify the spec file for a test build - # once. The srpm method may be called multiple times during koji - # releases to create the proper disttags, but we only want to modify - # the spec file once. - self.ran_setup_test_specfile = False - - # NOTE: These are defined later when/if we actually dump a copy of the - # project source at the tag we're building. Only then can we search for - # a spec file. - self.spec_file_name = None - self.spec_file = None - - # Set to path to srpm once we build one. - self.srpm_location = None - - def _get_build_version(self): - """ - Figure out the git tag and version-release we're building. - """ - # Determine which package version we should build: - build_version = None - if self.build_tag: - build_version = self.build_tag[len(self.project_name + "-"):] - else: - build_version = get_spec_version_and_release(self.start_dir, - find_spec_like_file(self.start_dir)) - self.build_tag = self._get_tag_for_version(build_version) - - self.spec_version = build_version.split('-')[0] - self.spec_release = build_version.split('-')[-1] - return build_version - - def _setup_sources(self): - """ - Create a copy of the git source for the project at the point in time - our build tag was created. - - Created in the temporary rpmbuild SOURCES directory. - """ - self._create_build_dirs() - working_path = os.path.join(os.getcwd(), self.relative_project_dir) - - debug('SETUP SOURCES') - if self.relative_project_dir in os.path.join(os.getcwd(), ''): - working_path = os.getcwd() - debug("working_path: %s" % working_path) - - for directory, _, filenames in os.walk(working_path): - debug('WALK') - dir_artifacts_with_path = [os.path.join(directory, f) for f in filenames] - - debug(dir_artifacts_with_path) - for artifact in dir_artifacts_with_path: - debug(" Copying source file %s" % artifact) - if os.path.isfile(artifact): - if not os.path.exists("/".join([self.rpmbuild_gitcopy, os.path.basename(artifact)])): - shutil.copy(artifact, self.rpmbuild_gitcopy) - if not os.path.exists("/".join([self.rpmbuild_sourcedir, os.path.basename(artifact)])): - shutil.copy(artifact, self.rpmbuild_sourcedir) - - - # NOTE: The spec file we actually use is the one exported by git - # archive into the temp build directory. This is done so we can - # modify the version/release on the fly when building test rpms - # that use a git SHA1 for their version. - self.spec_file_name = os.path.basename(find_spec_like_file(self.rpmbuild_sourcedir)) - self.spec_file = os.path.join( - self.rpmbuild_sourcedir, self.spec_file_name) - - self.old_cwd = os.getcwd() # pylint: disable=W0201 - if self.relative_project_dir not in os.path.join(os.getcwd(), ''): - os.chdir(os.path.join(self.old_cwd, self.relative_project_dir)) - - # NOTE: 'which' may not be installed... (docker containers) - status = getstatusoutput("which git-annex")[0] - if status != 0: - msg = "Please run '%s' as root." % self.package_manager.install(["git-annex"]) - error_out('%s' % msg) - - run_command("git-annex lock") - annexed_files = run_command("git-annex find --include='*'").splitlines() - run_command("git-annex get") - run_command("git-annex unlock") - debug(" Annex files: %s" % annexed_files) - - for annex in annexed_files: - debug("Copying unlocked file %s" % annex) - if os.path.isfile(os.path.join(self.rpmbuild_gitcopy, annex)): - os.remove(os.path.join(self.rpmbuild_gitcopy, annex)) - shutil.copy(annex, self.rpmbuild_gitcopy) - - self._lock() - os.chdir(self.old_cwd) diff --git a/tests/fixtures/mockbin/mockbin b/tests/fixtures/mockbin/mockbin index 9697b005..9ccb47c1 100755 --- a/tests/fixtures/mockbin/mockbin +++ b/tests/fixtures/mockbin/mockbin @@ -43,42 +43,7 @@ if mockbin_log: with open(mockbin_log, 'r') as logfile: mockbin_log_contents = [line.strip() for line in logfile.readlines()] -if prog == 'tito': - parser = argparse.ArgumentParser() - subparsers = parser.add_subparsers() - - # tito release arguments and options - parser_release = subparsers.add_parser('release') - parser_release.add_argument('dest') - parser_release.add_argument('--scratch', action='store_true') - parser_release.add_argument('--test', action='store_true') - parser_release.add_argument('-y', '--yes', dest='yes', action='store_true', default=False) - parser_release.add_argument('--arg') - - # tito build arguments and options - parser_build = subparsers.add_parser('build') - parser_build.add_argument('--srpm', action='store_true', default=False) - parser_build.add_argument('--output', default=None) - parser_build.add_argument('--scl') - parser_build.add_argument('--offline', action='store_true') - - args = parser.parse_args() - - pkg = os.path.basename(os.getcwd()) - - if 'yes' in args and args.yes: - print('Created task: 1234') - if 'output' in args and args.output: - if not os.path.exists(args.output): - os.makedirs(args.output) - srpm_path = os.path.join(args.output, _FAKE_SRPMS[pkg]) - open(srpm_path, 'w').close() - else: - srpm_path = _FAKE_SRPMS[pkg] - if 'srpm'in args and args.srpm: - print("Wrote: {}".format(srpm_path)) - -elif prog in ['koji', 'brew']: +if prog in ['koji', 'brew']: parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest='subcommand') diff --git a/tests/fixtures/mockbin/tito b/tests/fixtures/mockbin/tito deleted file mode 120000 index b8affed8..00000000 --- a/tests/fixtures/mockbin/tito +++ /dev/null @@ -1 +0,0 @@ -mockbin \ No newline at end of file diff --git a/tests/fixtures/testrepo/upstream/package_manifest.yaml b/tests/fixtures/testrepo/upstream/package_manifest.yaml index 9439111d..efd0bb84 100644 --- a/tests/fixtures/testrepo/upstream/package_manifest.yaml +++ b/tests/fixtures/testrepo/upstream/package_manifest.yaml @@ -16,9 +16,7 @@ packages: rhel7: - el7-base hosts: - hello: - nightly_package_tito_releaser_args: - - "jenkins_job=hello-master-release" + hello: {} foo: {} package-with-existing-build: {} package-with-two-targets: diff --git a/tests/fixtures/testrepo/upstream_with_epoch/package_manifest.yaml b/tests/fixtures/testrepo/upstream_with_epoch/package_manifest.yaml index 29e88e2f..0f5ed908 100644 --- a/tests/fixtures/testrepo/upstream_with_epoch/package_manifest.yaml +++ b/tests/fixtures/testrepo/upstream_with_epoch/package_manifest.yaml @@ -11,9 +11,7 @@ packages: - name: obaltest-nightly-rhel7 dist: '.el7' hosts: - hello: - nightly_package_tito_releaser_args: - - "jenkins_job=hello-master-release" + hello: {} repoclosures: hosts: From 7fedbed35995bc77f2c9b4be60c2d7831c3c7c54 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 23 Dec 2023 16:07:55 +0100 Subject: [PATCH 2/3] Drop setup_sources_git support This was only used for Pulp 2 and can now be dropped. --- obal/data/roles/setup_sources/tasks/git.yml | 12 ------------ obal/data/roles/setup_sources/tasks/main.yml | 5 ----- 2 files changed, 17 deletions(-) delete mode 100644 obal/data/roles/setup_sources/tasks/git.yml diff --git a/obal/data/roles/setup_sources/tasks/git.yml b/obal/data/roles/setup_sources/tasks/git.yml deleted file mode 100644 index eb0db3e1..00000000 --- a/obal/data/roles/setup_sources/tasks/git.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: 'Set source checkout location' - set_fact: - setup_sources_git_checkout_dir: "/tmp/ansible_git_{{ inventory_hostname }}" - -- name: 'Clone latest git' - git: - repo: "{{ setup_sources_git }}" - dest: "{{ setup_sources_git_checkout_dir }}" - version: "{{ git_branch | default(omit) }}" - force: true - depth: 1 diff --git a/obal/data/roles/setup_sources/tasks/main.yml b/obal/data/roles/setup_sources/tasks/main.yml index 3baff89d..94210571 100644 --- a/obal/data/roles/setup_sources/tasks/main.yml +++ b/obal/data/roles/setup_sources/tasks/main.yml @@ -5,8 +5,3 @@ - name: 'Setup sources from specfile' include_tasks: specfile.yml - when: setup_sources_git is not defined - -- name: 'Clone git repository' - include_tasks: git.yml - when: setup_sources_git is defined From d3a3530a4c7063a92b50c957ab0e83c3dc70f081 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 23 Dec 2023 16:08:52 +0100 Subject: [PATCH 3/3] Remove a layer of indirection by removing specfile.yml Now that the git based setup_sources is dropped, there's only specfile. This simplifies the role by including the content from specfile.yml directly in main.yml. --- obal/data/roles/setup_sources/tasks/main.yml | 9 +++++++-- obal/data/roles/setup_sources/tasks/specfile.yml | 8 -------- 2 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 obal/data/roles/setup_sources/tasks/specfile.yml diff --git a/obal/data/roles/setup_sources/tasks/main.yml b/obal/data/roles/setup_sources/tasks/main.yml index 94210571..f26fc91f 100644 --- a/obal/data/roles/setup_sources/tasks/main.yml +++ b/obal/data/roles/setup_sources/tasks/main.yml @@ -3,5 +3,10 @@ set_fact: package_dir: "{{ inventory_dir }}/{{ package_base_dir }}/{{ inventory_hostname }}" -- name: 'Setup sources from specfile' - include_tasks: specfile.yml +- name: 'Extract Sources from spec' + shell: "spectool --list-files --all {{ spec_file_path }} | awk '{print $2}'" + register: setup_sources_sources + changed_when: false + +- include_tasks: annex.yml + with_items: "{{ setup_sources_sources.stdout_lines | list }}" diff --git a/obal/data/roles/setup_sources/tasks/specfile.yml b/obal/data/roles/setup_sources/tasks/specfile.yml deleted file mode 100644 index a468bd79..00000000 --- a/obal/data/roles/setup_sources/tasks/specfile.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: 'Extract Sources from spec' - shell: "spectool --list-files --all {{ spec_file_path }} | awk '{print $2}'" - register: setup_sources_sources - changed_when: false - -- include_tasks: annex.yml - with_items: "{{ setup_sources_sources.stdout_lines | list }}"