Accepting request 545915 from Base:System

OBS-URL: https://build.opensuse.org/request/show/545915
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ledmon?expand=0&rev=12
This commit is contained in:
Dominique Leuenberger 2017-11-27 21:18:37 +00:00 committed by Git OBS Bridge
commit 38b1ca6435
7 changed files with 78 additions and 144 deletions

View File

@ -1,75 +0,0 @@
From f0e0aac35deb8052f93256488e933409bdbfdc21 Mon Sep 17 00:00:00 2001
From: Zhilong Liu <zlliu@suse.com>
Date: Fri, 12 May 2017 16:13:04 +0800
Subject: [PATCH] Don't rely on searching for "/block" in sysfs path for
detecting partitions
It is simpler and more reliable to check for a "partition" file in the device's
directory (supported since kernel 2.6.28). The previous approach would fail for
nvme devices because their device path looks like this:
/sys/devices/pci0000:00/0000:00:0c.0/nvme/nvme0/nvme0n1
Fixes: b30173ec8c05 ("* fix off-normal-failure block dev status loop * remove
unused raid->slave_list member * support md raid on block device partitions")
Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
src/slave.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/slave.c b/src/slave.c
index 9843ffd..436ed4a 100644
--- a/src/slave.c
+++ b/src/slave.c
@@ -22,6 +22,8 @@
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
+#include <stdio.h>
+#include <sys/stat.h>
#if _HAVE_DMALLOC_H
#include <dmalloc.h>
@@ -100,27 +102,26 @@ static struct block_device *_get_block(const char *path, void *block_list)
{
char temp[PATH_MAX];
char link[PATH_MAX];
- char *ptr;
- struct block_device *device = NULL;
str_cpy(temp, path, PATH_MAX);
str_cat(temp, "/block", PATH_MAX);
- if (realpath(temp, link)) {
- ptr = strrchr(link, '/');
- if (ptr && link < ptr - strlen("/block")) {
- /* translate partition to master block dev */
- if(strncmp(
- ptr - strlen("/block"),
- "/block",
- strlen("/block"))) {
+ if (!realpath(temp, link))
+ return NULL;
+ /* translate partition to master block dev */
+ if (snprintf(temp, PATH_MAX, "%s/partition", link) > 0) {
+ struct stat sb;
+ char *ptr;
+
+ if (stat(temp, &sb) == 0 && S_ISREG(sb.st_mode)) {
+ ptr = strrchr(link, '/');
+ if (ptr)
*ptr = '\0';
- }
- device = list_first_that(block_list, _compare, link);
}
}
- return device;
+
+ return list_first_that(block_list, _compare, link);
}
/**
--
2.6.6

View File

@ -0,0 +1,57 @@
From 8e82bd8bec79d066c6263f99d395c87be4086dbc Mon Sep 17 00:00:00 2001
From: Zhilong Liu <zlliu@suse.com>
Date: Mon, 27 Nov 2017 11:29:50 +0800
Subject: [PATCH] fix compilation warnings on newer gcc
bsc#1067452
URL: https://bugzilla.suse.com/show_bug.cgi?id=1067452#c4
Upstream URL: https://github.com/intel/ledmon
Commit ID: e51e1a855df80e34e166984373dce7d765d61d52
Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
src/Makefile | 2 +-
src/ledctl.c | 1 +
src/smp.c | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index bb718d5..19a27d0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -62,7 +62,7 @@ CXFLAGS=-O0 -g
CWFLAGS=-Wall
CFLAGS=$(CXFLAGS) $(CWFLAGS)
-DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_BSD_SOURCE -DDMALLOC_DISABLE
+DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE
CPPFLAGS=$(DEFFLAGS)
ALL_CPPFLAGS=$(CPPFLAGS) -I../config
diff --git a/src/ledctl.c b/src/ledctl.c
index 2d013b4..e060fe2 100644
--- a/src/ledctl.c
+++ b/src/ledctl.c
@@ -30,6 +30,7 @@
#include <syslog.h>
#include <time.h>
#include <unistd.h>
+#include <sys/sysmacros.h>
#if _HAVE_DMALLOC_H
#include <dmalloc.h>
diff --git a/src/smp.c b/src/smp.c
index 7912bd0..872c0ca 100644
--- a/src/smp.c
+++ b/src/smp.c
@@ -31,6 +31,7 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <sys/sysmacros.h>
#if _HAVE_DMALLOC_H
#include <dmalloc.h>
--
2.15.0

View File

@ -1,59 +0,0 @@
---
Makefile | 11 +++--------
src/Makefile | 6 +++---
2 files changed, 6 insertions(+), 11 deletions(-)
Index: src/Makefile
===================================================================
--- src/Makefile.orig
+++ src/Makefile
@@ -61,7 +61,7 @@ CXFLAGS=-O0 -g
CWFLAGS=-Wall
CFLAGS=$(CXFLAGS) $(CWFLAGS)
-DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_BSD_SOURCE -DDMALLOC_DISABLE
+DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE
CPPFLAGS=$(DEFFLAGS)
ALL_CPPFLAGS=$(CPPFLAGS) -I../config
@@ -73,10 +73,10 @@ SOURCES:=$(shell find -name "*.[cC]" -pr
default: all
ledmon: $(OUTDIR)/.depend $(LEDMON_OBJECTS)
- $(CC) $(LDFLAGS) $(LDLIBS) $(LEDMON_OBJECTS) -o $@
+ $(CC) $(LDLIBS) $(LEDMON_OBJECTS) -o $@ $(LDFLAGS)
ledctl: $(OUTDIR)/.depend $(LEDCTL_OBJECTS)
- $(CC) $(LDFLAGS) $(LDLIBS) $(LEDCTL_OBJECTS) -o $@
+ $(CC) $(LDLIBS) $(LEDCTL_OBJECTS) -o $@ $(LDFLAGS)
$(OUTDIR)/%.o: %.c
$(CC) $(CFLAGS) $(ALL_CPPFLAGS) -c $< -o $@
Index: Makefile
===================================================================
--- Makefile.orig
+++ Makefile
@@ -19,20 +19,15 @@
# Installation directory
DESTDIR?=
-.PHONY: ledmon ledctl man all
+.PHONY: man all
default: all
-ledmon:
- $(MAKE) -C src ledmon
-
-ledctl:
- $(MAKE) -C src ledctl
-
man:
$(MAKE) -C doc all
-all: ledmon ledctl man
+all:
+ $(MAKE) -C src all
install: all
$(MAKE) -C src DESTDIR=$(DESTDIR) install

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5000b0114c82d04b0bebdfe205458c39eed19cd002868790b2fb498c26917128
size 64199

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Nov 27 06:46:41 UTC 2017 - zlliu@suse.com
- Update to version 0.81:
* No upstream changelog available
* add: 0001-fix-compilation-warnings-on-newer-gcc.patch
* modify spec file on demand, add libudev dependency.
* Intel has moved ledmon from Souceforge to Github.
- Drop no longer needed Makefile-error-dependency.patch
- Drop 0001-Don-t-rely-on-searching-for-block-in-sysfs-path-for-.patch
- bsc#1067452 and fate#322625
-------------------------------------------------------------------
Fri May 12 08:33:13 UTC 2017 - zlliu@suse.com

View File

@ -17,16 +17,16 @@
Name: ledmon
Version: 0.80
Version: 0.81
Release: 0
Summary: Enclosure LED Utilities
License: GPL-2.0
Group: Hardware/Other
Url: http://sourceforge.net/projects/ledmon/
Source0: http://sourceforge.net/projects/ledmon/files/ledmon-%{version}/%{name}-%{version}.tar.gz
Patch0: Makefile-error-dependency.patch
Patch1: 0001-Don-t-rely-on-searching-for-block-in-sysfs-path-for-.patch
Url: https://github.com/intel/ledmon/
Source0: https://github.com/intel/ledmon/archive/v%{version}.tar.gz
Patch0: 0001-fix-compilation-warnings-on-newer-gcc.patch
BuildRequires: libsgutils-devel
BuildRequires: libudev-devel
Provides: sgpio:/sbin/ledmon
Provides: sgpio:/{%{_bindir}}/ledctl
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -38,8 +38,7 @@ solutions.
%prep
%setup -q
%patch0
%patch1 -p1
%patch0 -p1
%build
make %{?_smp_mflags} CXFLAGS="%{optflags} -lsgutils2"

3
v0.81.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f125947232e1f7649fabafce3c689499448e2c13f25bb3f33440c9d873440f9
size 61363