[sdk/kdesrc-build] /: Add short options for --[no-]include-dependencies.

Michael Pyne null at kde.org
Thu Sep 7 01:34:56 BST 2023


Git commit 5b155c5e29dd2d377fd1f84fb42d0e629a9f368b by Michael Pyne.
Committed on 07/09/2023 at 02:34.
Pushed by mpyne into branch 'master'.

Add short options for --[no-]include-dependencies.

This adds and documents -d as a short alias for --include-dependencies, and a corresponding -D as its negation.

While I'm at it, and at user request, this also adds short options for:

* --help
* --no-src
* --src-only
* --refresh-build
* --ignore-modules
* --resume-from and --resume-after

BUG:473859

M  +11   -11   doc/index.docbook
M  +28   -10   doc/man-kdesrc-build.1.docbook
M  +37   -21   modules/ksb/Cmdline.pm

https://invent.kde.org/sdk/kdesrc-build/-/commit/5b155c5e29dd2d377fd1f84fb42d0e629a9f368b

diff --git a/doc/index.docbook b/doc/index.docbook
index 8ff50370..1cd114cb 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -3222,7 +3222,7 @@ configuration.
 </varlistentry>
 
 <varlistentry id="cmdline-help">
-<term><parameter>--help</parameter></term>
+<term><parameter>--help</parameter> (or <parameter>-h</parameter>)</term>
 <listitem><para>
 Only display simple help on this script.
 </para></listitem>
@@ -3352,7 +3352,7 @@ Be very descriptive about what is going on, and what &kdesrc-build; is doing.
 </varlistentry>
 
 <varlistentry id="cmdline-src-only">
-<term><parameter>--src-only</parameter> (or <parameter>--svn-only</parameter>)</term>
+<term><parameter>--src-only</parameter> (or <parameter>--svn-only</parameter> or <parameter>-s</parameter>)</term>
 <listitem><para>
 Only perform the source update. (The <parameter>--svn-only</parameter> is
 only supported for compatibility with older scripts).
@@ -3401,8 +3401,8 @@ work.</para></note>
 </varlistentry>
 
 <varlistentry id="cmdline-include-dependencies">
-<term><parameter>--include-dependencies</parameter></term>
-<term><parameter>--no-include-dependencies</parameter></term>
+<term><parameter>--include-dependencies</parameter> (or <parameter>-d</parameter>)</term>
+<term><parameter>--no-include-dependencies</parameter> (or <parameter>-D</parameter>)</term>
 <listitem><para>
 This option causes &kdesrc-build; to automatically include other &kde; and &Qt;
 modules in the build, if required for the modules you have requested to build
@@ -3421,7 +3421,7 @@ automatic inclusion of additional dependency modules.</para>
 </varlistentry>
 
 <varlistentry id="cmdline-ignore-modules">
-<term><parameter>--ignore-modules</parameter></term>
+<term><parameter>--ignore-modules</parameter> (or <parameter>-!</parameter>)</term>
 <listitem><para>
 Do not include the modules passed on the rest of the command line in the
 update/build process (this is useful if you want to build most of the modules
@@ -3431,7 +3431,7 @@ a few).
 </varlistentry>
 
 <varlistentry id="cmdline-no-src">
-<term><parameter>--no-src</parameter> (or <parameter>--no-svn</parameter>)</term>
+<term><parameter>--no-src</parameter> (or <parameter>--no-svn</parameter> or <parameter>-S</parameter>)</term>
 <listitem><para>
 Skip contacting the &subversion; server. (The <parameter>--no-svn</parameter>
 parameter is only supported for compatibility with older versions of the
@@ -3564,7 +3564,7 @@ scratch.
 </varlistentry>
 
 <varlistentry id="cmdline-refresh-build">
-<term><parameter>--refresh-build</parameter></term>
+<term><parameter>--refresh-build</parameter> (or <parameter>-r</parameter>)</term>
 <listitem><para>
 Recreate the build system and make from scratch.
 </para></listitem>
@@ -3583,7 +3583,7 @@ linkend="cmdline-refresh-build">--refresh-build</link></parameter> is used.
 </varlistentry>
 
 <varlistentry id="cmdline-resume-from">
-<term><parameter>--resume-from</parameter></term>
+<term><parameter>--resume-from</parameter> (or <parameter>--from</parameter> or <parameter>-f</parameter>)</term>
 <listitem><para>
 This option is used to resume the build starting from the given module, which
 should be the next option on the command line. You should not
@@ -3604,7 +3604,7 @@ build.</para></listitem>
 </varlistentry>
 
 <varlistentry id="cmdline-resume-after">
-<term><parameter>--resume-after</parameter></term>
+<term><parameter>--resume-after</parameter> (or <parameter>--after</parameter> or <parameter>-a</parameter>)</term>
 <listitem><para>
 This option is used to resume the build starting after the given module, which
 should be the next option on the command line. You should not
@@ -3653,7 +3653,7 @@ This option was added with &kdesrc-build; 1.16.
 </varlistentry>
 
 <varlistentry id="cmdline-stop-before">
-<term><parameter>--stop-before</parameter></term>
+<term><parameter>--stop-before</parameter> (or <parameter>--until</parameter>)</term>
 <listitem><para>
 This command line option is used to stop the normal build process just
 <emphasis>before</emphasis> a module would ordinarily be built.
@@ -3668,7 +3668,7 @@ This command line option was added with &kdesrc-build; 1.16.
 </varlistentry>
 
 <varlistentry id="cmdline-stop-after">
-<term><parameter>--stop-after</parameter></term>
+<term><parameter>--stop-after</parameter> (or <parameter>--to</parameter>)</term>
 <listitem><para>
 This command line option is used to stop the normal build process just
 <emphasis>after</emphasis> a module would ordinarily be built.
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 1c958dfa..e303ce15 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -182,7 +182,7 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--no-src</option>
+<option>-S, --no-src</option>
 </term>
 
 <listitem>
@@ -258,7 +258,7 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--src-only</option>
+<option>-s, --src-only</option>
 </term>
 
 <listitem>
@@ -300,7 +300,7 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--refresh-build</option>
+<option>-r, --refresh-build</option>
 </term>
 
 <listitem>
@@ -352,7 +352,9 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--resume-from=<replaceable>foo</replaceable></option>
+<option>--resume-from=<replaceable>foo</replaceable></option>,
+<option>--from=<replaceable>foo</replaceable></option>,
+<option>-f <replaceable>foo</replaceable></option>,
 </term>
 
 <listitem>
@@ -370,7 +372,9 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--resume-after=<replaceable>foo</replaceable></option>
+<option>--resume-after=<replaceable>foo</replaceable></option>,
+<option>--after=<replaceable>foo</replaceable></option>,
+<option>-a <replaceable>foo</replaceable></option>
 </term>
 
 <listitem>
@@ -414,7 +418,8 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--stop-before=<replaceable>foo</replaceable></option>
+<option>--stop-before=<replaceable>foo</replaceable></option>,
+<option>--until=<replaceable>foo</replaceable></option>
 </term>
 
 <listitem>
@@ -435,7 +440,8 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--stop-after=<replaceable>foo</replaceable></option>
+<option>--stop-after=<replaceable>foo</replaceable></option>,
+<option>--to=<replaceable>foo</replaceable></option>
 </term>
 
 <listitem>
@@ -453,8 +459,7 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--include-dependencies</option>
-<option>--no-include-dependencies</option>
+<option>-d, --include-dependencies</option>
 </term>
 
 <listitem>
@@ -490,6 +495,19 @@ combining short options into one at this point. (E.g. running
 </listitem>
 </varlistentry>
 
+<varlistentry>
+<term>
+<option>-D, --no-include-dependencies</option>
+</term>
+
+<listitem>
+<para>
+    This is the negation of <option>--include-dependencies</option>, for use if you have
+    configured dependencies to be included by default.
+</para>
+</listitem>
+</varlistentry>
+
 <varlistentry>
 <term>
 <option>--rebuild-failures</option>
@@ -530,7 +548,7 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
-<option>--ignore-modules</option>
+<option>-!, --ignore-modules</option>
 </term>
 
 <listitem>
diff --git a/modules/ksb/Cmdline.pm b/modules/ksb/Cmdline.pm
index 266a4b43..a06ae453 100644
--- a/modules/ksb/Cmdline.pm
+++ b/modules/ksb/Cmdline.pm
@@ -9,7 +9,7 @@ use ksb::PhaseList;
 use ksb::OSSupport;
 use ksb::Version qw(scriptVersion);
 
-use Getopt::Long qw(GetOptionsFromArray :config gnu_getopt nobundling);
+use Getopt::Long qw(GetOptionsFromArray :config gnu_getopt nobundling no_ignore_case);
 
 =head1 SYNOPSIS
 
@@ -145,7 +145,17 @@ sub readCommandLineOptionsAndSelectors (@options)
         author      => sub { _showAuthorAndExit();  },
         help        => sub { _showHelpAndExit();    },
 
-        install   => sub {
+        # Intended as a short option, -d would imply --include-dependencies and
+        # -D implies --no-include-dependencies.
+        d => sub {
+            $auxOptions{'include-dependencies'} = 1;
+        },
+
+        D => sub {
+            $auxOptions{'include-dependencies'} = 0;
+        },
+
+        install => sub {
             $opts->{run_mode} = 'install';
             $phases->phases('install');
         },
@@ -336,7 +346,7 @@ sub _showHelpAndExit
 
     say <<~DONE;
         kdesrc-build $scriptVersion
-        Copyright (c) 2003 - 2022 Michael Pyne <mpyne\@kde.org> and others, and is
+        Copyright (c) 2003 - 2023 Michael Pyne <mpyne\@kde.org> and others, and is
         distributed under the terms of the GNU GPL v2.
 
         This script automates the download, build, and install process for KDE software
@@ -350,7 +360,7 @@ sub _showHelpAndExit
             All configured modules are built if none are listed.
 
         Important Options:
-            --pretend              Don't actually take major actions, instead describe
+            --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.
@@ -358,10 +368,11 @@ sub _showHelpAndExit
                                    would be built, using a `tree` format. Very useful
                                    for learning how modules relate to each other. May
                                    generate a lot of output.
-            --no-src               Don't update source code, just build/install.
-            --src-only             Only update the source code
+            --no-src   (or -S)     Don't update source code, just build/install.
+            --src-only (or -s)     Only update the source code
+            --metadata-only        Only update dependency info and KDE project database
             --refresh-build        Start the build from scratch.
-
+              (or -r)
             --rc-file=<filename>   Read configuration from filename instead of default.
             --initial-setup        Installs Plasma env vars (~/.bashrc), required
                                    system pkgs, and a base kdesrc-buildrc.
@@ -371,8 +382,10 @@ sub _showHelpAndExit
             --stop-before=<pkg>    Stops just before or after the given package is
             --stop-after=<pkg>         reached.
 
-            --include-dependencies Also builds KDE-based dependencies of given modules.
-              (This is enabled by default; use --no-include-dependencies to disable)
+            --include-dependencies
+             -d                    Also builds KDE-based dependencies of given modules.
+              (This is enabled by default; use --no-include-dependencies or -D to disable)
+
             --stop-on-failure      Stops the build as soon as a package fails to build.
 
         More docs at https://docs.kde.org/?application=kdesrc-build
@@ -443,17 +456,19 @@ sub _supportedOptions
         'colorful-output|color!',
         'debug',
         'dependency-tree',
-        'help',
-        'ignore-modules=s{,}',
+        'help|h',
+        'ignore-modules|!=s{,}',
+        'd', # --include-dependencies, which is already pulled in via ksb::BuildContext::defaultGlobalFlags
         'install',
         'install-only',
         'list-build',
         'metadata-only',
         'niceness|nice:10',
         'no-build',
+        'D', # --no-include-dependencies, which is already pulled in via ksb::BuildContext::defaultGlobalFlags
         'no-install',
         'no-metadata',
-        'no-src|no-svn',
+        'no-src|no-svn|S',
         'no-tests',
         'prefix=s',
         'pretend|dry-run|p',
@@ -464,35 +479,36 @@ sub _supportedOptions
         'really-quiet',
         'rebuild-failures',
         'reconfigure',
-        'refresh-build',
+        'refresh-build|r',
         'resume',
-        'resume-after=s',
-        'resume-from=s',
+        'resume-after|after|a=s',
+        'resume-from|from|f=s',
         'revision=i',
         'set-module-option-value=s',
         'show-info',
-        'src-only|svn-only',
+        'src-only|svn-only|s',
         'start-program|run=s{,}',
-        'stop-after=s',
-        'stop-before=s',
+        'stop-after|to=s',
+        'stop-before|until=s',
         'uninstall',
         'verbose',
         'version|v',
     );
 
     # Remove stuff like ! and =s from list above;
-    my @optNames = map { m/([a-z-]+)/; $1 } @options;
+    my @optNames = map { m/([a-zA-Z-]+)/; $1 } @options;
 
     # Make sure this doesn't overlap with BuildContext default flags and options
     my %optsSeen;
 
-    $optsSeen{$_}++ foreach @optNames;
+    @optsSeen{@optNames} = (1) x @optNames;
+
     $optsSeen{$_}++ foreach keys %ksb::BuildContext::defaultGlobalFlags;
     $optsSeen{$_}++ foreach keys %ksb::BuildContext::defaultGlobalOptions;
 
     my @violators = grep { $optsSeen{$_} > 1 } keys %optsSeen;
     if (@violators) {
-        die "Options " . join(', ', @violators) . "overlap in ksb::Cmdline!";
+        die "The following options overlap in ksb::Cmdline: [" . join(', ', @violators) . "]!";
     }
 
     return @options;


More information about the kde-doc-english mailing list