[kdesrc-build/make_it_mojo] /: mojo: Remove dead code and improve comments.
Michael Pyne
null at kde.org
Mon Oct 8 18:57:42 BST 2018
Git commit 00d9c269d7c4bc43fdf078f4161f242c1b16841a by Michael Pyne.
Committed on 24/09/2018 at 00:19.
Pushed by mpyne into branch 'make_it_mojo'.
mojo: Remove dead code and improve comments.
In particular I consider 'async' as rock solid as kdesrc-build typically
gets so I'm making it the only mode to ease the testing burden as this
branch gets more integrated into Mojolicious.
M +0 -6 CMakeLists.txt
M +15 -24 doc/index.docbook
M +0 -29 doc/man-kdesrc-build.1.docbook
M +10 -18 modules/ksb/Application.pm
D +0 -402 modules/ksb/IPC.pm
D +0 -39 modules/ksb/IPC/Null.pm
D +0 -126 modules/ksb/IPC/Pipe.pm
M +4 -4 vim/syntax/kdesrc-buildrc.vim
https://commits.kde.org/kdesrc-build/00d9c269d7c4bc43fdf078f4161f242c1b16841a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1570c15..09b0b63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,6 @@ if (KDESRC_BUILD_INSTALL_MODULES)
modules/ksb/BuildSystem.pm
modules/ksb/Debug.pm
modules/ksb/DependencyResolver.pm
- modules/ksb/IPC.pm
modules/ksb/KDEProjectsReader.pm
modules/ksb/Module.pm
modules/ksb/ModuleResolver.pm
@@ -73,11 +72,6 @@ if (KDESRC_BUILD_INSTALL_MODULES)
modules/ksb/ModuleSet/Null.pm
DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/ModuleSet)
- install(FILES
- modules/ksb/IPC/Null.pm
- modules/ksb/IPC/Pipe.pm
- DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/IPC)
-
install(FILES
modules/ksb/Updater/Bzr.pm
modules/ksb/Updater/Git.pm
diff --git a/doc/index.docbook b/doc/index.docbook
index 62869e6..3ccbe25 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -1774,11 +1774,17 @@ linkend="conf-repository">repository</link> option.</entry>
<row id="conf-async">
<entry>async</entry>
<entry>Cannot be overridden</entry>
-<entry><para>This option enables the asynchronous mode of operation, where the source
-code update and the build process will be performed in parallel, instead of waiting for
-all of the source code updates before starting the build process. This option defaults
-to enabling asynchronous mode. To disable, set this option to <userinput>false</userinput></para>
-<para>This option is available since the 1.6 release.</para></entry>
+<entry><para>This option used to control the asynchronous mode of operation,
+permitting source code updates to happen at the same time as the build process
+when possible, instead of waiting for all of the source code updates before
+starting the build process.</para>
+<para>Asynchronous is the only supported mode of operation, though you can
+still use separate <link linkend="cmdline-no-src">--no-src</link> and <link
+linkend="cmdline-no-build">--no-build</link> script runs to achieve the same
+effect.</para>
+<para>This option was available since the 1.6 release and removed late
+2018.</para>
+</entry>
</row>
<row id="conf-binpath">
@@ -2977,16 +2983,6 @@ The script accepts the following command-line options:
<variablelist>
-<varlistentry id="cmdline-async">
-<term><parameter>--async</parameter></term>
-<listitem><para>
-Enables the <link linkend="conf-async">asynchronous mode</link>, which can
-perform the source code updates and module builds at the same time. This is
-the default, this option only needs specified if you have disabled it in the
-configuration.
-</para></listitem>
-</varlistentry>
-
<varlistentry id="cmdline-help">
<term><parameter>--help</parameter></term>
<listitem><para>
@@ -3029,11 +3025,9 @@ to 10.
<varlistentry id="cmdline-no-async">
<term><parameter>--no-async</parameter></term>
<listitem><para>
-Disables the <link linkend="conf-async">asynchronous mode</link> of updating.
-Instead the update will be performed in its entirety before the build starts.
-This option will slow down the overall process, but if you encounter IPC errors
-while running &kdesrc-build; try using this option, and submitting a
-<ulink url="https://bugs.kde.org/">bug report</ulink>.
+This option used to disables the asynchronous mode of updating. Due to lack of
+testing and the reliability of the asynchronous mode, this option has been
+disabled and asynchronous builds are always in effect.
</para></listitem>
</varlistentry>
@@ -3592,10 +3586,7 @@ linkend="conf-log-dir">log-dir</link> option, you would do:
<note><para>This feature can only be used for option names already recognized
by &kdesrc-build;, that are not already supported by relevant command line
-options. For example the <link linkend="conf-async">async</link> configuration
-file option has specific <link linkend="cmdline-async">--async</link> and <link
-linkend="cmdline-no-async">--no-async</link> command line options that are
-preferred by &kdesrc-build;.
+options.
</para></note>
</listitem>
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index 0d0602f..b04f6be 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -739,35 +739,6 @@ kdepim: master
</listitem>
</varlistentry>
-<varlistentry>
-<term>
-<option>--async</option>
-</term>
-
-<listitem>
-<para>
- Have <command>kdesrc-build</command> start the build process for a module
- as soon as the source code has finished downloading. Without this option
- <command>kdesrc-build</command> performs all source updates at once and
- only then starts with the build process. This option is enabled by default.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term>
-<option>--no-async</option>
-</term>
-
-<listitem>
-<para>
- Disables asynchronous building of modules. See <option>--async</option> for
- a more detailed description. Note that <command>kdesrc-build</command>'s
- output will be slightly different in this mode.
-</para>
-</listitem>
-</varlistentry>
-
<varlistentry>
<term>
<option>-v, --verbose</option>
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 1edb060..e444ceb 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -273,7 +273,7 @@ DONE
'install', 'uninstall', 'no-src|no-svn', 'no-install', 'no-build',
'no-tests', 'build-when-unchanged|force-build', 'no-metadata',
'verbose|v', 'quiet|quite|q', 'really-quiet', 'debug',
- 'reconfigure', 'colorful-output|color!', 'async!',
+ 'reconfigure', 'colorful-output|color!',
'src-only|svn-only', 'build-only', 'install-only', 'build-system-only',
'rc-file=s', 'prefix=s', 'niceness|nice:10', 'ignore-modules=s{,}',
'print-modules', 'pretend|dry-run|p', 'refresh-build',
@@ -361,9 +361,6 @@ sub establishContext
$ctx->setRcFile($cmdlineGlobalOptions->{'rc-file'});
}
- # disable async if only running a single phase.
- $cmdlineGlobalOptions->{async} = 0 if (scalar $ctx->phases()->phases() == 1);
-
my $fh = $ctx->loadRcFile();
$ctx->loadPersistentOptions();
@@ -690,19 +687,14 @@ sub runAllModulePhases
if ($runMode eq 'build')
{
- # No packages to install, we're in build mode
-
- # What we're going to do is fork another child to perform the source
- # updates while we build.
- my $updateOptsSub = sub {
- my ($k, $v) = @_;
- $ctx->setPersistentOption($k, $v);
- };
-
+ # Build then install packages
$result = _handle_async_build ($ctx);
}
elsif ($runMode eq 'install')
{
+ # Install directly
+ # TODO: Merge with previous by splitting 'install' into a separate
+ # phase
$result = _handle_install ($ctx);
}
elsif ($runMode eq 'uninstall')
@@ -758,7 +750,7 @@ sub finish
if (pretending() || $self->{_base_pid} != $$) {
# Abort early if pretending or if we're not the same process
- # that was started by the user (e.g. async mode, forked pipe-opens
+ # that was started by the user (for async mode)
exit $exitcode;
}
@@ -1978,7 +1970,6 @@ sub _handle_async_build
my ($ctx) = @_;
my $kdesrc = $ctx->getSourceDir();
- my @updateList = $ctx->modulesInPhase('update');
my $result = 0;
my $update_done = 0;
@@ -2405,9 +2396,10 @@ sub _output_failed_module_list
{
$logfile = $module->getOption('#error-log-file');
- # async updates may cause us not to have a error log file stored. There's only
- # one place it should be though, take advantage of side-effect of log_command()
- # to find it.
+ # async updates may cause us not to have a error log file stored
+ # (though this should now only happen due to other bugs). Since
+ # there's only one place it should be, take advantage of
+ # side-effect of log_command() to find it.
if (not $logfile) {
my $logdir = $module->getLogDir() . "/error.log";
$logfile = $logdir if -e $logdir;
diff --git a/modules/ksb/IPC.pm b/modules/ksb/IPC.pm
deleted file mode 100644
index a57e8f5..0000000
--- a/modules/ksb/IPC.pm
+++ /dev/null
@@ -1,402 +0,0 @@
-package ksb::IPC;
-
-# Handles the asynchronous communications needed to perform update and build
-# processes at the same time. This can be thought of as a partially-abstract
-# class, really you should use IPC::Null (which is fully synchronous) or
-# IPC::Pipe, which both fall back to common methods implemented here.
-
-use strict;
-use warnings;
-use 5.014;
-no if $] >= 5.018, 'warnings', 'experimental::smartmatch';
-
-our $VERSION = '0.20';
-
-use ksb::Util; # make_exception, list_has
-use ksb::Debug;
-
-# IPC message types
-use constant {
- MODULE_SUCCESS => 1, # Used for a successful src checkout
- MODULE_FAILURE => 2, # Used for a failed src checkout
- MODULE_SKIPPED => 3, # Used for a skipped src checkout (i.e. build anyways)
- MODULE_UPTODATE => 4, # Used to skip building a module when had no code updates
-
- # One of these messages should be the first message placed on the queue.
- ALL_SKIPPED => 5, # Used to indicate a skipped update process (i.e. build anyways)
- ALL_FAILURE => 6, # Used to indicate a major update failure (don't build)
- ALL_UPDATING => 7, # Informational message, feel free to start the build.
-
- # Used to indicate specifically that a source conflict has occurred.
- MODULE_CONFLICT => 8,
-
- MODULE_LOGMSG => 9, # Tagged message should be put to TTY for module.
-
- MODULE_PERSIST_OPT => 10, # Change to a persistent module option
-
- ALL_DONE => 11, # Affirmatively flags that all updates are done
-};
-
-sub new
-{
- my $class = shift;
- my $defaultOpts = {
- no_update => 0,
- updated => { },
- logged_module => 'global',
- messages => { }, # Holds log output from update process
- updates_done => 0,
- opt_update_handler => undef, # Callback for persistent option changes
- };
-
- # Must bless a hash ref since subclasses expect it.
- return bless $defaultOpts, $class;
-}
-
-# Sends a message to the main/build process that a persistent option for the
-# given module name must be changed. For use by processes that do not control
-# the persistent option store upon shutdown.
-sub notifyPersistentOptionChange
-{
- my $self = shift;
- my ($moduleName, $optName, $optValue) = @_;
-
- $self->sendIPCMessage(ksb::IPC::MODULE_PERSIST_OPT, "$moduleName,$optName,$optValue");
-}
-
-sub notifyUpdateSuccess
-{
- my $self = shift;
- my ($module, $msg) = @_;
-
- $self->sendIPCMessage(ksb::IPC::MODULE_SUCCESS, "$module,$msg");
-}
-
-# Sets which module messages stored by sendLogMessage are supposed to be
-# associated with.
-sub setLoggedModule
-{
- my ($self, $moduleName) = @_;
- $self->{logged_module} = $moduleName;
-}
-
-# Sends a message to be logged by the process holding the TTY.
-# The logged message is associated with the module set by setLoggedModule.
-sub sendLogMessage
-{
- my ($self, $msg) = @_;
- my $loggedModule = $self->{logged_module};
-
- $self->sendIPCMessage(MODULE_LOGMSG, "$loggedModule,$msg");
-}
-
-# Prints the given message out (adjusting to have proper whitespace
-# if needed). For use with the log-message forwarding facility.
-sub _printLoggedMessage
-{
- my $msg = shift;
-
- $msg = "\t$msg" unless $msg =~ /^\s+/;
- ksb::Debug::print_clr($msg);
-}
-
-sub _updateSeenModulesFromMessage
-{
- my ($self, $ipcType, $buffer) = @_;
-
- my $updated = $self->{'updated'};
- my $messagesRef = $self->{'messages'};
- my $message;
-
- croak_runtime("IPC failure: no IPC mechanism defined") unless $ipcType;
-
- given ($ipcType) {
- when (ksb::IPC::MODULE_SUCCESS) {
- my ($ipcModuleName, $msg) = split(/,/, $buffer);
- $message = $msg;
- $updated->{$ipcModuleName} = 'success';
-
- }
- when (ksb::IPC::MODULE_SKIPPED) {
- # The difference between success here and 'skipped' below
- # is that success means we should build even though we
- # didn't perform an update, while 'skipped' means the
- # *build* should be skipped even though there was no
- # failure.
- $message = 'skipped';
- $updated->{$buffer} = 'success';
- }
- when (ksb::IPC::MODULE_CONFLICT) {
- $message = 'conflicts present';
- $updated->{$buffer} = 'failed';
- }
- when (ksb::IPC::MODULE_FAILURE) {
- $message = 'update failed';
- $updated->{$buffer} = 'failed';
- }
- when (ksb::IPC::MODULE_UPTODATE) {
- # Although the module source hasn't changed, the user might be forcing a
- # rebuild, so our message should reflect what's actually going to happen.
- $message = 'no files affected';
- my ($ipcModuleName, $refreshReason) = split(',', $buffer);
-
- if ($refreshReason)
- {
- $updated->{$ipcModuleName} = 'success';
- note ("\tNo source update, but $refreshReason");
- }
- else
- {
- $updated->{$ipcModuleName} = 'skipped';
- }
- }
- when (ksb::IPC::MODULE_PERSIST_OPT) {
- my ($ipcModuleName, $optName, $value) = split(',', $buffer);
- if ($self->{opt_update_handler}) {
- # Call into callback to update persistent options
- $self->{opt_update_handler}->($optName, $optName);
- }
- }
- when (ksb::IPC::MODULE_LOGMSG) {
- my ($ipcModuleName, $logMessage) = split(',', $buffer, 2);
-
- # Save it for later if we can't print it yet.
- $messagesRef->{$ipcModuleName} //= [ ];
- push @{$messagesRef->{$ipcModuleName}}, $logMessage;
- }
- when (ksb::IPC::ALL_DONE) {
- $self->{updates_done} = 1;
- }
- default {
- croak_internal("Unhandled IPC type: $ipcType");
- }
- };
-
- return $message;
-}
-
-# Used to assign a callback / subroutine to use for updating persistent
-# options based on IPC update messages. The sub should itself take a
-# key and value pair.
-sub setPersistentOptionHandler
-{
- my ($self, $handler) = @_;
- $self->{opt_update_handler} = $handler;
-}
-
-sub waitForEnd
-{
- my ($self, $module) = @_;
-
- $self->waitForStreamStart();
- while(!$self->{no_update} && !$self->{updates_done}) {
- my $buffer;
- my $ipcType = $self->receiveIPCMessage(\$buffer);
-
- # We ignore the return value in favor of ->{updates_done}
- $self->_updateSeenModulesFromMessage($ipcType, $buffer);
- }
-}
-
-# Waits for an update for a module with the given name.
-# Returns a list containing whether the module was successfully updated,
-# and any specific string message (e.g. for module update success you get
-# number of files affected)
-# Will throw an exception for an IPC failure or if the module should not be
-# built.
-sub waitForModule
-{
- my ($self, $module) = @_;
-
- my $moduleName = $module->name();
- my $updated = $self->{'updated'};
-
- # Wait for for the initial phase to complete, if it hasn't.
- $self->waitForStreamStart();
-
- # No update? Just mark as successful
- if ($self->{'no_update'} || !$module->phases()->has('update')) {
- $updated->{$moduleName} = 'success';
- return ('success', 'Skipped');
- }
-
- my $message;
- while(! defined $updated->{$moduleName} && !$self->{updates_done}) {
- my $buffer;
- my $ipcType = $self->receiveIPCMessage(\$buffer);
-
- $message = $self->_updateSeenModulesFromMessage($ipcType, $buffer);
- }
-
- # If we have 'global' messages they are probably for the first module and
- # include standard setup messages, etc. Print first and then print module's
- # messages.
- my $messagesRef = $self->{'messages'};
- for my $item ('global', $moduleName) {
- for my $msg (@{$messagesRef->{$item}}) {
- _printLoggedMessage($msg);
- }
-
- delete $messagesRef->{$item};
- }
-
- return ($updated->{$moduleName}, $message);
-}
-
-# Just in case we somehow have messages to display after all modules are
-# processed, we have this function to show any available messages near the end
-# of the script run.
-sub outputPendingLoggedMessages
-{
- my $self = shift;
- my $messages = $self->{messages};
-
- while (my ($module, $logMessages) = each %{$messages}) {
- my @nonEmptyMessages = grep { !!$_ } @{$logMessages};
- if (@nonEmptyMessages) {
- debug ("Unhandled messages for module $module:");
- ksb::Debug::print_clr($_) foreach @nonEmptyMessages;
- }
- }
-
- $self->{messages} = { };
-}
-
-# Flags the given module as something that can be ignored from now on. For use
-# after the module has been waited on
-sub forgetModule
-{
- my ($self, $module) = @_;
-
- my $modulename = $module->name();
- delete $self->{'updated'}->{$modulename};
-}
-
-# Returns a hashref mapping module *names* to update statuses, for modules that
-# have not already been marked as ignorable using forgetModule()
-sub unacknowledgedModules
-{
- my $self = shift;
-
- return $self->{'updated'};
-}
-
-# Waits on the IPC connection until one of the ALL_* IPC codes is returned.
-# If ksb::IPC::ALL_SKIPPED is returned then the 'no_update' entry will be set in
-# $self to flag that you shouldn't wait.
-# If ksb::IPC::ALL_FAILURE is returned then an exception will be thrown due to the
-# fatal error.
-# This method can be called multiple times, but only the first time will
-# result in a wait.
-sub waitForStreamStart
-{
- my $self = shift;
- state $waited = 0;
-
- return if $waited;
-
- my $buffer = '';
- my $ipcType = 0;
- $waited = 1;
-
- while ($ipcType != ksb::IPC::ALL_UPDATING) {
- $ipcType = $self->receiveIPCMessage(\$buffer);
-
- if (!$ipcType) {
- croak_internal("IPC Failure waiting for stream start :( $!");
- }
- if ($ipcType == ksb::IPC::ALL_FAILURE)
- {
- croak_runtime("Unable to perform source update for any module:\n\t$buffer");
- }
- elsif ($ipcType == ksb::IPC::ALL_SKIPPED)
- {
- $self->{'no_update'} = 1;
- $self->{'updates_done'} = 1;
- }
- elsif ($ipcType == ksb::IPC::MODULE_LOGMSG) {
- my ($ipcModuleName, $logMessage) = split(',', $buffer);
- $self->{messages}->{$ipcModuleName} //= [ ];
- push @{$self->{messages}->{$ipcModuleName}}, $logMessage;
- }
- elsif ($ipcType != ksb::IPC::ALL_UPDATING)
- {
- croak_runtime("IPC failure while expecting an update status: Incorrect type: $ipcType");
- }
- }
-}
-
-# Sends an IPC message along with some IPC type information.
-#
-# First parameter is the IPC type to send.
-# Second parameter is the actual message.
-# All remaining parameters are sent to the object's sendMessage()
-# procedure.
-sub sendIPCMessage
-{
- my ($self, $ipcType, $msg) = @_;
-
- my $encodedMsg = pack("l! a*", $ipcType, $msg);
- return $self->sendMessage($encodedMsg);
-}
-
-# Static class function to unpack a message.
-#
-# First parameter is the message.
-# Second parameter is a reference to a scalar to store the result in.
-#
-# Returns the IPC message type.
-sub unpackMsg
-{
- my ($msg, $outBuffer) = @_;
- my $returnType;
-
- ($returnType, $$outBuffer) = unpack("l! a*", $msg);
-
- return $returnType;
-}
-
-# Receives an IPC message and decodes it into the message and its
-# associated type information.
-#
-# First parameter is a *reference* to a scalar to hold the message contents.
-# All remaining parameters are passed to the underlying receiveMessage()
-# procedure.
-#
-# Returns the IPC type, or undef on failure.
-sub receiveIPCMessage
-{
- my $self = shift;
- my $outBuffer = shift;
-
- croak_internal("Trying to pull message from closed IPC channel!") if $self->{updates_done};
- my $msg = $self->receiveMessage();
-
- return ($msg ? unpackMsg($msg, $outBuffer) : undef);
-}
-
-# These must be reimplemented. They must be able to handle scalars without
-# any extra frills.
-#
-# sendMessage should accept one parameter (the message to send) and return
-# true on success, or false on failure. $! should hold the error information
-# if false is returned.
-sub sendMessage { croak_internal("Unimplemented."); }
-
-# receiveMessage should return a message received from the other side, or
-# undef for EOF or error. On error, $! should be set to hold the error
-# information.
-sub receiveMessage { croak_internal("Unimplemented."); }
-
-# Should be reimplemented if default does not apply.
-sub supportsConcurrency
-{
- return 0;
-}
-
-# Should be reimplemented if default does not apply.
-sub close
-{
-}
-
-1;
diff --git a/modules/ksb/IPC/Null.pm b/modules/ksb/IPC/Null.pm
deleted file mode 100644
index 007082d..0000000
--- a/modules/ksb/IPC/Null.pm
+++ /dev/null
@@ -1,39 +0,0 @@
-package ksb::IPC::Null 0.10;
-
-# Dummy IPC module in case SysVIPC doesn't work or async mode is not needed.
-
-use strict;
-use warnings;
-use 5.014;
-
-use parent qw(ksb::IPC);
-
-sub new
-{
- my $class = shift;
- my $self = $class->SUPER::new;
-
- $self->{'msgList'} = []; # List of messages.
- return bless $self, $class; # OOP in Perl is so completely retarded
-}
-
-sub sendMessage
-{
- my $self = shift;
- my $msg = shift;
-
- push @{$self->{'msgList'}}, $msg;
- return 1;
-}
-
-sub receiveMessage
-{
- my $self = shift;
-
- return undef unless scalar @{$self->{'msgList'}} > 0;
-
- return shift @{$self->{'msgList'}};
-}
-
-1;
-
diff --git a/modules/ksb/IPC/Pipe.pm b/modules/ksb/IPC/Pipe.pm
deleted file mode 100644
index 12e7fe6..0000000
--- a/modules/ksb/IPC/Pipe.pm
+++ /dev/null
@@ -1,126 +0,0 @@
-package ksb::IPC::Pipe 0.20;
-
-# IPC class that uses pipes in addition to forking for IPC.
-
-use strict;
-use warnings;
-use 5.014;
-
-use parent qw(ksb::IPC);
-
-use ksb::Util qw(croak_internal croak_runtime);
-
-use IO::Handle;
-use IO::Pipe;
-use Errno qw(EINTR);
-
-sub new
-{
- my $class = shift;
- my $self = $class->SUPER::new;
-
- # Define file handles.
- $self->{fh} = IO::Pipe->new();
-
- return bless $self, $class;
-}
-
-# Call this to let the object know it will be the update process.
-sub setSender
-{
- my $self = shift;
-
- $self->{fh}->writer();
-
- # Disable buffering and any possibility of IO 'interpretation' of the bytes
- $self->{fh}->autoflush(1);
- binmode($self->{fh})
-}
-
-sub setReceiver
-{
- my $self = shift;
-
- $self->{fh}->reader();
-
- # Disable buffering and any possibility of IO 'interpretation' of the bytes
- $self->{fh}->autoflush(1);
- binmode($self->{fh})
-}
-
-# Reimplementation of ksb::IPC::supportsConcurrency
-sub supportsConcurrency
-{
- return 1;
-}
-
-# Required reimplementation of ksb::IPC::sendMessage
-# First parameter is the (encoded) message to send.
-sub sendMessage
-{
- my ($self, $msg) = @_;
-
- # Since streaming does not provide message boundaries, we will insert
- # ourselves, by sending a 2-byte unsigned length, then the message.
- my $encodedMsg = pack ("S a*", length($msg), $msg);
- my $result = $self->{fh}->syswrite($encodedMsg);
-
- if (!$result || length($encodedMsg) != $result) {
- croak_runtime("Unable to write full msg to pipe: $!");
- }
-
- return 1;
-}
-
-sub _readNumberOfBytes
-{
- my ($self, $length) = @_;
-
- my $fh = $self->{fh};
- my $readLength = 0;
- my $result;
-
- while ($readLength < $length) {
- $! = 0; # Reset errno
-
- my $curLength = $fh->sysread ($result, ($length - $readLength), $readLength);
-
- # EINTR is OK, but check early so we don't trip 0-length check
- next if (!defined $curLength && $!{EINTR});
- return if (defined $curLength && $curLength == 0);
- croak_internal("Error reading $length bytes from pipe: $!")
- if !$curLength;
- croak_internal("sysread read too much: $curLength vs $length")
- if ($curLength > $length);
-
- $readLength += $curLength;
- }
-
- return $result;
-}
-
-# Required reimplementation of ksb::IPC::receiveMessage
-sub receiveMessage
-{
- my $self = shift;
-
- # Read unsigned short with msg length, then the message
- my $msgLength = $self->_readNumberOfBytes(2);
- return if !$msgLength;
-
- $msgLength = unpack ("S", $msgLength); # Decode to Perl type
- if (!$msgLength) {
- croak_internal ("Failed to read $msgLength bytes as needed by earlier message!");
- }
-
- return $self->_readNumberOfBytes($msgLength);
-}
-
-sub close
-{
- my $self = shift;
- $self->{fh}->close();
-}
-
-1;
-
diff --git a/vim/syntax/kdesrc-buildrc.vim b/vim/syntax/kdesrc-buildrc.vim
index 934c11f..0c415d8 100644
--- a/vim/syntax/kdesrc-buildrc.vim
+++ b/vim/syntax/kdesrc-buildrc.vim
@@ -1,9 +1,9 @@
" Vim syntax file
" Language: kdesrc-build configuration file
" Maintainer: Michael Pyne <mpyne at kde.org>
-" Latest Revision: 23 July 2017
+" Latest Revision: 23 September 2018
-" Copyright (c) 2014-2017 Michael Pyne <mpyne at kde.org>
+" Copyright (c) 2014-2018 Michael Pyne <mpyne at kde.org>
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions
" are met:
@@ -68,14 +68,14 @@ syn keyword ksbrcBoolOption contained skipwhite nextgroup=ksbrcBoolValue
\ use-clean-install
syn keyword ksbrcGlobalBoolOption contained skipwhite nextgroup=ksbrcBoolValue
- \ async colorful-output disable-agent-check disable-snapshots pretend
+ \ colorful-output disable-agent-check disable-snapshots pretend
\ purge-old-logs stop-on-failure use-idle-io-priority install-session-driver
\ install-environment-driver
" MUST BE CONSISTENT WITH ABOVE. Used when a global option is used in the
" wrong spot to highlight the error.
syn keyword ksbrcErrorBoolOption contained skipwhite nextgroup=ksbrcBoolValue
- \ async colorful-output disable-agent-check disable-snapshots pretend
+ \ colorful-output disable-agent-check disable-snapshots pretend
\ purge-old-logs stop-on-failure use-idle-io-priority install-session-driver
\ install-environment-driver
More information about the kde-doc-english
mailing list