diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa9ba83 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libsmbios-2.4.1.tar.gz diff --git a/.libsmbios.metadata b/.libsmbios.metadata new file mode 100644 index 0000000..849afe7 --- /dev/null +++ b/.libsmbios.metadata @@ -0,0 +1 @@ +66207d09ea57f93a85b4ade60c15dc6bf14227bb SOURCES/libsmbios-2.4.1.tar.gz diff --git a/SOURCES/0001-libsmbios-fix-more-places-with-loop-iterators-with-b.patch b/SOURCES/0001-libsmbios-fix-more-places-with-loop-iterators-with-b.patch new file mode 100644 index 0000000..604318a --- /dev/null +++ b/SOURCES/0001-libsmbios-fix-more-places-with-loop-iterators-with-b.patch @@ -0,0 +1,51 @@ +From 22728f16eb611411258146045030292e1170bfef Mon Sep 17 00:00:00 2001 +From: Peter Jones +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 +--- + 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 + diff --git a/SPECS/libsmbios.spec b/SPECS/libsmbios.spec new file mode 100644 index 0000000..63fa579 --- /dev/null +++ b/SPECS/libsmbios.spec @@ -0,0 +1,479 @@ +# these are all substituted by autoconf +%define pot_file libsmbios +%define lang_dom libsmbios-2.4 + +Name: libsmbios +Version: 2.4.1 +Release: 2%{?dist} +License: GPLv2+ or OSL 2.1 +Summary: Libsmbios C/C++ shared libraries +Group: System Environment/Libraries +URL: https://github.com/dell/libsmbios +BuildRequires: strace libxml2-devel gcc-c++ gettext git doxygen +BuildRequires: valgrind cppunit-devel hardlink pkgconfig python3-devel +BuildRequires: autoconf gettext-devel automake libtool help2man + +# libsmbios only ever makes sense on intel compatible arches +# no DMI tables on ppc, s390, etc. +ExclusiveArch: x86_64 %{ix86} + +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 + +%description +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 provides the C-based libsmbios library, with a C interface. + +%package -n python3-smbios +Summary: Python interface to Libsmbios C library +Group: System Environment/Libraries +Requires: libsmbios = %{version}-%{release} +Requires: python3 +Obsoletes: python-smbios < 2.4.1 + +%description -n python3-smbios +This package provides a Python interface to libsmbios + +%package -n smbios-utils +Summary: Meta-package that pulls in all smbios binaries and python scripts +Group: Applications/System +Requires: smbios-utils-bin +Requires: 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 libsmbios +Group: Applications/System +Requires: libsmbios = %{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 libsmbios +Group: Applications/System +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. + +# name the devel package libsmbios-devel regardless of package name, per suse/fedora convention +%package -n libsmbios-devel +Summary: Development headers and archives +Group: Development/Libraries +Requires: libsmbios = %{version}-%{release} + +%description -n libsmbios-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. + +%prep +%setup -q -n libsmbios-%{version} +find . -type d -exec chmod -f 755 {} \; +find doc src -type f -exec chmod -f 644 {} \; +chmod 755 src/cppunit/*.sh +git init +git config user.email "%{name}-owner@fedoraproject.org" +git config user.name "Fedora Ninjas" +git config gc.auto 0 +git add . +git commit -a -q -m "%{version} baseline." +git am %{patches} configure +chmod +x ./configure + +%configure + +mkdir -p out/libsmbios_c +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 + +TOPDIR=$(pwd)/../ +pushd ../src/bin +for x in smbios-battery-ctl smbios-keyboard-ctl smbios-lcd-brightness \ + smbios-passwd smbios-sys-info smbios-thermal-ctl smbios-token-ctl \ + smbios-wakeup-ctl smbios-wireless-ctl ; +do + chmod +x ${x} + LD_LIBRARY_PATH=$TOPDIR/_build/out/.libs/ help2man -o ${x}.8 -s 8 -n ${x} -N -l ./${x} +done +popd +pushd out +for x in smbios-get-ut-data smbios-state-byte-ctl smbios-sys-info-lite \ + smbios-upflag-ctl ; +do + LD_LIBRARY_PATH=$TOPDIR/_build/out/.libs/ help2man -o ${x}.8 -s 8 -n ${x} -N -l ./${x} +done +popd + + +%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 +} + +if [ -d /usr/include/cppunit ]; then + # run this first since it is slightly faster than valgrind + VALGRIND="strace -f" runtest check strace > /dev/null || echo FAILED strace check +fi + +if [ -e /usr/bin/valgrind -a -d /usr/include/cppunit ]; then + runtest valgrind > /dev/null || echo FAILED valgrind check +fi + +if [ -d /usr/include/cppunit ]; then + runtest check > /dev/null || echo FAILED check +fi + +if [ ! -d /usr/include/cppunit ]; then + echo "Unit tests skipped due to missing cppunit." +fi + +%install +rm -rf %{buildroot} +mkdir %{buildroot} + +cd _build +TOPDIR=.. +make install DESTDIR=%{buildroot} INSTALL="%{__install} -p" +mkdir -p %{buildroot}/%{_includedir} +mkdir -p %{buildroot}/%{_bindir} +mkdir -p %{buildroot}/%{_mandir}/man8/ +cp -v $TOPDIR/src/bin/*.8 %{buildroot}/%{_mandir}/man8/ +cp -v $TOPDIR/_build/out/*.8 %{buildroot}/%{_mandir}/man8/ +cp -a $TOPDIR/src/include/* %{buildroot}/%{_includedir}/ +cp -a out/public-include/* %{buildroot}/%{_includedir}/ +rm -f %{buildroot}/%{_libdir}/lib*.{la,a} +find %{buildroot}/%{_includedir} out/libsmbios_c++ out/libsmbios_c -exec touch -r $TOPDIR/configure.ac {} \; + +mv out/libsmbios_c++ out/libsmbios_c++-%{_arch} +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} + +# hardlink files to save some space. +/usr/sbin/hardlink -c -v $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files -f _build/%{lang_dom}.lang +%defattr(-,root,root,-) +%{_libdir}/libsmbios_c.so.* + +%files -n libsmbios-devel -f _build/buildlogs.txt +%defattr(-,root,root,-) +%doc COPYING-GPL COPYING-OSL README.md src/bin/getopts_LICENSE.txt src/include/smbios_c/config/boost_LICENSE_1_0_txt +%{_includedir}/smbios +%{_includedir}/smbios_c +%{_libdir}/libsmbios_c.so +%{_libdir}/pkgconfig/*.pc +%doc _build/out/libsmbios_c-%{_arch} + +%files -n smbios-utils +# opensuse 11.1 enforces non-empty file list :( +%defattr(-,root,root,-) +%doc COPYING-GPL COPYING-OSL README.md +# no other files. + +%files -n smbios-utils-bin +%defattr(-,root,root,-) +%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 +%{_mandir}/man?/smbios-state-byte-ctl.* +%{_sbindir}/smbios-get-ut-data +%{_mandir}/man?/smbios-get-ut-data.* +%{_sbindir}/smbios-upflag-ctl +%{_mandir}/man?/smbios-upflag-ctl.* +%{_sbindir}/smbios-sys-info-lite +%{_mandir}/man?/smbios-sys-info-lite.* + +%files -n python3-smbios +%defattr(-,root,root,-) +%doc COPYING-GPL COPYING-OSL README.md +%{python3_sitearch}/* + +%files -n smbios-utils-python +%defattr(-,root,root,-) +%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/* + +# python utilities +%{_sbindir}/smbios-battery-ctl +%{_mandir}/man?/smbios-battery-ctl.* +%{_sbindir}/smbios-sys-info +%{_mandir}/man?/smbios-sys-info.* +%{_sbindir}/smbios-token-ctl +%{_mandir}/man?/smbios-token-ctl.* +%{_sbindir}/smbios-passwd +%{_mandir}/man?/smbios-passwd.* +%{_sbindir}/smbios-wakeup-ctl +%{_mandir}/man?/smbios-wakeup-ctl.* +%{_sbindir}/smbios-wireless-ctl +%{_mandir}/man?/smbios-wireless-ctl.* +%{_sbindir}/smbios-lcd-brightness +%{_mandir}/man?/smbios-lcd-brightness.* +%{_sbindir}/smbios-keyboard-ctl +%{_mandir}/man?/smbios-keyboard-ctl.* +%{_sbindir}/smbios-thermal-ctl +%{_mandir}/man?/smbios-thermal-ctl.* + +# data files +%{_datadir}/smbios-utils + +%changelog +* Wed Apr 18 2018 Karsten Hopp - 2.4.1-2 +- rebuild with latest rpm build flags (rhbz#1540264) + +* Wed Feb 14 2018 Peter Jones - 2.4.1-1 +- Update for libsmbios 2.4.1 + +* Wed Feb 07 2018 Fedora Release Engineering - 2.3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Dec 11 2017 Pete Walter - 2.3.3-2 +- Remove obsolete python-ctypes requires (#1399686) + +* Tue Nov 14 2017 Pete Walter - 2.3.3-1 +- Update to 2.3.3 + +* Thu Aug 03 2017 Fedora Release Engineering - 2.3.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 2.3.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 2.3.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Jul 19 2016 Fedora Release Engineering - 2.3.0-3 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Wed Mar 09 2016 Peter Jones - 2.3.0-2 +- Once again, don't complain about compilers newer than tested with in the + public headers. +- Fix up bad %%global vs %%define directives +- Fix up bad old changelog dates +- Note there's a missing changelog here from the 2.3.0 rebase + +* Thu Feb 25 2016 Peter Jones - 2.2.28-16 +- Don't complain about compilers newer than tested with in the public + headers. + +* Thu Feb 04 2016 Fedora Release Engineering - 2.2.28-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Sep 1 2015 Srinivas G Gowda - 2.2.28-14 +- Fixes Bug 852719: Dell Open Manage falis to start when libsmbios in EPEL branch is used. +- Patch re-enables display of "OEM String" in smbios-sys-info-lite. + +* Wed Jun 17 2015 Fedora Release Engineering - 2.2.28-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat May 02 2015 Kalev Lember - 2.2.28-12 +- Rebuilt for GCC 5 C++11 ABI change + +* Sun Aug 17 2014 Fedora Release Engineering - 2.2.28-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 2.2.28-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sat Aug 03 2013 Fedora Release Engineering - 2.2.28-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 2.2.28-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 2.2.28-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Feb 28 2012 Fedora Release Engineering - 2.2.28-6 +- Rebuilt for c++ ABI breakage + +* Fri Jan 13 2012 Fedora Release Engineering - 2.2.28-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Jun 30 2011 Praveen K Paladugu 2.2.28-4 +- Adding the right tar ball, coz files were missing from the previous version. + +* Thu Jun 30 2011 Praveen K Paladugu - 2.2.28-3 +- Fixing the build failure of version 2.2.26-4. +- The updated sources adds support for the compiler version available in F15 and other fixes. + +* Tue Feb 08 2011 Fedora Release Engineering - 2.2.26-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Sep 27 2010 Matt Domsch - 2.2.26-3 +- build for Fedora 15 + +* Wed Jul 21 2010 David Malcolm - 2.2.19-2 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Tue Jul 06 2010 Michael Brown - 2.2.26-1 +- implement CSV export of token settings from smbios-token-ctl + +* Tue Jul 06 2010 Michael Brown - 2.2.25-1 +- Fix breakage resulting from improperly fixing up constructors for MemoryAccess/CmosAccess. Fixes CLI utilities. + +* Fri Jun 11 2010 Michael Brown - 2.2.23-1 +- Fixup ABI break where a couple functions that should have been exported were not marked. + +* Thu Jun 10 2010 Michael Brown - 2.2.22-1 +- Fixup bug in reading asset and service tag where it A) read checksum from wrong location and B) used wrong comparison check to validate it +- enable service tag SET for machines that still set service tag in CMOS +- ABI/API - change to -fvisibility=hidden for libsmbios_c.so.*, mark public api's. This removes all non-public symbols that were not formerly part of the ABI from the dynamic link table. + +* Mon May 18 2009 Matt Domsch - 2.2.16-3 +- split yum plugin into yum-dellsysid package + +* Tue Mar 24 2009 Michael E Brown - 2.2.16-1 +- add gcc 4.4 support + +* Tue Mar 24 2009 Michael E Brown - 2.2.15-1 +- update to lastest upstream. +- fixes bug in bios update on systems with versions like x.y.z. + +* Wed Feb 25 2009 Fedora Release Engineering - 2.2.13-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Feb 3 2009 Michael E Brown - 2.2.12-1 +- Add feature to turn on debugging printf()'s without recompiling by setting + certain environment variables: + LIBSMBIOS_C_DEBUG_OUTPUT_ALL -- all debugging output + or, per module: + LIBSMBIOS_C_DEBUG_CONSTRUCTOR_C + LIBSMBIOS_C_DEBUG_SYSINFO_C + LIBSMBIOS_C_DEBUG_SMBIOS_C + LIBSMBIOS_C_DEBUG_TOKEN_C + LIBSMBIOS_C_DEBUG_MEMORY_C + LIBSMBIOS_C_DEBUG_CMOS_C + LIBSMBIOS_C_DEBUG_SMI_C + +* Mon Feb 2 2009 Michael E Brown - 2.2.12-1 +- Add pkgconfig files to -devel +- fixup yum plugin to not parse certain data that causes a crash on some machines (Optiplex 755, others may be affected) + +* Thu Jan 15 2009 Michael E Brown - 2.2.8-1 +- revert change in upstream renaming rpm to libsmbios2 + +* Thu Jan 15 2009 Michael E Brown - 2.2.7-1 +- change source to bz2 format +- Update to latest upstream release. Many changes in the new release: + - python interface + - libsmbios_c interface almost fully implemented + - libsmbios c++ interface deprecated + +* Tue Oct 28 2008 Michael E Brown - 2.2.0-1 +- Spec updates + +* Mon Apr 21 2008 Michael E Brown - 2.0.1-2.1 +- obsolete libsmbios-libs as well + +* Mon Mar 3 2008 Michael E Brown - 2.0.1-2 +- properly obsolete older versions + +* Wed Feb 13 2008 Michael E Brown - 2.0.1 +- Fixup GCC 4.3 compile issues. + +* Wed Jan 9 2008 Michael E Brown - 2.0.0 +- ABI incompatible, minor API changes +- sync up libsmbios soname with version # +- move binaries to /usr/sbin as they are only runnable by root +- drop libsmbiosxml lib as it was mostly unused. +- drop autotools generated files out of git and add autogen.sh +- drop tokenCtl binary-- pysmbios has a *much* improved version + +* Wed Aug 22 2007 Michael E Brown - 0.13.9 +- Fix a couple of failure-to-check-return on fopen. most were unit-test code + only, but two or three were in regular code. +- Add hinting to the memory class, so that it can intelligently close /dev/mem + file handle when it is not needed (which is most of the time). it only + leaves it open when it is scanning, so speed is not impacted. + +* Mon Aug 6 2007 Michael E Brown - 0.13.8 +- new upstream + +* Tue Apr 3 2007 Michael E Brown - 0.13.6 +- critical bugfix for dellBiosUpdate utility for packet mode +- autoconf/automake support for automatically building docs +- more readable 'make' lines by splitting out env vars +- remove run_cppunit option... always run unit tests. +- update autoconf/automake utilities to latest version +- fix LDFLAGS to not overwrite user entered LDFLAGS +- add automatic doxygen build of docs +- fix urls of public repos +- remove yum repo page in favor of official page from docs +- split dmi table entry point from smbios table entry point +- support legacy _DMI_ tables +- fix support for EFI-based imacs without proper _SM_ anchor + +* Tue Mar 20 2007 Michael E Brown - 0.13.5 +- rpmlint cleanups +- Add dellLEDCtl binary +- update AUTHORS file to add credit for dellLEDCtl +- update doc/DellToken.txt to add a few more useful tokens. +- updated build system to create documentation +- skip cppunit dep on .elX builds (not in EPEL yet) + +* Mon Mar 12 2007 Michael E Brown - 0.13.4-1 +- Added dellWirelessCtl binary +- Added 'static' makefile target to build static binaries and clean them as well +- fix for signed/unsigned bug in probes binary. CPU temp misreported +- simplify interface for DELL_CALLING_INTERFACE_SMI, autodetect Port/Magic +- document all of the tokens for controlling wireless on dell notebooks +- enums for SMI args/res to make code match docs better (cbRES1 = res[0], which + was confusing. +- helper functions isTokenActive() and activateToken() to simplify token API. +- Added missing windows .cpp files to the dist tarball for those who compile + windows from dist tarball vs source control +- Add support for EFI based machines without backwards compatible smbios table + entry point in 0xF0000 block. +- Added wirelessSwitchControl() and wirelessRadioControl() API for newer + laptops. +- fixed bug in TokenDA activate() code where it wasnt properly using SMI + (never worked, but apparently wasnt used until now.) + +* Tue Oct 3 2006 Michael E Brown - 0.13.0-1 +- autotools conversion +- add Changelog + +* Tue Sep 26 2006 Michael E Brown - 0.12.4-1 +- Changes per Fedora Packaging Guidelines to prepare to submit to Extras. +- Add in a changelog entry per Fedora Packaging Guidelines... +