From bf4e0180e780b982bf88a42c229f19036427e00cda7dc85db056fc138bd21188 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Wed, 9 Jun 2021 08:41:41 +0000 Subject: [PATCH 1/5] Accepting request 898655 from devel:openQA * Handle glyphs without unicode mapping gracefully * Fix generating psf2 fonts with multiple codepoints per glyph * psf2bdf.pl: Support mapping multiple codepoints to a glyph * Use eurlatgr as font * Further cleanup of spec-file * Cleanup spec-file (delete unused symbol; simplify) * Delete old pre-SLE11 cruft * Mark as noarch as there are only scripts * Cleanup spec-file * Add files from https://build.opensuse.org/package/show/devel:openQA/xterm-console OBS-URL: https://build.opensuse.org/request/show/898655 OBS-URL: https://build.opensuse.org/package/show/devel:openQA:tested/xterm-console?expand=0&rev=12 --- _service | 4 +- _service:obs_scm:_servicedata | 4 + _service:obs_scm:psf2bdf.pl | 132 ++++++++++++++++++ _service:obs_scm:xterm-console | 74 ++++++++++ _service:obs_scm:xterm-console.changes | 44 ++++++ _service:obs_scm:xterm-console.spec | 73 ++++++++++ _service:obs_scm:xterm_console-1.0.obscpio | 3 + _service:obs_scm:xterm_console.obsinfo | 5 + ...ice:set_version:obs_scm:xterm-console.spec | 73 ++++++++++ _service:set_version:xterm-console.spec | 73 ++++++++++ 10 files changed, 483 insertions(+), 2 deletions(-) create mode 100644 _service:obs_scm:_servicedata create mode 100644 _service:obs_scm:psf2bdf.pl create mode 100644 _service:obs_scm:xterm-console create mode 100644 _service:obs_scm:xterm-console.changes create mode 100644 _service:obs_scm:xterm-console.spec create mode 100644 _service:obs_scm:xterm_console-1.0.obscpio create mode 100644 _service:obs_scm:xterm_console.obsinfo create mode 100644 _service:set_version:obs_scm:xterm-console.spec create mode 100644 _service:set_version:xterm-console.spec diff --git a/_service b/_service index 7769592..a532deb 100644 --- a/_service +++ b/_service @@ -1,5 +1,5 @@ - + psf2bdf.pl xterm-console xterm-console.spec @@ -10,7 +10,7 @@ enable okurz@suse.com - + xz diff --git a/_service:obs_scm:_servicedata b/_service:obs_scm:_servicedata new file mode 100644 index 0000000..2b861de --- /dev/null +++ b/_service:obs_scm:_servicedata @@ -0,0 +1,4 @@ + + + git://github.com/os-autoinst/xterm_console.git + 9392dd687a6dde84ee4d56f1331717cb18a26ffd \ No newline at end of file diff --git a/_service:obs_scm:psf2bdf.pl b/_service:obs_scm:psf2bdf.pl new file mode 100644 index 0000000..edc71b6 --- /dev/null +++ b/_service:obs_scm:psf2bdf.pl @@ -0,0 +1,132 @@ +#!/usr/bin/env perl +# Convert PC Screen Font (PSF) font to Glyph Bitmap Distribution Format (BDF). +# Copyright (c) 2015 Kacper Gutowski +# Copyright (c) 2015 Susanne Oberhauser-Hirschoff +# The MIT License applies (http://opensource.org/licenses/MIT) + +# https://gist.github.com/mwgamera/6ad86e71e002e5aef1b8/01ffe8208b2763dd353ea7afacedf83072477372 +# with minor fixes + +use strict; + +use constant { + PSF1_MODE512 => 0x01, + PSF1_MODEHASTAB => 0x02, + PSF2_HAS_UNICODE_TABLE => 0x01, +}; + +push @ARGV, '-' unless scalar @ARGV; + +for (@ARGV) { + my $fn = /^-$/ ? 'stdin' : $_; + eval { + + my ($length, $width, $height); + my (@glyphs, @unicode); + my $unilen = 0; + + open my $fh, $_ or die $!; + binmode $fh; + read $fh, $_, 4 or die $!; + + if (0x0436 == unpack 'v') { # psf1 + my ($mode, $size) = unpack 'x2CC'; + $length = $mode & PSF1_MODE512 ? 512 : 256; + $height = $size; + $width = 8; + read $fh, $_, $length * $size; + @glyphs = unpack "(a$size)$length"; + if ($mode & PSF1_MODEHASTAB) { + for my $i (0 .. $length - 1) { + my ($u, @u) = 0; + do { + read $fh, $_, 2; + $u = unpack 'v'; + push @u, $u if $u < 0xFFFE; + } while $u < 0xFFFE; + while ($u != 0xFFFF) { + read $fh, $_, 2; + $u = unpack 'v'; + warn 'Unicode sequence ignored' if $u == 0xFFFE; + } + $unicode[$i] = [@u]; + $unilen += (scalar @u) - 1 if (scalar @u); + } + } + } + elsif (0x864ab572 == unpack 'V') { # psf2 + read $fh, $_, 28 or die $!; + (my ($ver, $hlen, $flg), $length, my $size, $height, $width) = unpack 'V7'; + die "Unknown version $ver\n" unless $ver == 0; + warn "Unexpected glyph size $size bytes for ${width}×$height px\n" + unless $size == $height * int(($width + 7) / 8); + read $fh, $_, $hlen - 32; # skip to data + read $fh, $_, $length * $size; + @glyphs = unpack "(a$size)$length"; + if ($flg & PSF2_HAS_UNICODE_TABLE) { + my $buf = do { local $/; <$fh>; }; + for my $i (0 .. $length - 1) { + $buf =~ m/\G([^\xfe\xff]*+)(?:\xfe[^\xfe\xff]++)*\xff/sg; + utf8::decode(my $str = $1); + $unicode[$i] = [map ord, split //, $str]; + $unilen += (scalar @{$unicode[$i]}) - 1 if (scalar @{$unicode[$i]}); + } + } + } + else { + die "Bad format\n"; + } + + + print "STARTFONT 2.1\n"; + printf "FONT %s\n", '-psf-'; + printf "SIZE %u 72 72\n", $height; + printf "FONTBOUNDINGBOX %u %u 0 0\n", $width, $height; + + printf "STARTPROPERTIES %u\n", 6 + 2 * !!@unicode; + printf "PIXEL_SIZE %u\n", $height; + printf "POINT_SIZE %u\n", 10 * $height; + printf "FONT_ASCENT %u\n", $height; + print "FONT_DESCENT 0\n"; + print "RESOLUTION_X 72\n"; + print "RESOLUTION_Y 72\n"; + if (@unicode) { + print "CHARSET_REGISTRY \"ISO10646\"\n"; + print "CHARSET_ENCODING \"1\"\n"; + } + print "ENDPROPERTIES\n"; + + printf "CHARS %u\n", $length + $unilen; + + for my $i (0 .. $length - 1) { + my @encodings = ($i); + my $is_unicode = 0; + + if(@unicode && @{$unicode[$i]}) { + @encodings = @{$unicode[$i]}; + $is_unicode = 1; + } + + foreach my $e (@encodings) { + printf "STARTCHAR psf%03x-%04x\n", $i, $e; + if ($is_unicode) { + printf "ENCODING %u\n", $e; + } + else { + printf "ENCODING -1 %u\n", $e; + } + printf "SWIDTH %u 0\n", $width * 1000 / $height; + printf "DWIDTH %u 0\n", $width; + printf "BBX %u %u 0 0\n", $width, $height; + my $bw = (($width + 7) & ~7) >> 3; + printf "BITMAP\n%s\n", join "\n", map unpack('H*', $_), unpack "(a$bw)*", $glyphs[$i]; + printf "ENDCHAR\n"; + } + } + + print "ENDFONT\n"; + + }; + warn "$fn: $@" if $@; + last; +} diff --git a/_service:obs_scm:xterm-console b/_service:obs_scm:xterm-console new file mode 100644 index 0000000..18240da --- /dev/null +++ b/_service:obs_scm:xterm-console @@ -0,0 +1,74 @@ +#!/usr/bin/python3 +# Copyright (C) 2015 Susanne Oberhauser-Hirschoff +# The MIT License applies (http://opensource.org/licenses/MIT) + +"""start an xterm that looks like a linux console + + + # do this once, to let the xserver know about the fonts + xset fp+ $(pwd) + + # for each font you want to try... + gunzip -c /usr/share/kbd/consolefonts/lat9w-16.psfu.gz | perl psf2bdf.pl > lat9w-16.bdf + + sed -i -e s,-psf-,lat9w_16, lat9w-16.bdf + + # update the fonts.dir file + mkfontdir + # notify X about the new font + xset fp rehash + + # have a look :) + # start an xterm with the right colors and all, script is attached [3] + python3 xterm_linux_vt.py + +""" + +# from pprint import pprint as pp +default_kernel_vt_colors = {} +RGB = ("red", "grn", "blu") +for cname in RGB: + with open("/sys/module/vt/parameters/default_{}".format(cname)) as f: + colors = f.read().rstrip().split(',') + default_kernel_vt_colors[cname] = map(int, colors) + +xterm_colors= list() + +for r, g, b in zip(*(default_kernel_vt_colors[c] for c in RGB)): + xterm_colors.append("rgb:{r:02x}/{g:02x}/{b:02x}".format(**locals())) + +def xtc(label, color): + return ("-xrm", "xterm*{label}: {color}".format(**locals())) + +def xrm_color_options(): + yield(xtc("foreground", xterm_colors[7])) + yield(xtc("background", xterm_colors[0])) + for i, c in enumerate(xterm_colors): + yield(xtc("color{}".format(i), c)) + +from itertools import chain + +import os + +xx = [ + "xterm", + # console font + "-fn", "eurlatgr", + "-fullscreen", + # no scrollbar + "+sb", + # no border + "-b", "0", + # blinking underline cursor + "-bc", "-uc", "-bcf", "200", "-bcn", "200", + # intense colors for bold + "+bdc", + # intense for bold... + "-xrm", "xterm*boldMode: false", +] + +import sys # for argv +sys.argv.pop(0) # strip command name +xx.extend(chain(*xrm_color_options())) +xx.extend(sys.argv) +os.execvp("xterm", xx) diff --git a/_service:obs_scm:xterm-console.changes b/_service:obs_scm:xterm-console.changes new file mode 100644 index 0000000..8c7215c --- /dev/null +++ b/_service:obs_scm:xterm-console.changes @@ -0,0 +1,44 @@ +------------------------------------------------------------------- +Tue May 18 10:05:59 UTC 2021 - okurz@suse.com + +- Update to version 1.0: + * Handle glyphs without unicode mapping gracefully + * Fix generating psf2 fonts with multiple codepoints per glyph + * psf2bdf.pl: Support mapping multiple codepoints to a glyph + * Use eurlatgr as font + * Further cleanup of spec-file + * Cleanup spec-file (delete unused symbol; simplify) + * Delete old pre-SLE11 cruft + * Mark as noarch as there are only scripts + * Cleanup spec-file + * Add files from https://build.opensuse.org/package/show/devel:openQA/xterm-console + +------------------------------------------------------------------- +Tue Jan 28 12:26:32 UTC 2020 - okurz@suse.com + +- Update to version 1.0: + * Change package to use upstream on + https://github.com/os-autoinst/xterm_console + * Change to noarch as there are only scripts + * Delete old pre-SLE11 cruft + * Cleanup spec-file (delete unused symbol; simplify) + +------------------------------------------------------------------- +Mon Jun 25 13:21:00 UTC 2018 - slindomansilla@suse.com + +- Use supplemments to os-autoinst + + When using svirt backend (s390x, XEN), xterm-console is needed. + It is expected the use of this backend only on special cases, + so this package is not added as required. But it may help to + mark it as supplement os os-autoinst. + +------------------------------------------------------------------- +Wed Apr 29 08:55:11 UTC 2015 - coolo@suse.com + +- remove nonexistant +itc option + +------------------------------------------------------------------- +* Mon Apr 27 2015 - froh@suse.de + +- initial version diff --git a/_service:obs_scm:xterm-console.spec b/_service:obs_scm:xterm-console.spec new file mode 100644 index 0000000..5f38e40 --- /dev/null +++ b/_service:obs_scm:xterm-console.spec @@ -0,0 +1,73 @@ +# +# spec file for package xterm-console +# +# Copyright (c) 2020 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: xterm-console +Version: 1.0 +Release: 0 +Summary: A Linux vt console look-alike xterm wrapper +License: MIT +Group: System/X11/Utilities +URL: https://github.com/os-autoinst/xterm-console +Source: xterm-console +Source1: psf2bdf.pl +BuildRequires: bdftopcf +BuildRequires: fontpackages-devel +# the original consolefonts: +BuildRequires: kbd +Requires: fonts-config +# svirt, eg. s390x, xen +Supplements: os-autoinst +%reconfigure_fonts_prereq +BuildArch: noarch + +%description +This package contains the basic X.Org terminal program. + +%prep + +%setup -q -c -T +cp %{SOURCE1} . + +%build +chmod +x ./psf2bdf.pl + +for font in %{_datadir}/kbd/consolefonts/*.psfu.gz; do + fontname="${font##*/}" + fontname="${fontname%.psfu.gz}" + gunzip -c $font | ./psf2bdf.pl | sed -e "s,FONT \+-psf-,FONT ${fontname}," > "$fontname".bdf +done + +for i in *.bdf; do + bdftopcf "$i" | gzip -9 >"${i%.bdf}.pcf.gz" +done + +%install +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_datadir}/fonts/misc/ + +install -m 0755 %{SOURCE0} %{buildroot}%{_bindir} +install -m 0644 *.pcf.gz %{buildroot}%{_datadir}/fonts/misc/ + +%reconfigure_fonts_scriptlets + +%files +%{_bindir}/xterm-console +%dir %{_datadir}/fonts/misc +%{_datadir}/fonts/misc/*.pcf.gz + +%changelog diff --git a/_service:obs_scm:xterm_console-1.0.obscpio b/_service:obs_scm:xterm_console-1.0.obscpio new file mode 100644 index 0000000..b8f7481 --- /dev/null +++ b/_service:obs_scm:xterm_console-1.0.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ce566cdc6d8f97bd3edc826fd903e63ff9afd8a04bb8dc5a975a529ed9fc6d8 +size 10762 diff --git a/_service:obs_scm:xterm_console.obsinfo b/_service:obs_scm:xterm_console.obsinfo new file mode 100644 index 0000000..38b9dff --- /dev/null +++ b/_service:obs_scm:xterm_console.obsinfo @@ -0,0 +1,5 @@ +name: xterm_console +version: 1.0 +mtime: 1621332343 +commit: 758680e5ededc0072b8f9b86ee136ac9973b2ef3 + diff --git a/_service:set_version:obs_scm:xterm-console.spec b/_service:set_version:obs_scm:xterm-console.spec new file mode 100644 index 0000000..5f38e40 --- /dev/null +++ b/_service:set_version:obs_scm:xterm-console.spec @@ -0,0 +1,73 @@ +# +# spec file for package xterm-console +# +# Copyright (c) 2020 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: xterm-console +Version: 1.0 +Release: 0 +Summary: A Linux vt console look-alike xterm wrapper +License: MIT +Group: System/X11/Utilities +URL: https://github.com/os-autoinst/xterm-console +Source: xterm-console +Source1: psf2bdf.pl +BuildRequires: bdftopcf +BuildRequires: fontpackages-devel +# the original consolefonts: +BuildRequires: kbd +Requires: fonts-config +# svirt, eg. s390x, xen +Supplements: os-autoinst +%reconfigure_fonts_prereq +BuildArch: noarch + +%description +This package contains the basic X.Org terminal program. + +%prep + +%setup -q -c -T +cp %{SOURCE1} . + +%build +chmod +x ./psf2bdf.pl + +for font in %{_datadir}/kbd/consolefonts/*.psfu.gz; do + fontname="${font##*/}" + fontname="${fontname%.psfu.gz}" + gunzip -c $font | ./psf2bdf.pl | sed -e "s,FONT \+-psf-,FONT ${fontname}," > "$fontname".bdf +done + +for i in *.bdf; do + bdftopcf "$i" | gzip -9 >"${i%.bdf}.pcf.gz" +done + +%install +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_datadir}/fonts/misc/ + +install -m 0755 %{SOURCE0} %{buildroot}%{_bindir} +install -m 0644 *.pcf.gz %{buildroot}%{_datadir}/fonts/misc/ + +%reconfigure_fonts_scriptlets + +%files +%{_bindir}/xterm-console +%dir %{_datadir}/fonts/misc +%{_datadir}/fonts/misc/*.pcf.gz + +%changelog diff --git a/_service:set_version:xterm-console.spec b/_service:set_version:xterm-console.spec new file mode 100644 index 0000000..5f38e40 --- /dev/null +++ b/_service:set_version:xterm-console.spec @@ -0,0 +1,73 @@ +# +# spec file for package xterm-console +# +# Copyright (c) 2020 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: xterm-console +Version: 1.0 +Release: 0 +Summary: A Linux vt console look-alike xterm wrapper +License: MIT +Group: System/X11/Utilities +URL: https://github.com/os-autoinst/xterm-console +Source: xterm-console +Source1: psf2bdf.pl +BuildRequires: bdftopcf +BuildRequires: fontpackages-devel +# the original consolefonts: +BuildRequires: kbd +Requires: fonts-config +# svirt, eg. s390x, xen +Supplements: os-autoinst +%reconfigure_fonts_prereq +BuildArch: noarch + +%description +This package contains the basic X.Org terminal program. + +%prep + +%setup -q -c -T +cp %{SOURCE1} . + +%build +chmod +x ./psf2bdf.pl + +for font in %{_datadir}/kbd/consolefonts/*.psfu.gz; do + fontname="${font##*/}" + fontname="${fontname%.psfu.gz}" + gunzip -c $font | ./psf2bdf.pl | sed -e "s,FONT \+-psf-,FONT ${fontname}," > "$fontname".bdf +done + +for i in *.bdf; do + bdftopcf "$i" | gzip -9 >"${i%.bdf}.pcf.gz" +done + +%install +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_datadir}/fonts/misc/ + +install -m 0755 %{SOURCE0} %{buildroot}%{_bindir} +install -m 0644 *.pcf.gz %{buildroot}%{_datadir}/fonts/misc/ + +%reconfigure_fonts_scriptlets + +%files +%{_bindir}/xterm-console +%dir %{_datadir}/fonts/misc +%{_datadir}/fonts/misc/*.pcf.gz + +%changelog From 9ad7fade02f6d69cd24ce1870fea0e83d961fcb9fe259265284b6c9221bc97c9 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Thu, 10 Jun 2021 13:52:44 +0000 Subject: [PATCH 2/5] Disable services again to allow submission to Factory OBS-URL: https://build.opensuse.org/package/show/devel:openQA:tested/xterm-console?expand=0&rev=13 --- _service | 4 +- _service:obs_scm:_servicedata | 4 - _service:obs_scm:psf2bdf.pl | 132 ------------------ _service:obs_scm:xterm-console | 74 ---------- _service:obs_scm:xterm-console.changes | 44 ------ _service:obs_scm:xterm-console.spec | 73 ---------- _service:obs_scm:xterm_console-1.0.obscpio | 3 - _service:obs_scm:xterm_console.obsinfo | 5 - ...ice:set_version:obs_scm:xterm-console.spec | 73 ---------- _service:set_version:xterm-console.spec | 73 ---------- xterm-console.changes | 5 + xterm-console.spec | 2 +- 12 files changed, 8 insertions(+), 484 deletions(-) delete mode 100644 _service:obs_scm:_servicedata delete mode 100644 _service:obs_scm:psf2bdf.pl delete mode 100644 _service:obs_scm:xterm-console delete mode 100644 _service:obs_scm:xterm-console.changes delete mode 100644 _service:obs_scm:xterm-console.spec delete mode 100644 _service:obs_scm:xterm_console-1.0.obscpio delete mode 100644 _service:obs_scm:xterm_console.obsinfo delete mode 100644 _service:set_version:obs_scm:xterm-console.spec delete mode 100644 _service:set_version:xterm-console.spec diff --git a/_service b/_service index a532deb..7769592 100644 --- a/_service +++ b/_service @@ -1,5 +1,5 @@ - + psf2bdf.pl xterm-console xterm-console.spec @@ -10,7 +10,7 @@ enable okurz@suse.com - + xz diff --git a/_service:obs_scm:_servicedata b/_service:obs_scm:_servicedata deleted file mode 100644 index 2b861de..0000000 --- a/_service:obs_scm:_servicedata +++ /dev/null @@ -1,4 +0,0 @@ - - - git://github.com/os-autoinst/xterm_console.git - 9392dd687a6dde84ee4d56f1331717cb18a26ffd \ No newline at end of file diff --git a/_service:obs_scm:psf2bdf.pl b/_service:obs_scm:psf2bdf.pl deleted file mode 100644 index edc71b6..0000000 --- a/_service:obs_scm:psf2bdf.pl +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/env perl -# Convert PC Screen Font (PSF) font to Glyph Bitmap Distribution Format (BDF). -# Copyright (c) 2015 Kacper Gutowski -# Copyright (c) 2015 Susanne Oberhauser-Hirschoff -# The MIT License applies (http://opensource.org/licenses/MIT) - -# https://gist.github.com/mwgamera/6ad86e71e002e5aef1b8/01ffe8208b2763dd353ea7afacedf83072477372 -# with minor fixes - -use strict; - -use constant { - PSF1_MODE512 => 0x01, - PSF1_MODEHASTAB => 0x02, - PSF2_HAS_UNICODE_TABLE => 0x01, -}; - -push @ARGV, '-' unless scalar @ARGV; - -for (@ARGV) { - my $fn = /^-$/ ? 'stdin' : $_; - eval { - - my ($length, $width, $height); - my (@glyphs, @unicode); - my $unilen = 0; - - open my $fh, $_ or die $!; - binmode $fh; - read $fh, $_, 4 or die $!; - - if (0x0436 == unpack 'v') { # psf1 - my ($mode, $size) = unpack 'x2CC'; - $length = $mode & PSF1_MODE512 ? 512 : 256; - $height = $size; - $width = 8; - read $fh, $_, $length * $size; - @glyphs = unpack "(a$size)$length"; - if ($mode & PSF1_MODEHASTAB) { - for my $i (0 .. $length - 1) { - my ($u, @u) = 0; - do { - read $fh, $_, 2; - $u = unpack 'v'; - push @u, $u if $u < 0xFFFE; - } while $u < 0xFFFE; - while ($u != 0xFFFF) { - read $fh, $_, 2; - $u = unpack 'v'; - warn 'Unicode sequence ignored' if $u == 0xFFFE; - } - $unicode[$i] = [@u]; - $unilen += (scalar @u) - 1 if (scalar @u); - } - } - } - elsif (0x864ab572 == unpack 'V') { # psf2 - read $fh, $_, 28 or die $!; - (my ($ver, $hlen, $flg), $length, my $size, $height, $width) = unpack 'V7'; - die "Unknown version $ver\n" unless $ver == 0; - warn "Unexpected glyph size $size bytes for ${width}×$height px\n" - unless $size == $height * int(($width + 7) / 8); - read $fh, $_, $hlen - 32; # skip to data - read $fh, $_, $length * $size; - @glyphs = unpack "(a$size)$length"; - if ($flg & PSF2_HAS_UNICODE_TABLE) { - my $buf = do { local $/; <$fh>; }; - for my $i (0 .. $length - 1) { - $buf =~ m/\G([^\xfe\xff]*+)(?:\xfe[^\xfe\xff]++)*\xff/sg; - utf8::decode(my $str = $1); - $unicode[$i] = [map ord, split //, $str]; - $unilen += (scalar @{$unicode[$i]}) - 1 if (scalar @{$unicode[$i]}); - } - } - } - else { - die "Bad format\n"; - } - - - print "STARTFONT 2.1\n"; - printf "FONT %s\n", '-psf-'; - printf "SIZE %u 72 72\n", $height; - printf "FONTBOUNDINGBOX %u %u 0 0\n", $width, $height; - - printf "STARTPROPERTIES %u\n", 6 + 2 * !!@unicode; - printf "PIXEL_SIZE %u\n", $height; - printf "POINT_SIZE %u\n", 10 * $height; - printf "FONT_ASCENT %u\n", $height; - print "FONT_DESCENT 0\n"; - print "RESOLUTION_X 72\n"; - print "RESOLUTION_Y 72\n"; - if (@unicode) { - print "CHARSET_REGISTRY \"ISO10646\"\n"; - print "CHARSET_ENCODING \"1\"\n"; - } - print "ENDPROPERTIES\n"; - - printf "CHARS %u\n", $length + $unilen; - - for my $i (0 .. $length - 1) { - my @encodings = ($i); - my $is_unicode = 0; - - if(@unicode && @{$unicode[$i]}) { - @encodings = @{$unicode[$i]}; - $is_unicode = 1; - } - - foreach my $e (@encodings) { - printf "STARTCHAR psf%03x-%04x\n", $i, $e; - if ($is_unicode) { - printf "ENCODING %u\n", $e; - } - else { - printf "ENCODING -1 %u\n", $e; - } - printf "SWIDTH %u 0\n", $width * 1000 / $height; - printf "DWIDTH %u 0\n", $width; - printf "BBX %u %u 0 0\n", $width, $height; - my $bw = (($width + 7) & ~7) >> 3; - printf "BITMAP\n%s\n", join "\n", map unpack('H*', $_), unpack "(a$bw)*", $glyphs[$i]; - printf "ENDCHAR\n"; - } - } - - print "ENDFONT\n"; - - }; - warn "$fn: $@" if $@; - last; -} diff --git a/_service:obs_scm:xterm-console b/_service:obs_scm:xterm-console deleted file mode 100644 index 18240da..0000000 --- a/_service:obs_scm:xterm-console +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python3 -# Copyright (C) 2015 Susanne Oberhauser-Hirschoff -# The MIT License applies (http://opensource.org/licenses/MIT) - -"""start an xterm that looks like a linux console - - - # do this once, to let the xserver know about the fonts - xset fp+ $(pwd) - - # for each font you want to try... - gunzip -c /usr/share/kbd/consolefonts/lat9w-16.psfu.gz | perl psf2bdf.pl > lat9w-16.bdf - - sed -i -e s,-psf-,lat9w_16, lat9w-16.bdf - - # update the fonts.dir file - mkfontdir - # notify X about the new font - xset fp rehash - - # have a look :) - # start an xterm with the right colors and all, script is attached [3] - python3 xterm_linux_vt.py - -""" - -# from pprint import pprint as pp -default_kernel_vt_colors = {} -RGB = ("red", "grn", "blu") -for cname in RGB: - with open("/sys/module/vt/parameters/default_{}".format(cname)) as f: - colors = f.read().rstrip().split(',') - default_kernel_vt_colors[cname] = map(int, colors) - -xterm_colors= list() - -for r, g, b in zip(*(default_kernel_vt_colors[c] for c in RGB)): - xterm_colors.append("rgb:{r:02x}/{g:02x}/{b:02x}".format(**locals())) - -def xtc(label, color): - return ("-xrm", "xterm*{label}: {color}".format(**locals())) - -def xrm_color_options(): - yield(xtc("foreground", xterm_colors[7])) - yield(xtc("background", xterm_colors[0])) - for i, c in enumerate(xterm_colors): - yield(xtc("color{}".format(i), c)) - -from itertools import chain - -import os - -xx = [ - "xterm", - # console font - "-fn", "eurlatgr", - "-fullscreen", - # no scrollbar - "+sb", - # no border - "-b", "0", - # blinking underline cursor - "-bc", "-uc", "-bcf", "200", "-bcn", "200", - # intense colors for bold - "+bdc", - # intense for bold... - "-xrm", "xterm*boldMode: false", -] - -import sys # for argv -sys.argv.pop(0) # strip command name -xx.extend(chain(*xrm_color_options())) -xx.extend(sys.argv) -os.execvp("xterm", xx) diff --git a/_service:obs_scm:xterm-console.changes b/_service:obs_scm:xterm-console.changes deleted file mode 100644 index 8c7215c..0000000 --- a/_service:obs_scm:xterm-console.changes +++ /dev/null @@ -1,44 +0,0 @@ -------------------------------------------------------------------- -Tue May 18 10:05:59 UTC 2021 - okurz@suse.com - -- Update to version 1.0: - * Handle glyphs without unicode mapping gracefully - * Fix generating psf2 fonts with multiple codepoints per glyph - * psf2bdf.pl: Support mapping multiple codepoints to a glyph - * Use eurlatgr as font - * Further cleanup of spec-file - * Cleanup spec-file (delete unused symbol; simplify) - * Delete old pre-SLE11 cruft - * Mark as noarch as there are only scripts - * Cleanup spec-file - * Add files from https://build.opensuse.org/package/show/devel:openQA/xterm-console - -------------------------------------------------------------------- -Tue Jan 28 12:26:32 UTC 2020 - okurz@suse.com - -- Update to version 1.0: - * Change package to use upstream on - https://github.com/os-autoinst/xterm_console - * Change to noarch as there are only scripts - * Delete old pre-SLE11 cruft - * Cleanup spec-file (delete unused symbol; simplify) - -------------------------------------------------------------------- -Mon Jun 25 13:21:00 UTC 2018 - slindomansilla@suse.com - -- Use supplemments to os-autoinst - - When using svirt backend (s390x, XEN), xterm-console is needed. - It is expected the use of this backend only on special cases, - so this package is not added as required. But it may help to - mark it as supplement os os-autoinst. - -------------------------------------------------------------------- -Wed Apr 29 08:55:11 UTC 2015 - coolo@suse.com - -- remove nonexistant +itc option - -------------------------------------------------------------------- -* Mon Apr 27 2015 - froh@suse.de - -- initial version diff --git a/_service:obs_scm:xterm-console.spec b/_service:obs_scm:xterm-console.spec deleted file mode 100644 index 5f38e40..0000000 --- a/_service:obs_scm:xterm-console.spec +++ /dev/null @@ -1,73 +0,0 @@ -# -# spec file for package xterm-console -# -# Copyright (c) 2020 SUSE LLC -# -# All modifications and additions to the file contributed by third parties -# remain the property of their copyright owners, unless otherwise agreed -# upon. The license for this file, and modifications and additions to the -# file, is the same license as for the pristine package itself (unless the -# license for the pristine package is not an Open Source License, in which -# case the license is the MIT License). An "Open Source License" is a -# license that conforms to the Open Source Definition (Version 1.9) -# published by the Open Source Initiative. - -# Please submit bugfixes or comments via https://bugs.opensuse.org/ -# - - -Name: xterm-console -Version: 1.0 -Release: 0 -Summary: A Linux vt console look-alike xterm wrapper -License: MIT -Group: System/X11/Utilities -URL: https://github.com/os-autoinst/xterm-console -Source: xterm-console -Source1: psf2bdf.pl -BuildRequires: bdftopcf -BuildRequires: fontpackages-devel -# the original consolefonts: -BuildRequires: kbd -Requires: fonts-config -# svirt, eg. s390x, xen -Supplements: os-autoinst -%reconfigure_fonts_prereq -BuildArch: noarch - -%description -This package contains the basic X.Org terminal program. - -%prep - -%setup -q -c -T -cp %{SOURCE1} . - -%build -chmod +x ./psf2bdf.pl - -for font in %{_datadir}/kbd/consolefonts/*.psfu.gz; do - fontname="${font##*/}" - fontname="${fontname%.psfu.gz}" - gunzip -c $font | ./psf2bdf.pl | sed -e "s,FONT \+-psf-,FONT ${fontname}," > "$fontname".bdf -done - -for i in *.bdf; do - bdftopcf "$i" | gzip -9 >"${i%.bdf}.pcf.gz" -done - -%install -mkdir -p %{buildroot}%{_bindir} -mkdir -p %{buildroot}%{_datadir}/fonts/misc/ - -install -m 0755 %{SOURCE0} %{buildroot}%{_bindir} -install -m 0644 *.pcf.gz %{buildroot}%{_datadir}/fonts/misc/ - -%reconfigure_fonts_scriptlets - -%files -%{_bindir}/xterm-console -%dir %{_datadir}/fonts/misc -%{_datadir}/fonts/misc/*.pcf.gz - -%changelog diff --git a/_service:obs_scm:xterm_console-1.0.obscpio b/_service:obs_scm:xterm_console-1.0.obscpio deleted file mode 100644 index b8f7481..0000000 --- a/_service:obs_scm:xterm_console-1.0.obscpio +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5ce566cdc6d8f97bd3edc826fd903e63ff9afd8a04bb8dc5a975a529ed9fc6d8 -size 10762 diff --git a/_service:obs_scm:xterm_console.obsinfo b/_service:obs_scm:xterm_console.obsinfo deleted file mode 100644 index 38b9dff..0000000 --- a/_service:obs_scm:xterm_console.obsinfo +++ /dev/null @@ -1,5 +0,0 @@ -name: xterm_console -version: 1.0 -mtime: 1621332343 -commit: 758680e5ededc0072b8f9b86ee136ac9973b2ef3 - diff --git a/_service:set_version:obs_scm:xterm-console.spec b/_service:set_version:obs_scm:xterm-console.spec deleted file mode 100644 index 5f38e40..0000000 --- a/_service:set_version:obs_scm:xterm-console.spec +++ /dev/null @@ -1,73 +0,0 @@ -# -# spec file for package xterm-console -# -# Copyright (c) 2020 SUSE LLC -# -# All modifications and additions to the file contributed by third parties -# remain the property of their copyright owners, unless otherwise agreed -# upon. The license for this file, and modifications and additions to the -# file, is the same license as for the pristine package itself (unless the -# license for the pristine package is not an Open Source License, in which -# case the license is the MIT License). An "Open Source License" is a -# license that conforms to the Open Source Definition (Version 1.9) -# published by the Open Source Initiative. - -# Please submit bugfixes or comments via https://bugs.opensuse.org/ -# - - -Name: xterm-console -Version: 1.0 -Release: 0 -Summary: A Linux vt console look-alike xterm wrapper -License: MIT -Group: System/X11/Utilities -URL: https://github.com/os-autoinst/xterm-console -Source: xterm-console -Source1: psf2bdf.pl -BuildRequires: bdftopcf -BuildRequires: fontpackages-devel -# the original consolefonts: -BuildRequires: kbd -Requires: fonts-config -# svirt, eg. s390x, xen -Supplements: os-autoinst -%reconfigure_fonts_prereq -BuildArch: noarch - -%description -This package contains the basic X.Org terminal program. - -%prep - -%setup -q -c -T -cp %{SOURCE1} . - -%build -chmod +x ./psf2bdf.pl - -for font in %{_datadir}/kbd/consolefonts/*.psfu.gz; do - fontname="${font##*/}" - fontname="${fontname%.psfu.gz}" - gunzip -c $font | ./psf2bdf.pl | sed -e "s,FONT \+-psf-,FONT ${fontname}," > "$fontname".bdf -done - -for i in *.bdf; do - bdftopcf "$i" | gzip -9 >"${i%.bdf}.pcf.gz" -done - -%install -mkdir -p %{buildroot}%{_bindir} -mkdir -p %{buildroot}%{_datadir}/fonts/misc/ - -install -m 0755 %{SOURCE0} %{buildroot}%{_bindir} -install -m 0644 *.pcf.gz %{buildroot}%{_datadir}/fonts/misc/ - -%reconfigure_fonts_scriptlets - -%files -%{_bindir}/xterm-console -%dir %{_datadir}/fonts/misc -%{_datadir}/fonts/misc/*.pcf.gz - -%changelog diff --git a/_service:set_version:xterm-console.spec b/_service:set_version:xterm-console.spec deleted file mode 100644 index 5f38e40..0000000 --- a/_service:set_version:xterm-console.spec +++ /dev/null @@ -1,73 +0,0 @@ -# -# spec file for package xterm-console -# -# Copyright (c) 2020 SUSE LLC -# -# All modifications and additions to the file contributed by third parties -# remain the property of their copyright owners, unless otherwise agreed -# upon. The license for this file, and modifications and additions to the -# file, is the same license as for the pristine package itself (unless the -# license for the pristine package is not an Open Source License, in which -# case the license is the MIT License). An "Open Source License" is a -# license that conforms to the Open Source Definition (Version 1.9) -# published by the Open Source Initiative. - -# Please submit bugfixes or comments via https://bugs.opensuse.org/ -# - - -Name: xterm-console -Version: 1.0 -Release: 0 -Summary: A Linux vt console look-alike xterm wrapper -License: MIT -Group: System/X11/Utilities -URL: https://github.com/os-autoinst/xterm-console -Source: xterm-console -Source1: psf2bdf.pl -BuildRequires: bdftopcf -BuildRequires: fontpackages-devel -# the original consolefonts: -BuildRequires: kbd -Requires: fonts-config -# svirt, eg. s390x, xen -Supplements: os-autoinst -%reconfigure_fonts_prereq -BuildArch: noarch - -%description -This package contains the basic X.Org terminal program. - -%prep - -%setup -q -c -T -cp %{SOURCE1} . - -%build -chmod +x ./psf2bdf.pl - -for font in %{_datadir}/kbd/consolefonts/*.psfu.gz; do - fontname="${font##*/}" - fontname="${fontname%.psfu.gz}" - gunzip -c $font | ./psf2bdf.pl | sed -e "s,FONT \+-psf-,FONT ${fontname}," > "$fontname".bdf -done - -for i in *.bdf; do - bdftopcf "$i" | gzip -9 >"${i%.bdf}.pcf.gz" -done - -%install -mkdir -p %{buildroot}%{_bindir} -mkdir -p %{buildroot}%{_datadir}/fonts/misc/ - -install -m 0755 %{SOURCE0} %{buildroot}%{_bindir} -install -m 0644 *.pcf.gz %{buildroot}%{_datadir}/fonts/misc/ - -%reconfigure_fonts_scriptlets - -%files -%{_bindir}/xterm-console -%dir %{_datadir}/fonts/misc -%{_datadir}/fonts/misc/*.pcf.gz - -%changelog diff --git a/xterm-console.changes b/xterm-console.changes index 54a5083..2986e1d 100644 --- a/xterm-console.changes +++ b/xterm-console.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jun 10 13:51:54 UTC 2021 - Marius Kittler + +- Disable services again to allow submission to Factory + ------------------------------------------------------------------- Tue Jan 28 12:26:32 UTC 2020 - okurz@suse.com diff --git a/xterm-console.spec b/xterm-console.spec index 5f38e40..e7e1e2f 100644 --- a/xterm-console.spec +++ b/xterm-console.spec @@ -1,7 +1,7 @@ # # spec file for package xterm-console # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed From 1be9538d37356a211b21f0c541b815e3d57482abc62c98d5bd6d440f1c069e55 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Thu, 10 Jun 2021 17:59:45 +0000 Subject: [PATCH 3/5] Offline generation of 1.1 OBS-URL: https://build.opensuse.org/package/show/devel:openQA:tested/xterm-console?expand=0&rev=14 --- _service | 1 + psf2bdf.pl | 37 +++++++++++++++++++++++++------------ xterm-console | 2 +- xterm-console.changes | 14 ++++++++++++-- xterm-console.spec | 2 +- xterm_console-1.1.obscpio | 3 +++ xterm_console.obsinfo | 6 +++--- 7 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 xterm_console-1.1.obscpio diff --git a/_service b/_service index 7769592..247e39f 100644 --- a/_service +++ b/_service @@ -1,3 +1,4 @@ + psf2bdf.pl diff --git a/psf2bdf.pl b/psf2bdf.pl index e838bef..edc71b6 100644 --- a/psf2bdf.pl +++ b/psf2bdf.pl @@ -23,6 +23,7 @@ for (@ARGV) { my ($length, $width, $height); my (@glyphs, @unicode); + my $unilen = 0; open my $fh, $_ or die $!; binmode $fh; @@ -49,6 +50,7 @@ for (@ARGV) { warn 'Unicode sequence ignored' if $u == 0xFFFE; } $unicode[$i] = [@u]; + $unilen += (scalar @u) - 1 if (scalar @u); } } } @@ -67,6 +69,7 @@ for (@ARGV) { $buf =~ m/\G([^\xfe\xff]*+)(?:\xfe[^\xfe\xff]++)*\xff/sg; utf8::decode(my $str = $1); $unicode[$i] = [map ord, split //, $str]; + $unilen += (scalar @{$unicode[$i]}) - 1 if (scalar @{$unicode[$i]}); } } } @@ -93,22 +96,32 @@ for (@ARGV) { } print "ENDPROPERTIES\n"; - printf "CHARS %u\n", $length; + printf "CHARS %u\n", $length + $unilen; for my $i (0 .. $length - 1) { - printf "STARTCHAR psf%03x\n", $i; - if (@unicode && @{$unicode[$i]}) { - printf "ENCODING %u\n", $unicode[$i][0]; + my @encodings = ($i); + my $is_unicode = 0; + + if(@unicode && @{$unicode[$i]}) { + @encodings = @{$unicode[$i]}; + $is_unicode = 1; } - else { - printf "ENCODING -1 %u\n", $i; + + foreach my $e (@encodings) { + printf "STARTCHAR psf%03x-%04x\n", $i, $e; + if ($is_unicode) { + printf "ENCODING %u\n", $e; + } + else { + printf "ENCODING -1 %u\n", $e; + } + printf "SWIDTH %u 0\n", $width * 1000 / $height; + printf "DWIDTH %u 0\n", $width; + printf "BBX %u %u 0 0\n", $width, $height; + my $bw = (($width + 7) & ~7) >> 3; + printf "BITMAP\n%s\n", join "\n", map unpack('H*', $_), unpack "(a$bw)*", $glyphs[$i]; + printf "ENDCHAR\n"; } - printf "SWIDTH %u 0\n", $width * 1000 / $height; - printf "DWIDTH %u 0\n", $width; - printf "BBX %u %u 0 0\n", $width, $height; - my $bw = (($width + 7) & ~7) >> 3; - printf "BITMAP\n%s\n", join "\n", map unpack('H*', $_), unpack "(a$bw)*", $glyphs[$i]; - printf "ENDCHAR\n"; } print "ENDFONT\n"; diff --git a/xterm-console b/xterm-console index f9a5f20..18240da 100644 --- a/xterm-console +++ b/xterm-console @@ -53,7 +53,7 @@ import os xx = [ "xterm", # console font - "-fn", "lat9w-16", + "-fn", "eurlatgr", "-fullscreen", # no scrollbar "+sb", diff --git a/xterm-console.changes b/xterm-console.changes index 2986e1d..8b70d63 100644 --- a/xterm-console.changes +++ b/xterm-console.changes @@ -1,7 +1,17 @@ ------------------------------------------------------------------- -Thu Jun 10 13:51:54 UTC 2021 - Marius Kittler +Thu Jun 10 17:58:04 UTC 2021 - okurz@suse.com -- Disable services again to allow submission to Factory +- Update to version 1.1: + * Bump version number in spec + * Handle glyphs without unicode mapping gracefully + * Fix generating psf2 fonts with multiple codepoints per glyph + * psf2bdf.pl: Support mapping multiple codepoints to a glyph + * Use eurlatgr as font + * Further cleanup of spec-file + * Cleanup spec-file (delete unused symbol; simplify) + * Delete old pre-SLE11 cruft + * Mark as noarch as there are only scripts + * Cleanup spec-file ------------------------------------------------------------------- Tue Jan 28 12:26:32 UTC 2020 - okurz@suse.com diff --git a/xterm-console.spec b/xterm-console.spec index e7e1e2f..788c5e4 100644 --- a/xterm-console.spec +++ b/xterm-console.spec @@ -17,7 +17,7 @@ Name: xterm-console -Version: 1.0 +Version: 1.1 Release: 0 Summary: A Linux vt console look-alike xterm wrapper License: MIT diff --git a/xterm_console-1.1.obscpio b/xterm_console-1.1.obscpio new file mode 100644 index 0000000..442b2e7 --- /dev/null +++ b/xterm_console-1.1.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:754be3cb16a7256bcbbcb658296c3db44d2bd8fce52c28ee7d44540ecf10b0fe +size 10762 diff --git a/xterm_console.obsinfo b/xterm_console.obsinfo index 4e57d37..c8291af 100644 --- a/xterm_console.obsinfo +++ b/xterm_console.obsinfo @@ -1,5 +1,5 @@ name: xterm_console -version: 1.0 -mtime: 1580219585 -commit: 580eaafe2972e1e642254c7fc64603a67637c388 +version: 1.1 +mtime: 1623347434 +commit: 2532f1418ee6df6f091c4c0e036a0852f7f4e0b4 From 93f4fcb6b5f4127118fd59c3758307998caee03771ed6cb972521e9c2e52c335 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Thu, 10 Jun 2021 18:00:13 +0000 Subject: [PATCH 4/5] OBS-URL: https://build.opensuse.org/package/show/devel:openQA:tested/xterm-console?expand=0&rev=15 --- xterm_console-1.0.obscpio | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 xterm_console-1.0.obscpio diff --git a/xterm_console-1.0.obscpio b/xterm_console-1.0.obscpio deleted file mode 100644 index c0478c2..0000000 --- a/xterm_console-1.0.obscpio +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e46efe2eaf8d79df16346b56fbdd20d7f729d4cb9442f7c96999b2ed982413cb -size 10250 From 12901a5202f380376333c254c96bee18aebbeb0336a17dd1f2e6e2529870504c Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Thu, 10 Jun 2021 19:56:31 +0000 Subject: [PATCH 5/5] Offline generation of 1.1 OBS-URL: https://build.opensuse.org/package/show/devel:openQA:tested/xterm-console?expand=0&rev=16 --- xterm_console-1.0.obscpio | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 xterm_console-1.0.obscpio diff --git a/xterm_console-1.0.obscpio b/xterm_console-1.0.obscpio new file mode 100644 index 0000000..c0478c2 --- /dev/null +++ b/xterm_console-1.0.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e46efe2eaf8d79df16346b56fbdd20d7f729d4cb9442f7c96999b2ed982413cb +size 10250