Commit 0f4cc4b9 authored by Michael Pyne's avatar Michael Pyne

first-run: Remove kde-language support.

This requires File::Find which interferes with --initial-setup on at
least Debian. And frankly the option is almost surely broken for some
time now; it's already been removed in the make_it_mojo branch.
parent c6e61dff
Pipeline #358 passed with stage
in 1 minute and 1 second
......@@ -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
......
......@@ -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>
......
......@@ -123,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;
......@@ -172,97 +171,6 @@ ksb::Version->path($baseBinDir);
#
# 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.
#
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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; }
......@@ -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.
#
......
......@@ -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');
......
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::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
......
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