From 6a4655ca40b2abcf9a95392c5c615a56968d44e9 Mon Sep 17 00:00:00 2001 From: Deji Akingunola Date: Mon, 4 Jul 2011 09:07:26 -0400 Subject: [PATCH] Apply upstream patch to build with parted-3.0 --- gparted-libparted_3-config.patch | 74 ++++++ gparted-libparted_3-src.patch | 372 +++++++++++++++++++++++++++++++ gparted.spec | 14 +- 3 files changed, 458 insertions(+), 2 deletions(-) create mode 100644 gparted-libparted_3-config.patch create mode 100644 gparted-libparted_3-src.patch diff --git a/gparted-libparted_3-config.patch b/gparted-libparted_3-config.patch new file mode 100644 index 0000000..e5d9bb5 --- /dev/null +++ b/gparted-libparted_3-config.patch @@ -0,0 +1,74 @@ +diff --git a/configure.in b/configure.in +index 427de2a..436051d 100644 +--- a/configure.in ++++ b/configure.in +@@ -131,6 +131,55 @@ int main () + LIBS="$LIBS_save" + + ++dnl====================== ++dnl check whether libparted >= 3.0 (libparted is missing file system resizing API) ++dnl====================== ++LIBPARTED_VERSION=3.0 ++AC_MSG_CHECKING([if libparted >= $LIBPARTED_VERSION (libparted is missing file system resizing API)]) ++LIBS_save="$LIBS" ++LIBS="-lparted -luuid -ldl" ++need_work_around=yes ++AC_TRY_RUN([ ++#include ++#include ++ ++int main () ++{ ++ int min_major = 0; ++ int min_minor = 0; ++ int min_micro = 0; ++ int major = 0; ++ int minor = 0; ++ int micro = 0; ++ ++ if ( ( sscanf( "$LIBPARTED_VERSION", "%d.%d.%d", &min_major, &min_minor, &min_micro ) == 3 ) || ++ ( sscanf( "$LIBPARTED_VERSION", "%d.%d", &min_major, &min_minor ) == 2 ) || ++ ( sscanf( "$LIBPARTED_VERSION", "%d", &min_major ) == 1 ) ++ ) ++ { ++ if ( ( sscanf( ped_get_version(), "%d.%d.%d", &major, &minor, µ ) == 3 ) || ++ ( sscanf( ped_get_version(), "%d.%d", &major, &minor ) == 2 ) || ++ ( sscanf( ped_get_version(), "%d", &major ) == 1 ) ++ ) ++ { ++ return ! ( (major > min_major) || ++ ( (major == min_major) && (minor > min_minor) ) || ++ ( (major == min_major) && (minor == min_minor) && (micro >= min_micro) ) ++ ) ; ++ } ++ } ++ ++ return 1 ; ++} ++], [AC_MSG_RESULT([yes]) ++ AC_DEFINE([HAVE_LIBPARTED_3_0_0_PLUS], [1], [Define to 1 if libparted >= 3.0]) ++ have_lp_fs_resize_api=no] ++, [AC_MSG_RESULT([no]) ++ have_lp_fs_resize_api=yes] ++) ++LIBS="$LIBS_save" ++ ++ + dnl GTKMM + PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 > 2.8]) + AC_SUBST([GTKMM_LIBS]) +@@ -215,9 +215,12 @@ + echo "" + echo " Build documentation? : $enable_doc" + echo "" ++echo " Use native libparted dmraid support? : $enable_libparted_dmraid" ++echo "" ++echo " --- Features Based On Libparted Version ---" + echo " Need part table re-read work around? : $need_pt_reread_work_around" + echo " Supports sector sizes > 512 bytes? : $support_sector_size_gt_512" +-echo " Use native libparted dmraid support? : $enable_libparted_dmraid" ++echo " Have libparted file system resizing API? : $have_lp_fs_resize_api" + echo "" + echo " If all settings are OK, type make and make install " + echo "========================================================" diff --git a/gparted-libparted_3-src.patch b/gparted-libparted_3-src.patch new file mode 100644 index 0000000..cd15efc --- /dev/null +++ b/gparted-libparted_3-src.patch @@ -0,0 +1,372 @@ +diff --git a/include/GParted_Core.h b/include/GParted_Core.h +index 55bd6f5..03ad852 100644 +--- a/include/GParted_Core.h ++++ b/include/GParted_Core.h +@@ -1,5 +1,5 @@ + /* Copyright (C) 2004 Bart +- * Copyright (C) 2008, 2009, 2010 Curtis Gedak ++ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -78,7 +78,9 @@ private: + bool inside_extended ) ; + void set_mountpoints( std::vector & partitions ) ; + void set_used_sectors( std::vector & partitions ) ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + void LP_set_used_sectors( Partition & partition ); ++#endif + void set_flags( Partition & partition ) ; + + //operationstuff... +@@ -103,9 +105,11 @@ private: + bool move_filesystem( const Partition & partition_old, + const Partition & partition_new, + OperationDetail & operationdetail ) ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + bool resize_move_filesystem_using_libparted( const Partition & partition_old, + const Partition & partition_new, + OperationDetail & operationdetail ) ; ++#endif + bool resize( const Partition & partition_old, + const Partition & partition_new, + OperationDetail & operationdetail ) ; +@@ -176,7 +180,9 @@ private: + Partition & partition_new, + OperationDetail & operationdetail ) ; + bool set_proper_filesystem( const FILESYSTEM & filesystem ) ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + bool erase_filesystem_signatures( const Partition & partition ) ; ++#endif + bool update_bootsector( const Partition & partition, OperationDetail & operationdetail ) ; + + //general.. +diff --git a/include/Utils.h b/include/Utils.h +index 180416b..e154d6f 100644 +--- a/include/Utils.h ++++ b/include/Utils.h +@@ -1,5 +1,5 @@ + /* Copyright (C) 2004 Bart +- * Copyright (C) 2008, 2009, 2010 Curtis Gedak ++ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -94,7 +94,9 @@ struct FS + { + NONE = 0, + GPARTED = 1, ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + LIBPARTED = 2, ++#endif + EXTERNAL = 3 + }; + +diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc +index 7ecb2e5..7be8ef4 100644 +--- a/src/Dialog_Partition_New.cc ++++ b/src/Dialog_Partition_New.cc +@@ -1,5 +1,5 @@ + /* Copyright (C) 2004 Bart +- * Copyright (C) 2008, 2009, 2010 Curtis Gedak ++ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -61,7 +61,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, + FS fs_tmp ; + //add FS_UNFORMATTED + fs_tmp .filesystem = GParted::FS_UNFORMATTED ; +- fs_tmp .create = GParted::FS::LIBPARTED ; ++ fs_tmp .create = FS::GPARTED ; + this ->FILESYSTEMS .push_back( fs_tmp ) ; + + //add FS_EXTENDED +diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc +index 847ca74..a39b88f 100644 +--- a/src/GParted_Core.cc ++++ b/src/GParted_Core.cc +@@ -1223,8 +1223,10 @@ void GParted_Core::read_label( Partition & partition ) + if ( set_proper_filesystem( partition .filesystem ) ) + p_filesystem ->read_label( partition ) ; + break ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case FS::LIBPARTED: + break ; ++#endif + + default: + break ; +@@ -1396,9 +1398,11 @@ void GParted_Core::set_used_sectors( std::vector & partitions ) + if ( set_proper_filesystem( partitions[ t ] .filesystem ) ) + p_filesystem ->set_used_sectors( partitions[ t ] ) ; + break ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case GParted::FS::LIBPARTED : + LP_set_used_sectors( partitions[ t ] ) ; + break ; ++#endif + + default: + break ; +@@ -1430,6 +1434,7 @@ void GParted_Core::set_used_sectors( std::vector & partitions ) + } + } + ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + void GParted_Core::LP_set_used_sectors( Partition & partition ) + { + PedFileSystem *fs = NULL; +@@ -1458,6 +1463,7 @@ void GParted_Core::LP_set_used_sectors( Partition & partition ) + } + } + } ++#endif + + void GParted_Core::set_flags( Partition & partition ) + { +@@ -1572,7 +1578,11 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail + close_device_and_disk() ; + } + +- bool succes = new_partition .partition_number > 0 && erase_filesystem_signatures( new_partition ) ; ++ bool succes = new_partition .partition_number > 0 ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS ++ && erase_filesystem_signatures( new_partition ) ++#endif ++ ; + + #ifndef USE_LIBPARTED_DMRAID + //create dev map entries if dmraid +@@ -1600,8 +1610,10 @@ bool GParted_Core::create_filesystem( const Partition & partition, OperationDeta + break ; + case GParted::FS::GPARTED: + break ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case GParted::FS::LIBPARTED: + break ; ++#endif + case GParted::FS::EXTERNAL: + succes = set_proper_filesystem( partition .filesystem ) && + p_filesystem ->create( partition, operationdetail .get_last_child() ) ; +@@ -1614,9 +1626,11 @@ bool GParted_Core::create_filesystem( const Partition & partition, OperationDeta + } + + bool GParted_Core::format( const Partition & partition, OperationDetail & operationdetail ) +-{ ++{ ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + //remove all file system signatures... + erase_filesystem_signatures( partition ) ; ++#endif + + return set_partition_type( partition, operationdetail ) && create_filesystem( partition, operationdetail ) ; + } +@@ -1684,8 +1698,10 @@ bool GParted_Core::label_partition( const Partition & partition, OperationDetail + succes = set_proper_filesystem( partition .filesystem ) && + p_filesystem ->write_label( partition, operationdetail .get_last_child() ) ; + break ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case FS::LIBPARTED: + break ; ++#endif + + default: + break ; +@@ -1867,11 +1883,13 @@ bool GParted_Core::move_filesystem( const Partition & partition_old, + succes = copy_filesystem( partition_old, partition_new, operationdetail .get_last_child() ) ; + + break ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case GParted::FS::LIBPARTED: + succes = resize_move_filesystem_using_libparted( partition_old, + partition_new, + operationdetail .get_last_child() ) ; + break ; ++#endif + case GParted::FS::EXTERNAL: + succes = set_proper_filesystem( partition_new .filesystem ) && + p_filesystem ->move( partition_old +@@ -1885,6 +1903,7 @@ bool GParted_Core::move_filesystem( const Partition & partition_old, + return succes ; + } + ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & partition_old, + const Partition & partition_new, + OperationDetail & operationdetail ) +@@ -1921,6 +1940,7 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par + + return return_value ; + } ++#endif + + bool GParted_Core::resize( const Partition & partition_old, + const Partition & partition_new, +@@ -2173,11 +2193,13 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old, + break ; + case GParted::FS::GPARTED: + break ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case GParted::FS::LIBPARTED: + succes = resize_move_filesystem_using_libparted( partition_old, + partition_new, + operationdetail .get_last_child() ) ; + break ; ++#endif + case GParted::FS::EXTERNAL: + succes = set_proper_filesystem( partition_new .filesystem ) && + p_filesystem ->resize( partition_new, +@@ -2244,10 +2266,12 @@ bool GParted_Core::copy( const Partition & partition_src, + partition_dst, + operationdetail .get_last_child() ) ; + break ; +- ++ ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case GParted::FS::LIBPARTED : + //FIXME: see if copying through libparted has any advantages + break ; ++#endif + + case GParted::FS::EXTERNAL : + succes = set_proper_filesystem( partition_dst .filesystem ) && +@@ -2479,8 +2503,10 @@ bool GParted_Core::check_repair_filesystem( const Partition & partition, Operati + break ; + case GParted::FS::GPARTED: + break ; ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + case GParted::FS::LIBPARTED: + break ; ++#endif + case GParted::FS::EXTERNAL: + succes = set_proper_filesystem( partition .filesystem ) && + p_filesystem ->check_repair( partition, operationdetail .get_last_child() ) ; +@@ -2908,7 +2934,8 @@ bool GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem ) + + return p_filesystem ; + } +- ++ ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + bool GParted_Core::erase_filesystem_signatures( const Partition & partition ) + { + bool return_value = false ; +@@ -2935,7 +2962,8 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition ) + + return return_value ; + } +- ++#endif ++ + bool GParted_Core::update_bootsector( const Partition & partition, OperationDetail & operationdetail ) + { + //only for ntfs atm... +diff --git a/src/fat16.cc b/src/fat16.cc +index a9d418a..2fe73c9 100644 +--- a/src/fat16.cc ++++ b/src/fat16.cc +@@ -1,5 +1,5 @@ + /* Copyright (C) 2004 Bart +- * Copyright (C) 2008, 2009, 2010 Curtis Gedak ++ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -49,11 +49,15 @@ FS fat16::get_filesystem_support() + fs .write_label = FS::EXTERNAL ; + } + ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + //resizing of start and endpoint are provided by libparted + fs .grow = GParted::FS::LIBPARTED ; + fs .shrink = GParted::FS::LIBPARTED ; + fs .move = GParted::FS::LIBPARTED ; +- ++#else ++ fs.move = FS::GPARTED ; ++#endif ++ + fs .copy = GParted::FS::GPARTED ; + + fs .MIN = 16 * MEBIBYTE ; +diff --git a/src/fat32.cc b/src/fat32.cc +index f7990dd..8860a5e 100644 +--- a/src/fat32.cc ++++ b/src/fat32.cc +@@ -1,5 +1,5 @@ + /* Copyright (C) 2004 Bart +- * Copyright (C) 2008, 2009, 2010 Curtis Gedak ++ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -48,12 +48,16 @@ FS fat32::get_filesystem_support() + fs .read_label = FS::EXTERNAL ; + fs .write_label = FS::EXTERNAL ; + } +- ++ ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + //resizing of start and endpoint are provided by libparted + fs .grow = GParted::FS::LIBPARTED ; + fs .shrink = GParted::FS::LIBPARTED ; + fs .move = GParted::FS::LIBPARTED ; +- ++#else ++ fs .move = FS::GPARTED ; ++#endif ++ + fs .copy = GParted::FS::GPARTED ; + + fs .MIN = 32 * MEBIBYTE ; //smaller fs'es will cause windows scandisk to fail.. +diff --git a/src/hfs.cc b/src/hfs.cc +index aa6fed7..0856aaa 100644 +--- a/src/hfs.cc ++++ b/src/hfs.cc +@@ -1,5 +1,5 @@ + /* Copyright (C) 2004 Bart +- * Copyright (C) 2008, 2009, 2010 Curtis Gedak ++ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -27,9 +27,11 @@ FS hfs::get_filesystem_support() + FS fs ; + + fs .filesystem = GParted::FS_HFS ; +- ++ ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + fs .read = GParted::FS::LIBPARTED ; + fs .shrink = GParted::FS::LIBPARTED ; ++#endif + + if ( ! Glib::find_program_in_path( "hformat" ) .empty() ) + fs .create = GParted::FS::EXTERNAL ; +diff --git a/src/hfsplus.cc b/src/hfsplus.cc +index bb5126d..31925a0 100644 +--- a/src/hfsplus.cc ++++ b/src/hfsplus.cc +@@ -1,5 +1,5 @@ + /* Copyright (C) 2004 Bart +- * Copyright (C) 2008, 2009, 2010 Curtis Gedak ++ * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -27,10 +27,12 @@ FS hfsplus::get_filesystem_support() + FS fs ; + + fs .filesystem = GParted::FS_HFSPLUS ; +- ++ ++#ifndef HAVE_LIBPARTED_3_0_0_PLUS + fs .read = GParted::FS::LIBPARTED ; + fs .shrink = GParted::FS::LIBPARTED ; +- ++#endif ++ + if ( ! Glib::find_program_in_path( "mkfs.hfsplus" ) .empty() ) + fs .create = GParted::FS::EXTERNAL ; + diff --git a/gparted.spec b/gparted.spec index 09e9165..cbcb5b9 100644 --- a/gparted.spec +++ b/gparted.spec @@ -1,18 +1,21 @@ Summary: Gnome Partition Editor Name: gparted Version: 0.8.1 -Release: 1%{?dist} +Release: 2%{?dist} Group: Applications/System License: GPLv2+ URL: http://gparted.sourceforge.net Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 Source1: gparted-console.apps Source2: gparted-pam.d +Patch0: gparted-libparted_3-config.patch +Patch1: gparted-libparted_3-src.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gtkmm24-devel parted-devel BuildRequires: libuuid-devel gettext perl(XML::Parser) BuildRequires: desktop-file-utils gnome-doc-utils intltool BuildRequires: rarian-compat +BuildRequires: automake autoconf gnome-common %description GParted stands for Gnome Partition Editor and is a graphical frontend to @@ -23,9 +26,13 @@ will be detected at runtime and don't require a rebuild of GParted %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build -%configure +PKG_NAME="gparted" REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 USE_COMMON_DOC_BUILD=yes . gnome-autogen.sh + +%configure --enable-libparted-dmraid make %{?_smp_mflags} %install @@ -85,6 +92,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %config(noreplace) %{_sysconfdir}/security/console.apps/gparted %changelog +* Sun Jun 26 2011 Deji Akingunola - 0.8.1-2 +- Apply upstream patch to build with parted-3.0 + * Sun Jun 26 2011 Deji Akingunola - 0.8.1-1 - Update to version 0.8.1