Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 2 years ago
commit
0e41d9412c
  1. 44
      SOURCES/0001-Replace-the-obsolete-get_event_loop-with-get_running.patch
  2. 60
      SOURCES/0001-build-install-media-lirc.h-BTS-872074.patch
  3. 24
      SOURCES/0002-lirc-setup-Fix-crash-on-start-on-missing-lirc.config.patch
  4. 38
      SOURCES/0003-plugins-devinput-fix-glob-no-match-error.patch
  5. 25
      SOURCES/0005-mode2-Fix-inconsistent-loglevel-debug-option-307.patch
  6. 30
      SOURCES/0006-python-pkg-Don-t-use-deprecated-time.clock-RHBZ-1718.patch
  7. 78
      SOURCES/0007-database.py-Handle-new-PyYAML-interface.patch
  8. 1
      SOURCES/99-remote-control-lirc.rules
  9. 146
      SOURCES/README.fedora
  10. 1066
      SPECS/lirc.spec

44
SOURCES/0001-Replace-the-obsolete-get_event_loop-with-get_running.patch

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
From fd88080637e019fdca3e9412e470b073d4f282b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Mon, 14 Jun 2021 19:49:22 +0200
Subject: [PATCH] Replace the obsolete get_event_loop with get_running_loop

---
python-pkg/lirc/async_client.py | 2 +-
python-pkg/tests/test_client.py | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/python-pkg/lirc/async_client.py b/python-pkg/lirc/async_client.py
index 1affce68..f3586b0f 100644
--- a/python-pkg/lirc/async_client.py
+++ b/python-pkg/lirc/async_client.py
@@ -63,7 +63,7 @@ class AsyncConnection(object):
self._conn = connection
self._loop = loop
- self._queue = asyncio.Queue(loop=self._loop)
+ self._queue = asyncio.Queue()
self._loop.add_reader(self._conn.fileno(), read_from_fd)
def close(self):
diff --git a/python-pkg/tests/test_client.py b/python-pkg/tests/test_client.py
index d9af254d..7c1fb9fa 100644
--- a/python-pkg/tests/test_client.py
+++ b/python-pkg/tests/test_client.py
@@ -106,7 +106,12 @@ class ReceiveTests(unittest.TestCase):
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT) as child:
_wait_for_socket()
- loop = asyncio.get_event_loop()
+
+ try:
+ loop = asyncio.get_running_loop()
+ except RuntimeError:
+ loop = asyncio.new_event_loop()
+
with LircdConnection('foo',
socket_path=_SOCKET,
lircrc_path='lircrc.conf') as conn:
--
2.31.1

60
SOURCES/0001-build-install-media-lirc.h-BTS-872074.patch

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
From 11e1e9ee6b353c6e7c68f92f89c49d52f396cfc7 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Mon, 14 Aug 2017 10:31:55 +0200
Subject: [PATCH] build: install media/lirc.h (BTS #872074).

The plugin builds references this file. Basically, this should be
resolved by lirc_driver.h, testing if the kernel header is
available and using it if so, but without including config.h

This fix adds an evil symlink to not remove anything. The proper
fix includes actually moving the file and also streamlining the
HAVE_KERNEL_LIRC_H to the generic HAVE_LINUX_LIRC_H.
---
Makefile.am | 5 ++++-
configure.ac | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index aafb4e8..9f3dd14 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -138,12 +138,15 @@ install-data-hook:
$(SED) -i -e '/^plugindir/s|/usr/lib|$(libdir)|' \
$(DESTDIR)$(lirc_confdir)/lirc_options.conf
cp -pr $(srcdir)/contrib $(DESTDIR)$(pkgdatadir)
+ chmod u+w $(DESTDIR)$(includedir)
+ cd $(DESTDIR)$(includedir)/lirc; ln -s include/media .
uninstall-hook:
-chmod -R u+w $(DESTDIR)/$(pkgdatadir)/contrib
-rm -rf $(DESTDIR)/$(pkgdatadir) \
$(DESTDIR)/$(pkgpythondir) \
- $(DESTDIR)/$(pkgdatadir)/contrib
+ $(DESTDIR)/$(pkgdatadir)/contrib \
+ $(DESTDIR)$(includedir)/lirc
dist-hook: ChangeLog fix-version
cp -pr $(srcdir)/contrib $(distdir)
diff --git a/configure.ac b/configure.ac
index 321a61f..4108688 100644
--- a/configure.ac
+++ b/configure.ac
@@ -511,11 +511,14 @@ AC_DEFINE(LIRC_OPTIONS_VAR, ["LIRC_OPTIONS_PATH"],[
Environment variable overriding options file path])
AH_TOP([
+#ifndef ROOT_CONFIG_H
+#define ROOT_CONFIG_H
#include "paths.h"
])
AH_BOTTOM([
#include "lirc/lirc_config.h"
+#endif // ROOT_CONFIG_H
])
dnl write these decisions out to the Makefiles
--
2.9.3

24
SOURCES/0002-lirc-setup-Fix-crash-on-start-on-missing-lirc.config.patch

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
From e2693b9022f390070ef0136020aafc8c1c18769c Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Fri, 12 Oct 2018 20:49:58 +0200
Subject: [PATCH] lirc-setup: Fix crash on start on missing lirc.config.

---
Makefile.am | 1 +
1 file changed, 1 insertion(+)

diff --git a/Makefile.am b/Makefile.am
index aafb4e8ca..d5dbfb621 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -80,6 +80,7 @@ py_PYTHON = python-pkg/lirc/__init__.py \
python-pkg/lirc/database.py \
python-pkg/lirc/paths.py
+nodist_py_PYTHON = python-pkg/lirc/config.py
nodist_py_pkg_PYTHON = python-pkg/lirc/config.py
if HAVE_PYTHON35
--
2.14.4

38
SOURCES/0003-plugins-devinput-fix-glob-no-match-error.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
From 14685b280fde85a6e801f7fb7d5e579b2ddb3581 Mon Sep 17 00:00:00 2001
From: Ayke van Laethem <aykevanlaethem@gmail.com>
Date: Fri, 28 Jul 2017 18:07:50 +0200
Subject: [PATCH 3/6] plugins: devinput: fix glob "no match" error

See 63e041cc5 and LIRC issue #285 (Debian: #860551)
---
plugins/devinput.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/devinput.c b/plugins/devinput.c
index 846a0b70..d4d733a0 100644
--- a/plugins/devinput.c
+++ b/plugins/devinput.c
@@ -247,15 +247,15 @@ static int locate_default_device(char* errmsg, size_t size)
r = glob("/sys/class/rc/rc0/input[0-9]*/event[0-9]*",
0, NULL, &matches);
- if (r != 0) {
- log_perror_warn("Cannot run glob %s", DEV_PATTERN);
+ if (r == GLOB_NOMATCH) {
+ strncpy(errmsg, "No /sys/class/rc/ devices found", size - 1);
log_notice("No input device available for devinput driver."
" Consider stopping lircd.socket or reconfigure lirc");
- snprintf(errmsg, size, "Cannot glob %s", DEV_PATTERN);
return 0;
}
- if (matches.gl_pathc == 0) {
- strncpy(errmsg, "No /sys/class/rc/ devices found", size - 1);
+ if (r != 0) {
+ log_perror_warn("Cannot run glob %s", DEV_PATTERN);
+ snprintf(errmsg, size, "Cannot glob %s", DEV_PATTERN);
return 0;
}
if (matches.gl_pathc > 1) {
--
2.20.1

25
SOURCES/0005-mode2-Fix-inconsistent-loglevel-debug-option-307.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
From aa2b06cff01b52666e44aae59ee56fc9092cad93 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Sun, 3 Sep 2017 04:21:57 +0200
Subject: [PATCH 5/6] mode2: Fix inconsistent loglevel/debug option (#307).

---
tools/mode2.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/mode2.cpp b/tools/mode2.cpp
index fe578f89..e962610d 100644
--- a/tools/mode2.cpp
+++ b/tools/mode2.cpp
@@ -74,7 +74,7 @@ static const char* const help =
static const struct option options[] = {
{"help", no_argument, NULL, 'h'},
- {"debug", required_argument, NULL, 'D'},
+ {"loglevel", required_argument, NULL, 'D'},
{"version", no_argument, NULL, 'v'},
{"device", required_argument, NULL, 'd'},
{"driver", required_argument, NULL, 'H'},
--
2.20.1

30
SOURCES/0006-python-pkg-Don-t-use-deprecated-time.clock-RHBZ-1718.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
From 9d2e0a40294408764710657e78929c83f2fc0f31 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Wed, 21 Aug 2019 21:48:25 +0200
Subject: [PATCH 6/6] python-pkg: Don't use deprecated time.clock() (RHBZ
#1718285)

---
python-pkg/lirc/client.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python-pkg/lirc/client.py b/python-pkg/lirc/client.py
index 7e069a55..482913cf 100644
--- a/python-pkg/lirc/client.py
+++ b/python-pkg/lirc/client.py
@@ -219,10 +219,10 @@ class RawConnection(AbstractConnection):
def readline(self, timeout: float = None) -> str:
''' Implements AbstractConnection.readline(). '''
if timeout:
- start = time.clock()
+ start = time.perf_counter()
while b'\n' not in self._buffer:
ready = self._select.select(
- start + timeout - time.clock() if timeout else timeout)
+ start + timeout - time.perf_counter() if timeout else timeout)
if ready == []:
if timeout:
raise TimeoutException(
--
2.20.1

78
SOURCES/0007-database.py-Handle-new-PyYAML-interface.patch

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
From bb6a390633f32942ac10f9b7b7fc01dfbd395a48 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@nowhere.net>
Date: Fri, 21 Jan 2022 14:00:54 +0100
Subject: [PATCH] database.py: Handle new PyYAML interface.

---
python-pkg/lirc/database.py | 12 ++++++++----
tools/check_configs.py | 4 ++++
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/python-pkg/lirc/database.py b/python-pkg/lirc/database.py
index d464c2ab..d1f42c64 100644
--- a/python-pkg/lirc/database.py
+++ b/python-pkg/lirc/database.py
@@ -44,6 +44,10 @@ import sys
try:
import yaml
+ try:
+ from yaml import CLoader as Loader, CDumper as Dumper
+ except ImportError:
+ from yaml import Loader, Dumper
except ImportError:
_YAML_MSG = '''
"Cannot import the yaml library. Please install the python3
@@ -66,7 +70,7 @@ def _load_kerneldrivers(configdir):
'''
with open(os.path.join(configdir, "kernel-drivers.yaml")) as f:
- cf = yaml.load(f.read())
+ cf = yaml.load(f.read(), Loader = Loader)
drivers = cf['drivers'].copy()
for driver in cf['drivers']:
if driver == 'default':
@@ -132,14 +136,14 @@ class Database(object):
yamlpath = configdir
db = {}
with open(os.path.join(yamlpath, "confs_by_driver.yaml")) as f:
- cf = yaml.load(f.read())
+ cf = yaml.load(f.read(), Loader = Loader)
db['lircd_by_driver'] = cf['lircd_by_driver'].copy()
db['lircmd_by_driver'] = cf['lircmd_by_driver'].copy()
db['kernel-drivers'] = _load_kerneldrivers(configdir)
db['drivers'] = db['kernel-drivers'].copy()
with open(os.path.join(yamlpath, "drivers.yaml")) as f:
- cf = yaml.load(f.read())
+ cf = yaml.load(f.read(), Loader = Loader)
db['drivers'].update(cf['drivers'].copy())
for key, d in db['drivers'].items():
d['id'] = key
@@ -158,7 +162,7 @@ class Database(object):
configs = {}
for path in glob.glob(configdir + '/*.conf'):
with open(path) as f:
- cf = yaml.load(f.read())
+ cf = yaml.load(f.read(), Loader = Loader)
configs[cf['config']['id']] = cf['config']
db['configs'] = configs
self.db = db
diff --git a/tools/check_configs.py b/tools/check_configs.py
index 1e0d831b..5e458de7 100755
--- a/tools/check_configs.py
+++ b/tools/check_configs.py
@@ -4,6 +4,10 @@
import glob
import yaml
+try:
+ from yaml import CLoader as Loader, CDumper as Dumper
+except ImportError:
+ from yaml import Loader, Dumper
def main():
configs = {}
--
2.34.1

1
SOURCES/99-remote-control-lirc.rules

@ -0,0 +1 @@ @@ -0,0 +1 @@
SUBSYSTEM=="rc", ATTR{protocols}="lirc"

146
SOURCES/README.fedora

@ -0,0 +1,146 @@ @@ -0,0 +1,146 @@
## Fedora README

0.9.2

This a major upstream update. Don't expect things to be the same, read
the NEWS file in the documentation (/usr/share/doc/lirc/NEWS).

Packaging-wise, the package has been split into smaller packages. Installing
the 'lirc' package will bring all of them. You might be interested in
not installing or removing e. g., unused drivers, the gui and/or the
config package.

The lircd daemon now runs as user lirc. This is using the new
--effective-user option, so it's still started as root and runs as root
until all devices and files are opened. Should this become a problem, just
change the effective-user option in lirc_options.conf.



0.9.1

#### Systemd

The fedora lirc package supports two systemd services lircd.socket
and lircmd.service. See below for enabling and starting these
services.

Since systemd quite aggressively runs things in parallel during startup,
clients like irexec sometimes runs into troubles because the socket
they want to connect to isn't available. This can cause hard to debug
problems. From this version, lircd supports a --wait-for-socket option.
Using this, the calling party is blocked until the socket is available.

#### New configuration file(s)

From this version lirc supports a new configuration file
/etc/lirc/lirc_options.conf. This holds default values for all
command line options, and does in fact replace those in most
installations. When updating, you need to use your old
/etc/sysconfig/lirc config file to update lirc_options.conf.

The old file /etc/sysconfig/lirc is no longer used.

The need to define a device that should be reserved (the old
LIRC_IR_DEVICE option) is no longer needed - lircd is clever enough
to do this by itself.

#### Enable lirc protocol (obsolete)

In previous version the lirc protocol had to be be enabled
for the actual device used. This was done using either by installing the
lirc-disable-kernel-rc subpackage or by setting the LIRCD_IR_DEVICE in
/etc/sysconfig/lirc. This is no longer needed, lircd does this
automatically. The lirc-disable-kernel-rc subpackage is still available
"just in case" but should normally not be needed.

#### Socket activation

As of 0.9.4-15+, the Fedora lirc package sports systemd socket
activation. This should fix the problems at startup when clients can't
connect to /var/run/lircd because the lircd service is yet not started.

To start the lircd service using socket activation:
```
# systemctl enable lircd.socket
# systemctl start lircd.socket
```
The lircmd is started the usual way:
```
# systemctl enable lircmd.service
# systemctl start lircmd.service
```
#### Running another instance.

Sometimes another lircd instance is required to handle some other input
device. This could be done by creating a new service definition in
/etc/systemd/system.

In my case I have an extra instance handling ir output to the transciever.
This is accomplished with a file /etc/systemd/system/lirc-tx:
----------------
[Unit]
Description=LIRC Infrared Signal Decoder
After=network.target

[Service]
Type=simple
ExecStart=/usr/sbin/lircd --driver=iguanaIR \
--device=/var/run/iguanaIR/0 \
--output=/var/run/lirc/lircd-tx \
--pidfile=/run/lirc/dont-use-lircd-tx.pid \
--nodaemon \
--allow-simulate

[Install]
WantedBy=multi-user.target

-----------------------

This defines a new service which can be started using
'systemctl start lirc-tx' etc. It's essential that each service has an
unique output socket. You should probably also think twice before running
two instances with the same input device.

## Troubleshooting

Getting lircd logs from last boot cycle:
```
# journalctl -b /usr/sbin/lircd
```

If lircd fails to start or dies after restart, first check logs for errors:
```
# journalctl -f &
# systemctl restart lircd.service
```

You could also run lircd in foreground after stopping service:
```
# systemctl stop lircd.service
# bash
# source /etc/systconfig/lirc
# /usr/sbin/lircd $LIRCD_OPTIONS --driver $LIRC_DRIVER \
> --device $LIRC_DEVICE --nodaemon
```

Sometimes kernel complains about multiple clients trying to access the
same device. In this case you need to blacklist some kernel module
to make the kernel device available for lircd. One example is my RF
remote using the atilibusb driver. This needs to blacklist the built_in
ati_remote module. This is is done by creating the file
/etc/modprobe.conf.d/blacklist-ati-remote.conf as:
```
# Block built-in handling of ati-remote (use lircd instead).
blacklist ati_remote
```










1066
SPECS/lirc.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save