From 483409b439bab3feef2d0a7546bd30fe2b34f546 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenz=20H=C3=BCdepohl?= <dev@stellardeath.org>
Date: Tue, 26 May 2020 19:15:30 +0200
Subject: [PATCH] Option '--only-project' for mcpdf_setup_subproject

---
 mpcdf_common.py           | 8 +++++---
 mpcdf_setup_subproject.py | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/mpcdf_common.py b/mpcdf_common.py
index 76e6722..3ddd200 100644
--- a/mpcdf_common.py
+++ b/mpcdf_common.py
@@ -579,7 +579,7 @@ def parse_prjconf(api_url, project):
 
 
 def mpcdf_setup_subproject(api_url, project, distribution, microarchitecture,
-                           parent=None, dry_run=False, remove_old=False, all_possible=False):
+                           parent=None, dry_run=False, remove_old=False, all_possible=False, only_project=False):
 
     if parent and not dry_run:
         for attribute in config_attributes + default_attributes:
@@ -615,6 +615,7 @@ def mpcdf_setup_subproject(api_url, project, distribution, microarchitecture,
 
     prjconf_ours.append("Constraint: hostlabel {0}".format(microarchitecture))
     prjconf_ours.append("Preinstall: mpcdf_{0}_directory".format(microarchitecture))
+    prjconf_ours.append("PublishFilter: ^mpcdf_.*$")
     prjconf_ours.append("")
 
     extra_tags = dist_prjconf_tags(distribution)
@@ -805,8 +806,9 @@ Macros:
 
         # Create and remove the <enable/> flags before the new repsitories,
         # that way no spurious builds are launched
-        print("Updating enabled repositories for all packages")
-        mpcdf_enable_repositories_for_all_packages(api_url, project)
+        if not only_project:
+            print("Updating enabled repositories for all packages")
+            mpcdf_enable_repositories_for_all_packages(api_url, project)
 
         # Update repositories
         print("Updating prj meta")
diff --git a/mpcdf_setup_subproject.py b/mpcdf_setup_subproject.py
index f9a6cde..9de8470 100644
--- a/mpcdf_setup_subproject.py
+++ b/mpcdf_setup_subproject.py
@@ -11,6 +11,8 @@ import osc.cmdln
 
 @osc.cmdln.option('-n', '--dry-run', action="store_true",
                   help="Do not actually run anything but output the resulting XML configuration")
+@osc.cmdln.option('--only-project', action="store_true",
+                  help="Do not actually run anything but output the resulting XML configuration")
 @osc.cmdln.option('--remove-old', action="store_true", default=False,
                   help="Remove all obsolete repositories instead of only disabling builds for packages there")
 @osc.cmdln.alias("mpcdf_setup_sub")
@@ -49,4 +51,4 @@ def do_mpcdf_setup_subproject(self, subcmd, opts, *args):
 
     mpcdf_setup_subproject(self.get_api_url(),
                            project, distribution, microarchitecture,
-                           dry_run=opts.dry_run, remove_old=opts.remove_old)
+                           dry_run=opts.dry_run, remove_old=opts.remove_old, only_project=opts.only_project)
-- 
GitLab