...
 
Commits (4)
......@@ -53,7 +53,6 @@ if (KDESRC_BUILD_INSTALL_MODULES)
modules/ksb/Updater.pm
modules/ksb/Util.pm
modules/ksb/Version.pm
modules/ksb/l10nSystem.pm
DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb)
install(FILES
......@@ -66,6 +65,7 @@ if (KDESRC_BUILD_INSTALL_MODULES)
install(FILES
modules/ksb/Module/BranchGroupResolver.pm
modules/ksb/Module/KDE.pm
DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/Module)
install(FILES
......@@ -99,6 +99,7 @@ install(PROGRAMS
${CMAKE_SOURCE_DIR}/kf5-kdepim-build-include
${CMAKE_SOURCE_DIR}/kf5-qt5-build-include
${CMAKE_SOURCE_DIR}/kf5-workspace-build-include
${CMAKE_SOURCE_DIR}/dependencies_local_distro.yaml
DESTINATION ${KDE_INSTALL_DATADIR}/kdesrc-build)
if (ECM_FOUND)
......
# This file maps KDE git repository names to the appropriate **direct**
# dependencies for the various popular distributions.
#
# Assistance from the wider community is appreciated in keeping this up to
# date! CHECK YOUR EDITOR SETTINGS CAREFULLY. We are ALL SPACES here.
#
# Structure: Each repository's name (not the whole path, *just* the name) is
# mapped to a dictionary that itself maps each supported vendor's ID/VERSION_ID
# combination (as from /etc/os-release) to a list of package names for that
# vendor's OS.
#
# Exactly 1 or 0 ID/VERSION_ID combinations is chosen. A generic vendor ID
# (as set by ID_LIKE in /etc/os-release) will be used if a more specific vendor ID
# is not listed here. but if a more specific vendor ID *is* listed then it should
# be comprehensive (no "inheritance" is done from a generic ID).
#
# The vendor is determined before the version is looked up (so
# don't add entries for a derivative distribution if the
# versions will be outdated). Rolling release distros don't have a version,
# kdesrc-build will assign a version of "unknown" here.
#
# Packages that are effectively required for everything should be listed as
# dependencies of extra-cmake-modules for now until I decide on something
# better.
#
# Remember to add -dev / -devel versions as appropriate!
# Basic module template
# module-name:
# debian:
# 9:
# - foo
# - bar
# # Leave commented if debian/9 suits for *buntu as well
# ubuntu:
# 18.04:
# - foo
# - bar
# opensuse-leap:
# 15.0:
# - foo
# - bar
# gentoo:
# unknown: # Rolling release!
# - foo
# - bar
# Module list starts
extra-cmake-modules:
debian:
9:
- cmake
- build-essential
- git
# ubuntu:
# 18.04:
opensuse-leap:
15.0:
- cmake
- git
gentoo:
unknown:
- cmake
- git
juk:
debian:
9:
- libtag1-dev
opensuse-leap:
15.0:
- libtag-devel
gentoo:
unknown:
- media-libs/taglib
# vim: set sts=4 et sw=4:
......@@ -2385,24 +2385,13 @@ well.</entry>
<row id="conf-kde-languages">
<entry>kde-languages</entry>
<entry>Cannot be overridden</entry>
<entry><para>This option allows you to choose to download and install
localization packages along with &kde;. You might do this if you do not live in
the United States and would like to use &kde; translated into your native
language.</para>
<para>To use this option, set it to a space-separated list of languages to
install. Each language has a language code associated with it, which you
can look up at this page: <ulink
url="http://l10n.kde.org/teams-list.php">http://l10n.kde.org/teams-list.php</ulink>.
<entry><para>This option was intended to allow for building language packs from
the &kde; repository but has been removed due to brokenness. Interested users
should follow the <ulink
url="https://l10n.kde.org/docs/translation-howto/">normal translation build
instructions instead</ulink>.
</para>
<para>It is alright to choose only one language. By default, none are
downloaded, which means &kde; will display in American English.</para>
<para>For instance, to choose to install French, you would set the option to
something like: <userinput><option>kde-languages</option>
<replaceable>fr</replaceable></userinput>. You would still need to use
&systemsettings; in order to choose the French language, however.</para>
</entry>
</row>
......
......@@ -154,3 +154,4 @@ these two steps concurrently:
== List of Packages
* <<ksb/Module#,ksb::Module>>
* <<ksb/Module/KDE#,ksb::Module::KDE>>
......@@ -124,6 +124,7 @@ just from the method name, sadly.
directory, including any module name or dest-dir accoutrement. This is the
directory you can git-clone to, cd to for build, etc.
[#destDir]
* ``destDir``, returns the 'dest-dir' for the module. dest-dir is effectively
just a way to modify the on-disk module name. It used to be used more heavily
to allow for having multiple build/source directories for a given CVS/SVN
......@@ -167,10 +168,15 @@ just from the method name, sadly.
==== KDE-SPECIFIC HANDLERS
NOTE: See <<Module/KDE#,ksb::Module::KDE>> which handles implementing these
methods.
[#fullProjectPath]
* ``fullProjectPath``, returns the logical module path in the git.kde.org
infrastructure for the module, if it's defined from a kde-projects module
set. E.g. for the 'juk' module, would return 'kde/kdemultimedia/juk'.
[#isKDEProject]
* ``isKDEProject``, returns true if the module was sourced from the special
``kde-projects`` module set in the user's rc-file. In this case the module's
``moduleSet()`` function should return a ksb::ModuleSet that is-a
......
= ksb::Module::KDE
== DESCRIPTION
This is ksb::Module::KDE, a subclass of <<../Module#,ksb::Module>> for
modules that are generated from the special `kde-projects` module sets that
provides some of the additional information available for such modules
(including dependencies and position within the virtual hierarchy of modules).
Currently much of the magic is still imposed from outside, including setting of
specific ksb::ModuleSet subclasses and specific ksb::Updater::Git subclasses
that are each specific to the KDE infrastructure.
Note that you can tell if a ksb::Module is really a ksb::Module::KDE using
Perl's `->isa` method or the dedicated `isKDEProject()` method in ksb::Module.
== METHODS
=== Overrides
These methods all override corresponding methods in ksb::Module.
* ``fullProjectPath`` (<<../Module#fullProjectPath,override>>), to return the
virtual hierarchical path for the given module, such as `kde/kdemultimedia/juk`
or `extragear/utils/kdesrc-build`.
* ``isKDEProject`` (<<../Module#isKDEProject,override>>), for "`stringifying`" a
module into a quoted string.
* ``destDir`` (<<../Module#destDir,override>>), for sorting ksb::Modules
amongst each other based on name.
......@@ -36,13 +36,17 @@ use 5.014; # Require Perl 5.14
use strict;
use warnings;
# On many container-based distros, even FindBin is missing to conserve space.
# But we can use File::Spec to do nearly the same.
my $RealBin;
# "our" makes this a package-shared variable accessible outside of this package
# by referring to $main::baseDataDir.
our $baseDataDir; # where to find support files like modules and dependencies
my $baseBinDir; # where to find kdesrc-build itself this run
my $modPath;
# The File::Spec calls have to run when parsing (i.e. in BEGIN) to make the
# 'use lib' below work (which itself implicitly uses BEGIN { })
# Find our base directory to find modules and data under. On many
# container-based distros, even FindBin is missing to conserve space. But we
# can use File::Spec to do nearly the same.
# These calls have to run when parsing (i.e. in BEGIN) to make the 'use lib'
# below work (which itself implicitly uses BEGIN { })
BEGIN {
use File::Spec;
......@@ -52,20 +56,28 @@ BEGIN {
last unless -l $scriptPath;
$scriptPath = readlink $scriptPath;
}
die "Too many symlinks followed looking for script" if -l $scriptPath;
die "Too many symlinks followed looking for script"
if -l $scriptPath;
my ($volume, $directories, $script) = File::Spec->splitpath($scriptPath);
my $baseDir = File::Spec->catpath($volume, $directories, '');
$RealBin = File::Spec->catpath($volume, $directories, '');
die "Couldn't find base directory!" unless $RealBin;
die "Couldn't find base directory!"
unless $baseDir;
$baseBinDir = File::Spec->rel2abs('.', $baseDir);
# Use modules in git repo if running from git dir, otherwise assume
# system install
$modPath = File::Spec->rel2abs('modules', $RealBin);
$modPath = ($RealBin =~ s,/bin/?$,/share/kdesrc-build/modules,r)
unless -d $modPath;
# system install.
if (-d "$baseDir/modules" && -e "$baseDir/kdesrc-build") {
$baseDataDir = $baseBinDir;
} elsif (-d "$baseDir/../share/kdesrc-build/modules") {
$baseDataDir = File::Spec->rel2abs("../share/kdesrc-build", $baseDir);
}
die "Couldn't find modules for kdesrc-build!" unless $modPath;
$modPath = "$baseDataDir/modules";
die "Couldn't find modules for kdesrc-build from $baseDir!"
unless -d $modPath;
}
use lib "$modPath"; # Make ksb:: modules available
......@@ -87,7 +99,7 @@ eval {
require ksb::FirstRun;
require ksb::Debug;
ksb::Debug::setColorfulOutput(1);
exit ksb::FirstRun::setupUserSystem(File::Spec->rel2abs($RealBin));
exit ksb::FirstRun::setupUserSystem($baseDataDir);
}
};
......@@ -111,7 +123,6 @@ DONE
# enough to cause errors.
eval {
use Carp;
use File::Find; # For our lndir reimplementation.
use File::Path qw(remove_tree);
require ksb::Debug;
......@@ -150,7 +161,7 @@ ksb::Application->import();
# will be better than the alternative backtrace we get (which is to say, none)
$SIG{__DIE__} = \&Carp::confess;
ksb::Version->path($RealBin);
ksb::Version->path($baseBinDir);
### Script-global functions.
......@@ -160,97 +171,6 @@ ksb::Version->path($RealBin);
#
# Everything else should be in an appropriate class.
# Subroutine to recursively symlink a directory into another location, in a
# similar fashion to how the XFree/X.org lndir() program does it. This is
# reimplemented here since some systems lndir doesn't seem to work right.
#
# Used from ksb::l10nSystem
#
# As a special exception to the GNU GPL, you may use and redistribute this
# function however you would like (i.e. consider it public domain).
#
# The first parameter is the directory to symlink from.
# The second parameter is the destination directory name.
#
# e.g. if you have $from/foo and $from/bar, lndir would create $to/foo and
# $to/bar.
#
# All intervening directories will be created as needed. In addition, you
# may safely run this function again if you only want to catch additional files
# in the source directory.
#
# Note that this function will unconditionally output the files/directories
# created, as it is meant to be a close match to lndir.
#
# RETURN VALUE: Boolean true (non-zero) if successful, Boolean false (0, "")
# if unsuccessful.
sub safe_lndir
{
my ($from, $to) = @_;
# Create destination directory.
if (not -e $to)
{
print "$to\n";
if (not pretending() and not super_mkdir($to))
{
error ("Couldn't create directory r[$to]: b[r[$!]");
return 0;
}
}
# Create closure callback subroutine.
my $wanted = sub {
my $dir = $File::Find::dir;
my $file = $File::Find::fullname;
$dir =~ s/$from/$to/;
# Ignore the .svn directory and files.
return if $dir =~ m,/\.svn,;
# Create the directory.
if (not -e $dir)
{
print "$dir\n";
if (not pretending())
{
super_mkdir ($dir) or croak_runtime("Couldn't create directory $dir: $!");
}
}
# Symlink the file. Check if it's a regular file because File::Find
# has no qualms about telling you you have a file called "foo/bar"
# before pointing out that it was really a directory.
if (-f $file and not -e "$dir/$_")
{
print "$dir/$_\n";
if (not pretending())
{
symlink $File::Find::fullname, "$dir/$_" or
croak_runtime("Couldn't create file $dir/$_: $!");
}
}
};
# Recursively descend from source dir using File::Find
eval {
find ({ 'wanted' => $wanted,
'follow_fast' => 1,
'follow_skip' => 2},
$from);
};
if ($@)
{
error ("Unable to symlink $from to $to: $@");
return 0;
}
return 1;
}
# Subroutine to delete recursively, everything under the given directory,
# unless we're in pretend mode.
#
......
This diff is collapsed.
......@@ -11,7 +11,7 @@ use 5.014;
no if $] >= 5.018, 'warnings', 'experimental::smartmatch';
use ksb::Debug;
use ksb::Util;
use ksb::Util 0.35;
use ksb::BuildContext 0.35;
use ksb::BuildSystem::QMake;
use ksb::BuildException 0.20;
......@@ -458,10 +458,6 @@ sub generateModuleList
else {
# Build everything in the rc-file, in the order specified.
@modules = $moduleResolver->expandModuleSets(@optionModulesAndSets);
if ($ctx->getOption('kde-languages')) {
@modules = _expandl10nModules($ctx, @modules);
}
}
# If modules were on the command line then they are effectively forced to
......@@ -1971,52 +1967,6 @@ sub _defineNewModuleFactory
};
}
# This function converts any 'l10n' references on the command line to return a l10n
# module with the proper build system, scm type, etc.
#
# The languages are selected using global/kde-languages (which should be used
# exclusively from the configuration file).
sub _expandl10nModules
{
my ($ctx, @modules) = @_;
my $l10n = 'l10n-kde4';
assert_isa($ctx, 'ksb::BuildContext');
# Only filter if 'l10n' is actually present in list.
my @matches = grep {$_->name() =~ /^(?:$l10n|l10n)$/} @modules;
my @langs = split(' ', $ctx->getOption('kde-languages'));
return @modules if (!@matches || !@langs);
my $l10nModule;
for my $match (@matches)
{
# Remove all instances of l10n.
@modules = grep {$_->name() ne $match->name()} @modules;
# Save l10n module if user had it in config. We only save the first
# one encountered though.
$l10nModule //= $match;
}
# No l10n module? Just create one.
$l10nModule //= ksb::Module->new($ctx, $l10n);
whisper ("\tAdding languages ", join(';', @langs), " to build.");
$l10nModule->setScmType('l10n');
my $scm = $l10nModule->scm();
# Add all required directories to the l10n module. Its buildsystem should
# know to skip scripts and templates.
$scm->setLanguageDirs(qw/scripts templates/, @langs);
$l10nModule->setBuildSystem($scm);
push @modules, $l10nModule;
return @modules;
}
# Updates the built-in phase list for all Modules passed into this function in
# accordance with the options set by the user.
sub _updateModulePhases
......@@ -2348,26 +2298,12 @@ sub _installCustomFile
# Return value: There is no return value.
sub _installCustomSessionDriver
{
use FindBin qw($RealBin);
use List::Util qw(first);
use File::Copy qw(copy);
my $ctx = assert_isa(shift, 'ksb::BuildContext');
my @xdgDataDirs = split(':', $ENV{XDG_DATA_DIRS} || '/usr/local/share/:/usr/share/');
my $xdgDataHome = $ENV{XDG_DATA_HOME} || "$ENV{HOME}/.local/share";
# First we have to find the source
my @searchPaths = ($RealBin, map { "$_/apps/kdesrc-build" } ($xdgDataHome, @xdgDataDirs));
s{/+$}{} foreach @searchPaths; # Remove trailing slashes
s{//+}{/}g foreach @searchPaths; # Remove duplicate slashes
my $envScript = first { -f $_ } (
map { "$_/sample-kde-env-master.sh" } @searchPaths
);
my $sessionScript = first { -f $_ } (
map { "$_/sample-xsession.sh" } @searchPaths
);
my $envScript = findDataResource('sample-kde-env-master.sh');
my $sessionScript = findDataResource('sample-xsession.sh');
if (!$envScript || !$sessionScript) {
warning ("b[*] Unable to find helper files to setup a login session.");
......
......@@ -15,6 +15,7 @@ use IO::File;
use POSIX qw(strftime);
use Errno qw(:POSIX);
use JSON::PP;
use YAML::XS (); # Don't import any functions
# We derive from ksb::Module so that BuildContext acts like the 'global'
# ksb::Module, with some extra functionality.
......@@ -27,6 +28,7 @@ use ksb::Util;
use ksb::PhaseList;
use ksb::Module;
use ksb::Module::BranchGroupResolver;
use ksb::OSSupport;
use ksb::Updater::KDEProjectMetadata 0.20;
use ksb::Version qw(scriptVersion);
use ksb::StatusView;
......@@ -160,6 +162,8 @@ sub new
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
non_kde_deps_metadata => undef, # Distro dependencies for KDE repos
os_support => ksb::OSSupport->new(), # /etc/os-release
logical_module_resolver => undef, # For branch-group option
status_view => ksb::StatusView->new(),
projects_db => undef, # See getProjectDataReader
......@@ -899,6 +903,14 @@ sub setPersistentOption
$persistent_opts->{$moduleName}{$key} = $value;
}
# Returns a ksb::OSSupport to avoid having to re-read /etc/os-release
# all the time.
sub getOSSupport
{
my $self = shift;
return $self->{os_support};
}
# Returns the ksb::Module (which has a 'metadata' scm type) that is used for
# kde-build-metadata, so that other modules that need it can call into it if
# necessary.
......@@ -912,6 +924,24 @@ sub getKDEDependenciesMetadataModule
return $self->{kde_dependencies_metadata};
}
# Returns a mapping from distro id/version to package names for the given KDE
# repository name.
sub getKDEDistroDependencies
{
my ($self, $kde_module) = @_;
assert_isa($kde_module, 'ksb::Module::KDE');
if (!$self->{non_kde_deps_metadata}) {
my $depsPath = findDataResource('dependencies_local_distro.yaml');
$YAML::XS::LoadBlessed = 0;
$self->{non_kde_deps_metadata} = YAML::XS::LoadFile($depsPath);
}
return $self->{non_kde_deps_metadata}->{$kde_module->name()} // {};
}
# 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
# necessary.
......
......@@ -274,13 +274,6 @@ sub createBuildSystem
return 0;
}
if ($builddir ne $srcdir && $self->needsBuilddirHack() && 0 != log_command($module, 'lndir',
['kdesrc-build', 'main::safe_lndir', $srcdir, $builddir]))
{
error ("\tUnable to setup symlinked build directory for r[$module]!!");
return 0;
}
return 1;
}
......
......@@ -22,7 +22,8 @@ environments as fielded in "minimal Docker container" forms of popular distros.
=head1 SYNOPSIS
my $exitcode = ksb::FirstRun::setupUserSystem();
# $baseDir is the data directory (either from source dir or as installed)
my $exitcode = ksb::FirstRun::setupUserSystem($baseDir);
exit $exitcode;
=cut
......
......@@ -16,8 +16,6 @@ use ksb::IPC;
use ksb::Debug;
use ksb::Util;
use ksb::l10nSystem;
use ksb::Updater::Svn;
use ksb::Updater::Git;
use ksb::Updater::Bzr;
......@@ -253,7 +251,6 @@ sub setScmType
when('git') { $newType = ksb::Updater::Git->new($self); }
when('proj') { $newType = ksb::Updater::KDEProject->new($self); }
when('metadata') { $newType = ksb::Updater::KDEProjectMetadata->new($self); }
when('l10n') { $newType = ksb::l10nSystem->new($self); }
when('svn') { $newType = ksb::Updater::Svn->new($self); }
when('bzr') { $newType = ksb::Updater::Bzr->new($self); }
default { $newType = undef; }
......@@ -333,7 +330,7 @@ sub buildSystem
}
if (!$buildType && (-e "$sourceDir/CMakeLists.txt" ||
$self->getOption('#xml-full-path')))
$self->isKDEProject()))
{
$buildType = ksb::BuildSystem::KDE4->new($self);
}
......@@ -372,7 +369,7 @@ sub setBuildSystem
}
# Current possible build system types:
# KDE (i.e. cmake), Qt, l10n (KDE language buildsystem), autotools (either
# KDE (i.e. cmake), Qt, autotools (either
# configure or autogen.sh). A final possibility is 'pendingSource' which
# simply means that we don't know yet.
#
......@@ -694,6 +691,16 @@ sub compare
return $self->name() cmp $other->name();
}
# Runs just before update phase, can be used to ensure that things like local
# dependencies are setup. Meant to be subclassed.
#
# Returns non-zero on success or throws an exception if an error occurs.
sub preUpdate
{
my $self = assert_isa(shift, 'ksb::Module');
return 1;
}
sub update
{
my ($self, $ipc, $ctx) = @_;
......@@ -713,6 +720,8 @@ sub update
}
}
$self->preUpdate();
my $fullpath = $self->fullpath('source');
my $count;
my $returnValue;
......@@ -900,23 +909,19 @@ sub fullpath
return $pathinfo{'fullpath'};
}
# Returns the "full kde-projects path" for the module. As should be obvious by
# the description, this only works for modules with an scm type that is a
# Updater::KDEProject (or its subclasses).
# Returns the "full kde-projects path" for the module.
sub fullProjectPath
{
my $self = shift;
my $path = $self->getOption('#xml-full-path', 'module') ||
croak_internal("Tried to ask for full path of a module $self that doesn't have one!");
return $path;
# meant to be overridden
croak_internal("Tried to ask for full path of a module $self that doesn't have one!");
}
# Returns true if this module is (or was derived from) a kde-projects module.
sub isKDEProject
{
my $self = shift;
return $self->hasOption('#xml-full-path');
return 0; # overridden in subclasses
}
# Subroutine to return the name of the destination directory for the
......@@ -929,18 +934,10 @@ sub isKDEProject
# path to replace $MODULE entries in dest-dir.
sub destDir
{
my $self = assert_isa(shift, 'ksb::Module');
my ($self, $basePath) = @_;
my $destDir = $self->getOption('dest-dir');
my $basePath = "";
if ($self->getOption('ignore-kde-structure')) {
$basePath = $self->name();
} else {
$basePath = shift // $self->getOption('#xml-full-path');
$basePath ||= $self->name(); # Default if not provided in repo-metadata
}
$basePath ||= $self->name();
$destDir =~ s/(\$\{MODULE})|(\$MODULE\b)/$basePath/g;
return $destDir;
......
package ksb::Module::KDE 0.10;
# Class: Module::KDE
#
# A subclass of Module for modules that are generated from a kde-projects
# ModuleSet. (NOTE: I mean this literally: if you manually declare a module
# with an override-url or something to kde:foo.git then you'll get a regular
# ksb::Module!)
use 5.014;
use warnings;
no if $] >= 5.018, 'warnings', 'experimental::smartmatch';
use parent qw(ksb::Module);
use ksb::Debug;
use ksb::Util;
use ksb::BuildException 0.20;
use ksb::BuildSystem 0.30;
use ksb::BuildSystem::KDE4;
use ksb::OSSupport;
# Returns the "full kde-projects path" for the module, e.g.
# extragear/utils/kdesrc-build.
sub fullProjectPath
{
my $self = shift;
return $self->getOption('#xml-full-path', 'module');
}
# Override
sub isKDEProject
{
return 1;
}
# Subroutine to return the name of the destination
# directory for the checkout and build routines.
#
# Overridden from super class to allow a hierarchial
# directory structure for KDE-based modules.
sub destDir
{
my ($self, $basePath) = @_;
my $defaultBase = $self->getOption('ignore-kde-structure')
? $self->name()
: $self->fullProjectPath();
return $self->SUPER::destDir($basePath || $defaultBase);
}
# override
sub preUpdate
{
my $self = assert_isa(shift, 'ksb::Module::KDE');
my $deps = $self->_localOSDependencies();
if (@{$deps}) {
my $str = join(', ', @{$deps});
debug ("\tAdding dependencies g[b[$str] for $self");
}
return $self->SUPER::preUpdate();
}
# Returns a list of package names that must be installed as *direct*
# dependencies of this KDE repository, applicable for installation by the local
# OS package manager.
# This is all dependent upon suitable metadata being available. See
# dependencies_local_distro.yaml in the kdesrc-build repository.
# If the local OS is not recognized then an empty list is returned without
# further error.
sub _localOSDependencies
{
my $self = shift;
my $ctx = $self->buildContext();
my $os = $ctx->getOSSupport();
my %deps = %{$ctx->getKDEDistroDependencies($self)};
return unless %deps;
my $vendor = $os->bestDistroMatch(keys %deps);
return unless $deps{$vendor};
return $deps{$vendor}->{$os->vendorVersion()} // {};
}
1;
......@@ -245,10 +245,6 @@ sub _resolveSingleSelector
$selector = ksb::Module->new($ctx, $selectorName);
$selector->phases()->phases($ctx->phases()->phases());
if ($selectorName eq 'l10n') {
$_->setScmType('l10n')
}
$selector->setScmType('proj');
$selector->setOption('#guessed-kde-project', 1);
$selector->setOption('#selected-by', 'initial-guess');
......
......@@ -23,6 +23,7 @@ use ksb::BuildException;
use ksb::Debug;
use ksb::KDEProjectsReader 0.50;
use ksb::Module;
use ksb::Module::KDE;
use ksb::Util;
sub new
......@@ -42,7 +43,7 @@ sub none_true
sub _createMetadataModule
{
my ($ctx, $moduleName) = @_;
my $metadataModule = ksb::Module->new($ctx, $moduleName =~ s,/,-,r);
my $metadataModule = ksb::Module::KDE->new($ctx, $moduleName =~ s,/,-,r);
# Hardcode the results instead of expanding out the project info
$metadataModule->setOption('repository', "kde:$moduleName");
......@@ -155,7 +156,7 @@ sub _expandModuleCandidates
# Prefer kde: alias to normal clone URL.
$repo =~ s(^git://anongit\.kde\.org/)(kde:);
my $newModule = ksb::Module->new($ctx, $result->{'name'});
my $newModule = ksb::Module::KDE->new($ctx, $result->{'name'});
$self->_initializeNewModule($newModule);
$newModule->setOption('repository', $repo);
$newModule->setOption('#xml-full-path', $result->{'fullName'});
......
package ksb::Updater::Svn 0.10;
# Module responsible for source code updates on Subversion modules. Used as a
# superclass for our l10n update/build system as well.
# Module responsible for source code updates on Subversion modules.
use strict;
use warnings;
......
package ksb::Util 0.30;
package ksb::Util 0.35;
# Useful utilities, which are exported into the calling module's namespace by default.
......@@ -23,7 +23,9 @@ our @EXPORT = qw(list_has assert_isa assert_in any unique_items
fileDigestMD5 log_command disable_locale_message_translation
split_quoted_on_whitespace safe_unlink safe_system p_chdir
pretend_open safe_rmtree get_list_digest is_dir_empty
super_mkdir filter_program_output prettify_seconds);
super_mkdir filter_program_output prettify_seconds
findDataResource
);
# Function to work around a Perl language limitation.
# First parameter is a reference to the list to search. ALWAYS.
......@@ -666,5 +668,18 @@ sub is_dir_empty
return 1;
}
1;
# Returns path to a named data resource or throws an exception if it can't be
# found
sub findDataResource
{
my $name = shift;
my $baseDir = $main::baseDataDir;
my $resPath = "$baseDir/$name";
croak_internal("Can't find resource $name")
unless -e $resPath;
return $resPath;
}
1;
package ksb::l10nSystem 0.10;
# This class is an implementation of both the source and build interfaces needed to
# support building KDE l10n modules.
use strict;
use warnings;
use 5.014;
use parent qw(ksb::Updater::Svn ksb::BuildSystem);
use ksb::Debug;
use ksb::Util;
sub new
{
my ($class, $module) = @_;
# Ensure associated module updates from the proper svn path.
# TODO: Support different localization branches?
$module->setOption('module-base-path', 'trunk/l10n-kde4');
my $refreshMessage = "an update happened";
return bless { module => $module, needsRefreshed => $refreshMessage }, $class;
}
sub module
{
my $self = shift;
return $self->{module};
}
sub configuredModuleFileName
{
# Not quite correct (we should be looking at each individual language
# but it at least keeps the process going.
return 'teamnames';
}
# Sets the directories that are to be checked out/built/etc.
# There should be one l10nSystem for the entire l10n build (i.e. add
# all required support dirs and languages).
sub setLanguageDirs
{
my ($self, @languageDirs) = @_;
$self->{l10n_dirs} = \@languageDirs;
}
# Returns true if the given subdirectory (reference from the module's root source directory)
# can be built or not. Should be reimplemented by subclasses as appropriate.
sub isSubdirBuildable
{
my ($self, $subdir) = @_;
return ($subdir ne 'scripts' && $subdir ne 'templates');
}
sub prepareModuleBuildEnvironment
{
my ($ctx, $module, $prefix) = @_;
$ctx->prependEnvironmentValue('CMAKE_PREFIX_PATH', $prefix);
}
# scm-specific update procedure.
# May change the current directory as necessary.
sub updateInternal
{
my $self = assert_isa(shift, 'ksb::Updater');
my $module = $self->module();
my $fullpath = $module->fullpath('source');
my @dirs = @{$self->{l10n_dirs}};
if (-e "$fullpath/.svn") {
$self->check_module_validity();
my $count = $self->update_module_path(@dirs);
$self->{needsRefreshed} = '' if $count == 0;
return $count;
}
else {
return $self->checkout_module_path(@dirs);
}
}
sub name
{
return 'l10n';
}
# Returns a list of just the languages to install.
sub languages
{
my $self = assert_isa(shift, 'ksb::l10nSystem');
my @langs = @{$self->{l10n_dirs}};
return grep { $self->isSubdirBuildable($_); } (@langs);
}
# Buildsystem support section
sub needsRefreshed
{
my $self = shift;
# Should be a 'reason' string except if no update happened.
return $self->{needsRefreshed};
}
sub buildInternal
{
my $self = assert_isa(shift, 'ksb::l10nSystem');
my $builddir = $self->module()->fullpath('build');
my @langs = $self->languages();
my $result = ($self->safe_make({
target => undef,
message => "Building localization for language...",
logbase => "build",
subdirs => \@langs,
}))->{was_successful};
return $result;
}
sub configureInternal
{
my $self = assert_isa(shift, 'ksb::l10nSystem');
my $builddir = $self->module()->fullpath('build');
my @langs = $self->languages();
my $result = 0;
for my $lang (@langs) {
my $prefix = $self->module()->installationPath();
p_chdir("$builddir/$lang");
info ("\tConfiguring to build language $lang");
$result = (log_command($self->module(), "cmake-$lang",
['cmake', '-DCMAKE_INSTALL_PREFIX=' . $prefix]) == 0) || $result;
}
return $result;
}
sub installInternal
{
my $self = assert_isa(shift, 'ksb::l10nSystem');
my $builddir = $self->module()->fullpath('build');
my @langs = $self->languages();
return ($self->safe_make({
target => 'install',
message => "Installing language...",
logbase => "install",
subdirs => \@langs,
}) == 0);
}
# Subroutine to link a source directory into an alternate directory in
# order to fake srcdir != builddir for modules that don't natively support
# it. The first parameter is the module to prepare.
#
# The return value is true (non-zero) if it succeeded, and 0 (false) if it
# failed.
#
# On return from the subroutine the current directory will be in the build
# directory, since that's the only directory you should touch from then on.
sub prepareFakeBuilddir
{
my $self = assert_isa(shift, 'ksb::l10nSystem');
my $module = $self->module();
my $builddir = $module->fullpath('build');
my $srcdir = $module->fullpath('source');
# List reference, not a real list. The initial kdesrc-build does *NOT*
# fork another kdesrc-build using exec, see sub log_command() for more
# info.
my $args = [ 'kdesrc-build', 'main::safe_lndir', $srcdir, $builddir ];
info ("\tSetting up alternate build directory for l10n");
return (0 == log_command ($module, 'create-builddir', $args));
}
# Subroutine to create the build system for a module. This involves making
# sure the directory exists and then running any preparatory steps (like
# for l10n modules). This subroutine assumes that the module is already
# downloaded.
#
# Return convention: boolean (inherited)
sub createBuildSystem
{
my $self = assert_isa(shift, 'ksb::l10nSystem');
my $module = $self->module();
my $builddir = $module->fullpath('build');
# l10n doesn't support srcdir != builddir, fake it.
whisper ("\tFaking builddir for g[$module]");
if (!$self->prepareFakeBuilddir())
{
error ("Error creating r[$module] build system!");
return 0;
}
p_chdir ($builddir);
my @langs = @{$self->{l10n_dirs}};
@langs = grep { $self->isSubdirBuildable($_) } (@langs);
foreach my $lang (@langs) {
my $cmd_ref = [ './scripts/autogen.sh', $lang ];
if (log_command ($module, "build-system-$lang", $cmd_ref))
{
error ("\tUnable to create build system for r[$module]");
}
}
$module->setOption('#reconfigure', 1); # Force reconfigure of the module
return 1;
}
1;
" Vim syntax file
" Language: kdesrc-build configuration file
" Maintainer: Michael Pyne <mpyne@kde.org>
" Latest Revision: 23 July 2017
" Latest Revision: 6 January 2019
" Copyright (c) 2014-2017 Michael Pyne <mpyne@kde.org>
" Copyright (c) 2014-2019 Michael Pyne <mpyne@kde.org>
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions
" are met:
......@@ -45,13 +45,13 @@ syn keyword ksbrcOption contained skipwhite nextgroup=ksbrcStringValue
syn keyword ksbrcGlobalOption contained skipwhite nextgroup=ksbrcStringValue
\ branch-group git-desired-protocol git-repository-base http-proxy
\ kde-languages niceness debug-level persistent-data-file set-env
\ niceness debug-level persistent-data-file set-env
" MUST BE CONSISTENT WITH ABOVE. Used when a module-set option is used in the
" wrong spot to highlight the error.
syn keyword ksbrcErrorGlobalOption contained skipwhite nextgroup=ksbrcStringValue
\ branch-group git-desired-protocol git-repository-base http-proxy
\ kde-languages niceness debug-level persistent-data-file set-env
\ niceness debug-level persistent-data-file set-env
syn keyword ksbrcModuleSetOption contained skipwhite nextgroup=ksbrcStringValue
\ use-modules ignore-modules
......