Package init
This commit is contained in:
commit
abd6e01952
19
0000-sysfsutils-2.0.0-redhatify.patch
Normal file
19
0000-sysfsutils-2.0.0-redhatify.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff -Nurp sysfsutils-1.2.0.bak/COPYING sysfsutils-1.2.0/COPYING
|
||||
--- sysfsutils-1.2.0.bak/COPYING 2004-09-13 08:45:15.000000000 -0500
|
||||
+++ sysfsutils-1.2.0/COPYING 2004-10-11 13:05:00.483795976 -0500
|
||||
@@ -1,11 +1,10 @@
|
||||
|
||||
-The commands and utilities under the "test" directory are licensed under the
|
||||
-GNU General Public License (GPL) Version 2, June 1991. The full text of the
|
||||
-GPL is located at:
|
||||
+The commands and utilities are licensed under the GNU General Public License
|
||||
+(GPL) Version 2, June 1991. The full text of the GPL is located at:
|
||||
|
||||
-sysfsutils/cmd/GPL
|
||||
+/usr/share/doc/sysfsutils-{version}/GPL
|
||||
|
||||
The sysfs library is licensed under the GNU Lesser Public License (LGPL)
|
||||
Version 2.1, February 1999. The full text of the LGPL is located at:
|
||||
|
||||
-sysfsutils/lib/LGPL
|
||||
+/usr/share/doc/sysfsutils-{version}/LGPL
|
||||
12
0001-sysfsutils-2.0.0-class-dup.patch
Normal file
12
0001-sysfsutils-2.0.0-class-dup.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -puN lib/sysfs_class.c~sysfsutils_class_dup lib/sysfs_class.c
|
||||
--- sysfsutils-2.1.0/lib/sysfs_class.c~sysfsutils_class_dup 2006-09-07 17:01:26.000000000 -0500
|
||||
+++ sysfsutils-2.1.0-bjking1/lib/sysfs_class.c 2006-09-07 17:01:26.000000000 -0500
|
||||
@@ -66,7 +66,7 @@ static int cdev_name_equal(void *a, void
|
||||
return 0;
|
||||
|
||||
if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name,
|
||||
- strlen((char *)a)) == 0)
|
||||
+ SYSFS_NAME_LEN) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
164
0002-sysfsutils-2.1.0-get_link.patch
Normal file
164
0002-sysfsutils-2.1.0-get_link.patch
Normal file
@ -0,0 +1,164 @@
|
||||
diff -upr sysfsutils-2.1.0-old/lib/sysfs_utils.c sysfsutils-2.1.0/lib/sysfs_utils.c
|
||||
--- sysfsutils-2.1.0-old/lib/sysfs_utils.c 2006-08-07 07:08:01.000000000 +0200
|
||||
+++ sysfsutils-2.1.0/lib/sysfs_utils.c 2008-05-13 07:42:50.000000000 +0200
|
||||
@@ -117,84 +117,104 @@ int sysfs_get_link(const char *path, cha
|
||||
{
|
||||
char devdir[SYSFS_PATH_MAX];
|
||||
char linkpath[SYSFS_PATH_MAX];
|
||||
- char temp_path[SYSFS_PATH_MAX];
|
||||
- char *d = NULL, *s = NULL;
|
||||
- int slashes = 0, count = 0;
|
||||
+ char *d, *s;
|
||||
+ int count;
|
||||
|
||||
if (!path || !target || len == 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
- memset(devdir, 0, SYSFS_PATH_MAX);
|
||||
- memset(linkpath, 0, SYSFS_PATH_MAX);
|
||||
- memset(temp_path, 0, SYSFS_PATH_MAX);
|
||||
- safestrcpy(devdir, path);
|
||||
-
|
||||
- if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) {
|
||||
+ count = readlink(path, linkpath, SYSFS_PATH_MAX);
|
||||
+ if (count < 0)
|
||||
return -1;
|
||||
- }
|
||||
- d = linkpath;
|
||||
+ else
|
||||
+ linkpath[count] = '\0';
|
||||
/*
|
||||
* Three cases here:
|
||||
* 1. relative path => format ../..
|
||||
* 2. absolute path => format /abcd/efgh
|
||||
* 3. relative path _from_ this dir => format abcd/efgh
|
||||
*/
|
||||
- switch (*d) {
|
||||
- case '.':
|
||||
+ if (*linkpath == '/') {
|
||||
+ /* absolute path - copy as is */
|
||||
+ safestrcpymax(target, linkpath, len);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ safestrcpy(devdir, path);
|
||||
+ s = strrchr(devdir, '/');
|
||||
+ if (s == NULL)
|
||||
+ s = devdir - 1;
|
||||
+ d = linkpath;
|
||||
+ while (*d == '.') {
|
||||
+ if (*(d+1) == '/') {
|
||||
/*
|
||||
* handle the case where link is of type ./abcd/xxx
|
||||
*/
|
||||
- safestrcpy(temp_path, devdir);
|
||||
- if (*(d+1) == '/')
|
||||
- d += 2;
|
||||
- else if (*(d+1) == '.')
|
||||
- goto parse_path;
|
||||
- s = strrchr(temp_path, '/');
|
||||
- if (s != NULL) {
|
||||
- *(s+1) = '\0';
|
||||
- safestrcat(temp_path, d);
|
||||
- } else {
|
||||
- safestrcpy(temp_path, d);
|
||||
- }
|
||||
- safestrcpymax(target, temp_path, len);
|
||||
- break;
|
||||
+ d += 2;
|
||||
+ while (*d == '/')
|
||||
+ d++;
|
||||
+ continue;
|
||||
+ } else if (*(d+1) != '.' || *(d+2) != '/')
|
||||
/*
|
||||
- * relative path, getting rid of leading "../.."
|
||||
+ * relative path from this directory, starting
|
||||
+ * with a hidden directory
|
||||
*/
|
||||
-parse_path:
|
||||
- while (*d == '/' || *d == '.') {
|
||||
- if (*d == '/')
|
||||
- slashes++;
|
||||
- d++;
|
||||
- }
|
||||
- d--;
|
||||
- s = &devdir[strlen(devdir)-1];
|
||||
- while (s != NULL && count != (slashes+1)) {
|
||||
+ break;
|
||||
+
|
||||
+ /*
|
||||
+ * relative path, getting rid of leading "../.."; must
|
||||
+ * be careful here since any path component of devdir
|
||||
+ * could be a symlink again
|
||||
+ */
|
||||
+ for (;;) {
|
||||
+ while (s > devdir && *s == '/') {
|
||||
s--;
|
||||
- if (*s == '/')
|
||||
- count++;
|
||||
+ if (*s == '.'
|
||||
+ && (s == devdir || *(s-1) == '/'))
|
||||
+ s--;
|
||||
}
|
||||
- safestrcpymax(s, d, (SYSFS_PATH_MAX-strlen(devdir)));
|
||||
- safestrcpymax(target, devdir, len);
|
||||
- break;
|
||||
- case '/':
|
||||
- /* absolute path - copy as is */
|
||||
- safestrcpymax(target, linkpath, len);
|
||||
- break;
|
||||
- default:
|
||||
- /* relative path from this directory */
|
||||
- safestrcpy(temp_path, devdir);
|
||||
- s = strrchr(temp_path, '/');
|
||||
- if (s != NULL) {
|
||||
- *(s+1) = '\0';
|
||||
- safestrcat(temp_path, linkpath);
|
||||
- } else {
|
||||
- safestrcpy(temp_path, linkpath);
|
||||
+ *(s+1) = '\0';
|
||||
+ if (*devdir == '\0' || sysfs_path_is_link(devdir))
|
||||
+ /*
|
||||
+ * condition will be true eventually
|
||||
+ * because we already know that all
|
||||
+ * but the last component of path
|
||||
+ * resolve to a directory
|
||||
+ */
|
||||
+ break;
|
||||
+ if (sysfs_get_link(devdir, devdir, SYSFS_PATH_MAX))
|
||||
+ return -1;
|
||||
+ s = devdir + strlen(devdir) - 1;
|
||||
+ }
|
||||
+ while (s >= devdir) {
|
||||
+ if (*s == '/') {
|
||||
+ if (*(s+1) != '.' || *(s+2) != '.'
|
||||
+ || *(s+3) != '\0') {
|
||||
+ d += 3;
|
||||
+ while (*d == '/')
|
||||
+ d++;
|
||||
+ } else
|
||||
+ s += 2;
|
||||
+ break;
|
||||
}
|
||||
- safestrcpymax(target, temp_path, len);
|
||||
+ s--;
|
||||
+ }
|
||||
+ if (s < devdir || *(s+1) == '\0')
|
||||
+ break;
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * appending to devdir a slash and the (possibly shortened)
|
||||
+ * relative path to the link source
|
||||
+ */
|
||||
+ s++;
|
||||
+ if (s > devdir && *s == '\0')
|
||||
+ *s++ = '/';
|
||||
+ *s = '\0';
|
||||
+ safestrcpymax(s, d, SYSFS_PATH_MAX-(s-devdir));
|
||||
+ safestrcpymax(target, devdir, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
12
0003-sysfsutils-2.1.0-manpages.patch
Normal file
12
0003-sysfsutils-2.1.0-manpages.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urpN sysfsutils-2.1.0.orig/systool.1 sysfsutils-2.1.0/systool.1
|
||||
--- sysfsutils-2.1.0.orig/systool.1 2011-03-22 18:15:40.775891943 +0100
|
||||
+++ sysfsutils-2.1.0/systool.1 2011-03-22 18:16:05.158970786 +0100
|
||||
@@ -14,7 +14,7 @@ classes, and root devices.
|
||||
.P
|
||||
When
|
||||
.I device
|
||||
-is supplied, the information reqested by
|
||||
+is supplied, the information requested by
|
||||
.I options
|
||||
is shown only for the specified device, otherwise all present devices
|
||||
are displayed.
|
||||
2682
0004-sysfsutils-aarch64.patch
Normal file
2682
0004-sysfsutils-aarch64.patch
Normal file
File diff suppressed because it is too large
Load Diff
BIN
sysfsutils-2.1.0.tar.gz
Normal file
BIN
sysfsutils-2.1.0.tar.gz
Normal file
Binary file not shown.
101
sysfsutils.spec
Normal file
101
sysfsutils.spec
Normal file
@ -0,0 +1,101 @@
|
||||
Name: sysfsutils
|
||||
Version: 2.1.0
|
||||
Release: 27
|
||||
Summary: A set of utilities for interfacing with sysfs
|
||||
License: GPLv2 and LGPLv2+
|
||||
URL: http://sourceforge.net/projects/linux-diag/
|
||||
|
||||
Source0: http://prdownloads.sourceforge.net/linux-diag/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0: 0000-sysfsutils-2.0.0-redhatify.patch
|
||||
Patch1: 0001-sysfsutils-2.0.0-class-dup.patch
|
||||
Patch2: 0002-sysfsutils-2.1.0-get_link.patch
|
||||
Patch3: 0003-sysfsutils-2.1.0-manpages.patch
|
||||
Patch4: 0004-sysfsutils-aarch64.patch
|
||||
|
||||
BuildRequires: git gcc chrpath
|
||||
Provides: libsysfs libsysfs%{?_isa}
|
||||
Obsoletes: libsysfs
|
||||
|
||||
|
||||
%description
|
||||
This package's purpose is to provide a set of utilities for interfacing
|
||||
with sysfs, a virtual filesystem in Linux kernel versions 2.5+ that
|
||||
provides a tree of system devices.
|
||||
|
||||
|
||||
%package devel
|
||||
Summary: Including header files and library for the developing of sysfsutils
|
||||
License: LGPLv2+
|
||||
Requires: sysfsutils = %{version}-%{release}
|
||||
Provides: libsysfs-devel
|
||||
Obsoletes: libsysfs-devel
|
||||
|
||||
%description devel
|
||||
This contains dynamic libraries and header files for the developing of sysfsutils.
|
||||
|
||||
%package help
|
||||
Summary: Including man files for sysfsutils
|
||||
Requires: man
|
||||
BuildArch: noarch
|
||||
|
||||
%description help
|
||||
This contains man files for the using of sysfsutils.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -p1 -S git
|
||||
|
||||
%build
|
||||
%configure --disable-static --libdir=/%{_lib}
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
rm -f %{buildroot}/%{_bindir}/dlist_test
|
||||
rm -f %{buildroot}/%{_bindir}/get_device
|
||||
rm -f %{buildroot}/%{_bindir}/get_driver
|
||||
rm -f %{buildroot}/%{_lib}/libsysfs.la
|
||||
|
||||
chrpath -d $(find $RPM_BUILD_ROOT -name get_module)
|
||||
chrpath -d $(find $RPM_BUILD_ROOT -name systool)
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
%files
|
||||
%license COPYING cmd/GPL lib/LGPL
|
||||
%doc README NEWS ChangeLog
|
||||
%{_bindir}/systool
|
||||
%{_bindir}/get_module
|
||||
/%{_lib}/libsysfs.so.*
|
||||
|
||||
%files devel
|
||||
%dir %{_includedir}/sysfs
|
||||
%{_includedir}/sysfs/libsysfs.h
|
||||
%{_includedir}/sysfs/dlist.h
|
||||
/%{_lib}/libsysfs.so
|
||||
|
||||
%files help
|
||||
%{_mandir}/man1/systool.1.gz
|
||||
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Aug 20 2019 zhanghaibo <ted.zhang@huawei.com> - 2.1.0-27
|
||||
- Type:enhancemnet
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESCi:openEuler Debranding
|
||||
|
||||
* Tue Aug 20 2019 huangzheng <huangzheng22@huawei.com> - 2.1.0-26
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:rename patches
|
||||
|
||||
* Wed Jun 12 2019 zhangyujing<zhangyujing1@huawei.com> - 2.1.0-25.h1
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:restart
|
||||
- DESCi:remove rpath
|
||||
- Package init
|
||||
Loading…
x
Reference in New Issue
Block a user