Bugzilla – Attachment 28445 Details for
Bug 12061
tmpl_process3.pl new features
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12061 - tmpl_process3.pl - Include/exclude file by name
Bug-12061---tmplprocess3pl---Includeexclude-file-b.patch (text/plain), 4.70 KB, created by
Bernardo Gonzalez Kriegel
on 2014-05-22 14:28:45 UTC
(
hide
)
Description:
Bug 12061 - tmpl_process3.pl - Include/exclude file by name
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2014-05-22 14:28:45 UTC
Size:
4.70 KB
patch
obsolete
>From e1cd771a75016806cc7c66b2d72078639a367160 Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Wed, 9 Apr 2014 22:30:35 -0300 >Subject: [PATCH] Bug 12061 - tmpl_process3.pl - Include/exclude file by name > >This patch adds two options to tmpl_process3.pl >for include/exclude some files by matching their >names. > >To test after patch: > >A) Include only 'normarc' >1. create >cd misc/translator >perl tmpl_process3.pl create -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s normarc.po -r -m normarc >- check provenance of strings >egrep "^#:" normarc.po | cut -d":" -f2 | sort | uniq >- only files with normarc in their names must be present > >2. update >perl tmpl_process3.pl update -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s normarc.po -r -m normarc >- repeat check > >3. install >mkdir test >perl tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/bootstrap/en -o ./test -s normarc.po -r -m normarc >- check name of created files > >rm -rf test normarc.po > >B) Exclude >4. create >perl tmpl_process3.pl create -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s xnormarc.po -r -n normarc >- check provenance >egrep "^#:" xnormarc.po | cut -d":" -f2 | sort | uniq | grep -i normarc >- there must be no results > >5. update >perl tmpl_process3.pl update -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s xnormarc.po -r -n normarc >- check provenance > >6. install >mkdir test >perl tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/bootstrap/en -o ./test -s xnormarc.po -r -n normarc >- check files >find test | grep -i normarc >- there must be no results > >You can also try another combination, use for example -m/-n "patron|user|bottom" >or mixed "-m marc -n normarc", do create/install and look filenames >--- > misc/translator/tmpl_process3.pl | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl >index 4c23a8f..9bf63d0 100755 >--- a/misc/translator/tmpl_process3.pl >+++ b/misc/translator/tmpl_process3.pl >@@ -24,6 +24,7 @@ use VerboseWarnings qw( :warn :die ); > > use vars qw( @in_dirs @filenames $str_file $out_dir $quiet ); > use vars qw( @excludes $exclude_regex ); >+use vars qw( $match $nomatch ); > use vars qw( $recursive_p ); > use vars qw( $pedantic_p ); > use vars qw( $href ); >@@ -144,9 +145,11 @@ sub listfiles { > || (defined $exclude_regex && $dirent =~ /^(?:$exclude_regex)$/)) { > ; > } elsif (-f $path) { >- my $basename = basename $path; >+ my $basename = fileparse( $path ); > push @it, $path > if ( not @$filenames or ( grep { $path =~ /$_/ } @$filenames ) ) >+ and ( not defined $match or $basename =~ /($match)/i ) # files to include >+ and ( not defined $nomatch or $basename !~ /($nomatch)/i ) # files not to include > and (!defined $type || $dirent =~ /\.(?:$type)$/) || $action eq 'install'; > } elsif (-d $path && $recursive_p) { > push @it, listfiles($path, $type, $action, $filenames); >@@ -167,7 +170,7 @@ sub mkdir_recursive ($) { > my ($prefix, $basename) = ($dir =~ /\/([^\/]+)$/s)? ($`, $1): ('.', $dir); > mkdir_recursive($prefix) if $prefix ne '.' && !-d $prefix; > if (!-d $dir) { >- print STDERR "Making directory $dir..." unless $quiet; >+ print STDERR "Making directory $dir...\n" unless $quiet; > # creates with rwxrwxr-x permissions > mkdir($dir, 0775) || warn_normal "$dir: $!", undef; > } >@@ -196,7 +199,11 @@ Create or update PO files from templates, or install translated templates. > If given, only these files will be processed. > -s, --str-file=FILE Specify FILE as the translation (po) file > for input (install) or output (create, update) >- -x, --exclude=REGEXP Exclude files matching the given REGEXP >+ -x, --exclude=REGEXP Exclude dirs matching the given REGEXP >+ -m, --match=STRING Pipe (|) separated list. Include only files >+ with names matching the given REGEXP >+ -n, --nomatch=STRING Pipe (|) separated list. Exclude all files >+ with names matching the given STRING > --help Display this help and exit > -q, --quiet no output to screen (except for errors) > >@@ -225,6 +232,8 @@ GetOptions( > 'recursive|r' => \$recursive_p, > 'str-file|s=s' => \$str_file, > 'exclude|x=s' => \@excludes, >+ 'match|m=s' => \$match, >+ 'nomatch|n=s' => \$nomatch, > 'quiet|q' => \$quiet, > 'pedantic-warnings|pedantic' => sub { $pedantic_p = 1 }, > 'help' => \&usage, >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12061
:
26943
|
26944
|
26945
|
28443
|
28444
|
28445
|
28450
|
28451
|
28643
|
28644
|
28645
|
28735
|
28736
|
28737
|
30148
|
30966