[kde-doc-english] [kdesrc-build] /: kde-projects: Add --no-metadata command line option.

Michael Pyne mpyne at kde.org
Sat Mar 15 22:50:46 UTC 2014


Git commit 900a08a7d8421452be08d0e0967d46975541cb21 by Michael Pyne.
Committed on 15/03/2014 at 22:51.
Pushed by mpyne into branch 'master'.

kde-projects: Add --no-metadata command line option.

BUG:331939
FIXED-IN:1.16

M  +12   -0    doc/index.docbook
M  +20   -0    doc/man-kdesrc-build.1.docbook
M  +11   -7    modules/ksb/Application.pm
M  +1    -1    modules/ksb/BuildContext.pm

http://commits.kde.org/kdesrc-build/900a08a7d8421452be08d0e0967d46975541cb21

diff --git a/doc/index.docbook b/doc/index.docbook
index 2808bf2..ccdac0a 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -2855,6 +2855,18 @@ Skip the build process.
 </para></listitem>
 </varlistentry>
 
+<varlistentry id="cmdline-no-metadata">
+<term><parameter>--no-metadata</parameter></term>
+<listitem><para>
+Do not automatically download the extra metadata needed for &kde; git modules.
+The source updates for the modules themselves will still occur unless you pass
+<link linkend="cmdline-no-src">--no-src</link> as well.
+</para><para>
+This can be useful if you are frequently re-running &kdesrc-build; since the
+metadata does not change very often.
+</para></listitem>
+</varlistentry>
+
 <varlistentry id="cmdline-no-install">
 <term><parameter>--no-install</parameter></term>
 <listitem><para>
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index f58b619..7a6a642 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -163,6 +163,26 @@ combining short options into one at this point. (E.g. running
 
 <varlistentry>
 <term>
+<option>--no-metadata</option>
+</term>
+
+<listitem>
+<para>
+    Skips the metadata update phase for KDE modules. Other phases (including
+    the source update phase) are included as normal. If you wish to avoid all network
+    updates you should also pass <option>--no-src</option>.
+</para>
+
+<para>
+    This option can be useful if you are frequently running
+    <command>kdesrc-build</command> since the metadata itself does not change
+    very often.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
 <option>--no-install</option>
 </term>
 
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 6046ed6..0ee640b 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -259,7 +259,7 @@ DONE
     GetOptionsFromArray(\@options, \%foundOptions,
         'version', 'author', 'help', 'disable-snapshots|no-snapshots',
         'install', 'uninstall', 'no-src|no-svn', 'no-install', 'no-build',
-        'no-tests', 'build-when-unchanged|force-build',
+        'no-tests', 'build-when-unchanged|force-build', 'no-metadata',
         'verbose|v', 'quiet|quite|q', 'really-quiet', 'debug',
         'reconfigure', 'colorful-output|color!', 'async!',
         'src-only|svn-only', 'build-only', 'install-only', 'build-system-only',
@@ -609,9 +609,9 @@ sub generateModuleList
     return @modules;
 }
 
-# Causes kde-projects metadata to be downloaded (unless --pretend or --no-src
-# is in effect, although we'll download even in --pretend if nothing is
-# available).
+# Causes kde-projects metadata to be downloaded (unless --pretend, --no-src, or
+# --no-metadata is in effect, although we'll download even in --pretend if
+# nothing is available).
 #
 # No return value.
 sub _downloadKDEProjectMetadata
@@ -624,13 +624,17 @@ sub _downloadKDEProjectMetadata
         my $sourceDir = $metadataModule->getSourceDir();
         super_mkdir($sourceDir);
 
+        my $updateDesired = !$ctx->getOption('no-metadata') && $ctx->phases()->has('update');
         my $updateNeeded = (! -e "$sourceDir/dependency-data-common");
-        if (!$ctx->phases()->has('update') && $updateNeeded) {
-            warning (" r[b[*] Skipping build metadata update due to b[--no-src], but this is apparently required!");
+        my $lastUpdate = $ctx->getPersistentOption('global', 'last-metadata-update') // 0;
+
+        if (!$updateDesired && $updateNeeded && (time - ($lastUpdate)) >= 7200) {
+            warning (" r[b[*] Skipping build metadata update, but it hasn't been updated recently!");
         }
 
-        if ($ctx->phases()->has('update') && (!pretending() || $updateNeeded)) {
+        if ($updateDesired && (!pretending() || $updateNeeded)) {
             $metadataModule->scm()->updateInternal();
+            $ctx->setPersistentOption('global', 'last-metadata-update', time);
         }
     };
 
diff --git a/modules/ksb/BuildContext.pm b/modules/ksb/BuildContext.pm
index c5f25e4..5b92bc5 100644
--- a/modules/ksb/BuildContext.pm
+++ b/modules/ksb/BuildContext.pm
@@ -878,7 +878,7 @@ sub getKDEProjectMetadataFilehandle
 
     # Must use ->phases() directly to tell if we will be updating since
     # modules are not all processed until after this function is called...
-    my $updating = grep { /^update$/ } (@{$self->phases()});
+    my $updating = grep { /^update$/ } (@{$self->phases()}) && !$self->getOption('no-metadata');
     if (!pretending() && $updating) {
         info (" * Downloading projects.kde.org project database...");
         $result = download_file($url, $file, $self->getOption('http-proxy'));


More information about the kde-doc-english mailing list