Skip to content

Commit 165a94c

Browse files
deps: Install gr-dvbs2rx from binary packages
1 parent d70509b commit 165a94c

File tree

4 files changed

+33
-138
lines changed

4 files changed

+33
-138
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313

1414
## 0.4.5
1515

16-
Release Date: 2023-02-17
16+
Release Date: 2023-03-03
1717

1818
### Added
19+
- Support for the gr-dvbs2rx SDR receiver implementation selected with the new
20+
`--impl` option on the `sdr` command and installed by the `deps install`
21+
command on Ubuntu 22.04+ and Fedora 36+.
1922
- Support for password-based authentication with the Satellite Monitoring API,
2023
enabled automatically with the `--report` option.
2124
- Command `reporting password` to set/reset the Monitoring API password.
2225
- Command `reporting info` to show the Monitoring API registration info.
23-
- Support for the gr-dvbs2rx SDR receiver implementation selected with the new
24-
`--impl` option on the `sdr` command and installed by command
25-
`deps install --gr-dvbs2rx` on Ubuntu 22.04+ and Fedora 36+.
2626
- Option `--disable` to disable selected Linux media modules when building the
2727
TBS drivers with the `deps tbs-drivers` command.
2828
- Non-interactive modes for the `gqrx` and `sdr` commands.

blocksatcli/dependencies.py

Lines changed: 8 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
from . import config, defs, util
1717

18-
GR_DVBS2RX_VERSION = '1.0.0'
19-
2018
logger = logging.getLogger(__name__)
2119
runner = util.ProcessRunner(logger)
2220

@@ -371,11 +369,7 @@ def _install_common(interactive=True, update=False, btc=False):
371369
update)
372370

373371

374-
def _install_specific(cfg_dir,
375-
target,
376-
interactive=True,
377-
update=False,
378-
grdvbs2rx=False):
372+
def _install_specific(cfg_dir, target, interactive=True, update=False):
379373
"""Install setup-specific dependencies"""
380374
key = next(key for key, val in target_map.items() if val == target)
381375

@@ -391,122 +385,17 @@ def _install_specific(cfg_dir,
391385
pkg_map[key]['yum'], interactive, update)
392386

393387
# On Fedora >= 36 or Ubuntu >= 22.04, both of which have GNU Radio 3.10
394-
# available on the main package repo, install gr-dvbs2rx for SDR receivers
395-
# if so desired:
396-
if target == defs.sdr_setup_type and grdvbs2rx:
397-
_install_dvbs2rx(cfg_dir, interactive, update)
398-
399-
400-
def _install_dvbs2rx(cfg_dir, interactive, update):
401-
"""Install gr-dvbs2rx by building the binary package from source"""
402-
src_dir = os.path.join(cfg_dir, "src")
403-
proj_dir = os.path.join(src_dir, "gr-dvbs2rx")
404-
405-
util.print_header(
406-
"{} gr-dvbs2rx".format("Updating" if update else "Installing"))
407-
388+
# available on the main package repo, install gr-dvbs2rx:
408389
distro_id = distro.id()
409390
distro_ver = distro.version()
410-
411391
fc36_or_higher = distro_id == 'fedora' and int(distro_ver) >= 36
412392
ubuntu22_or_higher = distro_id == 'ubuntu' and LooseVersion(
413393
distro_ver) >= '22.04'
414-
if not (fc36_or_higher or ubuntu22_or_higher):
415-
logger.error("gr-dvbs2rx is only supported on Fedora >= 36 "
416-
"and Ubuntu >= 22.04")
417-
return
418-
419-
if _is_package_installed('gr-dvbs2rx', GR_DVBS2RX_VERSION):
420-
logger.info(f"gr-dvbs2rx {GR_DVBS2RX_VERSION} is already installed")
421-
return
422-
423-
gr_dvbs2rx_pkg_map = {
424-
'apt': [
425-
# gr-dvbs2rx build deps
426-
'cmake',
427-
'doxygen',
428-
'g++',
429-
'git',
430-
'gnuradio-dev',
431-
'graphviz',
432-
'libsndfile1-dev',
433-
'libspdlog-dev',
434-
'pkg-config',
435-
'pybind11-dev',
436-
'python3-packaging',
437-
# debian packaging deps
438-
'debhelper',
439-
'devscripts',
440-
'dh-python'
441-
],
442-
'dnf': [
443-
# gr-dvbs2rx build deps
444-
'cmake',
445-
'doxygen',
446-
'fftw-devel',
447-
'gcc-c++',
448-
'git',
449-
'gmp-devel',
450-
'gnuradio-devel',
451-
'graphviz',
452-
'libsndfile-devel',
453-
'pybind11-devel',
454-
'python3-packaging',
455-
'spdlog-devel',
456-
# rpm packaging deps
457-
'coreutils',
458-
'dnf-utils',
459-
'rpm-build',
460-
'rpm-devel',
461-
'rpmdevtools'
462-
],
463-
'yum': [] # no distro with yum support GR 3.10
464-
}
465-
466-
_install_packages(gr_dvbs2rx_pkg_map['apt'], gr_dvbs2rx_pkg_map['dnf'],
467-
gr_dvbs2rx_pkg_map['yum'], interactive, update)
468-
469-
runner.create_dir('src', cwd=cfg_dir)
470-
471-
if os.path.exists(proj_dir):
472-
runner.run(['git', 'checkout', GR_DVBS2RX_VERSION], cwd=proj_dir)
473-
else:
474-
runner.run([
475-
'git', 'clone', '--recursive',
476-
'https://github.com/igorauad/gr-dvbs2rx/', '-b', GR_DVBS2RX_VERSION
477-
],
478-
cwd=src_dir)
479-
480-
# Build the gr-dvbs2rx package from source
481-
if distro_id == 'ubuntu':
482-
arch = runner.run(['dpkg', '--print-architecture'],
483-
capture_output=True).stdout.decode().replace(
484-
"\n", "")
485-
dist = runner.run(['lsb_release', '-s', '-c'],
486-
capture_output=True).stdout.decode().replace(
487-
"\n", "")
488-
res_dir = None
489-
pkg_name = os.path.join(
490-
proj_dir, '.packaging/build/' + dist + '-' + arch,
491-
"gr-dvbs2rx_" + GR_DVBS2RX_VERSION + '-1_' + arch + '.deb')
492-
runner.run(['.packaging/scripts/pkg-debian.sh'], cwd=proj_dir)
493-
else:
494-
arch = runner.run(['rpmbuild', '--eval', '%{_arch}'],
495-
capture_output=True).stdout.decode().replace(
496-
"\n", "")
497-
dist = runner.run(['rpmbuild', '--eval', '%{dist}'],
498-
capture_output=True).stdout.decode().replace(
499-
"\n", "")
500-
pkg_name = "gr-dvbs2rx-" + GR_DVBS2RX_VERSION + '-1' + dist + '.' + \
501-
arch + '.rpm'
502-
res_dir = os.path.join(util.get_home_dir(), 'rpmbuild/RPMS/', arch)
503-
runner.run(['.packaging/scripts/pkg-rpm.sh'], cwd=proj_dir)
504-
505-
# Install the gr-dvbs2r package that was just built
506-
_install_packages([pkg_name], [pkg_name], [],
507-
interactive,
508-
update,
509-
cwd=res_dir)
394+
if target == defs.sdr_setup_type and \
395+
(fc36_or_higher or ubuntu22_or_higher):
396+
_install_packages(['gr-dvbs2rx', 'gr-osmosdr'],
397+
['gr-dvbs2rx', 'gr-osmosdr'], [], interactive,
398+
update)
510399

511400

512401
def _print_help(args):
@@ -550,10 +439,6 @@ def subparser(subparsers): # pragma: no cover
550439
action='store_true',
551440
default=False,
552441
help="Install bitcoin-satellite")
553-
p1.add_argument("--gr-dvbs2rx",
554-
action='store_true',
555-
default=False,
556-
help="Install gr-dvbs2rx")
557442
p1.set_defaults(func=run, update=False)
558443

559444
p2 = subsubp.add_parser('update',
@@ -568,10 +453,6 @@ def subparser(subparsers): # pragma: no cover
568453
action='store_true',
569454
default=False,
570455
help="Update bitcoin-satellite")
571-
p2.add_argument("--gr-dvbs2rx",
572-
action='store_true',
573-
default=False,
574-
help="Update gr-dvbs2rx")
575456
p2.set_defaults(func=run, update=True)
576457

577458
p3 = subsubp.add_parser('tbs-drivers',
@@ -626,8 +507,7 @@ def run(args):
626507
_install_specific(args.cfg_dir,
627508
target,
628509
interactive=interactive,
629-
update=args.update,
630-
grdvbs2rx=args.gr_dvbs2rx)
510+
update=args.update)
631511

632512

633513
def drivers(args):

blocksatcli/verify_deps_instal.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import logging
33
import unittest
44
import os
5+
from distutils.version import LooseVersion
6+
7+
import distro
8+
59
from . import dependencies, util
610

711

@@ -38,6 +42,17 @@ def test_sdr_deps(self):
3842
expected_apps = ["rtl_sdr", "leandvb", "ldpc_tool", "tsp"]
3943
self.assertTrue(dependencies.check_apps(expected_apps))
4044

45+
# gr-dvbs2rx on fc >= 36 and Ubuntu >= 22.04.
46+
distro_id = distro.id()
47+
distro_ver = distro.version()
48+
fc36_or_higher = distro_id == 'fedora' and int(distro_ver) >= 36
49+
ubuntu22_or_higher = distro_id == 'ubuntu' and LooseVersion(
50+
distro_ver) >= '22.04'
51+
if fc36_or_higher or ubuntu22_or_higher:
52+
self.assertTrue(dependencies.check_apps(["dvbs2-rx"]))
53+
else:
54+
self.assertFalse(dependencies.check_apps(["dvbs2-rx"]))
55+
4156
def test_standalone_deps(self):
4257
"""Test the installation of standalone receiver dependencies"""
4358
args = self.gen_args("standalone")

doc/sdr.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The SDR setup is connected as follows:
3838

3939
The SDR-based setup relies on the applications listed below:
4040

41-
- [leandvb](http://www.pabr.org/radio/leandvb/leandvb.en.html): a software-based DVB-S2 receiver application.
41+
- [leandvb](http://www.pabr.org/radio/leandvb/leandvb.en.html) or [gr-dvbs2rx](https://github.com/igorauad/gr-dvbs2rx): the software-based DVB-S2 receiver application.
4242
- [rtl_sdr](https://github.com/osmocom/rtl-sdr): reads samples taken by the RTL-SDR and feeds them into [leandvb](http://www.pabr.org/radio/leandvb/leandvb.en.html).
4343
- [TSDuck](https://tsduck.io/): unpacks the output of leandvb and produces IP packets to be fed to [Bitcoin Satellite](bitcoin.md).
4444
- [Gqrx](https://gqrx.dk): useful for spectrum visualization during antenna pointing.
@@ -99,18 +99,18 @@ A Docker image is available for running the SDR host on a container. Please refe
9999

100100
### gr-dvbs2rx Receiver
101101

102-
An alternative software-defined DVB-S2 receiver implementation named gr-dvbs2rx is available on the CLI starting from version 0.4.5. This alternative application is based on the [GNU Radio](https://www.gnuradio.org) framework for software-defined radio.
102+
An alternative software-defined DVB-S2 receiver implementation named gr-dvbs2rx is available on the CLI starting from version 0.4.5. This application is based on the [GNU Radio](https://www.gnuradio.org) framework for software-defined radio, and it is supported on Fedora 36 and Ubuntu 22.04 or later versions only.
103103

104-
To try gr-dvbs2rx, first, run the command below to install it. The installation is supported on Fedora 36 and Ubuntu 22.04 or later versions.
104+
The CLI installs gr-dvbs2rx automatically when available. However, if you are running an existing setup configured with a CLI version preceding 0.4.5, please rerun the installation command:
105105

106106
```
107-
blocksat-cli deps install --gr-dvbs2rx
107+
blocksat-cli deps install
108108
```
109109

110-
Then, use the `--impl gr-dvbs2rx` option when launching the receiver, as follows:
110+
Then, relaunch the SDR receiver with the regular command below. The CLI will choose the gr-dvbs2rx application by default when available. However, you can always toggle the implementation using option `--impl`.
111111

112112
```
113-
blocksat-cli sdr --impl gr-dvbs2rx
113+
blocksat-cli sdr
114114
```
115115

116116
### Manual Installation of SDR Software

0 commit comments

Comments
 (0)