Git commit 08c6bb39486fc51aca90a20708f65ee3ae7eb0eb by Andrew Shark.
Committed on 10/02/2024 at 09:37.
Pushed by ashark into branch 'master'.

Remove --print-modules and --list-build options

There are already `--query module-set` and `--query branch` options, no need to 
create unnecessarily entities.

The --list-build tree indentation was not properly implemented, but made 
correctly in dependency-tree.

The #dependency-level sticky option was never set, so print-modules indentation 
was broken forever.

The zsh completion script relied on --list-build option and needs to be 
reworked.

M  +0    -2    completions/zsh/_kdesrc-build
M  +1    -1    completions/zsh/_kdesrc-build_modules
M  +1    -5    doc/README.md
M  +0    -67   doc/man-kdesrc-build.1.docbook
M  +0    -48   doc/supported-cmdline-params.docbook
M  +0    -25   modules/ksb/Application.pm
M  +0    -4    modules/ksb/Cmdline.pm
M  +5    -3    scripts/gen_zsh_completions.py

https://invent.kde.org/sdk/kdesrc-build/-/commit/08c6bb39486fc51aca90a20708f65ee3ae7eb0eb

diff --git a/completions/zsh/_kdesrc-build b/completions/zsh/_kdesrc-build
index 4e42e40c..8dccee6f 100644
--- a/completions/zsh/_kdesrc-build
+++ b/completions/zsh/_kdesrc-build
@@ -49,7 +49,6 @@ _arguments \
   "(--install-session-driver 
--no-install-session-driver)"{--install-session-driver,--no-install-session-driver}"[Install
 a driver for the graphical login manager]" \
   "--libname""[Default name of the installed library directory]"":argument:" \
   "--libpath""[Set the environment variable LD_LIBRARY_PATH while 
building]"":argument:" \
-  "--list-build""[List what modules would be built in the order in which they 
would be built]" \
   "--log-dir""[Directory used to hold the log files generated by the 
script]"":argument:" \
   "--make-install-prefix""[A command and its options to precede the make 
install command used to install modules]"":argument:" \
   "--make-options""[Pass command line options to the make 
command]"":argument:" \
@@ -61,7 +60,6 @@ _arguments \
   "--override-build-system""[Manually specify the correct build 
type]"":argument:" \
   "--persistent-data-file""[Change where kdesrc-build stores its persistent 
data]"":argument:" \
   "(--dry-run --pretend -p)"{--dry-run,--pretend,-p}"[Dont actually take major 
actions, instead describe what would be done]" \
-  "--print-modules""[Prints the modules that would be processed]" \
   "(--purge-old-logs 
--no-purge-old-logs)"{--purge-old-logs,--no-purge-old-logs}"[Automatically 
delete old log directories]" \
   "--qmake-options""[Options passed to the qmake command]"":argument:" \
   "--qt-install-dir""[Where to install qt modules after build]"":argument:" \
diff --git a/completions/zsh/_kdesrc-build_modules 
b/completions/zsh/_kdesrc-build_modules
index 0e5a1d30..ec91aa82 100644
--- a/completions/zsh/_kdesrc-build_modules
+++ b/completions/zsh/_kdesrc-build_modules
@@ -13,7 +13,7 @@ if _cache_invalid kdesrc_build_modules || ! _retrieve_cache 
kdesrc_build_modules
   # (@) array Expansion Flags are needed because we need to operate on each 
element separately.
   kdesrc_build_modules=( "${(@)${(@)${(@)${(f)"$(
     _call_program kdesrc-build-modules \
-      kdesrc-build --list-build --no-src
+      kdesrc-build --query module-set --no-src
     )"}[1,-2]}# ── }%% *}" )
   _store_cache kdesrc_build_modules kdesrc_build_modules
 fi
diff --git a/doc/README.md b/doc/README.md
index 0c846677..9d51bc55 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -48,10 +48,6 @@ These are some kdesrc-build tricks that probably should be 
documented with the
 [KDE Community Wiki 
page](https://community.kde.org/Get_Involved/development#Set_up_kdesrc-build)
 but for now they're at least worth nothing here:
 
-- Use `--print-modules` to view which modules kdesrc-build would build, in the
-  order they would be built in. This implies `--pretend` although it doesn't 
hurt
-  to include that.
-
 - Use `kdesrc-build --rebuild-failures` (potentially with `--no-src`) to
   rebuild modules that failed to build during the last kdesrc-build run. This
   is particularly useful when a silly local error breaks an important module
@@ -107,7 +103,7 @@ but for now they're at least worth nothing here:
 - Use `--resume-from` (or `--resume-after`) to have kdesrc-build start the
   build from a later module than normal, and `--stop-before` (or
   `--stop-after`) to have kdesrc-build stop the build at an earlier module than
-  normal. This can also be used with `--print-modules`.
+  normal.
 
 - Use the `ignore-modules` option with your module sets if you want to build
   every module in the set *except* for a few specific ones.
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 3fa71162..d8c7f41c 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -516,11 +516,6 @@ Edit the "~/.bashrc" (or other shell rc file) to add 
&kdesrc-build; to your $PAT
     Consider using the <option>--resume-from</option> option (and similar
     options) to control the build list when using this option.
 </para>
-
-<para>
-    To see just the list of modules that would be built, use 
<option>--print-modules</option> or
-    <option>--pretend</option>.
-</para>
 </listitem>
 </varlistentry>
 
@@ -711,68 +706,6 @@ kdepim: master
 </listitem>
 </varlistentry>
 
-<varlistentry>
-<term>
-<option>--print-modules</option>
-</term>
-
-<listitem>
-<para>
-    Takes all actions up to and including dependency reordering of the modules
-    specified on the command line (or configuration file), prints the modules
-    that would be processed one per line, and then exits without further 
action.
-</para>
-
-<para>
-    The <literal>kde-project</literal> metadata is downloaded first (though, 
see
-    <option>--pretend</option> or <option>--no-src</option>).
-</para>
-
-<para>
-    The output is not fully compatible with usage by scripts as other output 
messages
-    may be generated until the module list is shown.
-</para>
-
-<para>
-    This is mostly just useful for quickly determining what
-    <command>kdesrc-build</command> understands a module's dependencies to be,
-    which means it's only useful for <literal>kde-projects</literal> modules.
-    This option is also compatible with <option>--resume-from</option>,
-    <option>--resume-after</option>, <option>--stop-before</option>, and
-    <option>--stop-after</option>.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>
-<option>--list-build</option>
-</term>
-
-<listitem>
-<para>
-    Takes all actions up to and including dependency reordering of the modules
-    specified on the command line (or configuration file), prints the modules
-    that would be processed one per line, and then exits without further 
action.
-</para>
-<para>
-    This option is similar to <option>--print-modules</option> but includes 
what specific
-    commit/branch/tag would be built as well. Furthermore, the order in which 
the modules
-    are listed corresponds to the order in which these would be built.
-</para>
-
-<para>
-    The <literal>kde-project</literal> metadata is downloaded first (though, 
see
-    <option>--pretend</option> or <option>--no-src</option>).
-</para>
-
-<para>
-    The output is not fully compatible with usage by scripts as other output 
messages
-    may be generated until the module list is shown.
-</para>
-</listitem>
-</varlistentry>
-
 <varlistentry>
 <term>
 <option>--dependency-tree</option>
diff --git a/doc/supported-cmdline-params.docbook 
b/doc/supported-cmdline-params.docbook
index b52bf204..86eaf976 100644
--- a/doc/supported-cmdline-params.docbook
+++ b/doc/supported-cmdline-params.docbook
@@ -323,54 +323,6 @@ kdepim: master
 </listitem>
 </varlistentry>
 
-
-<varlistentry id="cmdline-print-modules">
-<term><option><link 
linkend="cmdline-print-modules">--print-modules</link></option></term>
-<listitem>
-<para>
-    Takes all actions up to and including dependency reordering of the modules
-    specified on the command line (or configuration file), prints the modules
-    that would be processed one per line, and then exits without further 
action.
-</para>
-<para>
-    The <literal>kde-project</literal> metadata is downloaded first (though, 
see
-    <link linkend="cmdline-pretend"><option>--pretend</option></link> or <link
-    linkend="cmdline-no-src"><option>--no-src</option></link>).
-</para>
-<para>
-    The output is not fully compatible with usage by scripts as other output 
messages
-    may be generated until the module list is shown.
-</para>
-<para>
-    This is mostly just useful for quickly determining what &kdesrc-build;
-    understands a module's dependencies to be, which means it's only useful for
-    <link
-    linkend="kde-projects-module-sets"><literal>kde-projects</literal></link>
-    modules.  This option is also compatible with <link
-    linkend="cmdline-resume-from"><option>--resume-from</option></link>, <link
-    linkend="cmdline-resume-after"><option>--resume-after</option></link>,
-    <link linkend="cmdline-stop-before"><option>--stop-before</option></link>,
-    <link linkend="cmdline-stop-after"><option>--stop-after</option></link>.
-</para></listitem>
-</varlistentry>
-
-<varlistentry id="cmdline-list-build">
-<term><option><link 
linkend="cmdline-list-build">--list-build</link></option></term>
-<listitem>
-<para>
-    Lists the modules that would be built, in the order in which they would be 
built.
-    If applicable, the output listing also mentions which commit/branch/tag 
would be
-    selected for checkout.
-</para>
-<para>
-    This option is similar to
-    <link 
linkend="cmdline-print-modules"><option>--print-modules</option></link>.
-    For more detailed information on how modules relate to each other, see 
also:
-    <link 
linkend="cmdline-dependency-tree"><option>--dependency-tree</option></link>.
-</para>
-</listitem>
-</varlistentry>
-
 <varlistentry id="cmdline-dependency-tree">
 <term><option><link 
linkend="cmdline-dependency-tree">--dependency-tree</link></option></term>
 <listitem>
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index c66218f6..0bc1b082 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -444,24 +444,6 @@ EOF
         ! exists $ignoredSelectors{$_->moduleSet()->name() // ''}
     } @modules;
 
-    if(exists $cmdlineGlobalOptions->{'list-build'}) {
-        for my $module (@modules) {
-            my $branch = ksb::DependencyResolver::_getBranchOf($module);
-            print(' ── ', $module->name());
-            if($branch) {
-                print(' : ', $branch);
-            }
-            print("\n");
-        }
-
-        my $result = {
-            dependencyInfo => $moduleGraph,
-            selectedModules => [],
-            build => 0
-        };
-        return $result;
-    }
-
     my $result = {
         dependencyInfo => $moduleGraph,
         selectedModules => \@modules,
@@ -620,13 +602,6 @@ sub runAllModulePhases
     my $ctx = $self->context();
     my @modules = $self->modules();
 
-    if ($ctx->getOption('print-modules')) {
-        for my $m (@modules) {
-            say ((" " x ($m->getOption('#dependency-level', 'module') // 0)), 
"$m");
-        }
-        return 0; # Abort execution early!
-    }
-
     # Add to global module list now that we've filtered everything.
     $ctx->addModule($_) foreach @modules;
 
diff --git a/modules/ksb/Cmdline.pm b/modules/ksb/Cmdline.pm
index efb13ab2..ab9edb42 100644
--- a/modules/ksb/Cmdline.pm
+++ b/modules/ksb/Cmdline.pm
@@ -333,8 +333,6 @@ sub _showHelpAndExit
         Important Options:
             --pretend (or -p)      Don't actually take major actions, instead 
describe
                                    what would be done.
-            --list-build           List what modules would be built in the 
order in
-                                   which they would be built.
             --dependency-tree      Print out dependency information on the 
modules that
                                    would be built, using a `tree` format. Very 
useful
                                    for learning how modules relate to each 
other. May
@@ -429,10 +427,8 @@ sub _supportedOptions
         'dependency-tree',
         'dependency-tree-fullpath',
         'help|h',
-        'list-build',
         'metadata-only',
         'no-metadata',
-        'print-modules',
         'query=s',
         'rc-file=s',
         'rebuild-failures',
diff --git a/scripts/gen_zsh_completions.py b/scripts/gen_zsh_completions.py
index 00596ea8..08adcce2 100644
--- a/scripts/gen_zsh_completions.py
+++ b/scripts/gen_zsh_completions.py
@@ -11,10 +11,14 @@ This script generates the zsh completions file.
 import os.path
 import subprocess
 
-p = subprocess.run("./kdesrc-build --show-options-specifiers", 
cwd=os.path.expanduser("~/kde6"), shell=True, capture_output=True, 
text=True).stdout
+p = subprocess.run("./kdesrc-build --show-options-specifiers", 
cwd=os.path.expanduser(os.getcwd() + "/.."), shell=True, capture_output=True, 
text=True).stdout
 specifiers = p.split("\n")
 specifiers = list(filter(None, specifiers))  # remove empty string from last 
line
 specifiers.sort()
+if not specifiers:
+    print("Cannot get options specifiers")
+    exit(1)
+
 
 individual_options = []
 conflicting_sets = []
@@ -149,7 +153,6 @@ short_descriptions = {  # contains one of the options (any 
of them) from set, an
     "--install-session-driver": "Install a driver for the graphical login 
manager",
     "--libname": "Default name of the installed library directory",
     "--libpath": "Set the environment variable LD_LIBRARY_PATH while building",
-    "--list-build": "List what modules would be built in the order in which 
they would be built",
     "--log-dir": "Directory used to hold the log files generated by the 
script",
     "--make-install-prefix": "A command and its options to precede the make 
install command used to install modules",
     "--make-options": "Pass command line options to the make command",
@@ -162,7 +165,6 @@ short_descriptions = {  # contains one of the options (any 
of them) from set, an
     "--override-build-system": "Manually specify the correct build type",
     "--persistent-data-file": "Change where kdesrc-build stores its persistent 
data",
     "--pretend": "Dont actually take major actions, instead describe what 
would be done",
-    "--print-modules": "Prints the modules that would be processed",
     "--purge-old-logs": "Automatically delete old log directories",
     "--qmake-options": "Options passed to the qmake command",
     "--qt-install-dir": "Where to install qt modules after build",

Reply via email to