Bug#945868: ros-rospkg: OS detection is wrong for Ubuntu, uses deprecated LSB instead of os-release

Steve Langasek steve.langasek at canonical.com
Sat Nov 30 03:35:54 GMT 2019


Package: ros-rospkg
Version: 1.2.0-2
Severity: minor
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu focal ubuntu-patch

Dear maintainers,

In Ubuntu, the latest version of ros-rosdep was failing to build due to test
failures related to ros-rospkg, which was not properly detecting the
platform as Ubuntu.  Digging into this, I found that ros-rospkg was relying
on the lsb_release command to detect Debian and Ubuntu as platforms; but
lsb_release is not part of the base system, so this fails when the
additional lsb-release package is not installed.

The attached patch fixes ros-rospkg to use os-release on Ubuntu, which works
for all supported releases.  I have not looked to confirm that
/etc/os-release is also guaranteed to be present on all supported Debian
releases, but it probably is.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru ros-rospkg-1.2.0/debian/patches/series ros-rospkg-1.2.0/debian/patches/series
--- ros-rospkg-1.2.0/debian/patches/series	2019-11-24 01:47:43.000000000 -0800
+++ ros-rospkg-1.2.0/debian/patches/series	2019-11-29 17:05:19.000000000 -0800
@@ -3,3 +3,4 @@
 0003-Set-rosversion-to-Debian.patch
 0004-Use-Python-in-instead-of-string-find.patch
 0005-Replace-deprecated-platform-functions-with-distro.patch
+ubuntu-uses-fdo-not-lsb.patch
diff -Nru ros-rospkg-1.2.0/debian/patches/ubuntu-uses-fdo-not-lsb.patch ros-rospkg-1.2.0/debian/patches/ubuntu-uses-fdo-not-lsb.patch
--- ros-rospkg-1.2.0/debian/patches/ubuntu-uses-fdo-not-lsb.patch	1969-12-31 16:00:00.000000000 -0800
+++ ros-rospkg-1.2.0/debian/patches/ubuntu-uses-fdo-not-lsb.patch	2019-11-29 17:09:14.000000000 -0800
@@ -0,0 +1,20 @@
+Description: Don't rely on LSB-based OS detection for Ubuntu
+ All recent versions of Ubuntu ship /etc/os-release, and the lsb_release
+ command is only available if the optional lsb-release package is
+ installed.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Updated: 2019-11-29
+
+Index: ros-rospkg-1.2.0/src/rospkg/os_detect.py
+===================================================================
+--- ros-rospkg-1.2.0.orig/src/rospkg/os_detect.py
++++ ros-rospkg-1.2.0/src/rospkg/os_detect.py
+@@ -756,7 +756,7 @@
+ OsDetect.register_default(OS_QNX, QNX())
+ OsDetect.register_default(OS_RHEL, Rhel())
+ OsDetect.register_default(OS_SLACKWARE, Slackware())
+-OsDetect.register_default(OS_UBUNTU, LsbDetect("Ubuntu"))
++OsDetect.register_default(OS_UBUNTU, FdoDetect("ubuntu"))
+ OsDetect.register_default(OS_CLEARLINUX, FdoDetect("clear-linux-os"))
+ OsDetect.register_default(OS_NIXOS, FdoDetect("nixos"))
+ OsDetect.register_default(OS_WINDOWS, Windows())


More information about the debian-science-maintainers mailing list