Bug#658668: console-setup: Only include the debconf-selectable layouts in udeb
tags 658668 + patch
thanks
Samuel Thibault, le Sun 05 Feb 2012 02:21:15 +0100, a écrit :
> To reduce the file & memory footprint of console-setup-udeb, it should
> not include support for layouts other than what is selectable in
> debian/console-setup-udeb.templates (keyboard-configuration/xkb-keymap)
>
> That means in the ekmap files,
Here is a patch proposal. It brings pc105.ekmap.gz from 120KiB down to
33KiB, and pc105.ekmp from 1MiB down to 300KiB, definitely worth it :)
> but also in the all_kbdnames() function of
> keyboard-configuration.config, which should BTW not include the layout
> name since that is not used.
The patch removes the layout names, dropping about 20KiB. Removing the
variants does not seem very easy, perhaps passing debian/preprocessor an
option to already include only the expected layouts.
Samuel
diff --git a/Keyboard/Makefile b/Keyboard/Makefile
index e6c22cc..9a7d9a6 100644
--- a/Keyboard/Makefile
+++ b/Keyboard/Makefile
@@ -17,11 +17,13 @@ build-mini-freebsd : $(gzipped_ekbds) charmap_functions.sh
%.gz : %
gzip -9 <$< >$@
-%.ekmap :
- ./kbdcompiler $(@:%.ekmap=%) KeyboardNames.pl $(xkbdir) >$@
+choices :
+ grep -A 2 keyboard-configuration/xkb-keymap ../debian/console-setup-udeb.templates | tail -n 1 | cut -d ' ' -f 2- | tr -d , | tr ' ' '\n' > $@
+%.ekmap : choices
+ cat $< | ./kbdcompiler $(@:%.ekmap=%) KeyboardNames.pl $(xkbdir) >$@
-%.ekbd :
- ./kbdcompiler freebsd-$(@:%.ekbd=%) KeyboardNames.pl $(xkbdir) >$@
+%.ekbd : choices
+ cat $< | ./kbdcompiler freebsd-$(@:%.ekbd=%) KeyboardNames.pl $(xkbdir) >$@
charmap_functions.sh : $(acmfiles)
./make_charmap_functions ../acm $(charmaps) >$@
@@ -68,7 +70,7 @@ clean:
-rm -rf linux-keymaps freebsd-keymaps keymaps
-rm -f keymaps.dir names.list
-rm -f charmap_functions.sh
- -rm -f $(gzipped_ekmaps) $(gzipped_ekbds)
+ -rm -f choices $(gzipped_ekmaps) $(gzipped_ekbds)
.PHONY: maintainer-clean
maintainer-clean: clean
diff --git a/Keyboard/kbdcompiler b/Keyboard/kbdcompiler
index 1c4fc78..5998564 100755
--- a/Keyboard/kbdcompiler
+++ b/Keyboard/kbdcompiler
@@ -81,14 +81,20 @@ ensuredir $dir;
printf STDERR "Compiling compact keymaps for %s...\n", $model;
-for my $layout (values %KeyboardNames::layouts) {
- next if ($layout eq 'nec/jp');
- next if ($layout eq 'nec_vndr/jp');
+for my $choice (<STDIN>) {
+ chomp $choice;
+ my $layout = $choice;
+ my $variant = "";
+ if ($choice =~ /\(/) {
+ $layout =~ s/\(.*//;
+ $variant = $choice;
+ $variant =~ s/.*\((.*)\)/$1/;
+ }
+
my $actual_layout = (($layout eq 'cs') ? 'cs,cs'
: (($layout eq 'lt') ? 'lt,lt'
: (($nonlatin =~ / $layout /)
? "us,$layout" : $layout)));
- for my $variant ('', values %{$KeyboardNames::variants{$layout}}) {
my $actual_variant;
if ($actual_layout eq 'cs,cs') {
if ($variant =~ /latin/) {
@@ -123,7 +129,6 @@ for my $layout (values %KeyboardNames::layouts) {
if (-f "$dir/$model-$layout:$variant") {
read_temp_kmap "$layout:$variant";
}
- }
}
sub subtraction {
diff --git a/debian/rules b/debian/rules
index 68252ae..9ff7f5b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -195,6 +195,7 @@ install-udeb: build
install -m0755 debian/keyboard-configuration.config \
debian/console-setup-udeb/usr/share/console-setup/
$(pre) --mini debian/console-setup-udeb/usr/share/console-setup/keyboard-configuration.config
+ sed -i -e '/all_kbdnames/,/^EOF/s/\(.*\*\)[^*]*/\1/' debian/console-setup-udeb/usr/share/console-setup/keyboard-configuration.config
dh_install -p console-setup-udeb debian/kbdnames.gz usr/share/console-setup
dh_installdirs -p console-setup-udeb lib/debian-installer.d/
install -m0644 debian/console-setup-udeb.startup \
Reply to: