Package init

This commit is contained in:
overweight 2019-09-30 10:52:59 -04:00
commit 8fc01b28e1
5 changed files with 198 additions and 0 deletions

View File

@ -0,0 +1,32 @@
From 9c64788d897d300dbd05239b04855c2cd0196316 Mon Sep 17 00:00:00 2001
From: Chandni Verma <chandni@linux.vnet.ibm.com>
Date: Wed, 21 Jun 2017 17:06:17 +0530
Subject: [PATCH] Ensure /var/lib/hardware/udi exists and with 755 permissions
We make this fix in Makefile at installation time so that the
directory gets removed upon purging the package and doesn't
linger on.
This fixes any save-config issues one may see on Linux
distributions where the directory doesn't exist by default.
Signed-off-by: Chandni Verma <chandni@linux.vnet.ibm.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index ba7df1c..da5f124 100644
--- a/Makefile
+++ b/Makefile
@@ -119,6 +119,7 @@ install:
install -m 755 getsysinfo $(DESTDIR)/usr/sbin
install -m 755 src/isdn/cdb/mk_isdnhwdb $(DESTDIR)/usr/sbin
install -d -m 755 $(DESTDIR)/usr/share/hwinfo
+ install -d -m 755 $(DESTDIR)/var/lib/hardware/udi
install -m 644 src/isdn/cdb/ISDN.CDB.txt $(DESTDIR)/usr/share/hwinfo
install -m 644 src/isdn/cdb/ISDN.CDB.hwdb $(DESTDIR)/usr/share/hwinfo
--
2.7.4

View File

@ -0,0 +1,34 @@
From 1f1354fc1e5098a61bcc62d556db2b9549056d3f Mon Sep 17 00:00:00 2001
From: Chris Lamb <chris@chris-lamb.co.uk>
Date: Thu, 11 Jan 2018 22:45:24 +0530
Subject: [PATCH 19/39] Please make CDBISDN_DATE ignore timezone.
Whilst working on the Reproducible Builds effort [0], we noticed
that hwinfo could not be built reproducibly.
Whilst it uses SOURCE_DATE_EPOCH, it varies depending on the timezone
via ctime(&t) instead of asctime(gmtime(&t)).
[0] https://reproducible-builds.org/
Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
---
src/isdn/cdb/isdn_cdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/isdn/cdb/isdn_cdb.c b/src/isdn/cdb/isdn_cdb.c
index 53c3c75..95a239c 100644
--- a/src/isdn/cdb/isdn_cdb.c
+++ b/src/isdn/cdb/isdn_cdb.c
@@ -222,7 +222,7 @@ char **argv;
fprintf(stdout, "/* CDBISDN database */\n");
fprintf(stdout,"const int CDBISDN_DBVERSION = 0x%x;\n", CDB_DATAVERSION);
time(&tim);
- strcpy(line,ctime(&tim));
+ strcpy(line,asctime(gmtime(&tim)));
l = strlen(line);
if (l)
line[l-1] = 0;
--
1.8.3.1

View File

@ -0,0 +1,63 @@
From 576beaa671c735b99745ee8fa9741d635ad952b9 Mon Sep 17 00:00:00 2001
From: Steffen Winterfeldt <wfeldt@opensuse.org>
Date: Thu, 29 Mar 2018 14:56:21 +0200
Subject: [PATCH 21/39] ensure udev device links are unique (bsc #1084700)
It sometimes happens that udev generates the same by-* links for different
devices. Mainly in strange virtualized environments.
This patch ensures that the udev symlinks libhd gathers point to the correct
kernel device (only one of the duplicates can, obviously).
---
src/hd/hd.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/hd/hd.c b/src/hd/hd.c
index 528ef40..5321050 100644
--- a/src/hd/hd.c
+++ b/src/hd/hd.c
@@ -5634,6 +5634,7 @@ void read_udevinfo(hd_data_t *hd_data)
str_list_t *sl, *udevinfo;
hd_udevinfo_t **uip, *ui;
char *s = NULL, buf[256];
+ struct stat sbuf;
udevinfo = read_file("| " PROG_UDEVADM " info -e 2>/dev/null", 0, 0);
if(!udevinfo) udevinfo = read_file("| " PROG_UDEVINFO " -e 2>/dev/null", 0, 0);
@@ -5675,6 +5676,33 @@ void read_udevinfo(hd_data_t *hd_data)
s = free_mem(s);
+ /*
+ * It sometimes happens that udev generates the same link for different
+ * kernel devices. To catch this we check here that udev device symlinks
+ * actually point to the kernel device name.
+ *
+ * If it does not match the link is replaced by the kernel device name.
+ */
+ for(ui = hd_data->udevinfo; ui; ui = ui->next) {
+ if(!ui->name || stat(ui->name, &sbuf)) continue;
+
+ for(sl = ui->links; sl; sl = sl->next) {
+ char *real_path = realpath(sl->str, NULL);
+
+ if(real_path) {
+ if(strcmp(real_path, ui->name)) {
+ ADD2LOG(
+ "udev link %s points to %s (expected %s) - removed\n",
+ sl->str, real_path, ui->name
+ );
+ str_printf(&sl->str, 0, "%s", ui->name);
+ }
+
+ free(real_path);
+ }
+ }
+ }
+
for(ui = hd_data->udevinfo; ui; ui = ui->next) {
ADD2LOG("%s\n", ui->sysfs);
if(ui->name) ADD2LOG(" name: %s\n", ui->name);
--
2.7.4

BIN
hwinfo-21.47.tar.gz Normal file

Binary file not shown.

69
hwinfo.spec Normal file
View File

@ -0,0 +1,69 @@
Name: hwinfo
Version: 21.47
Release: 5
Summary: Probe for hardware
License: GPL+
URL: https://github.com/openSUSE/hwinfo
Source0: https://github.com/openSUSE/hwinfo/archive/%{version}/%{name}-%{version}.tar.gz
Patch6000: Please-make-CDBISDN_DATE-ignore-timezone.patch
Patch6001: ensure-udev-device-links-are-unique.patch
Patch6002: Ensure-var-lib-hardware-udi-exists-and-with-755-perm.patch
BuildRequires: libx86emu-devel doxygen flex perl-XML-Parser pkgconfig udev
%description
hwinfo is used to report the present hardware information in the system.
It is able to generate a system overview log about hardware.
%package devel
Summary: The devel for %{name}
Requires: %{name} = %{version}-%{release}
%description devel
The header files and libraries for developing %{name}.
%package_help
%prep
%autosetup -n %{name}-%{version} -p1
%build
make LDFLAGS="%{__global_ldflags} -Lsrc" LIBDIR=%{_libdir} HWINFO_VERSION=%{version}
%install
%make_install LDFLAGS="%{__global_ldflags} -Lsrc" LIBDIR=%{_libdir} HWINFO_VERSION=%{version}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%license COPYING
%{_sbindir}/*
%{_libdir}/libhd.so.*
%{_sharedstatedir}/hardware/udi
%files devel
%{_includedir}/hd.h
%{_libdir}/pkgconfig/hwinfo.pc
%{_libdir}/libhd.so
%files help
%doc *.md MAINTAINER
%{_datadir}/hwinfo
%changelog
* Sat Apr 20 2019 liusirui<liusirui@huawei.com> - 21.47-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: backport patch to fix save-config issues.
* Tue Apr 9 2019 liusirui<liusirui@huawei.com> - 21.47-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:backport patches from https://github.com/openSUSE/hwinfo
* Mon Apr 8 2019 openEuler Buildteam <buildteam@openeuler.org> - 21.47-3
- Package init