SHA256
1
0
forked from pool/libsmbios

Accepting request 593790 from home:scarabeus_iv:branches:Base:System

- 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

OBS-URL: https://build.opensuse.org/request/show/593790
OBS-URL: https://build.opensuse.org/package/show/Base:System/libsmbios?expand=0&rev=39
This commit is contained in:
Josef Möllers 2018-04-09 15:14:43 +00:00 committed by Git OBS Bridge
parent 5e821c3c67
commit 510d67e0c3
5 changed files with 139 additions and 230 deletions

3
libsmbios-2.4.1.tar.gz Normal file
View File

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

View File

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

View File

@ -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 Mon Mar 26 11:18:52 UTC 2018 - jengelh@inai.de

View File

@ -16,71 +16,30 @@
# #
# these are all substituted by autoconf %define libname libsmbios_c2
%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}}
Name: libsmbios Name: libsmbios
Version: %{release_version} Version: 2.4.1
Release: 0%{?dist} Release: 0
Summary: SMBIOS table library and utilities Summary: SMBIOS table library and utilities
License: GPL-2.0-or-later OR OSL-2.1 License: GPL-2.0-or-later OR OSL-2.1
Group: Hardware/Other Group: Hardware/Other
Source: libsmbios-%{version}.tar.xz URL: https://github.com/dell/libsmbios
Source1: libsmbios.rpmlintrc Source: https://github.com/dell/libsmbios/archive/v2.4.1.tar.gz#/%{name}-%{version}.tar.gz
Url: http://github.com/dell/libsmbios Source1: libsmbios-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: gettext-devel BuildRequires: chrpath
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: gettext
BuildRequires: help2man
BuildRequires: libcppunit-devel
BuildRequires: libtool BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
BuildRequires: strace libxml2-devel gcc-c++ gettext doxygen help2man %{valgrind_BR} %{pkgconfig_BR} %{python_devel_BR} BuildRequires: python3-devel
# 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}
# libsmbios only ever makes sense on intel compatible arches # libsmbios only ever makes sense on intel compatible arches
# no DMI tables on ppc, s390, etc. # no DMI tables on ppc, s390, etc.
ExclusiveArch: x86_64 ia64 %{ix86} 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 also provides extensions for proprietary methods of interfacing with
Dell specific SMBIOS tables. Dell specific SMBIOS tables.
%package lang %lang_package
Summary: Translations for package libsmbios
Group: System/Localization
%description lang %package -n %{libname}
Provides translations for the "libsmbios" package.
%package -n %{release_name}
Summary: SMBIOS table interface library Summary: SMBIOS table interface library
# Leap 42.X
Group: System/Libraries 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 libsmbios provides a library to interface with the SMBIOS tables. It
also provides extensions for proprietary methods of interfacing with also provides extensions for proprietary methods of interfacing with
Dell specific SMBIOS tables. Dell specific SMBIOS tables.
This package provides the C API library. This package provides the C API library.
%package -n python-smbios %package -n python3-smbios
Summary: Python interface to Libsmbios C library Summary: Python interface to Libsmbios C library
Group: System/Libraries Group: System/Libraries
Requires: %{release_name} = %{version}-%{release} Requires: %{libname} = %{version}
Requires: python3 # 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 This package provides a Python interface to libsmbios
%package -n smbios-utils %package -n smbios-utils
Summary: Meta-package that pulls in all smbios binaries and python scripts Summary: Utilities that use libsmbios
Group: System/Management Group: System/Management
Requires: smbios-utils-bin Recommends: %{name}-lang
%if 0%{?build_python} Recommends: python3-smbios-utils = %{version}
Requires: smbios-utils-python # Give away the bin subpkg and just pull them all here instead of playing with
%endif # metapackages
Obsoletes: libsmbios-bin < 0:2.0.0 Provides: smbios-utils-bin
Provides: libsmbios-bin = %{version}-%{release} Provides: libsmbios-bin = %{version}
Obsoletes: libsmbios-unsupported-bin < 0:2.0.0 Obsoletes: libsmbios-bin < %{version}
Provides: libsmbios-unsupported-bin = %{version}-%{release} Provides: libsmbios-unsupported-bin = %{version}
Obsoletes: libsmbios-unsupported-bin < %{version}
%description -n smbios-utils %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 Get BIOS information, such as System product name, product id, service tag and
asset tag. asset tag.
%package -n smbios-utils-python %package -n python3-smbios-utils
Summary: Python executables that use libsmbios Summary: Python executables that use libsmbios
Group: System/Management 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 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 asset tag. Set service and asset tags on Dell machines. Manipulate wireless
cards/bluetooth on Dell laptops. Set BIOS password on select Dell systems. 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. 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 %package -n libsmbios-devel
Summary: Development headers and archives Summary: Development headers and archives
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: %{release_name} = %{version}-%{release} Requires: %{libname} = %{version}
Provides: libsmbios2-devel = %{version}-%{release} Provides: libsmbios2-devel = %{version}
Obsoletes: libsmbios2-devel < %{version}-%{release} Obsoletes: libsmbios2-devel < %{version}
%description -n libsmbios-devel %description -n libsmbios-devel
Libsmbios is a library and utilities that can be used by client programs to get 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. programs against libsmbios.
%prep %prep
: '########################################' %setup -q
: '########################################'
: '#'
: '# 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 "{}" "+"
%build %build
# this line lets us build an RPM directly from a git tarball autoreconf -fvi
# and retains any customized version information we might have export CFLAGS="%{optflags} -fPIE"
[ -e ./configure ] || ./autogen.sh --no-configure export LDFLAGS="-pie"
mkdir _build
cd _build
%define _configure ../configure
%configure \ %configure \
%{?!as_needed:--disable-as-needed} %{?!build_python:--disable-python} --disable-static \
--enable-nls \
mkdir -p out/libsmbios_c --enable-python \
make CFLAGS="-Werror %{optflags}" %{?_smp_mflags} 2>&1 | tee build-%{_arch}.log --enable-as-needed \
--enable-doxygen
echo '%%doc _build/build-%{_arch}.log' > buildlogs.txt make %{?_smp_mflags}
%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
%install %install
cd _build %make_install
TOPDIR=.. find %{buildroot} -type f -name "*.la" -delete -print
%make_install INSTALL="install -p"
# 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}/%{_includedir}
mkdir -p %{buildroot}/%{_bindir} cp -a src/include/* %{buildroot}/%{_includedir}/
cp -a $TOPDIR/src/include/* %{buildroot}/%{_includedir}/ cp -a out/public-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 "{}" "+"
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) # backwards compatible
%find_lang %{lang_dom} mkdir -p %{buildroot}%{_bindir}
ln -s %{_sbindir}/smbios-wireless-ctl %{buildroot}/%{_bindir}/dellWirelessCtl
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
ln -s smbios-sys-info %{buildroot}/%{_sbindir}/getSystemId ln -s smbios-sys-info %{buildroot}/%{_sbindir}/getSystemId
ln -s smbios-wireless-ctl %{buildroot}/%{_sbindir}/dellWirelessCtl ln -s smbios-wireless-ctl %{buildroot}/%{_sbindir}/dellWirelessCtl
ln -s smbios-lcd-brightness %{buildroot}/%{_sbindir}/dellLcdBrightness ln -s smbios-lcd-brightness %{buildroot}/%{_sbindir}/dellLcdBrightness
cat > files-python-smbios <<-EOF %check
%%doc COPYING-GPL COPYING-OSL make %{?_smp_mflags} check
%%{python3_sitearch}/*
EOF
cat > files-smbios-utils-python <<-EOF %post -n %{libname} -p /sbin/ldconfig
%%doc COPYING-GPL COPYING-OSL %postun -n %{libname} -p /sbin/ldconfig
%%doc src/bin/getopts_LICENSE.txt
%%dir %%{_sysconfdir}/libsmbios
%%config(noreplace) %%{_sysconfdir}/libsmbios/*
# python utilities %files -n %{libname}
%%{_sbindir}/smbios-sys-info %license COPYING-GPL COPYING-OSL
%%{_sbindir}/smbios-token-ctl %license src/bin/getopts_LICENSE.txt
%%{_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,-)
%{_libdir}/libsmbios_c.so.* %{_libdir}/libsmbios_c.so.*
%files lang -f _build/%{lang_dom}.lang %files lang -f %{name}.lang
%defattr(-,root,root,-)
%files -n libsmbios-devel -f _build/buildlogs.txt %files -n libsmbios-devel
%defattr(-,root,root,-)
%doc COPYING-GPL COPYING-OSL src/bin/getopts_LICENSE.txt
%{_includedir}/smbios %{_includedir}/smbios
%{_includedir}/smbios_c %{_includedir}/smbios_c
%{_libdir}/libsmbios_c.so %{_libdir}/libsmbios_c.so
%{_libdir}/pkgconfig/*.pc %{_libdir}/pkgconfig/*.pc
%doc _build/out/libsmbios_c-%{_arch}
%files -n smbios-utils %files -n smbios-utils
# opensuse 11.1 enforces non-empty file list :( # C utilities
%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
%{_sbindir}/smbios-state-byte-ctl %{_sbindir}/smbios-state-byte-ctl
%{_mandir}/man?/smbios-state-byte-ctl.*
%{_sbindir}/smbios-get-ut-data %{_sbindir}/smbios-get-ut-data
%{_mandir}/man?/smbios-get-ut-data.*
%{_sbindir}/smbios-upflag-ctl %{_sbindir}/smbios-upflag-ctl
%{_mandir}/man?/smbios-upflag-ctl.*
%{_sbindir}/smbios-sys-info-lite %{_sbindir}/smbios-sys-info-lite
%{_mandir}/man?/smbios-sys-info-lite.*
%files -n python-smbios -f _build/files-python-smbios %files -n python3-smbios
%defattr(-,root,root,-) %{python3_sitearch}/*
%files -n smbios-utils-python -f _build/files-smbios-utils-python %files -n python3-smbios-utils
%defattr(-,root,root,-) %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 %changelog