Update to 3.12.2, add Python 3 subpackage (#1236000)
This commit is contained in:
parent
318fced441
commit
a1139058fa
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
python-dmidecode-3.10.13.tar.gz
|
python-dmidecode-3.10.13.tar.gz
|
||||||
python-dmidecode-3.10.13.tar.xz
|
python-dmidecode-3.10.13.tar.xz
|
||||||
|
/python-dmidecode-3.12.2.tar.gz
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
diff --git a/src/util.c b/src/util.c
|
|
||||||
index 2eebf30..4d1be64 100644
|
|
||||||
--- a/src/util.c
|
|
||||||
+++ b/src/util.c
|
|
||||||
@@ -44,6 +44,7 @@
|
|
||||||
#include <string.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
+#include <signal.h>
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "util.h"
|
|
||||||
@@ -87,6 +88,23 @@ int checksum(const u8 * buf, size_t len)
|
|
||||||
return (sum == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* Static global variables which should only
|
|
||||||
+ * be used by the sigill_handler()
|
|
||||||
+ */
|
|
||||||
+static int sigill_error = 0;
|
|
||||||
+static Log_t *sigill_logobj = NULL;
|
|
||||||
+
|
|
||||||
+void sigill_handler(int ignore_this) {
|
|
||||||
+ sigill_error = 1;
|
|
||||||
+ if( sigill_logobj ) {
|
|
||||||
+ log_append(sigill_logobj, LOGFL_NODUPS, LOG_WARNING,
|
|
||||||
+ "SIGILL signal caught in mem_chunk()");
|
|
||||||
+ } else {
|
|
||||||
+ fprintf(stderr,
|
|
||||||
+ "** WARNING ** SIGILL signal caught in mem_chunk()\n");
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Copy a physical memory chunk into a memory buffer.
|
|
||||||
* This function allocates memory.
|
|
||||||
@@ -100,15 +118,20 @@ void *mem_chunk(Log_t *logp, size_t base, size_t len, const char *devmem)
|
|
||||||
size_t mmoffset;
|
|
||||||
void *mmp;
|
|
||||||
#endif
|
|
||||||
-
|
|
||||||
- if((fd = open(devmem, O_RDONLY)) == -1) {
|
|
||||||
- log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s: %s", devmem, strerror(errno));
|
|
||||||
- return NULL;
|
|
||||||
+ sigill_logobj = logp;
|
|
||||||
+ signal(SIGILL, sigill_handler);
|
|
||||||
+ if(sigill_error || (fd = open(devmem, O_RDONLY)) == -1) {
|
|
||||||
+ log_append(logp, LOGFL_NORMAL, LOG_WARNING,
|
|
||||||
+ "Failed to open memory buffer (%s): %s",
|
|
||||||
+ devmem, strerror(errno));
|
|
||||||
+ p = NULL;
|
|
||||||
+ goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if((p = malloc(len)) == NULL) {
|
|
||||||
- log_append(logp, LOGFL_NORMAL, LOG_WARNING, "malloc: %s", strerror(errno));
|
|
||||||
- return NULL;
|
|
||||||
+ if(sigill_error || (p = malloc(len)) == NULL) {
|
|
||||||
+ log_append(logp, LOGFL_NORMAL, LOG_WARNING,"malloc: %s", strerror(errno));
|
|
||||||
+ p = NULL;
|
|
||||||
+ goto exit;
|
|
||||||
}
|
|
||||||
#ifdef USE_MMAP
|
|
||||||
#ifdef _SC_PAGESIZE
|
|
||||||
@@ -122,33 +145,49 @@ void *mem_chunk(Log_t *logp, size_t base, size_t len, const char *devmem)
|
|
||||||
* to read from /dev/mem using regular read() calls.
|
|
||||||
*/
|
|
||||||
mmp = mmap(0, mmoffset + len, PROT_READ, MAP_SHARED, fd, base - mmoffset);
|
|
||||||
- if(mmp == MAP_FAILED) {
|
|
||||||
+ if(sigill_error || (mmp == MAP_FAILED)) {
|
|
||||||
log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s (mmap): %s", devmem, strerror(errno));
|
|
||||||
free(p);
|
|
||||||
- return NULL;
|
|
||||||
+ p = NULL;
|
|
||||||
+ goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(p, (u8 *) mmp + mmoffset, len);
|
|
||||||
-
|
|
||||||
- if(munmap(mmp, mmoffset + len) == -1) {
|
|
||||||
+ if (sigill_error) {
|
|
||||||
+ log_append(logp, LOGFL_NODUPS, LOG_WARNING,
|
|
||||||
+ "Failed to do memcpy() due to SIGILL signal");
|
|
||||||
+ free(p);
|
|
||||||
+ p = NULL;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if(sigill_error || (munmap(mmp, mmoffset + len) == -1)) {
|
|
||||||
log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s (munmap): %s", devmem, strerror(errno));
|
|
||||||
+ free(p);
|
|
||||||
+ p = NULL;
|
|
||||||
+ goto exit;
|
|
||||||
}
|
|
||||||
#else /* USE_MMAP */
|
|
||||||
- if(lseek(fd, base, SEEK_SET) == -1) {
|
|
||||||
+ if(sigill_error || (lseek(fd, base, SEEK_SET) == -1)) {
|
|
||||||
log_append(logp, LOGFL_NORMAL, LOG_WARNING, "%s (lseek): %s", devmem, strerror(errno));
|
|
||||||
free(p);
|
|
||||||
- return NULL;
|
|
||||||
+ p = NULL;
|
|
||||||
+ goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if(myread(logp, fd, p, len, devmem) == -1) {
|
|
||||||
+ if(sigill_error || (myread(logp, fd, p, len, devmem) == -1)) {
|
|
||||||
free(p);
|
|
||||||
- return NULL;
|
|
||||||
+ p = NULL;
|
|
||||||
+ goto exit;
|
|
||||||
}
|
|
||||||
#endif /* USE_MMAP */
|
|
||||||
|
|
||||||
if(close(fd) == -1)
|
|
||||||
perror(devmem);
|
|
||||||
|
|
||||||
+ exit:
|
|
||||||
+ signal(SIGILL, SIG_DFL);
|
|
||||||
+ sigill_logobj = NULL;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
From 39869fb9346cd46097bd6d70a90f351938d30296 Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Sommerseth <davids@redhat.com>
|
|
||||||
Date: Fri, 5 Apr 2013 18:25:23 +0200
|
|
||||||
Subject: [PATCH 1/2] Do not add explictly 'dmispec' attributes inside
|
|
||||||
switch() in dmi_decode()
|
|
||||||
|
|
||||||
The dmispec attribute is added outside the switch() call, and must not be
|
|
||||||
duplicated. If this happens, an invalid XML file will be generated.
|
|
||||||
(Un)fortunately, libxml2 is quite forgiving to this error. But xmllint
|
|
||||||
will complain about it and other XML libraries (such as python-lxml)
|
|
||||||
may reject such XML data.
|
|
||||||
|
|
||||||
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
||||||
---
|
|
||||||
src/dmidecode.c | 2 --
|
|
||||||
1 file changed, 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/dmidecode.c b/src/dmidecode.c
|
|
||||||
index 17f2130..215c3f4 100644
|
|
||||||
--- a/src/dmidecode.c
|
|
||||||
+++ b/src/dmidecode.c
|
|
||||||
@@ -4784,7 +4784,6 @@ xmlNode *dmi_decode(xmlNode *prnt_n, dmi_codes_major *dmiMajor, struct dmi_heade
|
|
||||||
|
|
||||||
case 40: /* 3.3.41 Additional Information */
|
|
||||||
dmixml_AddAttribute(sect_n, "subtype", "AdditionalInformation");
|
|
||||||
- dmixml_AddAttribute(sect_n, "dmispec", "3.3.41");
|
|
||||||
|
|
||||||
if(h->length < 0x0B) {
|
|
||||||
break;
|
|
||||||
@@ -4795,7 +4794,6 @@ xmlNode *dmi_decode(xmlNode *prnt_n, dmi_codes_major *dmiMajor, struct dmi_heade
|
|
||||||
|
|
||||||
case 41: /* 3.3.42 Onboard Device Extended Information */
|
|
||||||
dmixml_AddAttribute(sect_n, "subtype", "OnboardDeviceExtendedInformation");
|
|
||||||
- dmixml_AddAttribute(sect_n, "dmispec", "3.3.42");
|
|
||||||
|
|
||||||
if(h->length < 0x0B) {
|
|
||||||
break;
|
|
||||||
--
|
|
||||||
1.7.10.2
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
VERSION=$1
|
|
||||||
|
|
||||||
# git clone ssh://git.fedorahosted.org/git/python-dmidecode.git
|
|
||||||
# cd python-dmidecode
|
|
||||||
git archive --format=tar --prefix=python-dmidecode-$VERSION/ -o python-dmidecode-$VERSION.tar v$VERSION
|
|
||||||
tar -xvf python-dmidecode-$VERSION.tar
|
|
||||||
rm -r python-dmidecode-$VERSION/debian
|
|
||||||
tar -cJvf python-dmidecode-$VERSION.tar.xz python-dmidecode-$VERSION
|
|
@ -1,31 +0,0 @@
|
|||||||
From 69a1c9ca658c9708698cde6aee32af7bb2e16f9a Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Sommerseth <davids@redhat.com>
|
|
||||||
Date: Thu, 20 Jun 2013 12:58:12 +0200
|
|
||||||
Subject: [PATCH] Fixed a missing break statement in a switch for DMI section
|
|
||||||
3.3.7.2
|
|
||||||
|
|
||||||
This missing break could cause duplicated 'installed' attributes in
|
|
||||||
<InstalledSize/> or <EnabledSize/> XML tags. This is only happening
|
|
||||||
when dmi_memory_module_size() is called and only on some hardware.
|
|
||||||
|
|
||||||
Signed-off-by: David Sommerseth <davids@redhat.com>
|
|
||||||
---
|
|
||||||
src/dmidecode.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/src/dmidecode.c b/src/dmidecode.c
|
|
||||||
index 215c3f4..dae2fef 100644
|
|
||||||
--- a/src/dmidecode.c
|
|
||||||
+++ b/src/dmidecode.c
|
|
||||||
@@ -1516,6 +1516,7 @@ void dmi_memory_module_size(xmlNode *node, const char *tagname, u8 code)
|
|
||||||
case 0x7F:
|
|
||||||
dmixml_AddAttribute(data_n, "installed", "0");
|
|
||||||
check_conn = 0;
|
|
||||||
+ break;
|
|
||||||
default:
|
|
||||||
dmixml_AddAttribute(data_n, "installed", "1");
|
|
||||||
dmixml_AddAttribute(data_n, "unit", "MB");
|
|
||||||
--
|
|
||||||
1.7.10.2
|
|
||||||
|
|
||||||
|
|
@ -1,65 +1,107 @@
|
|||||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
|
||||||
%{!?python_ver: %global python_ver %(%{__python} -c "import sys ; print sys.version[:3]")}
|
|
||||||
|
|
||||||
Summary: Python module to access DMI data
|
|
||||||
Name: python-dmidecode
|
Name: python-dmidecode
|
||||||
Version: 3.10.13
|
Summary: Python module to access DMI data
|
||||||
Release: 13%{?dist}
|
Version: 3.12.2
|
||||||
|
Release: 1%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: http://projects.autonomy.net.au/python-dmidecode/
|
URL: http://projects.autonomy.net.au/python-dmidecode/
|
||||||
Source0: %{name}-%{version}.tar.xz
|
Source0: https://fedorahosted.org/releases/p/y/%{name}/%{name}-%{version}.tar.gz
|
||||||
Source1: generate-tarball.sh
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|
||||||
Requires: libxml2-python
|
|
||||||
BuildRequires: libxml2-python
|
|
||||||
BuildRequires: libxml2-devel
|
|
||||||
BuildRequires: python-devel
|
|
||||||
|
|
||||||
# already in restored upstream git
|
BuildRequires: libxml2-devel
|
||||||
Patch1: SIGILL-catcher.patch
|
|
||||||
# email: upstream why not in git, planed for release
|
BuildRequires: python2-devel
|
||||||
Patch2: dmispec-remove.patch
|
BuildRequires: libxml2-python
|
||||||
# email: git postponed but planned for release
|
|
||||||
Patch3: installed-invalid.patch
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: libxml2-python3
|
||||||
|
|
||||||
|
Requires: libxml2-python
|
||||||
|
|
||||||
%description
|
%description
|
||||||
python-dmidecode is a python extension module that uses the
|
python-dmidecode is a python extension module that uses the
|
||||||
code-base of the 'dmidecode' utility, and presents the data
|
code-base of the 'dmidecode' utility, and presents the data
|
||||||
as python data structures or as XML data using libxml2.
|
as python data structures or as XML data using libxml2.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%package -n python3-dmidecode
|
||||||
|
Summary: Python 3 module to access DMI data
|
||||||
|
Requires: libxml2-python3
|
||||||
|
|
||||||
|
%description -n python3-dmidecode
|
||||||
|
python3-dmidecode is a Python 3 extension module that uses the
|
||||||
|
code-base of the 'dmidecode' utility, and presents the data
|
||||||
|
as Python 3 data structures or as XML data using libxml2.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -qc
|
||||||
%patch1 -p1 -b .SIGILL-catcher
|
mv %{name}-%{version} python2
|
||||||
%patch2 -p1 -b .dmispec-remove
|
cp -a python{2,3}
|
||||||
%patch3 -p1 -b .install-invalid
|
|
||||||
|
pushd python3
|
||||||
|
sed -i 's/python2/python3/g' Makefile unit-tests/Makefile
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
# Not to get undefined symbol: dmixml_GetContent
|
||||||
|
export CFLAGS="${CFLAGS-} -std=gnu89"
|
||||||
|
|
||||||
|
|
||||||
|
for PY in python2 python3; do
|
||||||
|
pushd $PY
|
||||||
make build
|
make build
|
||||||
cd unit-tests
|
popd
|
||||||
make
|
done
|
||||||
cd ..
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
pushd python2
|
||||||
python src/setup.py install --root $RPM_BUILD_ROOT --prefix=%{_prefix}
|
%{__python2} src/setup.py install --root %{buildroot} --prefix=%{_prefix}
|
||||||
|
popd
|
||||||
|
|
||||||
%clean
|
pushd python3
|
||||||
rm -rf $RPM_BUILD_ROOT
|
%{__python3} src/setup.py install --root %{buildroot} --prefix=%{_prefix}
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
|
%check
|
||||||
|
for PY in python2 python3; do
|
||||||
|
pushd $PY/unit-tests
|
||||||
|
make
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
%license python2/doc/LICENSE python2/doc/AUTHORS python2/doc/AUTHORS.upstream
|
||||||
%doc README doc/README.upstream doc/LICENSE doc/AUTHORS doc/AUTHORS.upstream
|
%doc python2/README python2/doc/README.upstream
|
||||||
%{python_sitearch}/dmidecodemod.so
|
%{python2_sitearch}/dmidecodemod.so
|
||||||
%{python_sitearch}/dmidecode.py
|
%{python2_sitearch}/dmidecode.py
|
||||||
%{python_sitearch}/dmidecode.py[co]
|
%{python2_sitearch}/dmidecode.py[co]
|
||||||
%if "%{python_ver}" >= "2.5"
|
%{python2_sitearch}/*.egg-info
|
||||||
%{python_sitearch}/*.egg-info
|
%{_datadir}/python-dmidecode/
|
||||||
%endif
|
|
||||||
|
%files -n python3-dmidecode
|
||||||
|
%license python3/doc/LICENSE python3/doc/AUTHORS python3/doc/AUTHORS.upstream
|
||||||
|
%doc python3/README python3/doc/README.upstream
|
||||||
|
%{python3_sitearch}/dmidecodemod.cpython-%{python3_version_nodots}m.so
|
||||||
|
%{python3_sitearch}/__pycache__/dmidecode.cpython-%{python3_version_nodots}.py[co]
|
||||||
|
%{python3_sitearch}/dmidecode.py
|
||||||
|
%{python3_sitearch}/*.egg-info
|
||||||
%{_datadir}/python-dmidecode/
|
%{_datadir}/python-dmidecode/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jul 10 2015 Miro Hrončok <mhroncok@redhat.com> - 3.12.2-1
|
||||||
|
- Update to 3.12.2
|
||||||
|
- Add Python 3 subpackage (#1236000)
|
||||||
|
- Removed deprecated statements
|
||||||
|
- Moved some docs to license
|
||||||
|
- Removed pacthes
|
||||||
|
- Corrected bogus dates in %%changelog
|
||||||
|
- Build with -std=gnu89
|
||||||
|
|
||||||
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.10.13-13
|
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.10.13-13
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||||
|
|
||||||
@ -72,7 +114,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.10.13-10
|
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.10.13-10
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||||
|
|
||||||
* Mon Jun 20 2013 Ales Ledvinka <aledvink@redhat.com> - 3.10.13-9
|
* Thu Jun 20 2013 Ales Ledvinka <aledvink@redhat.com> - 3.10.13-9
|
||||||
- Attribute installed may appear as duplicate and cause invalid XML.
|
- Attribute installed may appear as duplicate and cause invalid XML.
|
||||||
|
|
||||||
* Mon Jun 17 2013 Ales Ledvinka <aledvink@redhat.com> - 3.10.13-8
|
* Mon Jun 17 2013 Ales Ledvinka <aledvink@redhat.com> - 3.10.13-8
|
||||||
@ -113,7 +155,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
- Update to new release
|
- Update to new release
|
||||||
|
|
||||||
|
|
||||||
* Thu Dec 15 2009 Nima Talebi <nima@it.net.au> - 3.10.8-1
|
* Tue Dec 15 2009 Nima Talebi <nima@it.net.au> - 3.10.8-1
|
||||||
- New Upstream release.
|
- New Upstream release.
|
||||||
- Big-endian and little-endian approved.
|
- Big-endian and little-endian approved.
|
||||||
- Packaged unit-test to tarball.
|
- Packaged unit-test to tarball.
|
||||||
@ -131,19 +173,19 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
* Wed Sep 23 2009 Nima Talebi <nima@it.net.au> - 3.10.7-1
|
* Wed Sep 23 2009 Nima Talebi <nima@it.net.au> - 3.10.7-1
|
||||||
- Updated source0 to new 3.10.7 tar ball
|
- Updated source0 to new 3.10.7 tar ball
|
||||||
|
|
||||||
* Wed Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-6
|
* Mon Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-6
|
||||||
- Only build the python-dmidecode module, not everything
|
- Only build the python-dmidecode module, not everything
|
||||||
|
|
||||||
* Wed Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-5
|
* Mon Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-5
|
||||||
- Added missing BuildRequres for libxml2-python
|
- Added missing BuildRequres for libxml2-python
|
||||||
|
|
||||||
* Wed Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-4
|
* Mon Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-4
|
||||||
- Added missing BuildRequres for python-devel
|
- Added missing BuildRequres for python-devel
|
||||||
|
|
||||||
* Wed Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-3
|
* Mon Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-3
|
||||||
- Added missing BuildRequres for libxml2-devel
|
- Added missing BuildRequres for libxml2-devel
|
||||||
|
|
||||||
* Wed Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-2
|
* Mon Jul 13 2009 David Sommerseth <davids@redhat.com> - 3.10.6-2
|
||||||
- Updated release, to avoid build conflict
|
- Updated release, to avoid build conflict
|
||||||
|
|
||||||
* Wed Jun 10 2009 David Sommerseth <davids@redhat.com> - 3.10.6-1
|
* Wed Jun 10 2009 David Sommerseth <davids@redhat.com> - 3.10.6-1
|
||||||
|
Loading…
Reference in New Issue
Block a user