Merge pull request !1 from openeuler-basic/dev
This commit is contained in:
openeuler-ci-bot 2019-12-17 17:17:34 +08:00 committed by Gitee
commit 199ac75661
3 changed files with 226 additions and 0 deletions

View File

@ -0,0 +1,51 @@
From 22728f16eb611411258146045030292e1170bfef Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 14 Feb 2018 16:15:28 -0500
Subject: [PATCH] libsmbios: fix more places with loop iterators with bad types
In these cases we get:
../src/libsmbios_c/smbios/smbios_obj.c: In function 'smbios_verify_smbios':
../src/libsmbios_c/smbios/smbios_obj.c:415:31: error: comparison of integer expressions of different signedness: 'unsigned int' and 'long int' [-Werror=sign-compare]
for(unsigned int i = 0; i < length ; ++i )
^
../src/libsmbios_c/smbios/smbios_obj.c: In function 'smbios_verify_smbios3':
../src/libsmbios_c/smbios/smbios_obj.c:436:31: error: comparison of integer expressions of different signedness: 'unsigned int' and 'long int' [-Werror=sign-compare]
for(unsigned int i = 0; i < length ; ++i )
^
I really don't understand why gcc will complain about it being signed vs
unsigned, but not about the fact that the int can obviously overflow
before the condition being checked against length, a larger type, is
satisfied.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
src/libsmbios_c/smbios/smbios_obj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libsmbios_c/smbios/smbios_obj.c b/src/libsmbios_c/smbios/smbios_obj.c
index a6f2e1e3525..c932ba59535 100644
--- a/src/libsmbios_c/smbios/smbios_obj.c
+++ b/src/libsmbios_c/smbios/smbios_obj.c
@@ -412,7 +412,7 @@ bool __hidden smbios_verify_smbios(const char *buf, long length, long *dmi_lengt
bool retval = true;
u8 checksum = 0;
- for(unsigned int i = 0; i < length ; ++i )
+ for(long i = 0; i < length ; ++i )
checksum = (checksum + buf[i]) & 0xFF;
fnprintf("SMBIOS TEP csum %d.\n", (int)checksum);
@@ -433,7 +433,7 @@ bool __hidden smbios_verify_smbios3(const char *buf, long length, long *dmi_leng
{
struct smbios_table_entry_point_64 *ep;
u8 checksum = 0;
- for(unsigned int i = 0; i < length ; ++i )
+ for(long i = 0; i < length ; ++i )
checksum = (checksum + buf[i]) & 0xFF;
fnprintf("SMBIOS TEP csum %d.\n", (int)checksum);
--
2.14.3

BIN
libsmbios-2.4.2.tar.gz Normal file

Binary file not shown.

175
libsmbios.spec Normal file
View File

@ -0,0 +1,175 @@
# these are all substituted by autoconf
%define pot_file libsmbios
%define lang_dom libsmbios-2.4
Name: libsmbios
Version: 2.4.2
Release: 3
Summary: Interface with the SMBIOS tables
License: GPLv2+ or OSL 2.1
URL: https://github.com/dell/libsmbios
Source0: https://github.com/dell/libsmbios/archive/v%{version}/libsmbios-%{version}.tar.gz
Patch0001: 0001-libsmbios-fix-more-places-with-loop-iterators-with-b.patch
BuildRequires: autoconf automake cppunit-devel doxygen gcc-c++ gettext gettext-devel
BuildRequires: git help2man libtool libxml2-devel pkgconfig python3-devel strace valgrind
ExclusiveArch: x86_64 %{ix86}
%description
This package provides a library to interface with the SMBIOS tables. It also provides extensions for proprietary methods of interfacing with Dell specific SMBIOS tables.
%package -n python3-smbios
Summary: Python interface to Libsmbios C library
Requires: %{name} = %{version}-%{release} python3
Obsoletes: python-smbios < 2.4.1
%description -n python3-smbios
This package provides a Python interface to %{name}.
%package -n smbios-utils
Summary: Meta-package that pulls in all smbios binaries and python scripts
Requires: smbios-utils-bin smbios-utils-python
%description -n smbios-utils
This is a meta-package that pulls in the binary libsmbios executables as well
as the python executables.
%package -n smbios-utils-bin
Summary: Binary utilities that use %{name}
Requires: %{name} = %{version}-%{release}
%description -n smbios-utils-bin
Get BIOS information, such as System product name, product id, service tag and
asset tag.
%package -n smbios-utils-python
Summary: Python executables that use %{name}
Requires: python3-smbios = %{version}-%{release}
%description -n smbios-utils-python
Get BIOS information, such as System product name, product id, service tag and
asset tag. Set service and asset tags on Dell machines. Manipulate wireless
cards/bluetooth on Dell laptops. Set BIOS password on select Dell systems.
Update BIOS on select Dell systems. Set LCD brightness on select Dell laptops.
%package devel
Summary: Development headers and archives
Requires: %{name} = %{version}-%{release}
%description devel
Libsmbios is a library and utilities that can be used by client programs to get
information from standard BIOS tables, such as the SMBIOS table.
This package contains the headers and .a files necessary to compile new client
programs against libsmbios.
%package_help
%prep
%autosetup -n libsmbios-%{version} -p1 -Sgit
%build
[ -e ./configure ] || PACKAGE_VERSION=%{version} ./autogen.sh --no-configure
mkdir _build
cd _build
echo '../configure "$@"' > configure
chmod +x ./configure
%configure
mkdir -p out/libsmbios_c
make CFLAGS+="%{optflags} -Werror" %{?_smp_mflags} 2>&1 | tee build-%{_arch}.log
echo \%doc _build/build-%{_arch}.log > buildlogs.txt
%check
runtest() {
mkdir _$1$2
pushd _$1$2
../configure
make -e $1 CFLAGS="$CFLAGS -DDEBUG_OUTPUT_ALL" 2>&1 | tee $1$2.log
touch -r ../configure.ac $1$2-%{_arch}.log
make -e $1 2>&1 | tee $1$2.log
popd
echo \%doc _$1$2/$1$2-%{_arch}.log >> _build/buildlogs.txt
}
VALGRIND="strace -f" runtest check strace > /dev/null || echo FAILED strace check
runtest valgrind > /dev/null || echo FAILED valgrind check
runtest check > /dev/null || echo FAILED check
%install
cd _build
TOPDIR=..
%make_install
%delete_la_and_a
find %{buildroot}/%{_includedir} out/libsmbios_c -exec touch -r $TOPDIR/configure.ac {} \;
mv out/libsmbios_c out/libsmbios_c-%{_arch}
rename %{pot_file}.mo %{lang_dom}.mo $(find %{buildroot}/%{_datadir} -name %{pot_file}.mo)
%find_lang %{lang_dom}
%pre
%post
/sbin/ldconfig
%preun
%postun
/sbin/ldconfig
%files -f _build/%{lang_dom}.lang
%{_libdir}/libsmbios_c.so.*
%files -n libsmbios-devel -f _build/buildlogs.txt
%doc COPYING-GPL COPYING-OSL README.md src/bin/getopts_LICENSE.txt src/include/smbios_c/config/boost_LICENSE_1_0_txt
%{_includedir}/smbios_c
%{_libdir}/libsmbios_c.so
%{_libdir}/pkgconfig/*.pc
%doc _build/out/libsmbios_c-%{_arch}
%files -n smbios-utils
%doc COPYING-GPL COPYING-OSL README.md
%files -n smbios-utils-bin
%doc COPYING-GPL COPYING-OSL README.md
%doc src/bin/getopts_LICENSE.txt src/include/smbios_c/config/boost_LICENSE_1_0_txt
%{_sbindir}/smbios-state-byte-ctl
%{_sbindir}/smbios-get-ut-data
%{_sbindir}/smbios-upflag-ctl
%{_sbindir}/smbios-sys-info-lite
%files -n python3-smbios
%doc COPYING-GPL COPYING-OSL README.md
%{python3_sitearch}/*
%files -n smbios-utils-python
%doc COPYING-GPL COPYING-OSL README.md
%doc src/bin/getopts_LICENSE.txt src/include/smbios_c/config/boost_LICENSE_1_0_txt
%dir %{_sysconfdir}/libsmbios
%config(noreplace) %{_sysconfdir}/libsmbios/*
%{_sbindir}/smbios-battery-ctl
%{_sbindir}/smbios-sys-info
%{_sbindir}/smbios-token-ctl
%{_sbindir}/smbios-passwd
%{_sbindir}/smbios-wakeup-ctl
%{_sbindir}/smbios-wireless-ctl
%{_sbindir}/smbios-lcd-brightness
%{_sbindir}/smbios-keyboard-ctl
%{_sbindir}/smbios-thermal-ctl
%{_datadir}/smbios-utils
%files help
%{_mandir}/man?/smbios-*
%changelog
* Tue Dec 10 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.4.2-3
- Package init