From 8b1a57fd34cdc28ae688dcdf73fe70443e0463ac Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Fri, 7 Oct 2016 14:51:41 +1000 Subject: [PATCH] common: Remove the runtime dependency on lsb_release With modern releases we should be able to make do with the call to os_release_parse only which uses /etc/os-release which should be available on most (all?) releases we currently support. this then allows us to remove the runtime dependency which pulls in several other packages and would be nice to avoid. Fixes: http://tracker.ceph.com/issues/17425 Signed-off-by: Brad Hubbard --- ceph.spec.in | 4 ---- debian/control | 1 - src/common/util.cc | 31 ++----------------------------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/ceph.spec.in b/ceph.spec.in index b1391fa01e9..4ef3fddbf65 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -230,12 +230,8 @@ Requires: cryptsetup Requires: findutils Requires: which %if 0%{?suse_version} -Requires: lsb-release Recommends: ntp-daemon %endif -%if 0%{?fedora} || 0%{?rhel} -Requires: redhat-lsb-core -%endif %if 0%{with xio} Requires: libxio %endif diff --git a/debian/control b/debian/control index bc9f19aecb1..3943e097def 100644 --- a/debian/control +++ b/debian/control @@ -89,7 +89,6 @@ Depends: binutils, gdisk, grep, logrotate, - lsb-release, ${python:Depends}, xfsprogs, ${misc:Depends}, diff --git a/src/common/util.cc b/src/common/util.cc index 124b9b9c39e..ee4b84e87b5 100644 --- a/src/common/util.cc +++ b/src/common/util.cc @@ -150,33 +150,6 @@ static void file_values_parse(const map& kvm, FILE *fp, map *m, CephContext *cct) -{ - static const map kvm = { - { "distro", "Distributor ID:" }, - { "distro_description", "Description:" }, - { "distro_codename", "Codename:", }, - { "distro_version", "Release:" } - }; - - FILE *fp = popen("lsb_release -idrc", "r"); - if (!fp) { - int ret = -errno; - lderr(cct) << "lsb_release_parse - failed to call lsb_release binary with error: " << cpp_strerror(ret) << dendl; - return false; - } - - file_values_parse(kvm, fp, m, cct); - - if (pclose(fp)) { - int ret = -errno; - lderr(cct) << "lsb_release_parse - pclose failed: " << cpp_strerror(ret) << dendl; - return false; - } - - return true; -} - static bool os_release_parse(map *m, CephContext *cct) { static const map kvm = { @@ -201,8 +174,8 @@ static bool os_release_parse(map *m, CephContext *cct) static void distro_detect(map *m, CephContext *cct) { - if (!lsb_release_parse(m, cct) && !os_release_parse(m, cct)) { - lderr(cct) << "distro_detect - lsb_release or /etc/os-release is required" << dendl; + if (!os_release_parse(m, cct)) { + lderr(cct) << "distro_detect - /etc/os-release is required" << dendl; } for (const char* rk: {"distro", "distro_version"}) { -- 2.47.3