Commit 05e740fb authored by Michael Pyne's avatar Michael Pyne
Browse files

modularize: Move Module class to separate file.

Destination: ksb::Module. Obviously this affects many other areas of the
code, but seems to work fine so far.
parent 83d8fa8f
This diff is collapsed.
......@@ -39,6 +39,7 @@ use File::Temp 'tempdir';
use Storable 'dclone';
use File::Copy;
use ksb::BuildSystem::QMake;
use ksb::Module;
use ksb::l10nSystem;
# From kdesrc-build
......@@ -134,8 +135,8 @@ SKIP: {
my $fh = ensure_projects_xml_present($ctx);
ok($fh, 'Valid filehandle from ensure_projects_xml_present');
my $metadataModuleSet = Module->new($ctx, 'kde-build-metadata');
isa_ok($metadataModuleSet, 'Module');
my $metadataModuleSet = ksb::Module->new($ctx, 'kde-build-metadata');
isa_ok($metadataModuleSet, 'ksb::Module');
$metadataModuleSet->setScmType('proj');
my @buildMetadataModule = expandXMLModules($ctx, $metadataModuleSet);
......@@ -158,7 +159,7 @@ is_deeply(\@uniqList, [qw(2 3 5 8)], 'unique_list');
my ($qtModule, $kdelibsModule, $testModule, $kdesupportModule, $phononModule)
= map {
Module->new($ctx, $_);
ksb::Module->new($ctx, $_);
} (qw/qt kdelibs test kdesupport phonon/);
like($kdelibsModule->getLogDir(), qr{^$testSourceDirName/log}, 'correct log dir for test run');
......@@ -264,7 +265,7 @@ $kdelibsModule->setOption('build-dir', '~/tmp/build');
is($kdelibsModule->getSubdirPath('build-dir'), "$ENV{HOME}/tmp/build", 'build-dir subdir path abs and tilde expansion');
# correct log dir for modules with a / in the name
my $playLibsModule = Module->new($ctx, 'playground/libs');
my $playLibsModule = ksb::Module->new($ctx, 'playground/libs');
my $logdir = $playLibsModule->getLogDir();
ok(log_command($playLibsModule, 'touch', ['touch', "$testSourceDirName/touched"]) == 0, 'creating temp file');
......@@ -313,7 +314,7 @@ is(scalar @modules, 0, 'testing process_arguments return value for no passed mod
@modules = qw/qt kdelibs kdebase/;
my $kdebaseModule;
$ctx = ksb::BuildContext->new();
my @Modules = map { Module->new($ctx, $_) } (@modules);
my @Modules = map { ksb::Module->new($ctx, $_) } (@modules);
my $backupCtx = dclone($ctx);
# Ensure functions like updateModulePhases doesn't change the objects we pass
......@@ -321,7 +322,7 @@ my $backupCtx = dclone($ctx);
my $resetContext = sub {
$ctx = dclone($backupCtx);
# We must re-create modules to have the same context as ctx.
@Modules = map { Module->new($ctx, $_) } (@modules);
@Modules = map { ksb::Module->new($ctx, $_) } (@modules);
($qtModule, $kdelibsModule, $kdebaseModule) = @Modules;
};
......@@ -427,7 +428,7 @@ is($conf_modules[0]->scmType(), 'git', 'Ensure repository gives git scm (part 1)
is($conf_modules[2]->getOption('manual-build'), 'true', 'manual-build for kde-projects submodule (Bug 288611)');
my @ConfModules = map { Module->new($ctx, $_) }(qw/kdelibs kdesrc-build kde-runtime qt/);
my @ConfModules = map { ksb::Module->new($ctx, $_) }(qw/kdelibs kdesrc-build kde-runtime qt/);
is($ConfModules[0]->scmType(), 'git', 'Ensure repository gives git scm (part 2)');
$ConfModules[0]->setModuleSet(''); # Unnamed module set, instead of undef
......@@ -500,7 +501,7 @@ ok ($flagged, 'Verify LC_MESSAGES set if no_translate used');
ok (!$lc_all_found, 'Verify LC_ALL stripped if no_translate used');
# Test isSubdirBuildable
my $tokenModule = Module->new($ctx, 'test-module');
my $tokenModule = ksb::Module->new($ctx, 'test-module');
my $buildSystem = ksb::BuildSystem->new($tokenModule);
ok ($buildSystem->isSubdirBuildable('meh'), 'generic-build isSubdirBuildable');
ok ($buildSystem->createBuildSystem(), 'Ensure createBuildSystem can be called');
......
......@@ -270,7 +270,7 @@ sub createBuildSystem
# The first command name found which resolves to an executable on the
# system will be used, if no command this function will fail.
#
# The first argument should be the Module object to be made.
# The first argument should be the ksb::Module object to be made.
# The second argument should be the reference to the hash described above.
#
# Returns 0 on success, non-zero on failure (shell script style)
......
......@@ -57,7 +57,7 @@ sub notifyUpdateSuccess
sub waitForModule
{
my ($self, $module) = @_;
assert_isa($module, 'Module');
assert_isa($module, 'ksb::Module');
my $moduleName = $module->name();
my $updated = $self->{'updated'};
......
This diff is collapsed.
package ksb::Updater;
# Base class for classes that handle updating the source code for a given Module.
# Base class for classes that handle updating the source code for a given ksb::Module.
# It should not be used directly.
use strict;
......
......@@ -19,7 +19,7 @@ our @ISA = qw(ksb::Updater);
sub updateInternal
{
my $self = assert_isa(shift, 'ksb::Updater::Bzr');
my $module = assert_isa($self->module(), 'Module');
my $module = assert_isa($self->module(), 'ksb::Module');
# Full path to source directory on-disk.
my $srcdir = $module->fullpath('source');
......
......@@ -388,7 +388,7 @@ sub getBranch
return $branch;
}
# Attempts to download and install a git snapshot for the given Module.
# Attempts to download and install a git snapshot for the given ksb::Module.
# This requires the module to have the '#snapshot-tarball' option set,
# normally done after KDEXMLReader is used to parse the projects.kde.org
# XML database. This function should be called with the current directory
......
......@@ -84,7 +84,7 @@ sub _moduleBaseName
# Second parameter is the type ('tags' or 'branches')
sub _handle_branch_tag_option
{
my $module = assert_isa(shift, 'Module');
my $module = assert_isa(shift, 'ksb::Module');
my $type = shift;
my $branch = _branch_prefix($module->name(), $type);
my $svn_server = $module->getOption('svn-server');
......@@ -502,7 +502,7 @@ END
#
# This function will throw an exception in the event of a build failure.
#
# First parameter is the Module object we're building.
# First parameter is the ksb::Module object we're building.
# Second parameter is the filename to use for the log file.
# Third parameter is a reference to a list, which is the command ('svn')
# and all of its arguments.
......@@ -563,7 +563,7 @@ sub run_svn
# Returns 0 if a conflict exists, non-zero otherwise.
sub module_has_conflict
{
my $module = assert_isa(shift, 'Module');
my $module = assert_isa(shift, 'ksb::Module');
my $srcdir = $module->fullpath('source');
if ($module->getOption('no-svn'))
......@@ -632,7 +632,7 @@ EOF
# scm-specific update procedure.
# May change the current directory as necessary.
# Assumes called as part of a Module (i.e. $self->isa('Module') should be true.
# Assumes called as part of a ksb::Module (i.e. $self->isa('ksb::Module') should be true.
sub updateInternal
{
my $self = assert_isa(shift, 'ksb::Updater::Svn');
......
......@@ -331,7 +331,7 @@ sub prettify_seconds
# Second parameter is the filename in the log directory of the error log.
sub _setErrorLogfile
{
my $module = assert_isa(shift, 'Module');
my $module = assert_isa(shift, 'ksb::Module');
my $logfile = shift;
return unless $logfile;
......@@ -392,7 +392,7 @@ sub _setErrorLogfile
sub log_command
{
my ($module, $filename, $argRef, $optionsRef) = @_;
assert_isa($module, 'Module');
assert_isa($module, 'ksb::Module');
my @command = @{$argRef};
$optionsRef //= { };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment