diff --git a/libsmbios-2.4.1.tar.gz b/libsmbios-2.4.1.tar.gz new file mode 100644 index 0000000..e58864a --- /dev/null +++ b/libsmbios-2.4.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad200d0b8db681d04336afb64c765808b3bfdfc18619e24621576c03564e629f +size 667796 diff --git a/libsmbios-2.4.1.tar.xz b/libsmbios-2.4.1.tar.xz deleted file mode 100644 index a647b36..0000000 --- a/libsmbios-2.4.1.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bca36af54a169eafeda19463e100378b26b1845d90dfd2fcb41cbd05a632f015 -size 435512 diff --git a/libsmbios.rpmlintrc b/libsmbios-rpmlintrc similarity index 100% rename from libsmbios.rpmlintrc rename to libsmbios-rpmlintrc diff --git a/libsmbios.changes b/libsmbios.changes index 4cb5c2f..9a88961 100644 --- a/libsmbios.changes +++ b/libsmbios.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Thu Apr 5 11:50:10 UTC 2018 - tchvatal@suse.com + +- Adhere to the packaging guidelines + * As we build only against tumbleweed do not fuzz around with + supporting Fedora and Centos + * Use explicit filelists as it is way more readable + * Do not play around with %release as it behaves differently + compared to RH +- Use package names as mandated by python packaging guidelines +- Use full url to fetch tarball from github... +- Do not mess with permission in %prep phase, the perms on + directories and files look correct both in tarball and github +- Make build run parallel make and just configure/make without any + hassle +- Do not mess with locale generating, it is properly created by make + already +- Do not install buildlog on user systems, we have OBS for that +- Install manpage with each binary, do not just put all mans in + python3 subpackage +- Actually run tests rather than playing around with valgrind +- Make sure to do -fPIE build + ------------------------------------------------------------------- Mon Mar 26 11:18:52 UTC 2018 - jengelh@inai.de diff --git a/libsmbios.spec b/libsmbios.spec index c883a97..8c1572d 100644 --- a/libsmbios.spec +++ b/libsmbios.spec @@ -16,71 +16,30 @@ # -# these are all substituted by autoconf -%define major 2 -%define minor 4 -%define micro 1 -%define extra %{nil} -%define pot_file libsmbios -%define lang_dom libsmbios-2.4-x86_64 -%define release_version 2.4.1 - -%define release_name libsmbios -%define other_name libsmbios2 -%if 0%{?suse_version} -%define release_name libsmbios_c2 -%define other_name libsmbios -%endif - -%{!?build_python: %global build_python 1} -%{?_with_python: %global build_python 1} -%{?_without_python: %undefine build_python} - -# run_unit_tests not defined by default as cppunit -# not available in OS on several major OS -%{?_without_unit_tests: %undefine run_unit_tests} -%{?_with_unit_tests: %global run_unit_tests 1} - -%{!?as_needed: %global as_needed 1} -%{?_without_as_needed: %undefine as_needed} -%{?_with_as_needed: %global as_needed 1} - -%global pkgconfig_BR pkgconfig -%global valgrind_BR valgrind -# Some variable definitions so that we can be compatible between SUSE Build service and Fedora build system -# SUSE: fedora_version suse_version rhel_version centos_version sles_version -# Fedora: fedora dist fc8 fc9 - -%global python_devel_BR %{nil} -%if 0%{?build_python} - %global python_devel_BR python3-devel -%endif - -# if unit tests are disabled, get rid of a few BuildRequires -%{!?run_unit_tests: %global valgrind_BR %{nil}} - +%define libname libsmbios_c2 Name: libsmbios -Version: %{release_version} -Release: 0%{?dist} +Version: 2.4.1 +Release: 0 Summary: SMBIOS table library and utilities License: GPL-2.0-or-later OR OSL-2.1 Group: Hardware/Other -Source: libsmbios-%{version}.tar.xz -Source1: libsmbios.rpmlintrc -Url: http://github.com/dell/libsmbios -BuildRoot: %{_tmppath}/%{name}-%{version}-build +URL: https://github.com/dell/libsmbios +Source: https://github.com/dell/libsmbios/archive/v2.4.1.tar.gz#/%{name}-%{version}.tar.gz +Source1: libsmbios-rpmlintrc BuildRequires: autoconf BuildRequires: automake -BuildRequires: gettext-devel +BuildRequires: chrpath +BuildRequires: doxygen +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: gettext +BuildRequires: help2man +BuildRequires: libcppunit-devel BuildRequires: libtool +BuildRequires: libxml2-devel +BuildRequires: pkgconfig BuildRequires: python-rpm-macros -BuildRequires: strace libxml2-devel gcc-c++ gettext doxygen help2man %{valgrind_BR} %{pkgconfig_BR} %{python_devel_BR} -# uncomment for official fedora -Obsoletes: libsmbios-libs < 2.0.0 -Provides: libsmbios-libs = 0:%{version}-%{release} -Obsoletes: %{other_name} < 0:%{version}-%{release} -Provides: %{other_name} = 0:%{version}-%{release} - +BuildRequires: python3-devel # libsmbios only ever makes sense on intel compatible arches # no DMI tables on ppc, s390, etc. ExclusiveArch: x86_64 ia64 %{ix86} @@ -90,82 +49,65 @@ libsmbios provides a library to interface with the SMBIOS tables. It also provides extensions for proprietary methods of interfacing with Dell specific SMBIOS tables. -%package lang -Summary: Translations for package libsmbios -Group: System/Localization +%lang_package -%description lang -Provides translations for the "libsmbios" package. - -%package -n %{release_name} +%package -n %{libname} Summary: SMBIOS table interface library -# Leap 42.X Group: System/Libraries -Provides: libsmbios = %{version} -Obsoletes: libsmbios < %{version} -# Short-time Factory package containing libsmbios_c2 -Provides: libsmbios2 = %{version} -Obsoletes: libsmbios2 < %{version} -%description -n %{release_name} +%description -n %{libname} libsmbios provides a library to interface with the SMBIOS tables. It also provides extensions for proprietary methods of interfacing with Dell specific SMBIOS tables. This package provides the C API library. -%package -n python-smbios +%package -n python3-smbios Summary: Python interface to Libsmbios C library Group: System/Libraries -Requires: %{release_name} = %{version}-%{release} -Requires: python3 +Requires: %{libname} = %{version} +# We provide only python3 bindings thus obsolete the old ones +Obsoletes: python-smbios -%description -n python-smbios +%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 +Summary: Utilities that use libsmbios Group: System/Management -Requires: smbios-utils-bin -%if 0%{?build_python} -Requires: smbios-utils-python -%endif -Obsoletes: libsmbios-bin < 0:2.0.0 -Provides: libsmbios-bin = %{version}-%{release} -Obsoletes: libsmbios-unsupported-bin < 0:2.0.0 -Provides: libsmbios-unsupported-bin = %{version}-%{release} +Recommends: %{name}-lang +Recommends: python3-smbios-utils = %{version} +# Give away the bin subpkg and just pull them all here instead of playing with +# metapackages +Provides: smbios-utils-bin +Provides: libsmbios-bin = %{version} +Obsoletes: libsmbios-bin < %{version} +Provides: libsmbios-unsupported-bin = %{version} +Obsoletes: libsmbios-unsupported-bin < %{version} %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: System/Management -Requires: %{release_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 +%package -n python3-smbios-utils Summary: Python executables that use libsmbios Group: System/Management -Requires: python-smbios = %{version}-%{release} +Requires: python3-smbios = %{version} +# Former name replacement +Provides: smbios-utils-python = %{version} -%description -n smbios-utils-python +%description -n python3-smbios-utils 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/C and C++ -Requires: %{release_name} = %{version}-%{release} -Provides: libsmbios2-devel = %{version}-%{release} -Obsoletes: libsmbios2-devel < %{version}-%{release} +Requires: %{libname} = %{version} +Provides: libsmbios2-devel = %{version} +Obsoletes: libsmbios2-devel < %{version} %description -n libsmbios-devel Libsmbios is a library and utilities that can be used by client programs to get @@ -175,161 +117,105 @@ This package contains the headers and .a files necessary to compile new client programs against libsmbios. %prep -: '########################################' -: '########################################' -: '#' -: '# build_python: %{?build_python}' -: '# run_unit_tests: %{?run_unit_tests}' -: '# rhel: %{?rhel}' -: '# suse_version: %{?suse_version}' -: '#' -: '########################################' -: '########################################' -%setup -q -n libsmbios-%{version} -find . -type d -exec chmod -f a+rx "{}" "+" -find doc src -type f -exec chmod -f a-x "{}" "+" -find src/pyunit/ -name "*.sh" -o -name "*.py" -type f -exec chmod a+x "{}" "+" +%setup -q %build -# this line lets us build an RPM directly from a git tarball -# and retains any customized version information we might have -[ -e ./configure ] || ./autogen.sh --no-configure - -mkdir _build -cd _build -%define _configure ../configure +autoreconf -fvi +export CFLAGS="%{optflags} -fPIE" +export LDFLAGS="-pie" %configure \ - %{?!as_needed:--disable-as-needed} %{?!build_python:--disable-python} - -mkdir -p out/libsmbios_c -make CFLAGS="-Werror %{optflags}" %{?_smp_mflags} 2>&1 | tee build-%{_arch}.log - -echo '%%doc _build/build-%{_arch}.log' > buildlogs.txt - -%check -runtest() { - mkdir _$1$2 -%if 0%{?run_unit_tests} - 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 -%endif -} - -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 + --disable-static \ + --enable-nls \ + --enable-python \ + --enable-as-needed \ + --enable-doxygen +make %{?_smp_mflags} %install -cd _build -TOPDIR=.. -%make_install INSTALL="install -p" +%make_install +find %{buildroot} -type f -name "*.la" -delete -print + +# remove rpath from binaries +chrpath --replace '$ORIGIN' %{buildroot}%{_sbindir}/smbios-sys-info-lite + +# python3 duplicates +%fdupes %{buildroot}%{python3_sitearch} + +# include files mkdir -p %{buildroot}/%{_includedir} -mkdir -p %{buildroot}/%{_bindir} -cp -a $TOPDIR/src/include/* %{buildroot}/%{_includedir}/ -cp -a out/public-include/* %{buildroot}/%{_includedir}/ -rm -f %{buildroot}/%{_libdir}/libsmbios*.*a -find %{buildroot}/%{_includedir} out/libsmbios_c -exec touch -r $TOPDIR/configure.ac "{}" "+" +cp -a src/include/* %{buildroot}/%{_includedir}/ +cp -a out/public-include/* %{buildroot}%{_includedir}/ -mv out/libsmbios_c out/libsmbios_c-%{_arch} +%find_lang %{name} -rename %{pot_file}.mo %{lang_dom}.mo $(find %{buildroot}/%{_datadir} -name %{pot_file}.mo) -%find_lang %{lang_dom} - -find %{buildroot} -name '*-1.pyc' -delete - -touch files-smbios-utils-python -touch files-python-smbios - -%if 0%{?build_python} - -# backwards compatible: -ln -s %{_sbindir}/dellWirelessCtl %{buildroot}/%{_bindir}/dellWirelessCtl +# backwards compatible +mkdir -p %{buildroot}%{_bindir} +ln -s %{_sbindir}/smbios-wireless-ctl %{buildroot}/%{_bindir}/dellWirelessCtl ln -s smbios-sys-info %{buildroot}/%{_sbindir}/getSystemId ln -s smbios-wireless-ctl %{buildroot}/%{_sbindir}/dellWirelessCtl ln -s smbios-lcd-brightness %{buildroot}/%{_sbindir}/dellLcdBrightness -cat > files-python-smbios <<-EOF - %%doc COPYING-GPL COPYING-OSL - %%{python3_sitearch}/* -EOF +%check +make %{?_smp_mflags} check -cat > files-smbios-utils-python <<-EOF - %%doc COPYING-GPL COPYING-OSL - %%doc src/bin/getopts_LICENSE.txt - %%dir %%{_sysconfdir}/libsmbios - %%config(noreplace) %%{_sysconfdir}/libsmbios/* +%post -n %{libname} -p /sbin/ldconfig +%postun -n %{libname} -p /sbin/ldconfig - # python utilities - %%{_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 - %%{_sbindir}/smbios-battery-ctl - - # man pages - %%{_mandir}/man1/smbios* - - # used by HAL in old location, so keep it around until HAL is updated. - %%{_sbindir}/dellLcdBrightness - %%{_sbindir}/getSystemId - %%{_sbindir}/dellWirelessCtl - %%{_bindir}/dellWirelessCtl - - # data files - %%{_datadir}/smbios-utils -EOF - -%endif - -%post -n %{release_name} -p /sbin/ldconfig -%postun -n %{release_name} -p /sbin/ldconfig - -%files -n %{release_name} -%defattr(-,root,root,-) +%files -n %{libname} +%license COPYING-GPL COPYING-OSL +%license src/bin/getopts_LICENSE.txt %{_libdir}/libsmbios_c.so.* -%files lang -f _build/%{lang_dom}.lang -%defattr(-,root,root,-) +%files lang -f %{name}.lang -%files -n libsmbios-devel -f _build/buildlogs.txt -%defattr(-,root,root,-) -%doc COPYING-GPL COPYING-OSL src/bin/getopts_LICENSE.txt +%files -n libsmbios-devel %{_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 -# no other files. - -%files -n smbios-utils-bin -%defattr(-,root,root,-) -%doc COPYING-GPL COPYING-OSL -%doc src/bin/getopts_LICENSE.txt - -# new C utilities +# C utilities %{_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 python-smbios -f _build/files-python-smbios -%defattr(-,root,root,-) +%files -n python3-smbios +%{python3_sitearch}/* -%files -n smbios-utils-python -f _build/files-smbios-utils-python -%defattr(-,root,root,-) +%files -n python3-smbios-utils +%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.* +# used by HAL in old location, so keep it around until HAL is updated. +%{_sbindir}/dellLcdBrightness +%{_sbindir}/getSystemId +%{_sbindir}/dellWirelessCtl +%{_bindir}/dellWirelessCtl +# data files +%{_datadir}/smbios-utils %changelog