Re: copypage diff
On Mon, Jul 15, 2002 at 12:14:00PM +0200, Gerfried Fuchs wrote:
[...]
> >> If noone objects I'm willing to commit it. If one does I'm just using
> >> it in my private copy ;)
> >
> > I object, it only works for German ;o)
>
> *gulp* Yeah, sorry. s/german/$language/ of course.
>
> > You could also replace
> > system "echo ..."
> > by Perl I/O commands (open, print, close).
>
> Right, dirty hack anyway. Would having another environment as switch
> for that be acceptable? Like $DWWW_COPY if you like copied Makefiles? Or
> should it be a "real" switch to the script (like with grep in @ARGS)?
>
> And if, what should be the default?
Does someone use DWWW_LANG?
IMO it is much simpler to have a language.conf file, and we could put this
choice on line 2 of this file, e.g. 'sync' and 'copy'; in attached patch,
default is 'copy', and we will change it to 'sync' when most languages use
these Makefiles.
Feel free to commit it if you like this patch.
Denis
Index: copypage.pl
===================================================================
RCS file: /cvs/webwml/webwml/copypage.pl,v
retrieving revision 1.15
diff -u -u -r1.15 copypage.pl
--- copypage.pl 2002/03/27 13:42:07 1.15
+++ copypage.pl 2002/07/15 11:38:23
@@ -14,6 +14,7 @@
use File::Path;
# Get configuration
+$copym = "copy";
if (exists $ENV{DWWW_LANG})
{
$language = $ENV{DWWW_LANG};
@@ -22,6 +23,8 @@
{
$language = <CONF>;
chomp $language;
+ $copym = <CONF> or $copym = "copy\n";
+ chomp $copym;
close CONF;
}
else
@@ -101,7 +104,17 @@
or die "Could not create $dstdir: $!\n";
if ( -e $srcmake ) {
print "creating and copying $dstmake\n";
- system "cp $srcmake $dstmake";
+ if ($copym eq 'sync')
+ {
+ open MK, "> $dstmake"
+ or die "Could not create $dstmake: $!\n";
+ print MK "include \$(subst webwml/$language,webwml/english,\$(CURDIR))/Makefile\n";
+ close MK;
+ }
+ else
+ {
+ system "cp $srcmake $dstmake";
+ }
}
}
Reply to: