From cc62363ea73e4b268dc6e45810fba56941ea8c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 29 Oct 2017 21:32:07 +0100 Subject: Update sterm --- .../sterm/files/0001-Fix-install-strip.patch | 36 ++++++ ...0002-Print-more-descriptive-error-message.patch | 46 ++++++++ .../0003-Add-completions-for-bash-and-zsh.patch | 122 +++++++++++++++++++++ net-dialup/sterm/files/Fix-install-strip.patch | 36 ------ .../Print-more-descriptive-error-message.patch | 46 -------- net-dialup/sterm/sterm-20170112-r2.ebuild | 24 ---- net-dialup/sterm/sterm-20170112-r3.ebuild | 26 +++++ 7 files changed, 230 insertions(+), 106 deletions(-) create mode 100644 net-dialup/sterm/files/0001-Fix-install-strip.patch create mode 100644 net-dialup/sterm/files/0002-Print-more-descriptive-error-message.patch create mode 100644 net-dialup/sterm/files/0003-Add-completions-for-bash-and-zsh.patch delete mode 100644 net-dialup/sterm/files/Fix-install-strip.patch delete mode 100644 net-dialup/sterm/files/Print-more-descriptive-error-message.patch delete mode 100644 net-dialup/sterm/sterm-20170112-r2.ebuild create mode 100644 net-dialup/sterm/sterm-20170112-r3.ebuild (limited to 'net-dialup/sterm') diff --git a/net-dialup/sterm/files/0001-Fix-install-strip.patch b/net-dialup/sterm/files/0001-Fix-install-strip.patch new file mode 100644 index 0000000..03bc8b6 --- /dev/null +++ b/net-dialup/sterm/files/0001-Fix-install-strip.patch @@ -0,0 +1,36 @@ +From ee783982a99e25d97658a369981d573245e5d0b5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= +Date: Mon, 5 Dec 2016 07:41:40 +0100 +Subject: [PATCH 1/3] Fix install strip + +Strip can be used only on executables, adding it to all install +commands causes error on some systems. +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 2cc363c..539342a 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,7 +2,7 @@ CFLAGS = -O2 -Wall -g + LDLIBS = -llockdev + + PREFIX ?= /usr/local +-INSTALL ?= install -s ++INSTALL ?= install + + all: sterm + +@@ -11,7 +11,7 @@ clean: + + install: all + $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin +- $(INSTALL) -m 755 sterm $(DESTDIR)$(PREFIX)/bin ++ $(INSTALL) -s -m 755 sterm $(DESTDIR)$(PREFIX)/bin + ifneq ($(NO_MAN),1) + $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/man/man1 + $(INSTALL) -m 644 sterm.man $(DESTDIR)$(PREFIX)/share/man/man1/sterm.1 +-- +2.13.6 + diff --git a/net-dialup/sterm/files/0002-Print-more-descriptive-error-message.patch b/net-dialup/sterm/files/0002-Print-more-descriptive-error-message.patch new file mode 100644 index 0000000..46c4a98 --- /dev/null +++ b/net-dialup/sterm/files/0002-Print-more-descriptive-error-message.patch @@ -0,0 +1,46 @@ +From 613b8407347b063320ebf408d06bb120293c6c3a Mon Sep 17 00:00:00 2001 +From: Michal Sojka +Date: Thu, 4 May 2017 00:00:10 +0200 +Subject: [PATCH 2/3] Print more descriptive error message + +--- + sterm.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/sterm.c b/sterm.c +index b375caf..ea86573 100644 +--- a/sterm.c ++++ b/sterm.c +@@ -31,6 +31,7 @@ + + #define _BSD_SOURCE + #define _DEFAULT_SOURCE ++#define _GNU_SOURCE + #include + #include + #include +@@ -44,6 +45,7 @@ + #include + #include + #include ++#include + + #define STRINGIFY(val) #val + #define TOSTRING(val) STRINGIFY(val) +@@ -269,7 +271,12 @@ int main(int argc, char *argv[]) + fprintf(stderr, "%s is used by PID %d\n", dev, pid); + exit(1); + } else if (pid < 0) { +- perror("dev_lock()"); ++ char *msg; ++ asprintf(&msg, "dev_lock('%s')", dev); /* No free() because we exit() immediately */ ++ if (errno) ++ perror(msg); ++ else ++ fprintf(stderr, "%s: Error\n", msg); + exit(1); + } + atexit(unlock); +-- +2.13.6 + diff --git a/net-dialup/sterm/files/0003-Add-completions-for-bash-and-zsh.patch b/net-dialup/sterm/files/0003-Add-completions-for-bash-and-zsh.patch new file mode 100644 index 0000000..e198a3c --- /dev/null +++ b/net-dialup/sterm/files/0003-Add-completions-for-bash-and-zsh.patch @@ -0,0 +1,122 @@ +From 6f946b6bffb54e045183059be70f92dd0321376e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= +Date: Sun, 29 Oct 2017 21:24:03 +0100 +Subject: [PATCH 3/3] Add completions for bash and zsh + +--- + Makefile | 6 ++++++ + completion.bash | 24 ++++++++++++++++++++++++ + completion.zsh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 86 insertions(+) + create mode 100644 completion.bash + create mode 100644 completion.zsh + +diff --git a/Makefile b/Makefile +index 539342a..862ab6d 100644 +--- a/Makefile ++++ b/Makefile +@@ -17,3 +17,9 @@ ifneq ($(NO_MAN),1) + $(INSTALL) -m 644 sterm.man $(DESTDIR)$(PREFIX)/share/man/man1/sterm.1 + gzip -f $(DESTDIR)$(PREFIX)/share/man/man1/sterm.1 + endif ++ifneq ($(NO_COMP),1) ++ $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/bash-completion/completions/ ++ $(INSTALL) -m 644 completion.bash $(DESTDIR)$(PREFIX)/share/bash-completion/completions/sterm ++ $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/zsh/site-functions ++ $(INSTALL) -m 644 completion.zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_sterm ++endif +diff --git a/completion.bash b/completion.bash +new file mode 100644 +index 0000000..eca6d85 +--- /dev/null ++++ b/completion.bash +@@ -0,0 +1,24 @@ ++# Bash completion file for sterm ++# vim: ft=sh ++ ++_sterm() { ++ local cur prev ++ _init_completion || return ++ COMPREPLY=() ++ #cur="${COMP_WORDS[COMP_CWORD]}" ++ local ops="-h --help -c -d -e -n -r -s -v" ++ case "$prev" in ++ -d|-r) ++ # No completion for these ++ ;; ++ -s) ++ local speeds="0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400" ++ COMPREPLY+=($(compgen -W "${speeds}" -- ${cur})) ++ ;; ++ *) ++ COMPREPLY+=($(compgen -W "${ops}" -- ${cur})) ++ ;; ++ esac ++} ++ ++complete -o default -F _sterm sterm +diff --git a/completion.zsh b/completion.zsh +new file mode 100644 +index 0000000..b803ab9 +--- /dev/null ++++ b/completion.zsh +@@ -0,0 +1,56 @@ ++#compdef sterm ++#autoload ++ ++_sterm_defs() { ++ _arguments : \ ++ "--help[Output help message]" \ ++ "-h[Print help text]" \ ++ "-s[Set baudrate]" \ ++ "-c[Enter command mode]" \ ++ "-d[Make pulse on DTR]" \ ++ "-r[Make pulse on RTS]" \ ++ "-e[Ignore '~.' escape sequence]" \ ++ "-n[Do not switch the device to raw mode]" \ ++ "-v[Verbose mode]" ++ _path_files ++} ++ ++_sterm() { ++ if (( CURRENT > 2)); then ++ local prev=${words[(( CURRENT - 1))]} ++ case "${prev}" in ++ -d|-r) ++ # No completion for these ++ ;; ++ -s) ++ _values "Baudrate" \ ++ "0" \ ++ "50" \ ++ "75" \ ++ "110" \ ++ "134" \ ++ "150" \ ++ "200" \ ++ "300" \ ++ "600" \ ++ "1200" \ ++ "1800" \ ++ "2400" \ ++ "4800" \ ++ "9600" \ ++ "19200" \ ++ "38400" \ ++ "57600" \ ++ "115200" \ ++ "230400" ++ ;; ++ *) ++ _sterm_defs ++ ;; ++ esac ++ else ++ _sterm_defs ++ fi ++} ++ ++_sterm +-- +2.13.6 + diff --git a/net-dialup/sterm/files/Fix-install-strip.patch b/net-dialup/sterm/files/Fix-install-strip.patch deleted file mode 100644 index ed7da33..0000000 --- a/net-dialup/sterm/files/Fix-install-strip.patch +++ /dev/null @@ -1,36 +0,0 @@ -From da180154a36f14169ed80da310e378ae38516ba8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= -Date: Mon, 5 Dec 2016 07:41:40 +0100 -Subject: [PATCH 1/2] Fix install strip - -Strip can be used only on executables, adding it to all install -commands causes error on some systems. ---- - Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile b/Makefile -index 2cc363c..539342a 100644 ---- a/Makefile -+++ b/Makefile -@@ -2,7 +2,7 @@ CFLAGS = -O2 -Wall -g - LDLIBS = -llockdev - - PREFIX ?= /usr/local --INSTALL ?= install -s -+INSTALL ?= install - - all: sterm - -@@ -11,7 +11,7 @@ clean: - - install: all - $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin -- $(INSTALL) -m 755 sterm $(DESTDIR)$(PREFIX)/bin -+ $(INSTALL) -s -m 755 sterm $(DESTDIR)$(PREFIX)/bin - ifneq ($(NO_MAN),1) - $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/man/man1 - $(INSTALL) -m 644 sterm.man $(DESTDIR)$(PREFIX)/share/man/man1/sterm.1 --- -2.10.2 - diff --git a/net-dialup/sterm/files/Print-more-descriptive-error-message.patch b/net-dialup/sterm/files/Print-more-descriptive-error-message.patch deleted file mode 100644 index 9db1dad..0000000 --- a/net-dialup/sterm/files/Print-more-descriptive-error-message.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 613b8407347b063320ebf408d06bb120293c6c3a Mon Sep 17 00:00:00 2001 -From: Michal Sojka -Date: Thu, 4 May 2017 00:00:10 +0200 -Subject: [PATCH] Print more descriptive error message - ---- - sterm.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/sterm.c b/sterm.c -index b375caf..ea86573 100644 ---- a/sterm.c -+++ b/sterm.c -@@ -31,6 +31,7 @@ - - #define _BSD_SOURCE - #define _DEFAULT_SOURCE -+#define _GNU_SOURCE - #include - #include - #include -@@ -44,6 +45,7 @@ - #include - #include - #include -+#include - - #define STRINGIFY(val) #val - #define TOSTRING(val) STRINGIFY(val) -@@ -269,7 +271,12 @@ int main(int argc, char *argv[]) - fprintf(stderr, "%s is used by PID %d\n", dev, pid); - exit(1); - } else if (pid < 0) { -- perror("dev_lock()"); -+ char *msg; -+ asprintf(&msg, "dev_lock('%s')", dev); /* No free() because we exit() immediately */ -+ if (errno) -+ perror(msg); -+ else -+ fprintf(stderr, "%s: Error\n", msg); - exit(1); - } - atexit(unlock); --- -2.13.0 - diff --git a/net-dialup/sterm/sterm-20170112-r2.ebuild b/net-dialup/sterm/sterm-20170112-r2.ebuild deleted file mode 100644 index d3ab7b9..0000000 --- a/net-dialup/sterm/sterm-20170112-r2.ebuild +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=5 - -inherit eutils git-r3 - -DESCRIPTION="Simple serial terminal" -HOMEPAGE="https://rtime.felk.cvut.cz/gitweb/sojka/sterm.git" - -EGIT_REPO_URI="git://rtime.felk.cvut.cz/sojka/sterm.git" -EGIT_COMMIT="${PV}" - -LICENSE="GPL-3.0+" -SLOT="0" -KEYWORDS="amd64 x86" -IUSE="" - -DEPEND="dev-libs/lockdev" -RDEPEND="${DEPEND}" - -src_prepare() { - epatch "${FILESDIR}/Fix-install-strip.patch" -} diff --git a/net-dialup/sterm/sterm-20170112-r3.ebuild b/net-dialup/sterm/sterm-20170112-r3.ebuild new file mode 100644 index 0000000..2c1c49b --- /dev/null +++ b/net-dialup/sterm/sterm-20170112-r3.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +inherit eutils git-r3 + +DESCRIPTION="Simple serial terminal" +HOMEPAGE="https://rtime.felk.cvut.cz/gitweb/sojka/sterm.git" + +EGIT_REPO_URI="git://rtime.felk.cvut.cz/sojka/sterm.git" +EGIT_COMMIT="${PV}" + +LICENSE="GPL-3.0+" +SLOT="0" +KEYWORDS="amd64 x86" +IUSE="" + +DEPEND="dev-libs/lockdev" +RDEPEND="${DEPEND}" + +src_prepare() { + epatch "${FILESDIR}/0001-Fix-install-strip.patch" + epatch "${FILESDIR}/0002-Print-more-descriptive-error-message.patch" + epatch "${FILESDIR}/0003-Add-completions-for-bash-and-zsh.patch" +} -- cgit v1.2.3