rpms/pciutils/devel pciutils-dir-d.patch, NONE, 1.1 pciutils.spec, 1.51, 1.52

Harald Hoyer (harald) fedora-extras-commits at redhat.com
Fri Jan 18 08:57:14 UTC 2008


Author: harald

Update of /cvs/pkgs/rpms/pciutils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10126

Modified Files:
	pciutils.spec 
Added Files:
	pciutils-dir-d.patch 
Log Message:
* Fri Jan 18 2008 Harald Hoyer <harald at redhat.com> 2.2.9-2
- removed static library, preserve timestamps on install (rhbz#226236)
- added modified patch from Michael E. Brown @ Dell, to also
  read all /usr/share/hwdata/pci.ids.d/*.ids files (rhbz#195327)


pciutils-dir-d.patch:

--- NEW FILE pciutils-dir-d.patch ---
diff -up pciutils-2.2.9/lib/pci.h.dird pciutils-2.2.9/lib/pci.h
--- pciutils-2.2.9/lib/pci.h.dird	2006-09-09 14:46:06.000000000 +0200
+++ pciutils-2.2.9/lib/pci.h	2008-01-18 09:51:03.000000000 +0100
@@ -162,6 +162,7 @@ char *pci_lookup_name(struct pci_access 
 int pci_load_name_list(struct pci_access *a);	/* Called automatically by pci_lookup_*() when needed; returns success */
 void pci_free_name_list(struct pci_access *a);	/* Called automatically by pci_cleanup() */
 void pci_set_name_list_path(struct pci_access *a, char *name, int to_be_freed);
+int pci_new_load_name_list(struct pci_access *a);
 
 enum pci_lookup_mode {
   PCI_LOOKUP_VENDOR = 1,		/* Vendor name (args: vendorID) */
diff -up pciutils-2.2.9/lib/names.c.dird pciutils-2.2.9/lib/names.c
--- pciutils-2.2.9/lib/names.c.dird	2008-01-18 09:51:03.000000000 +0100
+++ pciutils-2.2.9/lib/names.c	2008-01-18 09:54:28.000000000 +0100
@@ -11,6 +11,8 @@
 #include <stdarg.h>
 #include <string.h>
 #include <errno.h>
+#include <dirent.h>
+#include <libgen.h>
 
 #include "internal.h"
 
@@ -183,7 +185,7 @@ static inline int id_white_p(int c)
   return (c == ' ') || (c == '\t');
 }
 
-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;
@@ -308,7 +310,7 @@ static const char *id_parse_list(struct 
 	p++;
       if (!*p)
 	return parse_error;
-      if (id_insert(a, cat, id1, id2, id3, id4, p))
+      if (id_insert(a, cat, id1, id2, id3, id4, p) && flags)
 	return "Duplicate entry";
     }
   return NULL;
@@ -324,15 +326,15 @@ pci_load_name_list(struct pci_access *a)
   pci_free_name_list(a);
   a->hash_load_failed = 1;
   if (!(f = pci_open(a)))
-    return 0;
+    pci_new_load_name_list(a);
   a->id_hash = pci_malloc(a, sizeof(struct id_entry *) * HASH_SIZE);
   memset(a->id_hash, 0, sizeof(struct id_entry *) * HASH_SIZE);
-  err = id_parse_list(a, f, &lino);
+  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->hash_load_failed = 0;
+  pci_new_load_name_list(a);
   return 1;
 }
 
@@ -548,3 +550,46 @@ void pci_set_name_list_path(struct pci_a
   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] = {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); 
+  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, temp))+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);
+             a->hash_load_failed = 0;
+            }
+       }
+    }while (dp != NULL);
+  return 1;
+}   


Index: pciutils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/pciutils/devel/pciutils.spec,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- pciutils.spec	10 Jan 2008 11:50:42 -0000	1.51
+++ pciutils.spec	18 Jan 2008 08:56:39 -0000	1.52
@@ -9,6 +9,7 @@
 Patch6: 	pciutils-2.2.1-idpath.patch
 Patch7:		pciutils-2.1.99-gcc4.patch
 Patch8: 	pciutils-2.2.9-multilib.patch
+Patch9: 	pciutils-dir-d.patch
 License:	GPLv2+
 URL:		http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml
 BuildRoot: 	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -42,6 +43,7 @@
 %patch6 -p1 -b .idpath
 %patch7 -p1 -b .glibcmacros
 %patch8 -p1 -b .multilib
+%patch9 -p1 -b .dird
 sed -i -e 's/^SRC=.*/SRC="http:\/\/pciids.sourceforge.net\/pci.ids"/' update-pciids.sh
 
 %build
@@ -52,14 +54,14 @@
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT/{sbin,%{_mandir}/man8,%{_libdir},%{_libdir}/pkgconfig,%{_includedir}/pci}
 
-install lspci setpci update-pciids $RPM_BUILD_ROOT/sbin
-install lspci.8 setpci.8 update-pciids.8 $RPM_BUILD_ROOT%{_mandir}/man8
-install lib/libpci.a $RPM_BUILD_ROOT%{_libdir}
-install lib/pci.h $RPM_BUILD_ROOT%{_includedir}/pci
-install lib/header.h $RPM_BUILD_ROOT%{_includedir}/pci
-install lib/config.h $RPM_BUILD_ROOT%{_includedir}/pci
-install lib/types.h $RPM_BUILD_ROOT%{_includedir}/pci
-install lib/libpci.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
+install -p lspci setpci update-pciids $RPM_BUILD_ROOT/sbin
+install -p lspci.8 setpci.8 update-pciids.8 $RPM_BUILD_ROOT%{_mandir}/man8
+#install -p lib/libpci.a $RPM_BUILD_ROOT%{_libdir}
+install -p lib/pci.h $RPM_BUILD_ROOT%{_includedir}/pci
+install -p lib/header.h $RPM_BUILD_ROOT%{_includedir}/pci
+install -p lib/config.h $RPM_BUILD_ROOT%{_includedir}/pci
+install -p lib/types.h $RPM_BUILD_ROOT%{_includedir}/pci
+install -p lib/libpci.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig
 
 %files
 %defattr(0644, root, root, 0755)
@@ -69,7 +71,6 @@
 
 %files devel
 %defattr(0644, root, root, 0755)
-%{_libdir}/libpci.a
 %{_libdir}/pkgconfig/libpci.pc
 %{_includedir}/pci
 
@@ -77,6 +78,11 @@
 rm -rf $RPM_BUILD_ROOT
 
 %changelog
+* Fri Jan 18 2008 Harald Hoyer <harald at redhat.com> 2.2.9-2
+- removed static library, preserve timestamps on install (rhbz#226236)
+- added modified patch from Michael E. Brown @ Dell, to also
+  read all /usr/share/hwdata/pci.ids.d/*.ids files (rhbz#195327)
+
 * Thu Jan 10 2008 Harald Hoyer <harald at redhat.com> 2.2.9-2
 - added more requirements for pciutils-devel
 




More information about the fedora-extras-commits mailing list