%define glib2_version           2.6.0
%define dbus_version            1.2
%define dbus_glib_version       0.82
%define polkit_version          0.92
%define parted_version          2.3
%define udev_version            145
%define mdadm_version           2.6.7
%define device_mapper_version   1.02
%define libatasmart_version     0.12
%define sg3_utils_version       1.27
%define smp_utils_version       0.94
%define lvm2_version            2.02.78

Summary: Storage Management Service
Name: udisks
Version: 1.0.4
Release: 2%{?_dist_release}
License: GPLv2+
Group: System Environment/Libraries
URL: http://www.freedesktop.org/wiki/Software/udisks
Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: dbus-devel  >= %{dbus_version}
BuildRequires: dbus-glib-devel >= %{dbus_glib_version}
BuildRequires: polkit-devel >= %{polkit_version}
BuildRequires: parted-devel >= %{parted_version}
BuildRequires: device-mapper-devel >= %{device_mapper_version}
BuildRequires: intltool
BuildRequires: libatasmart-devel >= %{libatasmart_version}
BuildRequires: libgudev1-devel >= %{udev_version}
BuildRequires: libudev-devel >= %{udev_version}
BuildRequires: sg3_utils-devel >= %{sg3_utils_version}
BuildRequires: lvm2-devel >= %{lvm2_version}
# needed to pull in the system bus daemon
Requires: dbus >= %{dbus_version}
# needed to pull in the udev daemon
Requires: udev >= %{udev_version}
# we need at least this version for bugfixes / features etc.
Requires: libatasmart >= %{libatasmart_version}
Requires: mdadm >= %{mdadm_version}
# for smp_rep_manufacturer
Requires: smp_utils >= %{smp_utils_version}
# for mount, umount, mkswap
Requires: util-linux-ng
# for mkfs.ext3, mkfs.ext3, e2label
Requires: e2fsprogs
# for mkfs.xfs, xfs_admin
Requires: xfsprogs
# for mkfs.vfat
Requires: dosfstools
# for mlabel
Requires: mtools
# for mkntfs - no ntfsprogs on ppc, though
%ifnarch ppc ppc64
Requires: ntfsprogs
%endif

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

# we need liblvm2app at least this recent since the ABI changed (sizes
# reported in number of bytes instead of number of sectors) without
# the sonumber changing
#
Requires: lvm2-libs >= %{lvm2_version}

# Obsolete and Provide DeviceKit-disks - udisks provides exactly the same
# ABI just with a different name and versioning-scheme
#
Obsoletes: DeviceKit-disks <= 009
Provides: DeviceKit-disks = 010

Vendor: Project Vine
Distribution: Vine Linux

%description
udisks provides a daemon, D-Bus API and command line tools
for managing disks and storage devices.

%package devel
Summary: D-Bus interface definitions for udisks
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: gtk-doc

# See comment above
#
Obsoletes: DeviceKit-disks-devel <= 009
Provides: DeviceKit-disks-devel = 010

%description devel
D-Bus interface definitions and documentation for udisks.

%prep
%setup -q

%build
%configure \
	--enable-gtk-doc \
	--enable-lvm2
make

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a

# for now, include a compat symlink for the command-line tool
# and man page
ln -s udisks $RPM_BUILD_ROOT%{_bindir}/devkit-disks
ln -s udisks.1 $RPM_BUILD_ROOT%{_datadir}/man/man1/devkit-disks.1

# TODO: should be fixed upstream
chmod 0644 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/udisks-bash-completion.sh

%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root,-)

%doc README AUTHORS NEWS COPYING HACKING doc/TODO

%{_sysconfdir}/avahi/services/udisks.service
%{_sysconfdir}/dbus-1/system.d/*.conf
%{_sysconfdir}/profile.d/*.sh
/lib/udev/rules.d/*.rules

/lib/udev/udisks-part-id
/lib/udev/udisks-dm-export
/lib/udev/udisks-probe-ata-smart
/lib/udev/udisks-probe-sas-expander
/lib/udev/udisks-lvm-pv-export
/sbin/umount.udisks

%{_bindir}/*
%{_libexecdir}/*

%{_mandir}/man1/*
%{_mandir}/man7/*
%{_mandir}/man8/*

%{_datadir}/polkit-1/actions/*.policy

%{_datadir}/dbus-1/system-services/*.service

%attr(0700,root,root) %dir %{_localstatedir}/lib/udisks

%files devel
%defattr(-,root,root,-)

%{_datadir}/dbus-1/interfaces/*.xml
%{_datadir}/pkgconfig/udisks.pc

%dir %{_datadir}/gtk-doc/html/udisks
%{_datadir}/gtk-doc/html/udisks/*

# Note: please don't forget the %{?dist} in the changelog. Thanks
#
%changelog
* Thu Jan 05 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.4-2
- rebuild with parted-3.0

* Sat Sep 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.4-1
- new upstream release

* Tue Aug 16 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.3-1
- new upstream release
- drop Patch0

* Sun Aug 07 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.2-2
- add Patch0 (10-ide-cd-support.patch) from ubuntu

* Thu Dec 09 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.2-1
- new upstream release

* Tue Nov  9 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.1-2
- rebuilt with parted 2.3

* Tue Oct 05 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.0.1-1
- new upstream release

* Wed Apr 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.0.0-1
- Initial build for Vine Linux


* Tue Mar 30 2010 Richard W.M. Jones <rjones@redhat.com> - 1.0.0-2%{?dist}
- Bump release and rebuild so we link to the new libparted.

* Mon Mar 15 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-1%{?dist}
- Update to release 1.0.0

* Tue Feb 23 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20100223.1%{?dist}
- Update to new git snapshot

* Tue Feb 16 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20100215.3%{?dist}
- Require lvm2-libs >= 2.02.61 to get the right ABI for liblvm2app

* Tue Feb 16 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20100215.2%{?dist}
- Update for new liblvm2app library

* Mon Feb 15 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20100215.1%{?dist}
- Update to git snapshot

* Fri Jan 15 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20100115.2%{?dist}
- Rebuild

* Fri Jan 15 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20100115.1%{?dist}
- New git snapshot with LVM support

* Tue Jan 12 2010 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20091202.3%{?dist}
- Rebuild for new libparted

* Mon Dec 07 2009 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20091202.2%{?dist}
- Rebuild

* Fri Dec 04 2009 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20091202.1%{?dist}
- Updated for package review (#543608)

* Wed Dec 02 2009 David Zeuthen <davidz@redhat.com> - 1.0.0-0.git20091202%{?dist}
- Git snapshot for upcoming 1.0.0 release
