diff --git a/kbd-1.15-keycodes-man.patch b/kbd-1.15-keycodes-man.patch index 86162744e65ea441562e029c6470443a28daf1b2..221e0817f686105608a385b0dc873b1bf827524d 100644 --- a/kbd-1.15-keycodes-man.patch +++ b/kbd-1.15-keycodes-man.patch @@ -1,52 +1,59 @@ -diff -up kbd-2.0.4/docs/man/man1/showkey.1.orig kbd-2.0.4/docs/man/man1/showkey.1 ---- kbd-2.0.4/docs/man/man1/showkey.1.orig 2016-10-31 16:56:02.000000000 +0100 -+++ kbd-2.0.4/docs/man/man1/showkey.1 2017-01-11 10:45:03.763312393 +0100 -@@ -84,6 +84,19 @@ corresponds to what the keyboard hardwar - to know the scan codes sent by various keys it is better to boot a - 2.4 kernel. Since 2.6.9 there also is the boot option atkbd.softraw=0 - that tells the 2.6 kernel to return the actual scan codes. +diff -c -r old/docs/man/man1/showkey.1 kbd-2.4.0/docs/man/man1/showkey.1 +*** old/docs/man/man1/showkey.1 2020-12-15 22:32:21.000000000 +0800 +--- kbd-2.4.0/docs/man/man1/showkey.1 2021-12-03 22:01:27.702550615 +0800 +*************** +*** 84,89 **** +--- 84,102 ---- + to know the scan codes sent by various keys it is better to boot a + 2.4 kernel. Since 2.6.9 there also is the boot option atkbd.softraw=0 + that tells the 2.6 kernel to return the actual scan codes. + -+.SH NOTES -+The raw scan codes are available only on AT and PS/2 keyboards, -+and even then they are disabled unless the -+.B atkbd.softraw=0 -+kernel parameter is used. -+When the raw scan codes are not available, the kernel uses a fixed built-in -+table to produce scan codes from keycodes. Thus, -+.BR setkeycodes (8) -+can affect the output of -+.B showkey -+in scan code dump mode. ++ .SH NOTES ++ The raw scan codes are available only on AT and PS/2 keyboards, ++ and even then they are disabled unless the ++ .B atkbd.softraw=0 ++ kernel parameter is used. ++ When the raw scan codes are not available, the kernel uses a fixed built-in ++ table to produce scan codes from keycodes. Thus, ++ .BR setkeycodes (8) ++ can affect the output of ++ .B showkey ++ in scan code dump mode. + - .SH "SEE ALSO" - .BR loadkeys (1), - .BR dumpkeys (1), -diff -up kbd-2.0.4/docs/man/man8/setkeycodes.8.orig kbd-2.0.4/docs/man/man8/setkeycodes.8 ---- kbd-2.0.4/docs/man/man8/setkeycodes.8.orig 2016-10-31 16:56:02.000000000 +0100 -+++ kbd-2.0.4/docs/man/man8/setkeycodes.8 2017-01-11 10:45:03.763312393 +0100 -@@ -38,6 +38,10 @@ to showkey(1), the command - .RE - will assign the keycode 112 to it, and then loadkeys(1) can be used - to define the function of this key. + .SH "SEE ALSO" + .BR loadkeys (1), + .BR dumpkeys (1), +diff -c -r old/docs/man/man8/setkeycodes.8 kbd-2.4.0/docs/man/man8/setkeycodes.8 +*** old/docs/man/man8/setkeycodes.8 2020-12-15 22:32:21.000000000 +0800 +--- kbd-2.4.0/docs/man/man8/setkeycodes.8 2021-12-03 22:02:45.193516342 +0800 +*************** +*** 42,47 **** +--- 42,51 ---- + will assign the keycode 112 to it, and then + .BR loadkeys (1) + can be used to define the function of this key. + -+USB keyboards have standardized keycodes and -+.B setkeycodes -+doesn't affect them at all. - .LP - Some older kernels might hardwire a low scancode range to the - equivalent keycodes; setkeycodes will fail when you try to remap -@@ -56,6 +60,14 @@ None. - .SH BUGS - The keycodes of X have nothing to do with those of Linux. - Unusual keys can be made visible under Linux, but not under X. ++ USB keyboards have standardized keycodes and ++ .B setkeycodes ++ doesn't affect them at all. + .LP + Some older kernels might hardwire a low scancode range to the + equivalent keycodes; setkeycodes will fail when you try to remap +*************** +*** 60,65 **** +--- 64,77 ---- + .SH BUGS + The keycodes of X have nothing to do with those of Linux. + Unusual keys can be made visible under Linux, but not under X. + -+.B setkeycodes -+affects only the "first" input device -+that has modifiable scancode-to-keycode mapping. -+If there is more than one such device, -+.B setkeycodes -+cannot change the mapping of other devices than the "first" one. ++ .B setkeycodes ++ affects only the "first" input device ++ that has modifiable scancode-to-keycode mapping. ++ If there is more than one such device, ++ .B setkeycodes ++ cannot change the mapping of other devices than the "first" one. + - .SH "SEE ALSO" - .I "dumpkeys (1), loadkeys (1), showkey (1), getkeycodes (8)" - + .SH "SEE ALSO" + .BR dumpkeys (1), + .BR loadkeys (1), +~ \ No newline at end of file diff --git a/kbd-1.15.5-loadkeys-search-path.patch b/kbd-1.15.5-loadkeys-search-path.patch index 212dd3367cf1751b8df186cf6367070c19455fe2..e5f0535e19dc7faef81e3e38285e21ea36f8d66f 100644 --- a/kbd-1.15.5-loadkeys-search-path.patch +++ b/kbd-1.15.5-loadkeys-search-path.patch @@ -1,18 +1,24 @@ -diff -up kbd-2.1.0/src/loadkeys.c.orig kbd-2.1.0/src/loadkeys.c ---- kbd-2.1.0/src/loadkeys.c.orig 2019-07-15 10:57:18.000000000 +0200 -+++ kbd-2.1.0/src/loadkeys.c 2019-07-17 14:34:51.224525616 +0200 -@@ -24,7 +24,7 @@ - #include "paths.h" - #include "keymap.h" +diff -Nur kbd-2.4.0/src/loadkeys.c kbd-2.4.0-new/src/loadkeys.c +--- kbd-2.4.0/src/loadkeys.c 2020-06-02 18:16:45.000000000 +0800 ++++ kbd-2.4.0-new/src/loadkeys.c 2021-12-07 16:02:44.873000000 +0800 +@@ -27,9 +27,11 @@ --static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", KERNDIR "/", 0 }; -+static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", DATADIR "/" XKBKEYMAPDIR "/", DATADIR "/" LEGACYKEYMAPDIR "/**", KERNDIR "/", 0 }; - static const char *const suffixes[] = { "", ".kmap", ".map", 0 }; - - static void __attribute__((noreturn)) -diff -up kbd-2.1.0/src/paths.h.orig kbd-2.1.0/src/paths.h ---- kbd-2.1.0/src/paths.h.orig 2019-05-07 11:21:10.000000000 +0200 -+++ kbd-2.1.0/src/paths.h 2019-07-17 14:35:13.870574558 +0200 + static const char *const dirpath1[] = { + "", +- DATADIR "/" KEYMAPDIR "/**", +- KERNDIR "/", +- NULL ++ DATADIR "/" KEYMAPDIR "/**", ++ DATADIR "/" XKBKEYMAPDIR "/", ++ DATADIR "/" LEGACYKEYMAPDIR "/**", ++ KERNDIR "/", ++ 0 + }; + static const char *const suffixes[] = { + "", +diff -Nur kbd-2.4.0/src/paths.h kbd-2.4.0-new/src/paths.h +--- kbd-2.4.0/src/paths.h 2020-04-27 23:53:01.000000000 +0800 ++++ kbd-2.4.0-new/src/paths.h 2021-12-07 16:03:15.780000000 +0800 @@ -5,6 +5,8 @@ * The following five subdirectories are defined: */ diff --git a/kbd-2.0.4-covscan-fixes.patch b/kbd-2.0.4-covscan-fixes.patch index 6b1fda8b06a06716ed62757f25a042bac5a08e5b..8e4530a5608aa1fd8e9a17b2fefb2e866c1cbb24 100644 --- a/kbd-2.0.4-covscan-fixes.patch +++ b/kbd-2.0.4-covscan-fixes.patch @@ -1,23 +1,13 @@ -diff -up kbd-2.1.0/src/kdmapop.c.orig kbd-2.1.0/src/kdmapop.c ---- kbd-2.1.0/src/kdmapop.c.orig 2019-05-07 11:21:10.000000000 +0200 -+++ kbd-2.1.0/src/kdmapop.c 2019-07-17 14:38:15.799967669 +0200 -@@ -155,6 +155,7 @@ int getunimap(int fd, struct unimapdesc - } +diff -Nur kbd-2.4.0/src/libkfont/kdmapop.c kbd-2.4.0-new/src/libkfont/kdmapop.c +--- kbd-2.4.0/src/libkfont/kdmapop.c 2020-04-27 23:53:01.000000000 +0800 ++++ kbd-2.4.0-new/src/libkfont/kdmapop.c 2021-12-07 16:18:53.166000000 +0800 +@@ -166,7 +166,8 @@ + if (ioctl(fd, GIO_UNIMAP, &ud)) { - perror("GIO_UNIMAP"); + KFONT_ERR(ctx, "ioctl(GIO_UNIMAP): %m"); +- return -1; + free(ud.entries); - return -1; ++ return -1; } if (ct != ud.entry_ct) -diff -up kbd-2.1.0/src/setfont.c.orig kbd-2.1.0/src/setfont.c ---- kbd-2.1.0/src/setfont.c.orig 2019-06-25 18:14:32.000000000 +0200 -+++ kbd-2.1.0/src/setfont.c 2019-07-17 14:39:57.928188355 +0200 -@@ -323,6 +323,8 @@ do_loadfont(int fd, char *inbuf, int wid - - if (putfont(fd, buf, fontsize, width, hwunit)) - exit(EX_OSERR); -+ -+ free(buf); - } - - static void + KFONT_ERR(ctx, _("strange... ct changed from %d to %d"), ct, ud.entry_ct); diff --git a/kbd-2.2.0-fix-flags.patch b/kbd-2.2.0-fix-flags.patch deleted file mode 100644 index 6e1c018a6648043bb5ed4459cf62f03ff93ed17d..0000000000000000000000000000000000000000 --- a/kbd-2.2.0-fix-flags.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -up kbd-2.2.0/configure.ac.orig kbd-2.2.0/configure.ac ---- kbd-2.2.0/configure.ac.orig 2019-08-28 11:07:00.787173606 +0200 -+++ kbd-2.2.0/configure.ac 2019-08-28 11:08:07.217317151 +0200 -@@ -72,9 +72,9 @@ if test "$enable_code_coverage" = yes; t - fi - - case "$GCC,$ac_cv_prog_cc_g" in -- yes,yes) CFLAGS="-g $CC_O_LEVEL $FORTIFY_SOURCE" ;; -- yes,) CFLAGS="$CC_O_LEVEL $FORTIFY_SOURCE" ;; -- ,yes) CFLAGS="-g" ;; -+ yes,yes) CFLAGS="$CC_O_LEVEL $FORTIFY_SOURCE $CFLAGS" ;; -+ yes,) CFLAGS="$CC_O_LEVEL $FORTIFY_SOURCE $CFLAGS" ;; -+ ,yes) CFLAGS="$CFLAGS" ;; - esac - - CC_CHECK_CFLAGS_APPEND([\ diff --git a/kbd-2.2.0-format-security.patch b/kbd-2.2.0-format-security.patch deleted file mode 100644 index 291747fb7b0e53a60d33c85efa2bcc9127ebca8f..0000000000000000000000000000000000000000 --- a/kbd-2.2.0-format-security.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -up kbd-2.2.0/src/libkeymap/analyze.l.orig kbd-2.2.0/src/libkeymap/analyze.l ---- kbd-2.2.0/src/libkeymap/analyze.l.orig 2019-06-25 11:41:55.000000000 +0200 -+++ kbd-2.2.0/src/libkeymap/analyze.l 2019-10-17 08:39:01.924605478 +0200 -@@ -463,7 +463,10 @@ To to|To|TO - - strerror_r(errno, buf, sizeof(buf)); - -+ /* workaround -Werror=format-security error - ERR(yyextra, buf); -+ */ -+ ERR(yyextra, _("unknown error")); - return(ERROR); - } - diff --git a/kbd-2.2.0.tar.xz b/kbd-2.2.0.tar.xz deleted file mode 100644 index 30afd27b6d5a5b0d65aad5bd3def3bfcd3cb3f2d..0000000000000000000000000000000000000000 Binary files a/kbd-2.2.0.tar.xz and /dev/null differ diff --git a/kbd-2.4.0.tar.xz b/kbd-2.4.0.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..c9c5581ee793e18a90f126b8dbaa73f6095f2949 Binary files /dev/null and b/kbd-2.4.0.tar.xz differ diff --git a/kbd.spec b/kbd.spec index 87ed2a11e01024cc7374e0d24647a006f26dec3b..62e87e35e731cf542c8f345d903f7d36426bbc0f 100644 --- a/kbd.spec +++ b/kbd.spec @@ -1,11 +1,13 @@ +%global kbd_datadir %{_exec_prefix}/lib/kbd + Name: kbd -Version: 2.2.0 -Release: 2 +Version: 2.4.0 +Release: 1 Summary: Tools for managing Linux console(keyboard, virtual terminals, etc.) License: GPLv2+ URL: https://www.kbd-project.org/ -Source0: http://ftp.altlinux.org/pub/people/legion/%{name}/%{name}-%{version}.tar.xz +Source0: https://mirrors.edge.kernel.org/pub/linux/utils/kbd/%{name}-%{version}.tar.xz Source1: kbd-latsun-fonts.tar.bz2 Source2: kbd-latarcyrheb-32.tar.bz2 Source3: xml2lst.pl @@ -21,8 +23,6 @@ Patch4: kbd-1.15.5-sg-decimal-separator.patch Patch5: kbd-1.15.5-loadkeys-search-path.patch Patch6: kbd-2.0.2-unicode-start-font.patch Patch7: kbd-2.0.4-covscan-fixes.patch -Patch8: kbd-2.2.0-fix-flags.patch -Patch9: kbd-2.2.0-format-security.patch BuildRequires: bison flex gettext pam-devel check-devel BuildRequires: gcc console-setup xkeyboard-config automake @@ -66,8 +66,7 @@ cp -fp %{SOURCE6} . %patch5 -p1 -b .loadkeys-search-path %patch6 -p1 -b .unicode-start-font %patch7 -p1 -b .covscan-fixes.patch -%patch8 -p1 -b .fix-flags.patch -%patch9 -p1 -b .format-security.patch +aclocal autoconf pushd data/keymaps/i386 @@ -93,76 +92,77 @@ iconv -f iso-8859-1 -t utf-8 < "ChangeLog" > "ChangeLog_" mv "ChangeLog_" "ChangeLog" %build -%configure --prefix=%{_prefix} --datadir=/lib/%{name} --mandir=%{_mandir} --localedir=%{_datadir}/locale --enable-nls +%configure --prefix=%{_prefix} --datadir=%{kbd_datadir} --mandir=%{_mandir} --localedir=%{_datadir}/locale --enable-nls %make_build %install %make_install -rm -f %{buildroot}/lib/%{name}/keymaps/i386/qwerty/ro_win.map.gz - -ln -s sr-cy.map.gz %{buildroot}/lib/%{name}/keymaps/i386/qwerty/sr-latin.map.gz +rm -f $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/i386/qwerty/ro_win.map.gz -ln -s us.map.gz %{buildroot}/lib/%{name}/keymaps/i386/qwerty/ko.map.gz +ln -s sr-cy.map.gz $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/i386/qwerty/sr-latin.map.gz -mkdir -p %{buildroot}/bin -for binary in setfont dumpkeys %{name}_mode unicode_start unicode_stop loadkeys ; do - mv %{buildroot}%{_bindir}/$binary %{buildroot}/bin/ -done +ln -s us.map.gz $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/i386/qwerty/ko.map.gz -sed -i -e 's,\<%{name}_mode\>,/bin/%{name}_mode,g;s,\,/bin/setfont,g' \ - %{buildroot}/bin/unicode_start +ln -s fa.map.gz $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/i386/qwerty/ara.map.gz -gzip -c %SOURCE5 > %{buildroot}/%{_mandir}/man1/kbdinfo.1.gz +sed -i -e 's,\,%{_bindir}/kbd_mode,g;s,\,%{_bindir}/setfont,g' \ + $RPM_BUILD_ROOT%{_bindir}/unicode_start -cp -r %{buildroot}/lib/%{name}/locale/ %{buildroot}%{_datadir}/locale -rm -rf %{buildroot}/lib/%{name}/locale +gzip -c %SOURCE5 > $RPM_BUILD_ROOT/%{_mandir}/man1/kbdinfo.1.gz -mkdir -p %{buildroot}%{_sysconfdir}/pam.d -install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/pam.d/vlock +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d +install -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/vlock -mkdir -p %{buildroot}/lib/%{name}/keymaps/legacy -mv %{buildroot}/lib/%{name}/keymaps/{amiga,atari,i386,include,mac,ppc,sun} %{buildroot}/lib/%{name}/keymaps/legacy +mkdir -p $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/legacy +mv $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/{amiga,atari,i386,include,mac,ppc,sun} $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/legacy -mkdir -p %{buildroot}/lib/%{name}/keymaps/xkb +mkdir -p $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb perl xml2lst.pl < /usr/share/X11/xkb/rules/base.xml > layouts-variants.lst while read line; do XKBLAYOUT=`echo "$line" | cut -d " " -f 1` echo "$XKBLAYOUT" >> layouts-list.lst XKBVARIANT=`echo "$line" | cut -d " " -f 2` - ckbcomp "$XKBLAYOUT" "$XKBVARIANT" | gzip > %{buildroot}/lib/%{name}/keymaps/xkb/"$XKBLAYOUT"-"$XKBVARIANT".map.gz + ckbcomp -rules base "$XKBLAYOUT" "$XKBVARIANT" | gzip > $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/"$XKBLAYOUT"-"$XKBVARIANT".map.gz done < layouts-variants.lst cat layouts-list.lst | sort -u >> layouts-list-uniq.lst while read line; do - ckbcomp "$line" | gzip > %{buildroot}/lib/%{name}/keymaps/xkb/"$line".map.gz + ckbcomp -rules base "$line" | gzip > $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/"$line".map.gz done < layouts-list-uniq.lst -gunzip %{buildroot}/lib/%{name}/keymaps/xkb/fi.map.gz -mv %{buildroot}/lib/%{name}/keymaps/xkb/fi.map %{buildroot}/lib/%{name}/keymaps/xkb/fi-kotoistus.map -gzip %{buildroot}/lib/%{name}/keymaps/xkb/fi-kotoistus.map +zgrep -L "U+0041" $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/* | xargs rm -f + +if [ -f "$RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/cz.map.gz" ]; then + gunzip $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/cz.map.gz + patch $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/cz.map < %{SOURCE6} + gzip $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/cz.map +fi -gunzip %{buildroot}/lib/%{name}/keymaps/xkb/cz.map.gz -patch %{buildroot}/lib/%{name}/keymaps/xkb/cz.map < %{SOURCE6} -gzip %{buildroot}/lib/%{name}/keymaps/xkb/cz.map +%find_lang %{name} + +%check +make check %files %defattr(-,root,root) %license COPYING -%doc AUTHORS -/bin/* +%doc AUTHORS %{_datadir}/locale/* %{_bindir}/* %config(noreplace) %{_sysconfdir}/pam.d/vlock +# library for tests +%exclude %{_libdir}/libtswrap* +%exclude %{_prefix}/lib/debug/%{_libdir}/libtswrap* %files misc -%defattr(-,root,root) -/lib/%{name}/* -%exclude /lib/%{name}/keymaps/legacy +%defattr(-,root,root) +%{kbd_datadir} +%exclude %{kbd_datadir}/keymaps/legacy %files legacy %defattr(-,root,root) -/lib/%{name}/keymaps/legacy/* +%{kbd_datadir}/keymaps/legacy %files help %defattr(-,root,root) @@ -172,6 +172,9 @@ gzip %{buildroot}/lib/%{name}/keymaps/xkb/cz.map %{_mandir}/man8/*.8.gz %changelog +* Tue Dec 07 2021 wangkerong - 2.4.0-1 +- update to 2.4.0 + * Tue Jul 12 2021 panchenbo - 2.2.0-2 - fix kbd contain man dir