From: Anas Nashif Date: Mon, 5 Nov 2012 22:51:04 +0000 (-0800) Subject: add packaging X-Git-Tag: submit/tizen/20140204.131517~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71236457b68dce6cbeaa38b241fe19c8cd03b3b0;p=platform%2Fupstream%2Fpciutils.git add packaging --- diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..0eb5484 --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,5 @@ +libpci3 +pciutils-devel + requires -pciutils- + requires "libpci3- = " + diff --git a/packaging/pciutils-3.1.9_pkgconfig.patch b/packaging/pciutils-3.1.9_pkgconfig.patch new file mode 100644 index 0000000..f240f4e --- /dev/null +++ b/packaging/pciutils-3.1.9_pkgconfig.patch @@ -0,0 +1,10 @@ +--- pciutils-3.1.9.orig/lib/libpci.pc.in 2011-10-02 05:52:11.000000000 -0400 ++++ pciutils-3.1.9/lib/libpci.pc.in 2012-01-28 20:50:44.702715889 -0500 +@@ -6,6 +6,5 @@ + Name: libpci + Description: libpci + Version: @VERSION@ +-Libs: -L${libdir} -lpci ++Libs: -lpci @LDLIBS@ + Libs.private: @LDLIBS@ +-Cflags: -I${includedir} diff --git a/packaging/pciutils-ocloexec.patch b/packaging/pciutils-ocloexec.patch new file mode 100644 index 0000000..03d8bb4 --- /dev/null +++ b/packaging/pciutils-ocloexec.patch @@ -0,0 +1,123 @@ +diff -aur pciutils-3.1.9.orig/lib/dump.c pciutils-3.1.9/lib/dump.c +--- pciutils-3.1.9.orig/lib/dump.c 2011-11-14 06:08:39.000000000 -0500 ++++ pciutils-3.1.9/lib/dump.c 2012-01-28 20:53:40.446518788 -0500 +@@ -64,7 +64,7 @@ + + if (!name) + a->error("dump: File name not given."); +- if (!(f = fopen(name, "r"))) ++ if (!(f = fopen(name, "re"))) + a->error("dump: Cannot open %s: %s", name, strerror(errno)); + while (fgets(buf, sizeof(buf)-1, f)) + { +diff -aur pciutils-3.1.9.orig/lib/names-cache.c pciutils-3.1.9/lib/names-cache.c +--- pciutils-3.1.9.orig/lib/names-cache.c 2011-01-07 16:04:28.000000000 -0500 ++++ pciutils-3.1.9/lib/names-cache.c 2012-01-28 20:56:42.181246792 -0500 +@@ -62,7 +62,7 @@ + return 0; + } + +- f = fopen(name, "rb"); ++ f = fopen(name, "rbe"); + if (!f) + { + a->debug("Cache file does not exist\n"); +@@ -135,7 +135,7 @@ + tmpname = pci_malloc(a, strlen(name) + strlen(hostname) + 64); + sprintf(tmpname, "%s.tmp-%s-%d", name, hostname, this_pid); + +- f = fopen(tmpname, "wb"); ++ f = fopen(tmpname, "wbe"); + if (!f) + { + a->warning("Cannot write to %s: %s", name, strerror(errno)); +diff -aur pciutils-3.1.9.orig/lib/names-parse.c pciutils-3.1.9/lib/names-parse.c +--- pciutils-3.1.9.orig/lib/names-parse.c 2011-01-07 16:04:28.000000000 -0500 ++++ pciutils-3.1.9/lib/names-parse.c 2012-01-28 20:56:11.462630829 -0500 +@@ -52,7 +52,7 @@ + typedef FILE * pci_file; + #define pci_gets(f, l, s) fgets(l, s, f) + #define pci_eof(f) feof(f) +-#define pci_open(a) fopen(a->id_file_name, "r") ++#define pci_open(a) fopen(a->id_file_name, "re") + #define pci_close(f) fclose(f) + #define PCI_ERROR(f, err) if (!err && ferror(f)) err = "I/O error"; + #endif +diff -aur pciutils-3.1.9.orig/lib/proc.c pciutils-3.1.9/lib/proc.c +--- pciutils-3.1.9.orig/lib/proc.c 2011-01-07 16:04:28.000000000 -0500 ++++ pciutils-3.1.9/lib/proc.c 2012-01-28 20:55:32.827113838 -0500 +@@ -62,7 +62,7 @@ + + if (snprintf(buf, sizeof(buf), "%s/devices", pci_get_param(a, "proc.path")) == sizeof(buf)) + a->error("File name too long"); +- f = fopen(buf, "r"); ++ f = fopen(buf, "re"); + if (!f) + a->error("Cannot open %s", buf); + while (fgets(buf, sizeof(buf)-1, f)) +@@ -129,7 +129,7 @@ + if (e < 0 || e >= (int) sizeof(buf)) + a->error("File name too long"); + a->fd_rw = a->writeable || rw; +- a->fd = open(buf, a->fd_rw ? O_RDWR : O_RDONLY); ++ a->fd = open(buf, (a->fd_rw ? O_RDWR : O_RDONLY) | O_CLOEXEC); + if (a->fd < 0) + { + e = snprintf(buf, sizeof(buf), "%s/%04x:%02x/%02x.%d", +@@ -137,7 +137,7 @@ + d->domain, d->bus, d->dev, d->func); + if (e < 0 || e >= (int) sizeof(buf)) + a->error("File name too long"); +- a->fd = open(buf, a->fd_rw ? O_RDWR : O_RDONLY); ++ a->fd = open(buf, (a->fd_rw ? O_RDWR : O_RDONLY) | O_CLOEXEC); + } + if (a->fd < 0) + a->warning("Cannot open %s", buf); +diff -aur pciutils-3.1.9.orig/lib/sysfs.c pciutils-3.1.9/lib/sysfs.c +--- pciutils-3.1.9.orig/lib/sysfs.c 2011-01-07 16:04:28.000000000 -0500 ++++ pciutils-3.1.9/lib/sysfs.c 2012-01-28 20:58:27.320932364 -0500 +@@ -93,7 +93,7 @@ + char namebuf[OBJNAMELEN], buf[256]; + + sysfs_obj_name(d, object, namebuf); +- fd = open(namebuf, O_RDONLY); ++ fd = open(namebuf, O_RDONLY|O_CLOEXEC); + if (fd < 0) + a->error("Cannot open %s: %s", namebuf, strerror(errno)); + n = read(fd, buf, sizeof(buf)); +@@ -115,7 +115,7 @@ + int i; + + sysfs_obj_name(d, "resource", namebuf); +- file = fopen(namebuf, "r"); ++ file = fopen(namebuf, "re"); + if (!file) + a->error("Cannot open %s: %s", namebuf, strerror(errno)); + for (i = 0; i < 7; i++) +@@ -220,7 +220,7 @@ + n = snprintf(namebuf, OBJNAMELEN, "%s/%s/%s", dirname, entry->d_name, "address"); + if (n < 0 || n >= OBJNAMELEN) + a->error("File name too long"); +- file = fopen(namebuf, "r"); ++ file = fopen(namebuf, "re"); + /* + * Old versions of Linux had a fakephp which didn't have an 'address' + * file. There's no useful information to be gleaned from these +@@ -283,7 +283,7 @@ + if (a->fd_vpd < 0) + { + sysfs_obj_name(d, "vpd", namebuf); +- a->fd_vpd = open(namebuf, O_RDONLY); ++ a->fd_vpd = open(namebuf, O_RDONLY|O_CLOEXEC); + /* No warning on error; vpd may be absent or accessible only to root */ + } + return a->fd_vpd; +@@ -293,7 +293,7 @@ + { + sysfs_obj_name(d, "config", namebuf); + a->fd_rw = a->writeable || intent == SETUP_WRITE_CONFIG; +- a->fd = open(namebuf, a->fd_rw ? O_RDWR : O_RDONLY); ++ a->fd = open(namebuf, (a->fd_rw ? O_RDWR : O_RDONLY) | O_CLOEXEC); + if (a->fd < 0) + a->warning("Cannot open %s", namebuf); + a->fd_pos = 0; diff --git a/packaging/pciutils.spec b/packaging/pciutils.spec new file mode 100644 index 0000000..5af59c7 --- /dev/null +++ b/packaging/pciutils.spec @@ -0,0 +1,104 @@ +# +# spec file for package pciutils +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: pciutils +%define lname libpci +Version: 3.1.9 +Release: 0 +License: GPL-2.0+ +Summary: PCI utilities for Kernel version 2 +Url: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml +Group: Hardware/Other +Source: %{name}-%{version}.tar.bz2 +Source1: COPYING +Source2: baselibs.conf +Patch0: update-pciutils-dist +Patch1: %{name}-%{version}_pkgconfig.patch +Patch2: pciutils-ocloexec.patch +BuildRequires: pkg-config +BuildRequires: zlib-devel +Requires: pciutils-ids +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +lspci: This program displays detailed information about all PCI busses +and devices in the system, replacing the original /proc/pci interface. + +setpci: This program allows reading from and writing to PCI device +configuration registers. For example, you can adjust the latency timers +with it. + +update-pciids: This program downloads the current version of the +pci.ids file. + +%package -n %lname +Summary: PCI utility library +Group: System/Libraries + +%description -n %lname +libpci offers access to the PCI configuration space. + +%package devel +Summary: Library and Include Files of the PCI utilities +Group: Development/Libraries/C and C++ +Requires: %lname = %{version} + +%description devel +This package contains the files that are necessary for software +development using the PCI utilities. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 + +%build +make %{?_smp_mflags} OPT="%{optflags} -Wall" PREFIX=%{_prefix} LIBDIR=/%{_lib} SBINDIR=/sbin STRIP="" SHARED="yes" + +%install +make install PREFIX=%{buildroot}%{_prefix} SBINDIR=%{buildroot}/sbin \ + ROOT=%{buildroot}/ MANDIR=%{buildroot}/%{_mandir} STRIP="" \ + SHARED="yes" LIBDIR=%{buildroot}/%{_lib} +mkdir -p %{buildroot}%{_includedir}/pci +cp -p lib/{pci,header,config,types}.h %{buildroot}%{_includedir}/pci/ +rm -rf %{buildroot}%{_datadir}/pci.ids* +install -D -m 0644 lib/libpci.pc %{buildroot}%{_libdir}/pkgconfig/libpci.pc +ln -sf /%{_lib}/libpci.so.3 %{buildroot}%{_libdir}/libpci.so + +%post -n %lname -p /sbin/ldconfig + +%postun -n %lname -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%doc README COPYING +%doc %{_mandir}/man?/* +/sbin/* + +%files -n %lname +%defattr(-,root,root) +/%{_lib}/libpci.so.* + +%files devel +%defattr(-, root, root) +%{_includedir}/pci/ +%{_libdir}/*.so +%{_libdir}/pkgconfig/libpci.pc + +%changelog