From c47acc522d2ab9704582df3417db9924275f417c Mon Sep 17 00:00:00 2001
From: Tobias Melson <tobias.melson@mpcdf.mpg.de>
Date: Fri, 27 Sep 2024 12:00:44 +0200
Subject: [PATCH] Compatibility with recent osc command

Since the osc commit be8a5268, strings are no longer interpolated
in the help message.
---
 mpcdf_admin_info.py             |  6 +++---
 mpcdf_branch.py                 |  3 ++-
 mpcdf_build_status.py           | 11 ++++++-----
 mpcdf_copy_attributes.py        |  3 ++-
 mpcdf_enable_repositories.py    | 11 ++++++-----
 mpcdf_info.py                   |  6 +++---
 mpcdf_push.py                   |  3 ++-
 mpcdf_remove.py                 |  3 ++-
 mpcdf_set_as_branch.py          |  3 ++-
 mpcdf_setup_clusters_project.py |  5 +++--
 mpcdf_setup_home_project.py     |  6 +++---
 mpcdf_setup_software_project.py |  6 +++---
 mpcdf_setup_subproject.py       |  6 +++---
 mpcdf_sync_projects.py          |  3 ++-
 mpcdf_unresolved.py             |  7 ++++++-
 15 files changed, 48 insertions(+), 34 deletions(-)

diff --git a/mpcdf_admin_info.py b/mpcdf_admin_info.py
index a86a384..844ace1 100644
--- a/mpcdf_admin_info.py
+++ b/mpcdf_admin_info.py
@@ -16,7 +16,8 @@ from xml.etree import ElementTree
 
 
 def do_mpcdf_admin_info(self, subcmd, opts, *args):
-    """${cmd_name}: Print some status information about the OBS:
+    """mpcdf_admin_info:
+    Print some status information about the OBS:
 
     - The number or currently waiting build jobs and the number of
       active workers for the different architectures
@@ -25,10 +26,9 @@ def do_mpcdf_admin_info(self, subcmd, opts, *args):
     - The cluster update status
 
     Usage:
-        osc ${cmd_name}
+        osc mpcdf_admin_info
 
     ${cmd_option_list}
-
     """
 
     api_url = self.get_api_url()
diff --git a/mpcdf_branch.py b/mpcdf_branch.py
index 92b5a4a..b94c6ae 100644
--- a/mpcdf_branch.py
+++ b/mpcdf_branch.py
@@ -9,7 +9,8 @@ import osc.cmdln
 
 
 def do_mpcdf_branch(self, subcmd, opts, *args):
-    """${cmd_name}: Branch package from software to your home project
+    """mpcdf_branch:
+    Branch package from software to your home project
 
     This creates a branch of the package PACKAGE in the central
     'software' repository into your home:$USER project, and sets
diff --git a/mpcdf_build_status.py b/mpcdf_build_status.py
index e8b6c77..41ac45a 100644
--- a/mpcdf_build_status.py
+++ b/mpcdf_build_status.py
@@ -26,7 +26,8 @@ from xml.etree import ElementTree
 @osc.cmdln.option('--details', metavar="FILTER",
                   help="print details; set FILTER to '*' to print all; set FILTER to any string to filter details")
 def do_mpcdf_build_status(self, subcmd, opts, *args):
-    """${cmd_name}: List build statuses of a package for all software projects
+    """mpcdf_build_status:
+    List build statuses of a package for all software projects
 
     For a given package or the one from the current directory, iterate over all
     projects in "software" and the user's "home" project and display the build
@@ -34,7 +35,7 @@ def do_mpcdf_build_status(self, subcmd, opts, *args):
     "excluded", or "disabled". More statuses can be filtered out with --ignore.
 
     Usage:
-        osc ${cmd_name} [PACKAGE [PROJECT [REPOSITORIES]]]
+        osc mpcdf_build_status [PACKAGE [PROJECT [REPOSITORIES]]]
 
     PACKAGE can be "all" to display the builds of all packages in the selected
     project. REPOSITORIES can be a single repository or a comma-separated list.
@@ -59,13 +60,13 @@ def do_mpcdf_build_status(self, subcmd, opts, *args):
     Examples:
        - Show the build statuses of the package 'foobar_1_0' in all software
          subprojects, but hide all 'unresolvable' builds:
-         #> osc ${cmd_name} foobar_1_0 --skip-home --ignore unresolvable
+         #> osc mpcdf_build_status foobar_1_0 --skip-home --ignore unresolvable
        - Show the build statuses of the package 'foobar_1_0' in a specific
          software subproject:
-         #> osc ${cmd_name} foobar_1_0 software:SLE_15:skylake
+         #> osc mpcdf_build_status foobar_1_0 software:SLE_15:skylake
        - Print the build status of the package 'foobar_1_0' for a specific
          repository in a selected software subproject:
-         #> osc ${cmd_name} foobar_1_0 software:SLE_15:skylake openmpi_4_1_gcc_13
+         #> osc mpcdf_build_status foobar_1_0 software:SLE_15:skylake openmpi_4_1_gcc_13
     """
 
     api_url = self.get_api_url()
diff --git a/mpcdf_copy_attributes.py b/mpcdf_copy_attributes.py
index bf87a03..8f017f4 100644
--- a/mpcdf_copy_attributes.py
+++ b/mpcdf_copy_attributes.py
@@ -13,7 +13,8 @@ import osc.cmdln
                   help='URL of destination api server. Default is the source api server.')
 @osc.cmdln.alias("mpcdf_copy_attrs")
 def do_mpcdf_copy_attributes(self, subcmd, opts, *args):
-    """${cmd_name}: Copy attributes from one package to another
+    """mpcdf_copy_attributes:
+    Copy attributes from one package to another
 
     Usage:
         osc mpcdf_copy_attributes SOURCE_PROJECT SOURCE_PACKAGE DEST_PROJECT DEST_PACKAGE
diff --git a/mpcdf_enable_repositories.py b/mpcdf_enable_repositories.py
index 93d3499..74a2858 100644
--- a/mpcdf_enable_repositories.py
+++ b/mpcdf_enable_repositories.py
@@ -30,7 +30,8 @@ import osc.cmdln
                   help="Disable building this package")
 @osc.cmdln.alias("mpcdf_enable_repos")
 def do_mpcdf_enable_repositories(self, subcmd, opts, *args):
-    """${cmd_name}: Select all appropriate repositories for an MPCDF package
+    """mpcdf_enable_repositories:
+    Select all appropriate repositories for an MPCDF package
 
     Due to the large number of repository combinations at MPCDF it is
     cumbersome to enable all the appropriate repositories for a given package
@@ -47,10 +48,10 @@ def do_mpcdf_enable_repositories(self, subcmd, opts, *args):
     troublesome compiler)
 
     Usage:
-        osc ${cmd_name}                       [[PROJECT] PACKAGE]
-        osc ${cmd_name} --set FLAGS [options] [[PROJECT] PACKAGE]
-        osc ${cmd_name} --recreate            [[PROJECT] PACKAGE]
-        osc ${cmd_name} --disable             [[PROJECT] PACKAGE]
+        osc mpcdf_enable_repositories                       [[PROJECT] PACKAGE]
+        osc mpcdf_enable_repositories --set FLAGS [options] [[PROJECT] PACKAGE]
+        osc mpcdf_enable_repositories --recreate            [[PROJECT] PACKAGE]
+        osc mpcdf_enable_repositories --disable             [[PROJECT] PACKAGE]
 
     ${cmd_option_list}
     """
diff --git a/mpcdf_info.py b/mpcdf_info.py
index 70f2402..d86573a 100644
--- a/mpcdf_info.py
+++ b/mpcdf_info.py
@@ -12,13 +12,13 @@ import osc.cmdln
 
 
 def do_mpcdf_info(self, subcmd, opts, *args):
-    """${cmd_name}: Basic information about an MPCDF OBS project
+    """mpcdf_info:
+    Basic information about an MPCDF OBS project
 
     Usage:
-        osc ${cmd_name} [PROJECT]
+        osc mpcdf_info [PROJECT]
 
     ${cmd_option_list}
-
     """
 
     if len(args) == 0:
diff --git a/mpcdf_push.py b/mpcdf_push.py
index d322f15..bd5f57d 100644
--- a/mpcdf_push.py
+++ b/mpcdf_push.py
@@ -17,7 +17,8 @@ from xml.etree import ElementTree
 @osc.cmdln.option('-m', "--message", nargs=1,
                   help="message to include in the submit request")
 def do_mpcdf_push(self, subcmd, opts, *args):
-    """${cmd_name}: Push packages from a home project to a general project
+    """mpcdf_push:
+    Push packages from a home project to a general project
 
     You would typically use this to push your home project package into the
     "software" project.
diff --git a/mpcdf_remove.py b/mpcdf_remove.py
index 709da5a..b6a09a8 100644
--- a/mpcdf_remove.py
+++ b/mpcdf_remove.py
@@ -9,7 +9,8 @@ import urllib
 @osc.cmdln.option('--ignore-missing', action="store_true",
                   help="Ignore if package is missing in some/all sub-projects")
 def do_mpcdf_remove(self, subcmd, opts, *args):
-    """mpcdf_remove: Removes a package from all sub-projects of software:
+    """mpcdf_remove:
+    Removes a package from all sub-projects of software:
 
     Usage:
         osc mpcdf_remove [PACKAGE]
diff --git a/mpcdf_set_as_branch.py b/mpcdf_set_as_branch.py
index 98b796a..cdfffcf 100644
--- a/mpcdf_set_as_branch.py
+++ b/mpcdf_set_as_branch.py
@@ -11,7 +11,8 @@ import osc.cmdln
 
 @osc.cmdln.alias("mpcdf_setbranch")
 def do_mpcdf_set_as_branch(self, subcmd, opts, *args):
-    """${cmd_name}: Convert a package to be a branch of another
+    """mpcdf_set_as_branch:
+    Convert a package to be a branch of another
 
     The package MY_PACKAGE is set-up to be a branch of the package
     MAIN_PACKAGE
diff --git a/mpcdf_setup_clusters_project.py b/mpcdf_setup_clusters_project.py
index c5f76d8..82bab16 100644
--- a/mpcdf_setup_clusters_project.py
+++ b/mpcdf_setup_clusters_project.py
@@ -17,12 +17,13 @@ import mpcdf_common
                   help="Remove obsolete repositories")
 @osc.cmdln.alias("mpcdf_setup_clusters")
 def do_mpcdf_setup_clusters_project(self, subcmd, opts, *args):
-    """${cmd_name}: Set-up the 'clusters' project
+    """mpcdf_setup_clusters_project:
+    Set-up the 'clusters' project
 
     This creates the 'prjconf' for the 'clusters' project
 
     Usage:
-        osc ${cmd_name}
+        osc mpcdf_setup_clusters_project
 
     ${cmd_option_list}
 
diff --git a/mpcdf_setup_home_project.py b/mpcdf_setup_home_project.py
index 87b3e5a..f0a732d 100644
--- a/mpcdf_setup_home_project.py
+++ b/mpcdf_setup_home_project.py
@@ -28,16 +28,16 @@ import osc.cmdln
                        "home project".format(default_microarch))
 @osc.cmdln.alias("mpcdf_setup_home")
 def do_mpcdf_setup_home_project(self, subcmd, opts, *args):
-    """${cmd_name}: Setup a home project based on a software: sub-project
+    """mpcdf_setup_home_project:
+    Setup a home project based on a software: sub-project
 
     Set-up a home:$USER project for building packages for the 'software'
     project hierarchy (i.e. application group packages)
 
     Usage:
-        osc ${cmd_name} [home:USER]
+        osc mpcdf_setup_home_project [home:USER]
 
     ${cmd_option_list}
-
     """
 
     if len(args) == 0:
diff --git a/mpcdf_setup_software_project.py b/mpcdf_setup_software_project.py
index bdb8d95..28e33bd 100644
--- a/mpcdf_setup_software_project.py
+++ b/mpcdf_setup_software_project.py
@@ -18,17 +18,17 @@ import mpcdf_common
                   help="Only change project metadata, do not iterate over packages and change their enabled repositories")
 @osc.cmdln.alias("mpcdf_setup_software")
 def do_mpcdf_setup_software_project(self, subcmd, opts, *args):
-    """${cmd_name}: Set-up the 'software' project
+    """mpcdf_setup_software_project:
+    Set-up the 'software' project
 
     This creates the 'prjconf' for the 'software' project and
     enables the repositories for packages set to build for
     'system'
 
     Usage:
-        osc ${cmd_name}
+        osc mpcdf_setup_software_project
 
     ${cmd_option_list}
-
     """
 
     if len(args) != 0:
diff --git a/mpcdf_setup_subproject.py b/mpcdf_setup_subproject.py
index 779acce..8264e0e 100644
--- a/mpcdf_setup_subproject.py
+++ b/mpcdf_setup_subproject.py
@@ -21,7 +21,8 @@ import osc.cmdln
                   help="Remove all obsolete repositories matching this regular expression")
 @osc.cmdln.alias("mpcdf_setup_sub")
 def do_mpcdf_setup_subproject(self, subcmd, opts, *args):
-    """${cmd_name}: Setup a software: sub-project
+    """mpcdf_setup_subproject:
+    Setup a software: sub-project
 
     Given a list of compilers, MPI libraries, and possibly CUDA versions via
     the projects attributes, this command creates repositories for all the
@@ -31,10 +32,9 @@ def do_mpcdf_setup_subproject(self, subcmd, opts, *args):
     a "Constraint:" statement
 
     Usage:
-        osc ${cmd_name} [software:OS:microarchitecture]
+        osc mpcdf_setup_subproject [software:OS:microarchitecture]
 
     ${cmd_option_list}
-
     """
 
     if len(args) == 0:
diff --git a/mpcdf_sync_projects.py b/mpcdf_sync_projects.py
index e6695cd..5a8ae73 100644
--- a/mpcdf_sync_projects.py
+++ b/mpcdf_sync_projects.py
@@ -16,7 +16,8 @@ import osc.cmdln
                   help="Do not copy over maintainer field (for test projects)")
 @osc.cmdln.alias("mpcdf_sync_proj")
 def do_mpcdf_sync_projects(self, subcmd, opts, *args):
-    """${cmd_name}: Branch all/missing packages from a project to another and sync their metadata
+    """mpcdf_sync_projects:
+    Branch all/missing packages from a project to another and sync their metadata
 
     Usage:
         osc mpcdf_sync_projects
diff --git a/mpcdf_unresolved.py b/mpcdf_unresolved.py
index c0124d4..ce05606 100644
--- a/mpcdf_unresolved.py
+++ b/mpcdf_unresolved.py
@@ -15,8 +15,13 @@ from urllib.parse import quote
 @osc.cmdln.option('-r', '--repo', metavar='REPO',
                   help='specify repository')
 def do_mpcdf_unresolved(self, subcmd, opts, *args):
-    """
+    """mpcdf_unresolved:
     List unresolved RPM dependencies of built binaries
+
+    Usage:
+        osc mpcdf_unresolved [PACKAGE [PROJECT]]
+
+    ${cmd_option_list}
     """
 
     apiurl = self.get_api_url()
-- 
GitLab