File udisks2-testsuite.spec of Package udisks2-testsuite

#
# spec file for package udisks2-testsuite
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d}

Name:           udisks2-testsuite
Summary:        Disk Manager
License:        GPL-2.0+
Group:          System Environment/Daemons
Version:        2.6.5
Release:        0
Url:            https://github.com/storaged-project/udisks
#Source0:        https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2
Source0:        udisks2-%{version}.tar.xz
Source1:        %{name}-rpmlintrc
Source2:        run-tests.sh
Source3:        test-driver

# Needed to build the man pages
BuildRequires:  chrpath
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  gnome-common
BuildRequires:  gobject-introspection-devel
BuildRequires:  gtk-doc
BuildRequires:  intltool
BuildRequires:  libacl-devel
BuildRequires:  libgudev-1_0-devel
BuildRequires:  xsltproc
BuildRequires:  pkgconfig(glib-2.0) >= 2.31.13
BuildRequires:  pkgconfig(libatasmart) >= 0.17
BuildRequires:  pkgconfig(polkit-agent-1) >= 0.92
BuildRequires:  pkgconfig(polkit-gobject-1) >= 0.92
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(udev)

# Needed to pull in the system bus daemon
Requires:       dbus-1
# We need at least this version for bugfixes/features etc.
Requires:       libatasmart4
# For mount, umount, mkswap
Requires:       util-linux
# sgdisk is called by udisksd to modify the partition tables... thus a needed tool.
Requires:       gptfdisk
# For LUKS devices
Requires:       cryptsetup
# For ejecting removable disks
Requires:       eject

Requires:       libudisks2-0 = %{version}
Recommends:     %{name}-lang

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}

# For /proc/self/mountinfo, only available in 2.6.26 or higher
Conflicts:      kernel < 2.6.26

# Upstream First - Policy:
# Never add any patches to this package without the upstream commit id
# in the patch. Any patches added here without a very good reason to make
# an exception will be silently removed with the next version update.

Patch1:         0001-dbus-tests-adapt-for-testsuite-package.patch

%description
The Udisks project provides a daemon, tools and libraries to access and
manipulate disks, storage devices and technologies.

%package -n libudisks2-0
Summary:        Dynamic library to access the udisksd daemon
License:        LGPL-2.1+
Group:          System/Libraries
Recommends:     %{name} = %{version}

%description -n libudisks2-0
This package contains the dynamic library, which provides
access to the udisksd daemon.

%package -n typelib-1_0-UDisks-2_0
Summary:        UDisks Client Library, version 2 -- Introspection bindings
License:        LGPL-2.1+
Group:          System/Libraries

%description -n typelib-1_0-UDisks-2_0
udisks provides a daemon, D-Bus API and command line tools
for managing disks and storage devices.

This package provides the GObject Introspection bindings for
the UDisks client library.

%package devel
Summary:        Development files for lib%{name}
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires:       libudisks2-0 = %{version}

%description devel
This package contains the development files for the library lib%{name}, a
dynamic library, which provides access to the udisksd daemon.

%lang_package

%package testsuite
Summary:        Test suite binaries for QA
License:        GPL-2.0+
Group:          System/Benchmark
Requires:       libatasmart-utils
Requires:       libudisks2-0 = %{version}
Requires:       targetcli-fb
Requires:       typelib-1_0-UDisks-2_0

%description testsuite
This provides the udisks2 testsuite scripts and binaries for QA


%prep
%setup -q -n udisks2-%{version}
%autopatch -p1

%build
./autogen.sh
%configure            \
    --sysconfdir=/etc \
    --enable-gtk-doc
make %{?_smp_mflags}

%install
#testsuite installation
mkdir -p %{buildroot}/%{_libdir}
mkdir -p %{buildroot}/var/opt/udisks2-tests/tests
mkdir -p %{buildroot}/var/opt/udisks2-tests/tests/.libs
mkdir -p %{buildroot}/var/opt/udisks2-tests/tests/.deps
mkdir -p %{buildroot}/var/opt/udisks2-tests/tests/dbus-tests
mkdir -p %{buildroot}/var/opt/udisks2-tests/tests/install-udisks
mkdir -p %{buildroot}/var/opt/udisks2-tests/tests/storagectl
mkdir -p %{buildroot}/var/opt/udisks2-tests/logs
mkdir -p %{buildroot}/usr/local/var/run/udisks2
mkdir -p %{buildroot}/usr/local/var/lib/udisks2

install -m0755 src/tests/integration-test %{buildroot}/var/opt/udisks2-tests/tests
install -m0755 src/tests/test_polkitd.py %{buildroot}/var/opt/udisks2-tests/tests
install -m0755 src/tests/udisks-test %{buildroot}/var/opt/udisks2-tests/tests
install -m0755 src/tests/udisks-test-helper %{buildroot}/var/opt/udisks2-tests/tests
install -m0755 %{S:2} %{buildroot}/var/opt/udisks2-tests
install -m0755 %{S:3} %{buildroot}/var/opt/udisks2-tests/tests

for dir in src/tests/.libs src/tests/.deps src/tests/dbus-tests src/tests/install-udisks src/tests/storagectl; do
        for file in $(ls $dir); do
                install $dir/$file %{buildroot}/var/opt/udisks2-tests/${dir#src/}
        done
done

%pre
%service_add_pre udisks2.service

%post -n %{name}
%{?udev_rules_update:%udev_rules_update}
%service_add_post udisks2.service

%post -n libudisks2-0 -p /sbin/ldconfig

%preun
%service_del_preun udisks2.service

%postun
%service_del_postun udisks2.service

%postun -n libudisks2-0 -p /sbin/ldconfig

%postun -n %{name}-testsuite
rm -rf /var/opt/udisks2-tests/logs/* &>/dev/null

%files testsuite
%dir /var/opt/udisks2-tests
%dir /var/opt/udisks2-tests/tests/.libs
%dir /var/opt/udisks2-tests/tests/.deps
%dir /var/opt/udisks2-tests/tests/dbus-tests
%dir /var/opt/udisks2-tests/tests/install-udisks
%dir /var/opt/udisks2-tests/tests/storagectl
%dir /usr/local/var
%dir /usr/local/var/*
/var/opt/udisks2-tests/*

%changelog
openSUSE Build Service is sponsored by