kde-projects: Remove easy references to XML database.

KDEXMLReader will be renamed as its own step.
wilder
Michael Pyne 8 years ago
parent 305e69ee7f
commit c1ed57c3df
  1. 6
      modules/ksb/BuildContext.pm
  2. 2
      modules/ksb/Module.pm
  3. 2
      modules/ksb/ModuleResolver.pm
  4. 39
      modules/ksb/ModuleSet/KDEProjects.pm
  5. 4
      modules/ksb/Updater/Git.pm

@ -153,7 +153,7 @@ sub new
rcFiles => [@rcfiles],
rcFile => undef,
env => { },
ignore_list => [ ], # List of XML paths to ignore completely
ignore_list => [ ], # List of KDE project paths to ignore completely
kde_projects_metadata => undef, # Enumeration of kde-projects
kde_dependencies_metadata => undef, # Dependency resolution of kde-projects
logical_module_resolver => undef, # For branch-group option
@ -216,10 +216,10 @@ sub moduleList
}
# Adds a list of modules to ignore processing on completely.
# Parameters should simply be a list of XML repository paths to ignore,
# Parameters should simply be a list of KDE project paths to ignore,
# e.g. 'extragear/utils/kdesrc-build'. Partial paths are acceptable, matches
# are determined by comparing the path provided to the suffix of the full path
# of modules being compared.
# of modules being compared. See KDEXMLReader::_projectPathMatchesWildcardSearch
#
# Existing items on the ignore list are not removed.
sub addToIgnoreList

@ -938,7 +938,7 @@ sub destDir
$basePath = $self->name();
} else {
$basePath = shift // $self->getOption('#xml-full-path');
$basePath ||= $self->name(); # Default if not provided in XML
$basePath ||= $self->name(); # Default if not provided in repo-metadata
}
$destDir =~ s/(\$\{MODULE})|(\$MODULE\b)/$basePath/g;

@ -386,8 +386,6 @@ sub resolveModuleIfPresent
# so double-check by resolving module name into a kde-projects module-set
# selector (the + syntax) and then expanding out the module-set so generated.
if (!defined $self->{definedModules}->{$moduleName}) {
# TODO: Probably better to just read in the entire XML once and then
# store the module list at this point.
eval {
$self->_expandSingleModuleSet(
$self->_resolveSingleSelector("+$moduleName"));

@ -1,12 +1,11 @@
package ksb::ModuleSet::KDEProjects 0.20;
package ksb::ModuleSet::KDEProjects 0.30;
# Class: ModuleSet::KDEProjects
#
# This represents a collective grouping of modules that share common options,
# and are obtained via the kde-projects database at
# https://projects.kde.org/kde_projects.xml
#
# See also the parent class ModuleSet, from which most functionality is derived.
# based on the KDE project repositories. Metadata for that repository is
# itself housed in a dedicated KDE.org git repository "sysadmin/repo-metadata",
# which this class uses to imbue ksb::Modules generated by this ModuleSet.
#
# The only changes here are to allow for expanding out module specifications
# (except for ignored modules), by using KDEXMLReader.
@ -16,10 +15,9 @@ package ksb::ModuleSet::KDEProjects 0.20;
use strict;
use warnings;
use 5.014;
use parent qw(ksb::ModuleSet);
no if $] >= 5.018, 'warnings', 'experimental::smartmatch';
our @ISA = qw(ksb::ModuleSet);
use ksb::Module;
use ksb::Debug;
use ksb::KDEXMLReader 0.20;
@ -125,21 +123,20 @@ sub _expandModuleCandidates
my $ctx = assert_isa(shift, 'ksb::BuildContext');
my $moduleSearchItem = shift;
my $srcdir = $ctx->getSourceDir();
my $xmlReader = $ctx->getProjectDataReader();
my @allXmlResults = $xmlReader->getModulesForProject($moduleSearchItem);
my @allModuleResults = $ctx->
getProjectDataReader()->
getModulesForProject($moduleSearchItem);
croak_runtime ("Unknown KDE project: $moduleSearchItem") unless @allXmlResults;
croak_runtime ("Unknown KDE project: $moduleSearchItem") unless @allModuleResults;
# It's possible to match modules which are marked as inactive on
# projects.kde.org, elide those.
my @xmlResults = grep { $_->{'active'} } (@allXmlResults);
my @activeResults = grep { $_->{'active'} } (@allModuleResults);
if (!@xmlResults) {
warning (" y[b[*] Module y[$moduleSearchItem] is apparently XML-based, but contains no\n" .
if (!@activeResults) {
warning (" y[b[*] Module y[$moduleSearchItem] is apparently a KDE collection, but contains no\n" .
"active modules to build!");
my $count = scalar @allXmlResults;
my $count = scalar @allModuleResults;
if ($count > 0) {
warning ("\tAlthough no active modules are available, there were\n" .
"\t$count inactive modules. Perhaps the git modules are not ready?");
@ -150,7 +147,7 @@ sub _expandModuleCandidates
my @moduleList;
my @ignoreList = $self->modulesToIgnore();
foreach (@xmlResults) {
foreach (@activeResults) {
my $result = $_;
my $repo = $result->{'repo'};
@ -196,13 +193,13 @@ sub convertToModules
my %foundModules;
# Setup default options for each module
# Extraction of relevant XML modules will be handled immediately after
# this phase of execution.
# Extraction of relevant kde-project modules will be handled immediately
# after this phase of execution.
for my $moduleItem ($self->modulesToFind()) {
# We might have already grabbed the right module recursively.
next if exists $foundModules{$moduleItem};
# eval in case the XML processor throws an exception.
# eval in case the YAML processor throws an exception.
undef $@;
my @candidateModules = eval {
$self->_expandModuleCandidates($ctx, $moduleItem);
@ -210,7 +207,7 @@ sub convertToModules
if ($@) {
die $@ if had_an_exception(); # Forward exception objects up
croak_runtime("The XML for the KDE Project database could not be understood: $@");
croak_runtime("The KDE Project database could not be understood: $@");
}
my @moduleNames = map { $_->name() } @candidateModules;

@ -497,8 +497,8 @@ sub _splitUri
# 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
# normally done after KDEXMLReader is used to parse the sysadmin/repo-metadata
# project database. This function should be called with the current directory
# set to the source directory.
#
# After installing the tarball, an immediate git pull will be run to put the

Loading…
Cancel
Save