Skip to content

Commit

Permalink
apps: Remove gpsd as dependency in favor of manual installation
Browse files Browse the repository at this point in the history
This also adds supporting code to handle the presence of these
applications or lack thereof.

Change-Id: If104e5e0be211e596c5d3b68510a11d5dd171914
  • Loading branch information
awlane committed Feb 6, 2025
1 parent 8516386 commit 749b07a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
10 changes: 9 additions & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,12 @@ Currently, the compatible versions include:

- ``2024-08``: ndn-cxx 0.9.0, NFD 24.07, NLSR 24.08, PSync 0.5.0,
ndn-tools 24.07, and compatible versions of ndn-traffic-generator
and infoedit.
and infoedit.

Using gpsd (Experimental)
----------------

The gpsd application included currently is based on in-progress work and
is not treated as part of the main dependencies. To use it, install the
`gpsd` and `nc` (netcat) from your package manager, if not already present,
to enable the functionality.
17 changes: 17 additions & 0 deletions minindn/apps/gpsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
import math
import time
import datetime
from subprocess import TimeoutExpired, DEVNULL
from typing import Optional, Tuple

from mininet.log import error

from minindn.apps.application import Application
from minindn.util import getPopen


class Gpsd(Application):
Expand Down Expand Up @@ -222,6 +226,19 @@ def start(self) -> None:
"""
Start a thread to periodically send GPS data for the node.
"""
try:
gpsd_present = getPopen(self.node, "gpsd -V", stdout=DEVNULL, stderr=DEVNULL).wait(timeout=5)
nc_present = getPopen(self.node, "nc -h", stdout=DEVNULL, stderr=DEVNULL).wait(timeout=5)
if gpsd_present > 0:
error("The application is currently missing gpsd as a dependency. This must be installed manually.\n")
elif nc_present > 0:
error("The application is currently missing netcat as a dependency. This must be installed manually.\n")
if (gpsd_present + nc_present) > 0:
raise RuntimeError("Missing dependency for gpsd helper")
except TimeoutExpired as e:
error("The application is unable to validate if you have all required dependencies for gpsd.\n")
raise e

Application.start(self, command="gpsd -n udp://127.0.0.1:7150")

self.location_thread = threading.Thread(target=self.__feedGPStoGPSD, args=(self.node,))
Expand Down
1 change: 0 additions & 1 deletion util/pkgdep/debian-like.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ APT_PKGS=(
build-essential
ca-certificates
git
gpsd
libboost-atomic-dev
libboost-chrono-dev
libboost-date-time-dev
Expand Down
1 change: 0 additions & 1 deletion util/pkgdep/fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ DNF_PKGS=(
boost-devel
ca-certificates
gcc-c++
gpsd
libpcap-devel
openssl-devel
python3-pip
Expand Down

0 comments on commit 749b07a

Please sign in to comment.