[perl-Padre] Fix compatibility with ORLite-1.98

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit 7a191d76edf3fe2678737b738371b74ac6f8a759
Author: Petr Písař <ppisar@xxxxxxxxxx>
Date:   Tue Oct 15 16:20:21 2013 +0200

    Fix compatibility with ORLite-1.98

 ...o-the-delete_where-method-for-bulk-deleti.patch |  333 ++++++++++++++++++++
 perl-Padre.spec                                    |   15 +-
 2 files changed, 346 insertions(+), 2 deletions(-)
---
diff --git a/Padre-0.90-Migrating-to-the-delete_where-method-for-bulk-deleti.patch b/Padre-0.90-Migrating-to-the-delete_where-method-for-bulk-deleti.patch
new file mode 100644
index 0000000..531b474
--- /dev/null
+++ b/Padre-0.90-Migrating-to-the-delete_where-method-for-bulk-deleti.patch
@@ -0,0 +1,333 @@
+From dd579f8ce7ba1a26fb1c67bb9d82765251eacd54 Mon Sep 17 00:00:00 2001
+From: Petr Pisar <petr@xxxxxxxxxxxxxxxxxxxxxxxxx>
+Date: Tue, 15 Oct 2013 15:48:26 +0200
+Subject: [PATCH] Migrating to the delete_where method for bulk deletion to
+ align with ORLite 2.0
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is r18434 ported to 0.90 because ORLite-1.98 removed support for
+static delete() method.
+
+<https://bugzilla.redhat.com/show_bug.cgi?id=914310>
+
+Signed-off-by: Petr Písař <ppisar@xxxxxxxxxx>
+---
+ lib/Padre/DB/LastPositionInFile.pm    |  2 +-
+ lib/Padre/DB/Session.pm               | 30 ++++++++++++++----------------
+ lib/Padre/DB/SyntaxHighlight.pm       |  4 ++--
+ lib/Padre/Wx/ActionLibrary.pm         |  2 +-
+ lib/Padre/Wx/Dialog/Bookmarks.pm      |  4 +---
+ lib/Padre/Wx/Dialog/SessionManager.pm |  2 +-
+ lib/Padre/Wx/Dialog/SessionSave.pm    | 20 ++++++++++----------
+ lib/Padre/Wx/Main.pm                  | 34 ++++++++++++++++++++--------------
+ lib/Padre/Wx/Menu/File.pm             |  4 ++--
+ t/60-db.t                             |  2 +-
+ 10 files changed, 53 insertions(+), 51 deletions(-)
+
+diff --git a/lib/Padre/DB/LastPositionInFile.pm b/lib/Padre/DB/LastPositionInFile.pm
+index 3fb72e4..fc358b4 100644
+--- a/lib/Padre/DB/LastPositionInFile.pm
++++ b/lib/Padre/DB/LastPositionInFile.pm
+@@ -83,7 +83,7 @@ sub set_last_pos {
+ 	my $position = shift;
+ 
+ 	my $transaction = Padre::Current->main->lock('DB');
+-	$class->delete( 'where name = ?', $file );
++	$class->delete_where( 'name = ?', $file );
+ 	$class->create(
+ 		name     => $file,
+ 		position => $position,
+diff --git a/lib/Padre/DB/Session.pm b/lib/Padre/DB/Session.pm
+index 2fc08ba..1f9f3f9 100644
+--- a/lib/Padre/DB/Session.pm
++++ b/lib/Padre/DB/Session.pm
+@@ -10,12 +10,16 @@ package Padre::DB::Session;
+ use 5.008;
+ use strict;
+ use warnings;
++use Padre::Current ();
+ 
+ our $VERSION = '0.90';
+ 
+ my $PADRE_SESSION = 'padre-last';
+ 
+ sub last_padre_session {
++       	my $class       = shift;
++       	my $transaction = Padre::Current->main->lock('DB');
++
+ 
+ 	# find last padre session
+ 	my ($padre) = Padre::DB::Session->select(
+@@ -24,19 +28,21 @@ sub last_padre_session {
+ 	);
+ 
+ 	# no such session, create one
+-	if ( not defined $padre ) {
+-		$padre = Padre::DB::Session->new(
++        unless ( defined $padre ) {
++                $padre = $class->create(
+ 			name        => $PADRE_SESSION,
+ 			description => 'Last session within Padre',
+ 			last_update => time,
+ 		);
+-		$padre->insert;
+ 	}
++
+ 	return $padre;
+ }
+ 
+ sub clear_last_session {
+-	my $class = shift;
++        my $class       = shift;
++        my $transaction = Padre::Current->main->lock('DB');
++
+ 
+ 	# Find last padre session (shortcut if none)
+ 	my ($padre) = Padre::DB::Session->select(
+@@ -45,27 +51,19 @@ sub clear_last_session {
+ 	) or return;
+ 
+ 	# Remove any files in the session
+-	Padre::DB::SessionFile->delete(
+-		'where session = ?',
+-		$padre->id,
+-	);
++        Padre::DB::SessionFile->delete_where( 'session = ?', $padre->id );
+ 
+ 	# Remove the session itself
+-	Padre::DB::Session->delete(
+-		'where name = ?',
+-		$PADRE_SESSION,
+-	);
++        $padre->delete;
+ 
+ 	return;
+ }
+ 
+ sub files {
+-	my ($self) = @_;
+-	my @files = Padre::DB::SessionFile->select(
++        Padre::DB::SessionFile->select(
+ 		'where session = ?',
+-		$self->id
++		shift->id,
+ 	);
+-	return @files;
+ }
+ 
+ 1;
+diff --git a/lib/Padre/DB/SyntaxHighlight.pm b/lib/Padre/DB/SyntaxHighlight.pm
+index 5420157..38453ca 100644
+--- a/lib/Padre/DB/SyntaxHighlight.pm
++++ b/lib/Padre/DB/SyntaxHighlight.pm
+@@ -20,8 +20,8 @@ sub set_mime_type {
+ 	my $module    = shift;
+ 
+ 	my $transaction = Padre::Current->main->lock('DB');
+-	$class->delete(
+-		'where mime_type = ?', $mime_type,
++	$class->delete_where(
++		'mime_type = ?', $mime_type,
+ 	);
+ 	$class->create(
+ 		mime_type => $mime_type,
+diff --git a/lib/Padre/Wx/ActionLibrary.pm b/lib/Padre/Wx/ActionLibrary.pm
+index fdc59dd..2346286 100644
+--- a/lib/Padre/Wx/ActionLibrary.pm
++++ b/lib/Padre/Wx/ActionLibrary.pm
+@@ -542,7 +542,7 @@ sub init {
+ 		comment    => _T('Remove the entries from the recent files list'),
+ 		menu_event => sub {
+ 			my $lock = Padre::Current->main->lock( 'UPDATE', 'DB', 'refresh_recent' );
+-			Padre::DB::History->delete( 'where type = ?', 'files' );
++			Padre::DB::History->delete_where( 'type = ?', 'files' );
+ 		},
+ 	);
+ 
+diff --git a/lib/Padre/Wx/Dialog/Bookmarks.pm b/lib/Padre/Wx/Dialog/Bookmarks.pm
+index 3131959..b026bb7 100644
+--- a/lib/Padre/Wx/Dialog/Bookmarks.pm
++++ b/lib/Padre/Wx/Dialog/Bookmarks.pm
+@@ -66,9 +66,7 @@ sub run_set {
+ 	# Save it to the database
+ 	SCOPE: {
+ 		my $transaction = $self->main->lock('DB');
+-		Padre::DB::Bookmark->delete(
+-			'where name = ?', $name,
+-		);
++		Padre::DB::Bookmark->delete_where( 'name = ?', $name );
+ 		Padre::DB::Bookmark->create(
+ 			name => $name,
+ 			file => $path,
+diff --git a/lib/Padre/Wx/Dialog/SessionManager.pm b/lib/Padre/Wx/Dialog/SessionManager.pm
+index 076bf4c..af96200 100644
+--- a/lib/Padre/Wx/Dialog/SessionManager.pm
++++ b/lib/Padre/Wx/Dialog/SessionManager.pm
+@@ -82,7 +82,7 @@ sub _on_butdelete_clicked {
+ 
+ 	# remove session: files, then session itself
+ 	my $transaction = $self->GetParent->lock('DB');
+-	Padre::DB::SessionFile->delete( 'where session = ?', $current->id );
++	Padre::DB::SessionFile->delete_where( 'session = ?', $current->id );
+ 	$current->delete;
+ 
+ 	# update gui
+diff --git a/lib/Padre/Wx/Dialog/SessionSave.pm b/lib/Padre/Wx/Dialog/SessionSave.pm
+index 0cf96b6..8fa8c19 100644
+--- a/lib/Padre/Wx/Dialog/SessionSave.pm
++++ b/lib/Padre/Wx/Dialog/SessionSave.pm
+@@ -67,38 +67,38 @@ sub _on_butclose_clicked {
+ # handler called when the save button has been clicked.
+ #
+ sub _on_butsave_clicked {
+-	my $self = shift;
+-
++	my $self    = shift;
+ 	my $main    = $self->GetParent;
++	my $lock    = $main->lock('DB');
+ 	my $session = $self->_current_session;
+ 
+ 	# TO DO: This must be switched to use the main methods:
+-
+ 	if ( defined $session ) {
+ 
+ 		# session exist, remove all files associated to it
+-		Padre::DB::SessionFile->delete(
+-			'where session = ?',
++		Padre::DB::SessionFile->delete_where(
++			'session = ?',
+ 			$session->id
+ 		);
+ 
+ 		# Save Session description:
+ 		Padre::DB->do(
+-			'UPDATE session SET description=? WHERE id=?',
+-			{}, $self->_text->GetValue, $session->id
++                        'UPDATE session SET description = ? WHERE id = ?',
++                        {},
++                        $self->_text->GetValue,
++                        $session->id,
+ 		);
+ 	} else {
+ 
+ 		# session did not exist, create a new one
+-		$session = Padre::DB::Session->new(
++		$session = Padre::DB::Session->create(
+ 			name        => $self->_combo->GetValue,
+ 			description => $self->_text->GetValue,
+ 			last_update => time,
+ 		);
+-		$session->insert;
+ 	}
+ 
+-	# capture session and save it
++ 	# Capture session and save it
+ 	my @session = $main->capture_session;
+ 	$main->save_session( $session, @session );
+ 
+diff --git a/lib/Padre/Wx/Main.pm b/lib/Padre/Wx/Main.pm
+index bc2bc15..da96b89 100644
+--- a/lib/Padre/Wx/Main.pm
++++ b/lib/Padre/Wx/Main.pm
+@@ -3110,26 +3110,29 @@ associated to C<$session>. Note that C<$session> should already exist.
+ =cut
+ 
+ sub save_session {
+-	my ( $self, $session, @session ) = @_;
++        my $self    = shift;
++        my $session = shift;
++        my $lock    = $self->lock('DB');
+ 
+-	my $transaction = $self->lock('DB');
+-	foreach my $file (@session) {
++	foreach my $file (@_) {
+ 		$file->set( session => $session->id );
+ 		$file->insert;
+ 	}
+ 
+-	Padre::DB->do( 'UPDATE session SET last_update=? WHERE id=?', {}, time, $session->id );
+-
++        Padre::DB->do(
++                'UPDATE session SET last_update = ? WHERE id = ?', {},
++                time, $session->id,
++        );
+ }
+ 
+ sub save_current_session {
+ 	my $self = shift;
++	$self->ide->{session_autosave} or return;
+ 
+-	return if not $self->ide->{session_autosave};
+-
++	my $lock = $self->lock('DB');
+ 	my ($session) = Padre::DB::Session->select(
+ 		'where id = ?',
+-		$self->{ide}->{session}
++		$self->{ide}->{session},
+ 	);
+ 
+ 	$session ||= Padre::DB::Session->last_padre_session;
+@@ -3140,13 +3143,13 @@ sub save_current_session {
+ 		return;
+ 	}
+ 
+-	# session exist, remove all files associated to it
+-	Padre::DB::SessionFile->delete(
+-		'where session = ?',
+-		$session->id
++        # Session exist, remove all files associated to it
++        Padre::DB::SessionFile->delete_where(
++                'session = ?',
++                $session->id,
+ 	);
+ 
+-	# capture session and save it
++	# Capture session and save it
+ 	my @session = $self->capture_session;
+ 	$self->save_session( $session, @session );
+ 
+@@ -3758,7 +3761,10 @@ sub update_last_session {
+ 	# Write the current session to the database
+ 	my $transaction = $self->lock('DB');
+ 	my $session     = Padre::DB::Session->last_padre_session;
+-	Padre::DB::SessionFile->delete( 'where session = ?', $session->id );
++        Padre::DB::SessionFile->delete_where(
++                'session = ?',
++                $session->id,
++        );
+ 	$self->save_session( $session, $self->capture_session );
+ }
+ 
+diff --git a/lib/Padre/Wx/Menu/File.pm b/lib/Padre/Wx/Menu/File.pm
+index 24e4d62..0bb1d7b 100644
+--- a/lib/Padre/Wx/Menu/File.pm
++++ b/lib/Padre/Wx/Menu/File.pm
+@@ -390,8 +390,8 @@ sub on_recent {
+ 	# Because we filter for files that exist to generate the recent files
+ 	# list, anything that doesn't exist must have been deleted a short
+ 	# time ago. So we can remove it from history, it won't be coming back.
+-	Padre::DB::History->delete(
+-		'where name = ? and type = ?',
++	Padre::DB::History->delete_where(
++		'name = ? and type = ?',
+ 		$file, 'files',
+ 	);
+ 	Wx::MessageBox(
+diff --git a/t/60-db.t b/t/60-db.t
+index c5daa18..1cc8d11 100644
+--- a/t/60-db.t
++++ b/t/60-db.t
+@@ -34,7 +34,7 @@ SCOPE: {
+ 	# test delete_recent
+ 	@files = Padre::DB::History->recent('files');
+ 	is_deeply \@files, [ 'Test2.pm', 'Test.pm' ], 'files still remain after delete_recent pod';
+-	ok( Padre::DB::History->delete( 'where type = ?', 'files' ) );
++	ok( Padre::DB::History->delete_where( 'type = ?', 'files' ) );
+ 	@files = Padre::DB::History->recent('files');
+ 	is_deeply \@files, [], 'no files after delete_recent files';
+ }
+-- 
+1.8.3.1
+
diff --git a/perl-Padre.spec b/perl-Padre.spec
index 2d39b56..9853123 100644
--- a/perl-Padre.spec
+++ b/perl-Padre.spec
@@ -2,13 +2,15 @@
 
 Name:           perl-Padre
 Version:        0.90
-Release:        9%{?dist}
+Release:        10%{?dist}
 Summary:        Perl Application Development and Refactoring Environment
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Padre/
 Source0:        http://search.cpan.org/CPAN/authors/id/P/PL/PLAVEN/Padre-%{version}.tar.gz
 Source1:        padre.desktop
+# Fix compatibility with ORLite-1.98, in Padre-1.96, bug #914310
+Patch0:         Padre-0.90-Migrating-to-the-delete_where-method-for-bulk-deleti.patch
 BuildArch:      noarch
 BuildRequires:  gettext
 BuildRequires:  desktop-file-utils
@@ -84,7 +86,9 @@ BuildRequires:  perl(LWP::UserAgent) >= 5.815
 BuildRequires:  perl(Module::Build) >= 0.37
 BuildRequires:  perl(Module::CoreList) >= 2.22
 BuildRequires:  perl(Module::Manifest) >= 0.07
-BuildRequires:  perl(ORLite) >= 1.48
+# Padre-0.90 states ORLite-1.48, but we have 1.98 and a patch for Padre,
+# bug #914310
+BuildRequires:  perl(ORLite) >= 1.98
 BuildRequires:  perl(Params::Util) >= 0.33
 BuildRequires:  perl(Parse::ErrorString::Perl) >= 0.14
 BuildRequires:  perl(Parse::ExuberantCTags) >= 1.00
@@ -208,6 +212,9 @@ Requires:       perl(LWP::UserAgent) >= 5.815
 Requires:       perl(Module::Build) >= 0.37
 Requires:       perl(Module::CoreList) >= 2.22
 Requires:       perl(Module::Manifest) >= 0.07
+# Padre-0.90 states ORLite-1.48, but we have 1.98 and a patch for Padre,
+# bug #914310
+Requires:       perl(ORLite) >= 1.98
 Requires:       perl(POSIX)
 Requires:       perl(PPI) >= 1.213
 Requires:       perl(PPIx::EditorTools) >= 0.13
@@ -293,6 +300,7 @@ in a directory called .padre.
 
 %prep
 %setup -q -n Padre-%{version}
+%patch0 -p1
 
 find share/{examples,templates} -type f \( -name '*.pl' -o -name '*.t' \) \
     -exec chmod 755 {} +
@@ -374,6 +382,9 @@ mkdir "$HOME"
 
 
 %changelog
+* Tue Oct 15 2013 Petr Pisar <ppisar@xxxxxxxxxx> - 0.90-10
+- Fix compatibility with ORLite-1.98 (bug #914310)
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng@xxxxxxxxxxxxxxxxxxxxxxx> - 0.90-9
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/perl-devel





[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux