[sdk/kdesrc-build] /: Support invoking initial setup steps separately

Thiago Sueto null at kde.org
Thu Nov 23 15:57:41 GMT 2023


Git commit 7e1ceafd61b754fc55186d95fd4e241482c10361 by Thiago Sueto, on behalf of Andrew Shark.
Committed on 23/11/2023 at 16:57.
Pushed by thiagosueto into branch 'master'.

Support invoking initial setup steps separately

Related to https://invent.kde.org/sdk/kdesrc-build/-/issues/132

M  +3    -0    completions/zsh/_kdesrc-build
M  +32   -1    doc/index.docbook
M  +39   -0    doc/man-kdesrc-build.1.docbook
M  +20   -2    kdesrc-build
M  +10   -3    modules/ksb/FirstRun.pm

https://invent.kde.org/sdk/kdesrc-build/-/commit/7e1ceafd61b754fc55186d95fd4e241482c10361

diff --git a/completions/zsh/_kdesrc-build b/completions/zsh/_kdesrc-build
index 1c28bffe..f9b3d7ec 100644
--- a/completions/zsh/_kdesrc-build
+++ b/completions/zsh/_kdesrc-build
@@ -18,6 +18,9 @@ _arguments \
   '--refresh-build[Start the build from scratch]' \
   '--rc-file=[Read configuration from filename instead of default]:::_files' \
   '--initial-setup[Installs Plasma env vars (~/.bashrc), required system pkgs, and a base kdesrc-buildrc]' \
+  '--install-distro-packages[Installs required system pkgs]' \
+  '--generate-config[Installs a base kdesrc-buildrc]' \
+  '--update-shellrc[Installs Plasma env vars (~/.bashrc)]' \
   '(--resume-from --resume-after)'{--resume-from=,--resume-after=}'[Skips modules until just before or after the given package, then operates as normal]:::_kdesrc-build_modules' \
   '(--stop-before --stop-after)'{--stop-before=,--stop-after=}'[Stops just before or after the given package is reached]:::_kdesrc-build_modules' \
   '(--include-dependencies --no-include-dependencies)'{--include-dependencies,--no-include-dependencies}'[Builds/Skip KDE-based dependencies]' \
diff --git a/doc/index.docbook b/doc/index.docbook
index c1305c7f..5a671799 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -3086,8 +3086,39 @@ software to run.
 <listitem><para>Adding required environment variables to <literal>~/.bashrc</literal></para></listitem>
 <listitem><para>Setting up a <link linkend="setup-rcfile">configuration file</link></para></listitem>
 </itemizedlist>
+<para>This option is exactly equivalent to using
+    <option><link linkend="cmdline-install-distro-packages">--install-distro-packages</link></option>
+    <option><link linkend="cmdline-generate-config">--generate-config</link></option>
+    <option><link linkend="cmdline-update-shellrc">--update-shellrc</link></option> at the same time.
+</para>
+</listitem>
+</varlistentry>
 
-<para>Available since version 18.11.</para>
+<varlistentry id="cmdline-install-distro-packages">
+<term><parameter>--install-distro-packages</parameter></term>
+<listitem><para>
+Installs distro packages (on supported &Linux; distributions) necessary to prepare the system for &kdesrc-build; to operate, and for the newly-installed &kde;
+software to run.
+</para>
+<para>See also <option><link linkend="cmdline-initial-setup">--initial-setup</link></option></para>
+</listitem>
+</varlistentry>
+
+<varlistentry id="cmdline-generate-config">
+<term><parameter>--generate-config</parameter></term>
+<listitem><para>
+Generate the &kdesrc-build; configuration file.
+</para>
+<para>See also <option><link linkend="cmdline-initial-setup">--initial-setup</link></option></para>
+</listitem>
+</varlistentry>
+
+<varlistentry id="cmdline-update-shellrc">
+<term><parameter>--update-shellrc</parameter></term>
+<listitem><para>
+Edit the "~/.bashrc" (or other shell rc file) to add &kdesrc-build; to your $PATH variable and enable autocompletion.
+</para>
+<para>See also <option><link linkend="cmdline-initial-setup">--initial-setup</link></option></para>
 </listitem>
 </varlistentry>
 
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 8ef987a9..f9537776 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -130,6 +130,45 @@ combining short options into one at this point. (E.g. running
     distributions.  This includes installation of known system dependencies, a
     default configuration file setup, and changes to your ~/.bashrc to make the
     software installed by &kdesrc-build; accessible.
+
+    This is exactly equivalent to using "--install-distro-packages --generate-config --update-shellrc" at the same time.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<option>--install-distro-packages</option>
+</term>
+
+<listitem>
+<para>
+Installs distro packages (on supported &Linux; distributions) necessary to prepare the system for &kdesrc-build; to operate, and for the newly-installed &kde;
+software to run.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<option>--generate-config</option>
+</term>
+
+<listitem>
+<para>
+Generate the &kdesrc-build; configuration file.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<option>--update-shellrc</option>
+</term>
+
+<listitem>
+<para>
+Edit the "~/.bashrc" (or other shell rc file) to add &kdesrc-build; to your $PATH variable and enable autocompletion.
 </para>
 </listitem>
 </varlistentry>
diff --git a/kdesrc-build b/kdesrc-build
index e70c6c99..1ffaa32b 100755
--- a/kdesrc-build
+++ b/kdesrc-build
@@ -88,11 +88,29 @@ use ksb; # Enable boilerplate
 # our modules although we can find them. In this case we should help user
 # by setting up system dependencies.
 eval {
-    if (grep { $_ eq '--initial-setup' } @ARGV) {
+    my @setup_steps;
+
+    if (grep { $_ eq "--initial-setup" } @ARGV) {
+        push @setup_steps, "install-distro-packages";
+        push @setup_steps, "generate-config";
+        push @setup_steps, "update-shellrc";
+    } else {
+        if (grep {$_ eq "--install-distro-packages"} @ARGV) {
+            push @setup_steps, "install-distro-packages";
+        }
+        if (grep {$_ eq "--generate-config"} @ARGV) {
+            push @setup_steps, "generate-config";
+        }
+        if (grep {$_ eq "--update-shellrc"} @ARGV) {
+            push @setup_steps, "update-shellrc";
+        }
+    }
+
+    if (@setup_steps) {
         require ksb::FirstRun;
         require ksb::Debug;
         ksb::Debug::setColorfulOutput(1);
-        exit ksb::FirstRun::setupUserSystem(File::Spec->rel2abs($RealBin));
+        exit ksb::FirstRun::setupUserSystem(File::Spec->rel2abs($RealBin), @setup_steps);
     }
 };
 
diff --git a/modules/ksb/FirstRun.pm b/modules/ksb/FirstRun.pm
index 9840ed68..7d1de0ee 100644
--- a/modules/ksb/FirstRun.pm
+++ b/modules/ksb/FirstRun.pm
@@ -101,14 +101,21 @@ sub yesNoPrompt {
 sub setupUserSystem
 {
     my $baseDir = shift;
+    my @setup_steps = @_;
     my $os = ksb::OSSupport->new;
     my $envShell = $ENV{'SHELL'} // 'undefined';
     my $shellName = (split '/', $envShell)[-1];
 
     eval {
-        _installSystemPackages($os);
-        _setupBaseConfiguration($baseDir);
-        _setupShellRcFile($shellName, $baseDir);
+        if (grep { $_ eq "install-distro-packages" } @setup_steps) {
+            _installSystemPackages($os);
+        }
+        if (grep { $_ eq "generate-config" } @setup_steps) {
+            _setupBaseConfiguration($baseDir);
+        }
+        if (grep { $_ eq "update-shellrc" } @setup_steps) {
+            _setupShellRcFile($shellName, $baseDir);
+        }
     };
 
     if (had_an_exception($@)) {


More information about the kde-doc-english mailing list