[kdesrc-build] /: dep-resolv: Introduce --no-include-dependencies cmdline opt.

Michael Pyne null at kde.org
Sat Aug 31 23:02:28 BST 2019


Git commit 6c10817e55adcbb14ff17b5df8c224f5e416862c by Michael Pyne.
Committed on 31/08/2019 at 22:01.
Pushed by mpyne into branch 'master'.

dep-resolv: Introduce --no-include-dependencies cmdline opt.

Does what it says on the tin, to permit disabling dependency inclusion
on a one-time basis without editing config file. This just involved
moving changing this option internally to be a 'global flag' which
already are automagically able to be negated by precedining with --no-.

When adding documentation for it I noticed I had not documented it in
the Docbook docs so I've added docs for that and --include-dependencies
also and updated copyright.

This should also support updating other documentation for the issue
being tracked at #31

M  +25   -4    doc/index.docbook
M  +8    -5    doc/man-kdesrc-build.1.docbook
M  +1    -1    kdesrc-build
M  +3    -3    modules/ksb/Application.pm
M  +1    -0    modules/ksb/BuildContext.pm
M  +5    -0    t/data/sample-rc/kdesrc-buildrc
C  +4    -0    t/data/sample-rc/kdesrc-buildrc-with-deps [from: t/data/sample-rc/kdesrc-buildrc - 074% similarity]
A  +76   -0    t/smoke/cmdline-no-include-dependencies.t

https://invent.kde.org/kde/kdesrc-build/commit/6c10817e55adcbb14ff17b5df8c224f5e416862c

diff --git a/doc/index.docbook b/doc/index.docbook
index bae5759..b2dd5eb 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -2,7 +2,7 @@
 <!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
   <!--
     Documentation for kdesrc-build.
-    Copyright (c) 2005-2008, 2010-2018 Michael Pyne <mpyne at kde.org>
+    Copyright (c) 2005-2008, 2010-2019 Michael Pyne <mpyne at kde.org>
 
     Copyright (c) 2005 Carlos Leonhard Woelz <carloswoelz at imap-mail.com>
     Copyright (c) 2009 Burkhard Lück <lueck at hube-lueck.de>
@@ -99,6 +99,7 @@
 <year>2016</year>
 <year>2017</year>
 <year>2018</year>
+<year>2019</year>
 <holder>Michael Pyne</holder>
 </copyright>
 
@@ -2294,9 +2295,9 @@ modules</link>, and requires that the metadata maintained by the &kde;
 developers is accurate for your selected <link
 linkend="conf-branch-group">branch-group</link>.</para></note>
 
-<para>This option is disabled by default, to avoid inadvertently selecting a
-bunch of modules that were not desired. It was added with &kdesrc-build;
-1.16 in 2015.</para>
+<para>This option is enabled by default, to support building applications
+that need versions of &Qt; or &plasma; more recent than supported on
+common operating systems.</para>
 </entry>
 </row>
 
@@ -3207,6 +3208,26 @@ work.</para></note>
 </listitem>
 </varlistentry>
 
+<varlistentry id="cmdline-include-dependencies">
+<term><parameter>--include-dependencies</parameter></term>
+<term><parameter>--no-include-dependencies</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
+on the command line or in your
+<link linkend="configure-data">configuration file</link>.</para>
+
+<para>The modules that are added are as recorded within the &kde; source code
+management system. See <xref linkend="kde-projects-module-sets"/>.</para>
+
+<para>The corresponding configure file option is
+<link linkend="conf-include-dependencies">include-dependencies</link>.</para>
+
+<para>You can also use <parameter>--no-include-dependencies</parameter>, which turns off
+automatic inclusion of additional dependency modules.</para>
+</listitem>
+</varlistentry>
+
 <varlistentry id="cmdline-ignore-modules">
 <term><parameter>--ignore-modules</parameter></term>
 <listitem><para>
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 3743139..7aa3ad4 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -6,7 +6,7 @@
 
 <!--
     Man page for kdesrc-build.
-    Copyright (c) 2011, 2014-2016 Michael Pyne <mpyne at kde.org>
+    Copyright (c) 2011, 2014-2019 Michael Pyne <mpyne at kde.org>
 
     Permission is granted to copy, distribute and/or modify this document under
     the terms of the GNU Free Documentation License, Version 1.2 or any later
@@ -23,14 +23,14 @@
     <email>mpyne at kde.org</email>
     <personblurb><para>Authored man page</para></personblurb>
 </author>
-<date>2016-05-02</date>
-<releaseinfo>kdesrc-build 16.05</releaseinfo>
+<date>2019-08-31</date>
+<releaseinfo>kdesrc-build 19.08</releaseinfo>
 </refentryinfo>
 
 <refmeta>
 <refentrytitle><command>kdesrc-build</command></refentrytitle>
 <manvolnum>1</manvolnum>
-<refmiscinfo class="version">16.05</refmiscinfo>
+<refmiscinfo class="version">19.08</refmiscinfo>
 </refmeta>
 
 <refnamediv>
@@ -452,6 +452,7 @@ combining short options into one at this point. (E.g. running
 <varlistentry>
 <term>
 <option>--include-dependencies</option>
+<option>--no-include-dependencies</option>
 </term>
 
 <listitem>
@@ -460,6 +461,8 @@ combining short options into one at this point. (E.g. running
     it would normally build (either because they were specified on the command
     line, or mentioned in the configuration file), but also to include
     <emphasis>known dependencies</emphasis> of those modules in the build.
+    This is normally the default; you can use <option>--no-include-dependencies</option>
+    to disable this effect.
 </para>
 
 <para>
@@ -1307,7 +1310,7 @@ url="https://docs.kde.org/index.php?application=kdesrc-build">https://docs.kde.o
 <refsect1>
 <title>COPYING</title>
 
-<para>Copyright (C) 2003-2015 Michael Pyne.</para>
+<para>Copyright (C) 2003-2019 Michael Pyne.</para>
 
 <para>This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the Free
diff --git a/kdesrc-build b/kdesrc-build
index e2b79eb..233ce25 100755
--- a/kdesrc-build
+++ b/kdesrc-build
@@ -7,7 +7,7 @@
 # Please also see the documentation that should be included with this program,
 # in the doc/ directory.
 #
-# Copyright © 2003 - 2018 Michael Pyne. <mpyne at kde.org>
+# Copyright © 2003 - 2019 Michael Pyne. <mpyne at kde.org>
 # Home page: https://kdesrc-build.kde.org/
 #
 # Copyright © 2005, 2006, 2008 - 2011 David Faure <faure at kde.org>
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 6460669..9fcc617 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -302,8 +302,7 @@ DONE
         'revision=i', 'resume-from=s', 'resume-after=s',
         'rebuild-failures', 'resume',
         'stop-after=s', 'stop-before=s', 'set-module-option-value=s',
-        'metadata-only', 'include-dependencies', 'list-build',
-        'dependency-tree',
+        'metadata-only', 'list-build', 'dependency-tree',
 
         # Special sub used (see above), but have to tell Getopt::Long to look
         # for negatable boolean flags
@@ -2707,7 +2706,7 @@ sub _showHelpMessage
     my $scriptVersion = scriptVersion();
     say <<DONE;
 kdesrc-build $scriptVersion
-Copyright (c) 2003 - 2018 Michael Pyne <mpyne\@kde.org> and others, and is
+Copyright (c) 2003 - 2019 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
@@ -2742,6 +2741,7 @@ Important Options:
     --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)
     --stop-on-failure      Stops the build as soon as a package fails to build.
 
 More docs at https://docs.kde.org/trunk5/en/extragear-utils/kdesrc-build/
diff --git a/modules/ksb/BuildContext.pm b/modules/ksb/BuildContext.pm
index ffa5d9b..93082ff 100644
--- a/modules/ksb/BuildContext.pm
+++ b/modules/ksb/BuildContext.pm
@@ -82,6 +82,7 @@ our %defaultGlobalFlags = (
     "disable-agent-check"        => 0, # If true we don't check on ssh-agent
     "disable-snapshots"          => 1, # 2016-07-31 Temp. disabled until kde.org fixed to supply snapshots
     "ignore-kde-structure"       => 0, # Whether to use kde dir structure like extragear/network
+    "include-dependencies"       => 1, # 2019-08-31 Made negatable from cmdline
     "install-after-build"        => 1,
     "install-environment-driver" => 1, # Setup ~/.config/kde-env-*.sh for login scripts
     "install-session-driver"     => 0, # Above, + ~/.xsession
diff --git a/t/data/sample-rc/kdesrc-buildrc b/t/data/sample-rc/kdesrc-buildrc
index 069ec35..cdb81c3 100644
--- a/t/data/sample-rc/kdesrc-buildrc
+++ b/t/data/sample-rc/kdesrc-buildrc
@@ -1,11 +1,16 @@
 # Sample rc file just for testing purposes
 
+# This should be the same as kdesrc-build-with-deps except for
+# include-dependencies
+
 global
     source-dir /tmp
     make-options -j4
     git-repository-base fake git://localhost/git-set/
     cmake-options "-DCMAKE_BUILD_TYPE=a b" bar=c baz
     cxxflags # empty
+    # Make sure the cmdline switch in corresponding test is picked up
+    include-dependencies false
 end global
 
 module-set set1
diff --git a/t/data/sample-rc/kdesrc-buildrc b/t/data/sample-rc/kdesrc-buildrc-with-deps
similarity index 74%
copy from t/data/sample-rc/kdesrc-buildrc
copy to t/data/sample-rc/kdesrc-buildrc-with-deps
index 069ec35..c61f328 100644
--- a/t/data/sample-rc/kdesrc-buildrc
+++ b/t/data/sample-rc/kdesrc-buildrc-with-deps
@@ -1,11 +1,15 @@
 # Sample rc file just for testing purposes
 
+# This should be same as kdesrc-buildrc except for include-dependencies
+
 global
     source-dir /tmp
     make-options -j4
     git-repository-base fake git://localhost/git-set/
     cmake-options "-DCMAKE_BUILD_TYPE=a b" bar=c baz
     cxxflags # empty
+    # Make sure the cmdline switch in corresponding test is picked up
+    include-dependencies true
 end global
 
 module-set set1
diff --git a/t/smoke/cmdline-no-include-dependencies.t b/t/smoke/cmdline-no-include-dependencies.t
new file mode 100644
index 0000000..ab843df
--- /dev/null
+++ b/t/smoke/cmdline-no-include-dependencies.t
@@ -0,0 +1,76 @@
+use 5.014;
+use strict;
+use warnings;
+
+# Verify that --no-include-dependencies is recognized and results
+# in right value.
+
+use Test::More;
+
+use ksb::Application;
+use ksb::Module;
+
+# Redefine ksb::Application::_resolveModuleDependencies to avoid requiring metadata
+# module.
+package ksb::Application {
+    no warnings 'redefine';
+
+    sub _resolveModuleDependencyGraph {
+        my $self = shift;
+        my @modules = @_;
+
+        my $newModule = $self->{module_factory}->('setmod2');
+
+        my $graph = {
+            'setmod1' => {
+                votes => {
+                    'setmod2' => 1,
+                    'setmod3' => 1
+                },
+                build => 1,
+                module => $modules[0]
+            },
+            'setmod2' => {
+                votes => {
+                    'setmod3' => 1
+                },
+                build => !!$self->context()->getOption('include-dependencies'),
+                module => $newModule
+            },
+            'setmod3' => {
+                votes => {},
+                build => 1,
+                module => $modules[1]
+            }
+        };
+
+        my $result = {
+            graph => $graph
+        };
+
+        return $result;
+    }
+};
+
+my @args = qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc-with-deps --no-include-dependencies setmod1 setmod3);
+
+{
+    my $app = ksb::Application->new(@args);
+    my @moduleList = @{$app->{modules}};
+
+    is (scalar @moduleList, 2, 'Right number of modules (include-dependencies)');
+    is ($moduleList[0]->name(), 'setmod1', 'mod list[0] == setmod1');
+    is ($moduleList[1]->name(), 'setmod3', 'mod list[2] == setmod3');
+}
+
+{
+    push @args, '--ignore-modules', 'setmod2';
+    my $app = ksb::Application->new(@args);
+    my @moduleList = @{$app->{modules}};
+
+    is (scalar @moduleList, 2, 'Right number of modules (include-dependencies+ignore-modules)');
+    is ($moduleList[0]->name(), 'setmod1', 'mod list[0] == setmod1');
+    is ($moduleList[1]->name(), 'setmod3', 'mod list[1] == setmod3');
+}
+
+done_testing();


More information about the kde-doc-english mailing list