Package init

This commit is contained in:
overweight 2019-09-30 11:11:24 -04:00
commit 5ebe892929
5 changed files with 247 additions and 0 deletions

View File

@ -0,0 +1,12 @@
diff -up pciutils-3.0.0/Makefile.idpath pciutils-3.0.0/Makefile
--- pciutils-3.0.0/Makefile.idpath 2008-04-10 21:19:43.000000000 +0200
+++ pciutils-3.0.0/Makefile 2008-09-01 15:16:19.000000000 +0200
@@ -27,7 +27,7 @@ ABI_VERSION=.3
PREFIX=/usr/local
SBINDIR=$(PREFIX)/sbin
SHAREDIR=$(PREFIX)/share
-IDSDIR=$(SHAREDIR)
+IDSDIR=$(SHAREDIR)/hwdata
MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
INCDIR=$(PREFIX)/include
LIBDIR=$(PREFIX)/lib

113
0001-pciutils-dir-d.patch Normal file
View File

@ -0,0 +1,113 @@
diff -up pciutils-3.0.0/lib/names-parse.c.dird pciutils-3.0.0/lib/names-parse.c
--- pciutils-3.0.0/lib/names-parse.c.dird 2008-04-10 21:15:47.000000000 +0200
+++ pciutils-3.0.0/lib/names-parse.c 2008-09-01 15:17:23.000000000 +0200
@@ -6,10 +6,13 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <dirent.h>
+#include <libgen.h>
#include "internal.h"
#include "names.h"
@@ -82,7 +85,7 @@ static inline int id_white_p(int c)
}
-static const char *id_parse_list(struct pci_access *a, pci_file f, int *lino)
+static const char *id_parse_list(struct pci_access *a, pci_file f, int *lino, int flags)
{
char line[MAX_LINE];
char *p;
@@ -207,7 +210,7 @@ static const char *id_parse_list(struct
p++;
if (!*p)
return parse_error;
- if (pci_id_insert(a, cat, id1, id2, id3, id4, p, SRC_LOCAL))
+ if (pci_id_insert(a, cat, id1, id2, id3, id4, p, SRC_LOCAL) && flags)
return "Duplicate entry";
}
return NULL;
@@ -223,13 +226,14 @@ pci_load_name_list(struct pci_access *a)
pci_free_name_list(a);
a->id_load_failed = 1;
if (!(f = pci_open(a)))
- return 0;
- err = id_parse_list(a, f, &lino);
+ return pci_new_load_name_list(a);
+ err = id_parse_list(a, f, &lino, 0);
PCI_ERROR(f, err);
pci_close(f);
if (err)
a->error("%s at %s, line %d\n", err, a->id_file_name, lino);
a->id_load_failed = 0;
+ pci_new_load_name_list(a);
return 1;
}
@@ -249,3 +253,49 @@ pci_set_name_list_path(struct pci_access
a->id_file_name = name;
a->free_id_name = to_be_freed;
}
+int pci_new_load_name_list(struct pci_access *a)
+{
+ pci_file f;
+ int lino, tempsize;
+ const char *err;
+ char *temp;
+ char new_id_path[PATH_MAX+1] = {0,};
+ DIR *pci_ids_dir;
+ struct dirent *dp;
+
+ strncpy(new_id_path, a->id_file_name, PATH_MAX);
+ new_id_path[PATH_MAX] = 0;
+ strncat(new_id_path, ".d/", PATH_MAX - strnlen(new_id_path, PATH_MAX));
+ /* printf("new_id_path is %s\n", new_id_path); */
+ pci_ids_dir = opendir(new_id_path);
+ if (pci_ids_dir == NULL)
+ return 0;
+
+ do
+ {
+ if ((dp = readdir(pci_ids_dir)) != NULL)
+ {
+ if (! strcmp(dp->d_name, "..") || ! strcmp(dp->d_name, "."))
+ continue;
+ if (strstr(dp->d_name, ".ids"))
+ {
+ tempsize = strnlen(new_id_path, PATH_MAX) + dp->d_reclen + 1;
+ temp = malloc(tempsize); /* This malloced memory is freed in the function pci_set_name_list_path() */
+ memset(temp, 0, tempsize);
+ strncpy(temp, new_id_path, (strnlen(new_id_path, PATH_MAX))+1);
+ strncat(temp, dp->d_name, PATH_MAX - strnlen(temp, PATH_MAX));
+ /* printf("Found file %s, processing it\n", temp); */
+ pci_set_name_list_path(a, temp, 1);
+ if (!(f = pci_open(a)))
+ continue;
+ err = id_parse_list(a, f, &lino, 0);
+ PCI_ERROR(f, err);
+ pci_close(f);
+ if (err)
+ a->error("%s at %s, line %d\n", err, a->id_file_name, lino);
+ }
+ }
+ }while (dp != NULL);
+ closedir(pci_ids_dir);
+ return 1;
+}
diff -up pciutils-3.0.0/lib/pci.h.dird pciutils-3.0.0/lib/pci.h
--- pciutils-3.0.0/lib/pci.h.dird 2008-04-10 21:23:05.000000000 +0200
+++ pciutils-3.0.0/lib/pci.h 2008-09-01 15:17:23.000000000 +0200
@@ -194,6 +194,7 @@ int pci_load_name_list(struct pci_access
void pci_free_name_list(struct pci_access *a) PCI_ABI; /* Called automatically by pci_cleanup() */
void pci_set_name_list_path(struct pci_access *a, char *name, int to_be_freed) PCI_ABI;
void pci_id_cache_flush(struct pci_access *a) PCI_ABI;
+int pci_new_load_name_list(struct pci_access *a);
enum pci_lookup_mode {
PCI_LOOKUP_VENDOR = 1, /* Vendor name (args: vendorID) */

9
multilibconfigh Normal file
View File

@ -0,0 +1,9 @@
#if defined(__x86_64__) || defined(__ia64__) || defined(__ppc64__) || defined(__powerpc64__) || defined(__s390x__) || defined(__aarch64__) || defined(__mips64)
#include "config.lib64.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "config.lib64.h"
#elif defined(__i386__) || defined(__ppc__) || defined(__powerpc__) || defined(__s390__) || defined(__alpha__) || defined(__sparc__) || defined(__sh__) || defined(__arm__) || defined(__mips)
#include "config.lib.h"
#else
#error Unknown Arch
#endif

BIN
pciutils-3.6.2.tar.gz Normal file

Binary file not shown.

113
pciutils.spec Normal file
View File

@ -0,0 +1,113 @@
Name: pciutils
Version: 3.6.2
Release: 3
Summary: PCI bus related utilities
License: GPLv2+
URL: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml
Source0: ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/%{name}-%{version}.tar.gz
Patch0: 0000-pciutils-2.2.1-idpath.patch
Patch1: 0001-pciutils-dir-d.patch
ExclusiveOS: Linux
BuildRequires: gcc git sed kmod-devel pkgconfig zlib-devel
Requires: hwdata
Provides: %{name}-libs
Obsoletes: %{name}-libs
Provides: %{name}-libs-debuginfo
Obsoletes: %{name}-libs-debuginfo
%description
The PCI Utilities are a collection of programs for inspecting and manipulating configuration
of PCI devices, all based on a common portable library libpci which offers access to the PCI
configuration space on a variety of operating systems.
The utilities include:
lspci
displays detailed information about all PCI buses and devices in the system
setpci
allows reading from and writing to PCI device configuration registers. For example, you
can adjust the latency timers with it.
%package devel
Summary: Library and Include Files of the PCI utilities
Requires: zlib-devel pkgconfig %{name} = %{version}-%{release}
Provides: %{name}-devel-static
Obsoletes: %{name}-devel-static
%description devel
This package contains the files that are necessary for software
development using the PCI utilities.
%package help
Summary: Including man files for pciutils
Requires: man
%description help
This contains man files for the using of pciutils.
%prep
%autosetup -Sgit -n %{name}-%{version}
%build
make SHARED="no" ZLIB="no" LIBKMOD=yes STRIP="" OPT="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" PREFIX="/usr" %{?_smp_mflags}
mv lib/libpci.a lib/libpci.a.tobak
make clean
make SHARED="yes" ZLIB="no" LIBKMOD=yes STRIP="" OPT="$RPM_OPT_FLAGS" PREFIX="/usr" LIBDIR="/%{_lib}" %{?_smp_mflags}
sed -i "s|^libdir=.*$|libdir=/%{_lib}|" lib/libpci.pc
%install
make install PREFIX=$RPM_BUILD_ROOT/usr SBINDIR=$RPM_BUILD_ROOT/sbin \
ROOT=$RPM_BUILD_ROOT/ MANDIR=$RPM_BUILD_ROOT/%{_mandir} STRIP="" \
SHARED="yes" LIBDIR=$RPM_BUILD_ROOT/%{_lib}
install -d $RPM_BUILD_ROOT/{%{_libdir}/pkgconfig,%{_includedir}/pci}
mv lib/libpci.a.tobak lib/libpci.a
install -p -m 644 lib/libpci.a $RPM_BUILD_ROOT%{_libdir}
cp -p lib/{pci,header,config,types}.h $RPM_BUILD_ROOT%{_includedir}/pci
install -p lib/config.h $RPM_BUILD_ROOT%{_includedir}/pci/config.%{_lib}.h
/sbin/ldconfig -N $RPM_BUILD_ROOT%{_libdir}
install -p lib/libpci.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
install -D -m 0644 lib/libpci.pc %{buildroot}%{_libdir}/pkgconfig/libpci.pc
install -p lib/libpci.so.* $RPM_BUILD_ROOT/%{_lib}/
ln -s ../../%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/*.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/libpci.so
rm -rf $RPM_BUILD_ROOT/usr/share/hwdata/pci.ids*
%post -n %{name} -p /sbin/ldconfig
%postun -n %{name} -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc README ChangeLog pciutils.lsm COPYING
/sbin/lspci
/sbin/setpci
/sbin/update-pciids
/%{_lib}/libpci.so.*
%files devel
%defattr(0644, root, root, 0755)
%{_libdir}/pkgconfig/libpci.pc
%{_libdir}/libpci.so
%{_includedir}/pci
%{_libdir}/libpci.a
%files help
%{_mandir}/man7/*
%{_mandir}/man8/*
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Thu Aug 29 2019 zoujing <zoujing13@huawei.com> - 3.6.2-3
- Type:enhancemnet
- ID:NA
- SUG:restart
- DESCi:openEuler Debranding
* Mon Apr 15 2019 Buildteam <buildteam@openeuler.org> - 3.6.2-2
- Package Initialization