kde_projects: Consolidate metadata module creating code.

wilder
Michael Pyne 8 years ago
parent e406fc0814
commit 28afade793
  1. 8
      modules/ksb/BuildContext.pm
  2. 73
      modules/ksb/ModuleSet/KDEProjects.pm

@ -884,7 +884,7 @@ sub setPersistentOption
}
# Returns the ksb::Module (which has a 'metadata' scm type) that is used for
# kde-project metadata, so that other modules that need it can call into it if
# kde-build-metadata, so that other modules that need it can call into it if
# necessary.
#
# Also may return undef if the metadata is unavailable or has not yet
@ -909,8 +909,8 @@ sub getKDEProjectsMetadataModule
return $self->{kde_projects_metadata};
}
# Call this method to force this build context to pull in the kde-projects
# metadata module. This is a one-time action, subsequent calls to this method
# Call this method to force this build context to pull in the kde-build-metadata
# module. This is a one-time action, subsequent calls to this method
# are ignored. Use getKDEDependenciesMetadataModule to see if this build context is
# using a metadata module.
#
@ -931,7 +931,7 @@ sub setKDEDependenciesMetadataModuleNeeded
}
# Call this method to force this build context to pull in the
# sysadmin/repo-metadata metadata module. This is a one-time action,
# sysadmin/repo-metadata module. This is a one-time action,
# subsequent calls to this method are ignored. Use
# getKDEProjectsMetadataModule to see if this build context is using
# a metadata module.

@ -40,31 +40,14 @@ sub none_true
return 1;
}
# Function: getDependenciesModule
#
# A 'static' method that returns a <Module> that should be included
# first in the build context's module list.
#
# It will be configured to download required updates to the
# build metadata required for kde-projects module support. The module
# returned can be used to resolve dependencies amongst KDE modules.
#
# It should be included exactly once in the build context, if there are
# one or more ksb::ModuleSet::KDEProjects present in the module list.
#
# Parameters:
# ctx - the <ksb::BuildContext> for this script execution.
#
# Returns: The <Module> to added to the beginning of the update.
sub getDependenciesModule
sub _createMetadataModule
{
my $ctx = assert_isa(shift, 'ksb::BuildContext');
my $metadataModule = ksb::Module->new($ctx, 'kde-build-metadata');
my ($ctx, $moduleName) = @_;
my $metadataModule = ksb::Module->new($ctx, $moduleName =~ s,/,-,r);
# Hardcode the results instead of expanding out the project info
$metadataModule->setOption('repository', 'kde:kde-build-metadata');
$metadataModule->setOption('#xml-full-path', 'kde-build-metadata');
$metadataModule->setOption('repository', "kde:$moduleName");
$metadataModule->setOption('#xml-full-path', $moduleName);
$metadataModule->setOption('#branch:stable', 'master');
$metadataModule->setScmType('metadata');
$metadataModule->setOption('disable-snapshots', 1);
@ -75,45 +58,37 @@ sub getDependenciesModule
# Ensure we only ever try to update source, not build.
$metadataModule->phases()->phases('update');
return $metadataModule;
}
# Function: getProjectMetadataModule
# Function: getDependenciesModule
#
# A 'static' method that returns a <Module> that should be included
# first in the build context's module list.
# Static. Returns a <Module> that can be used to download the
# 'kde-build-metadata' module, which itself contains module dependencies
# in the KDE build system. The module is meant to be held by the <BuildContext>
#
# It will be configured to download required updates to the
# build metadata required for kde-projects module support. The module
# returned can be used to enumerate the list of KDE projects.
# Parameters:
# ctx - the <ksb::BuildContext> for this script execution.
sub getDependenciesModule
{
my $ctx = assert_isa(shift, 'ksb::BuildContext');
return _createMetadataModule($ctx, 'kde-build-metadata');
}
# Function: getProjectMetadataModule
#
# It should be included exactly once in the build context, if there are
# one or more ksb::ModuleSet::KDEProjects present in the module list.
# Static. Returns a <Module> that can be used to download the
# 'repo-metadata' module, which itself contains information on each
# repository in the KDE build system (though currently not
# dependencies). The module is meant to be held by the <BuildContext>
#
# Parameters:
# ctx - the <ksb::BuildContext> for this script execution.
#
# Returns: The <Module> to added to the beginning of the update.
sub getProjectMetadataModule
{
my $ctx = assert_isa(shift, 'ksb::BuildContext');
my $metadataModule = ksb::Module->new($ctx, 'repo-metadata');
# Hardcode the results instead of expanding out the project info
$metadataModule->setOption('repository', 'kde:sysadmin/repo-metadata');
$metadataModule->setOption('#xml-full-path', 'sysadmin/repo-metadata');
$metadataModule->setOption('#branch:stable', 'master');
$metadataModule->setScmType('metadata');
$metadataModule->setOption('disable-snapshots', 1);
$metadataModule->setOption('branch', 'master');
my $moduleSet = ksb::ModuleSet::KDEProjects->new($ctx, '<kde-projects metadata>');
$metadataModule->setModuleSet($moduleSet);
# Ensure we only ever try to update source, not build.
$metadataModule->phases()->phases('update');
return $metadataModule;
return _createMetadataModule($ctx, 'sysadmin/repo-metadata');
}
# Function: _expandModuleCandidates

Loading…
Cancel
Save