15
0

Accepting request 957140 from systemsmanagement:spacewalk

New package which we have in SLE already.

OBS-URL: https://build.opensuse.org/request/show/957140
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dmidecode?expand=0&rev=1
This commit is contained in:
2022-02-23 18:12:57 +00:00
committed by Git OBS Bridge
commit d34dbc796d
11 changed files with 310 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,20 @@
From 3d656cd92a7b19758a17dfa47b4ce13da5b2bb61 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stefano@rivera.za.net>
Date: Fri, 19 Nov 2021 12:01:32 -0400
Subject: [PATCH] Support Python 3.10's 2-digit minor version
---
unit-tests/unit | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/unit-tests/unit
+++ b/unit-tests/unit
@@ -9,7 +9,7 @@ from getopt import getopt
# Setup temporary sys.path() with our build dir
(sysname, nodename, release, version, machine) = os.uname()
-pyver = sys.version[:3]
+pyver = '%i.%i' % sys.version_info[:2]
sys.path.insert(0,'../build/lib.%s-%s-%s' % (sysname.lower(), machine, pyver))
root_user = (os.getuid() == 0 and True or False)

15
_service Normal file
View File

@@ -0,0 +1,15 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="versionprefix">3.12.2+git</param>
<param name="url">https://github.com/nima/python-dmidecode.git</param>
<param name="scm">git</param>
<param name="exclude">.git*</param>
<param name="changesgenerate">enable</param>
<param name="changesauthor">mcepl@cepl.eu</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="set_version" mode="disabled" />
</services>

4
_servicedata Normal file
View File

@@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/nima/python-dmidecode.git</param>
<param name="changesrevision">467038237266e2c1bec79d1d6698170b81208026</param></service></servicedata>

27
detect-lib-with-py3.patch Normal file
View File

@@ -0,0 +1,27 @@
---
python-dmidecode-3.12.2/src/setup_common.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/src/setup_common.py
+++ b/src/setup_common.py
@@ -30,7 +30,7 @@ import subprocess, sys
if sys.version_info[0] < 3:
import commands as subprocess
from os import path as os_path
-from distutils.sysconfig import get_python_lib
+from distutils.sysconfig import get_python_lib, get_config_var
# libxml2 - C flags
def libxml2_include(incdir):
@@ -69,7 +69,10 @@ def libxml2_lib(libdir, libs):
libs.append(l.replace("-l", "", 1))
# this library is not reported and we need it anyway
- libs.append('xml2mod')
+ if get_config_var("SOABI"):
+ libs.append('xml2mod.%s' % get_config_var("SOABI"))
+ else:
+ libs.append('xml2mod')

24
gcc7-inline.patch Normal file
View File

@@ -0,0 +1,24 @@
---
src/dmixml.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/src/dmixml.c
+++ b/src/dmixml.c
@@ -362,7 +362,7 @@ xmlNode *dmixml_FindNode(xmlNode *node,
* @return char* Pointer to the tag contents if found, otherwise NULL. This value
* must NOT be freed, as it points directly into the value in the XML document.
*/
-inline char *dmixml_GetContent(xmlNode *node) {
+char *dmixml_GetContent(xmlNode *node) {
// FIXME: Should find better way how to return UTF-8 data
return (((node != NULL) && (node->children != NULL)) ? (char *) node->children->content : NULL);
}
@@ -377,7 +377,7 @@ inline char *dmixml_GetContent(xmlNode *
* @return char* Pointer to the tag contents if found, otherwise NULL. This value
* must NOT be freed, as it points directly into the value in the XML document.
*/
-inline char *dmixml_GetNodeContent(xmlNode *node, const char *key) {
+char *dmixml_GetNodeContent(xmlNode *node, const char *key) {
return dmixml_GetContent(dmixml_FindNode(node, key));
}

15
huge-memory.patch Normal file
View File

@@ -0,0 +1,15 @@
---
src/dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/dmidecode.c
+++ b/src/dmidecode.c
@@ -4533,7 +4533,7 @@ xmlNode *dmi_decode(xmlNode *prnt_n, dmi
dmi_memory_device_width(sect_n, "TotalWidth", WORD(data + 0x08));
dmi_memory_device_width(sect_n, "DataWidth", WORD(data + 0x0A));
if (h->length >= 0x20 && WORD(data + 0x0C) == 0x7FFF) {
- dmi_memory_device_extended_size(sect_n, WORD(data + 0x1C));
+ dmi_memory_device_extended_size(sect_n, DWORD(data + 0x1C));
} else {
dmi_memory_device_size(sect_n, WORD(data + 0x0C));
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f8ca347601deb9507aabf8f78eff9c8189cb2477da11e4cc0fafb483494eaadc
size 150589

88
python-dmidecode.changes Normal file
View File

@@ -0,0 +1,88 @@
-------------------------------------------------------------------
Sat Dec 04 00:01:25 UTC 2021 - mcepl@cepl.eu
- Update to version 3.12.2+git.1625035095.f0a089a:
* fix "src/dmidecodemodule.c:828:9 warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where non-null expected"
* fix Error: FORWARD_NULL (CWE-476): [#def23]
* fix "src/dmierror.c:55:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL buf where non-null expected"
* fix Error: MISSING_COMMA: detected by covscan
* fix Error: CONSTANT_EXPRESSION_RESULT detected by covscan
* fix RESOURCE_LEAK error detected by covscan in src/util.c
* fix RESOURCE_LEAK errors detected by covscan in src/xmlpythonizer.c
* Update README
* fix RESOURCE_LEAK errors detected by covscan in src/dmidecodemodule.c
-------------------------------------------------------------------
Thu Dec 2 23:52:35 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Brutal simplification of the SPEC file to the standard single-spec
Python one. In the end we need one shared package and multiple
python-versioned ones.
- Removal of support for Python 2 (bsc#1193262)
-------------------------------------------------------------------
Thu Oct 19 07:53:52 UTC 2017 - mc@suse.com
- build python2-dmidecode and use python-dmidecode for shared files
-------------------------------------------------------------------
Tue Oct 17 13:05:04 UTC 2017 - mc@suse.com
- set rpath to libxml2mod library
-------------------------------------------------------------------
Sun Sep 24 14:05:44 UTC 2017 - mc@suse.com
- version 3.12.2
- Add Python 3 subpackage
- Removed deprecated statements
-------------------------------------------------------------------
Wed May 3 15:12:27 CEST 2017 - mantel@suse.de
- use correct data type DWORD for extended memory size (bsc#1036061)
-------------------------------------------------------------------
Wed Sep 3 01:41:37 CEST 2014 - ro@suse.de
- sanitize release line in specfile
-------------------------------------------------------------------
Fri Jan 17 17:12:10 CET 2014 - mc@suse.de
- version 3.12.1
obsoleted patches (available in new upstream version):
* python-dmidecode_copyright-update.patch
* bug-713982_python-dmidecode-nullversion.patch
* python-dmidecode-dmixml-error-63fa74b229dd2.patch
* bug-823328-fix-set_vendor-segfault.dif
- Add SIGILL catcher in mem_chunk()
- Implemented dmixml_AddDMIstring()
- Harden dmi_string() calls with better NULL checks
- Do not add explictly 'dmispec' attributes inside switch()
in dmi_decode()
- rebase against upstream dmidecode v2.12 and an update
against the SMBIOS reference specification v2.8.0.
-------------------------------------------------------------------
Tue Jun 11 18:38:23 CEST 2013 - mc@suse.de
- fix segfault in dmi_set_vendor (bnc#823328)
-------------------------------------------------------------------
Wed Sep 28 13:16:17 CEST 2011 - mc@suse.de
- fix dmi_decode assertion during client registration
(bnc#720885)
-------------------------------------------------------------------
Mon Sep 12 11:05:55 CEST 2011 - mc@suse.de
- fix Segfault when decoding DMI data in dmi_processor_id()
(bnc#713982)
-------------------------------------------------------------------
Thu Dec 9 14:15:15 CET 2010 - mc@suse.de
- initial release

90
python-dmidecode.spec Normal file
View File

@@ -0,0 +1,90 @@
#
# spec file for package python-dmidecode
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define python_subpackage_only 1
Name: python-dmidecode
Version: 3.12.2+git.1625035095.f0a089a
Release: 0
Summary: Python module to access DMI data
Group: System/Management
License: GPL-2.0-only
URL: https://github.com/nima/python-dmidecode
# Source0: https://github.com/nima/python-dmidecode/archive/refs/tags/v%%{version}.tar.gz#/python-dmidecode-%%{version}.tar.gz
Source0: python-dmidecode-%{version}.tar.gz
Patch0: huge-memory.patch
Patch1: gcc7-inline.patch
Patch2: detect-lib-with-py3.patch
# PATCH-FIX-UPSTREAM 31-version_info-v-version.patch gh#nima/python-dmidecode#31 mcepl@suse.com
# use sys.version_info instead of sys.version
Patch3: 31-version_info-v-version.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module libxml2}
BuildRequires: libxml2-devel
BuildRequires: python-rpm-macros
%python_subpackages
%description
python-dmidecode is a python extension module that uses the code-base
of the 'dmidecode' utility, and presents the data as python data
structures or as XML data using libxml2.
%package -n python-python-dmidecode
Summary: Python 3 module to access DMI data
Requires: %{name} = %{version}-%{release}
Requires: python-dmidecode
%description -n python-python-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
%autosetup -p1
sed -i 's/python2/python3/g' Makefile unit-tests/Makefile
%build
%{python_expand export LDFLAGS="-Wl,-rpath=%{$python_sitearch}"
%make_build PY_BIN=$python build
}
%install
%python_expand $python src/setup.py install --root %{buildroot} --prefix=%{_prefix}
%check
pushd unit-tests
%{python_expand export PYTHON=$python
%make_build
}
popd
%files
%license doc/LICENSE
%doc README doc/README.upstream doc/AUTHORS doc/AUTHORS.upstream
%{_datadir}/python-dmidecode/
%files %{python_files python-dmidecode}
%{python_sitearch}/dmidecode*
%{python_sitearch}/*.egg-info
%pycache_only %{python_sitearch}/__pycache__/*
%changelog