Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item12225: Patch files matching by MD5 sig.
The patch should be able to apply to multiple releases. However since Text::Patch doesn't do fuzzy patching, and we want this to be relatively safe, verify the md5sum of each file before attempting to patch it. Still need backup of the files to be patched, and some documentation might be helpful. git-svn-id: http://svn.foswiki.org/trunk@15960 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
GeorgeClark
authored and
GeorgeClark
committed
Nov 8, 2012
1 parent
48152e5
commit 0c1d126
Showing
4 changed files
with
99 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 8 additions & 14 deletions
22
PatchFoswikiContrib/lib/Foswiki/Contrib/PatchFoswikiContrib/POSTINSTALL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
|
||
my $this = shift; | ||
|
||
foreach my $key ( grep /^working.*\.patch/, keys %{ $this->{_manifest}} ) { | ||
foreach my $key ( grep /^working.*\.patch/, keys %{ $this->{_manifest} } ) { | ||
|
||
my $patchFile = Foswiki::Configure::Util::mapTarget( $this->{_root}, $key ); | ||
|
||
print STDERR "Mapped $key to $patchFile\n"; | ||
$this->log("Processing $patchFile\n"); | ||
|
||
require Foswiki::Configure::PatchFile; | ||
my %result = Foswiki::Configure::PatchFile::parsePatch( $patchFile ); | ||
my %result = Foswiki::Configure::PatchFile::parsePatch($patchFile); | ||
|
||
foreach my $key ( keys %result ) { | ||
print STDERR "Processing $key\n"; | ||
next if ( $key eq 'summary' ); | ||
$this->log( $result{error} ) if ( $result{error} ); | ||
$this->log( $result{summary}{na} ) if ( $result{summary} ); | ||
|
||
my $file = Foswiki::Configure::Util::mapTarget( $this->{_root}, $key ); | ||
my $msgs = | ||
Foswiki::Configure::PatchFile::applyPatch( $this->{_root}, \%result ); | ||
|
||
print STDERR "Patching $file with (($result{$key}))\n"; | ||
|
||
my $rc = Foswiki::Configure::PatchFile::updateFile( $file, $result{$key} ); | ||
|
||
die if $rc; | ||
|
||
} | ||
$this->log($msgs); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters