#
# spec file for package gptfdisk
#
# Copyright (c) 2015 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/
#


Name:           gptfdisk
Version:        1.0.0
Release:        1.1
Summary:        GPT partitioning and MBR repair software
License:        GPL-2.0
Group:          System/Base
Url:            http://rodsbooks.com/gdisk

Source:         http://downloads.sf.net/%name/%name-%version.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gcc-c++
BuildRequires:  ncurses-devel
BuildRequires:  pkgconfig(popt)
BuildRequires:  pkgconfig(uuid)

Obsoletes:      gdisk < %version-%release
Provides:       gdisk = %version-%release

%description
Partitioning software for GPT disks and to repair MBR disks. The
gdisk, cgdisk, and sgdisk utilities (in the gdisk package) are
GPT-enabled partitioning tools; the fixparts utility (in the fixparts
package) fixes some problems with MBR disks that can be created by
buggy partitioning software.

%package fixparts
Summary:        A tool for repairing certain types of damage to MBR disks
Group:          System/Base

%description fixparts
A program that corrects errors that can creep into MBR-partitioned
disks. Removes stray GPT data, fixes mis-sized extended partitions,
and enables changing primary vs. logical partition status. Also
provides a few additional partition manipulation features.

%prep
%setup -q

%build
CFLAGS="%optflags" CXXFLAGS="%optflags" make %{?_smp_mflags}

%install
b="%buildroot";
mkdir -p "$b/%_sbindir" "$b/%_mandir/man8";
install -pm0755 fixparts {,c,s}gdisk "$b/%_sbindir/";
install -pm0644 *.8 "$b/%_mandir/man8/";

%check
./gdisk_test.sh

%files
%defattr(-,root,root)
%doc NEWS COPYING README
%_sbindir/gdisk
%_sbindir/sgdisk
%_sbindir/cgdisk
%_mandir/man8/gdisk.8*
%_mandir/man8/cgdisk.8*
%_mandir/man8/sgdisk.8*

%files fixparts
%defattr(-,root,root)
%_sbindir/fixparts
%_mandir/man8/fixparts.8*

%changelog
* Fri Mar 27 2015 jengelh@inai.de
- Update to new upstream release 1.0.0
  * Added partition type for Windows Storage Spaces, Ceph,
  and Discoverable Linux Partitions.
  * Added -O/--print-mbr option to sgdisk
* Sun Mar  8 2015 jengelh@inai.de
- Remove old RPM tags for pre-12.x openSUSE.
  Remove duplicated documentation.
* Tue Mar  4 2014 sweet_f_a@gmx.de
- Update to new upstream release 0.8.10
  * Bug fix of previous version: The hybrid MBR creation code in
  gdisk would ignore the second and third partitions to be
  hybridized.
  * Fix bug that could cause incorrect partition end points to be
  set on hybridized partitions that spanned the 2^32-sector mark
  on disks.
  * Finally, this version enables the use of 0 as a value for a
  partition number to the -A/--attributes, -c/--change-name,
  - t/--typecode, and -u/--partition-guid commands if an earlier
  - n/--new option created a new partition; in this case, 0 refers
  to that newly-created partition.
* Tue Feb 25 2014 sweet_f_a@gmx.de
- Update to new upstream release 0.8.9
  * Three new type codes.
  * The verify (v) function now checks for MBR partitions (the 0xEE
  protective partitions or hybrid MBR partitions) that don't fit
  on the disk.
  * The GPT-destruction options (z in gdisk, -z and -Z in sgdisk)
  now wipe out the final few sectors on the disk rather than
  wherever the backup GPT data are recorded as being. This is done
  to prevent wiping out data mid-disk, which can otherwise happen
  if a RAID array is resized in certain ways and the GPT data are
  not moved prior to wiping the GPT data.
  * The FixParts program had developed a bug in which it complained
  that the 0xEE partition didn't begin on sector 1; this version
  fixes that bug.
  * Finally, this version removes the dependency on libicu for UTF-16
  support in partition names.
- remove obsolete libicu dependency
* Wed Nov 13 2013 sweet_f_a@gmx.de
- Update to new upstream release 0.8.8
  * Fixed bug that could cause segfault when passing an invalid
    partition number to sgdisk's -i/--info command.
  * Added new partition type codes.
  * Added a pause (with a prompt to hit <Enter>) to display more
    items gdisk and cgdisk. There's no such pause/prompt in sgdisk,
    though.
  * Fine-tuned verification ('v') check for 0xEE partition that
    doesn't begin on sector 1.
  * Fixed hybrid MBR creation on disks larger than 2TiB
  * Added check for an active/bootable 0xEE protective partition to
    the verify ('v') function.
* Mon Jul 29 2013 sweet_f_a@gmx.de
- Update to new upstream release 0.8.7
  * Small improvements and bug fixes mark this revision.
  * Three new partition type codes have been added:
    freedesktop.org's proposed $BOOT partition (type code EA00),
    the Intel Rapid Start partition (code 8400),
    and for Haiku's BFS (code EB00).
  * Removed a stray debug message that appeared when reading MBR
    disks.
  * The "converting MBR to GPT" message has been modified to
    clarify that changes are being held in memory.
  * The Mac version now works on /dev/rdisk* devices as well as
    /dev/disk* devices.
  * When used with /dev/rdisk* devices, the partition table can
    sometimes be re-read without rebooting or unplugging and
    re-inserting the disk.
  * Finally, cgdisk now supports a -a option, which works similarly
    to the -a option in cfdisk.
- remove gptfdisk-0.8.5-fix-test-suite-short-opt-usage.patch, is
  upstream merged
* Wed Mar 27 2013 mmeister@suse.com
- Added url as source.
  Please see http://en.opensuse.org/SourceUrls
* Fri Jan 18 2013 sweet_f_a@gmx.de
- Update to new upstream release 0.8.6
  * add type codes for a Sony System Partition and for VMWare ESX
  * new check in the verification code
  * support for building under Solaris.
  * fix Mac OS X build
  * fix the hybrid MBR creation support that could cause it to omit
    the 0xEE partition under some circumstances
  * fix a bug that could cause a crash when passing a partition
    number of 0 via the -t option.
* Fri Jan 18 2013 sweet_f_a@gmx.de
- remove outdated (0.8.2) debian spec files from package sources
- fix build for old suse and other distros
- add gptfdisk-0.8.5-fix-test-suite-short-opt-usage.patch and
  enable test suite
- change package group to System/Base (rpmlint fix)
* Fri Jun 22 2012 jengelh@inai.de
- Update to new upstream release 0.8.5
  * sgdisk: fix bug that caused truncation of 2+ TiB partitions
    on 32-bit
  * added type codes for Midnight BSD
- Rip out unused gdisk subpackage
* Sat Mar 17 2012 dimstar@opensuse.org
- Add gptfdisk-gcc47.patch: Fix build with gcc 4.7.
* Sun Jan 22 2012 rodsmith@rodsbooks.com
- Created spec file for 0.8.2 release