diff --git a/roles/copr/backend/files/patches/fixup-copr-repo-script.patch b/roles/copr/backend/files/patches/fixup-copr-repo-script.patch new file mode 100644 index 0000000000..8f1fe1bb74 --- /dev/null +++ b/roles/copr/backend/files/patches/fixup-copr-repo-script.patch @@ -0,0 +1,45 @@ +--- /usr/bin/copr-repo 2020-01-15 08:23:09.000000000 +0000 ++++ /usr/bin/copr-repo 2020-01-17 01:07:57.791459957 +0000 +@@ -148,6 +148,12 @@ + + def add_appdata(opts): + if opts.devel or opts.no_appstream_metadata: ++ opts.log.info("appstream-builder skipped, devel or " ++ "--no-appstream-metadata") ++ return ++ ++ if os.path.exists(os.path.join(opts.projectdir, ".disable-appstream")): ++ opts.log.info("appstream-builder skipped, .disable-appstream file") + return + + path = opts.directory +@@ -199,6 +205,9 @@ + # To avoid race conditions, remove the directories _after_ we have + # successfully generated the new repodata. + for subdir in opts.delete: ++ if not subdir or '..' in subdir: ++ raise Exception("removal of \"%s\" subdir requested", subdir) ++ + opts.log.info("removing %s subdirectory", subdir) + try: + shutil.rmtree(os.path.join(opts.directory, subdir)) +@@ -244,6 +253,7 @@ + def process_directory_path(opts): + helper_path = os.path.abspath(opts.directory) + helper_path, opts.chroot = os.path.split(helper_path) ++ opts.projectdir = helper_path + helper_path, opts.dirname = os.path.split(helper_path) + helper_path, opts.ownername = os.path.split(helper_path) + opts.projectname = opts.dirname.split(':')[0] +@@ -257,6 +267,11 @@ + # try to setup logging based on copr-be.conf + process_backend_config(opts) + ++ # argument parsing ++ if '' in opts.add or '' in opts.delete: ++ opts.log.error("'' dir addition/removal requested") ++ return 1 ++ + # resolve absolute path from opts.directory, and detect + # ownername, dirname, chroot, etc. from it + process_directory_path(opts) diff --git a/roles/copr/backend/tasks/main.yml b/roles/copr/backend/tasks/main.yml index 1e84a42c48..1e5b06a619 100644 --- a/roles/copr/backend/tasks/main.yml +++ b/roles/copr/backend/tasks/main.yml @@ -33,6 +33,11 @@ # dest=/usr/bin/prunerepo # tags: patches +- name: issue 1213 + patch: src=patches/fixup-copr-repo-script.patch + dest=/usr/bin/copr-repo + tags: patches + - name: install openstackclient for image preparation dnf: state=present name=python3-openstackclient when: devel|bool