You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/09/02 16:00:26 UTC

Re: scan's diff

On Wed, 29 Aug 2001, Doug MacEachern wrote:

> On Wed, 29 Aug 2001, Stas Bekman wrote:
>
> > What's the problem with having new dependencies on CPAN? Digest::MD5 seems
> > to be a core module. Remember that everybody talks about SDKs, so we will
> > end up with dependencies anyways. If we do PREREQ_PM, CPAN will
> > automatically install all the requirements, so will Bundle::Apache2.
>
> Digest::MD5 is not a core module in 5.6.1.
> we should not be creating dependencies on cpan modules when they are not
> needed.

what happens if we bundle a pure Perl md5 implementation? No CPAN
dependency.

See http://www.equi4.com/md5/ (about 7.5k source code)

> File::Compare is a core module, use that instead.
> having cpan dependencies for building mod_perl is a pita, no matter how
> hard CPAN.pm tries to make things easy, it is not.

File::Compare is quite useless. We need to compare a variable against the
file.

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Stas Bekman <st...@stason.org>.
On Thu, 6 Sep 2001, Doug MacEachern wrote:

> On Thu, 6 Sep 2001, Stas Bekman wrote:
>
> > OK, can somebody test this patch? the latest httpd source fails to get
> > parsed for me (via 'make source_scan'), so I cannot verify my patch.
>
> whats the error?

/home/stas/perl-bleed/bin/perl util/source_scan.pl

=> I was always getting the following.

panic: not expecting 'tcpi_rcv_wscale' after array bounds in '
  u_int8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;'

=> below is the new error, since the new httpd src update

Expecting parenth after identifier in `static __inline__ apr_uuid_t *mpxs_apr_uuid_get( PerlInterpreter *my_perl, SV *CLASS)'
after `static __inline__ apr_uuid_t ' at /home/stas/perl-bleed/lib/5.7.1/C/Scan.pm line 783.
	C::Scan::do_declaration('static __inline__ apr_uuid_t *mpxs_apr_uuid_get( PerlInterpreter *my_perl, SV *CLASS)','HASH(0x8604554)','HASH(0x860ee9c)') called at /home/stas/perl-bleed/lib/5.7.1/C/Scan.pm line 738
	C::Scan::do_declarations('ARRAY(0x8604560)','HASH(0x8604554)','HASH(0x860ee9c)') called at /home/stas/perl-bleed/lib/site_perl/5.7.1/Data/Flow.pm line 69
	Data::Flow::request('Apache::ParseSource::Scan=ARRAY(0x8be8ff4)','parsed_fdecls') called at /home/stas/perl-bleed/lib/site_perl/5.7.1/Data/Flow.pm line 39
	Data::Flow::get('Apache::ParseSource::Scan=ARRAY(0x8be8ff4)','parsed_fdecls') called at lib/Apache/ParseSource.pm line 49
	Apache::ParseSource::Scan::get('Apache::ParseSource::Scan=ARRAY(0x8be8ff4)','parsed_fdecls') called at lib/Apache/ParseSource.pm line 291
	Apache::ParseSource::get_functions('ModPerl::ParseSource=HASH(0x8c31b28)') called at lib/Apache/ParseSource.pm line 381
	Apache::ParseSource::write_functions_pm('ModPerl::ParseSource=HASH(0x8c31b28)','FunctionTable.pm','ModPerl::FunctionTable') called at lib/ModPerl/ParseSource.pm line 40
	ModPerl::ParseSource::write_functions_pm('ModPerl::ParseSource=HASH(0x8c31b28)') called at util/source_scan.pl line 26
make: *** [source_scan] Error 255

> > +        (my $old = $old_content) =~ s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}//;
> > +        (my $new = $new_content) =~ s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}//;
>
> doesn't work,

must be a wrong pattern, I didn't test it :(

> but this does:
>         my $table_header = qr{^\#\s!.*};
>         (my $old = $old_content) =~ s/$table_header//mg;
>         (my $new = $new_content) =~ s/$table_header//mg;
>
> i would rather rip out the entire header anyhow, since $VERSION might
> change, we might add other stuff, etc.

since I cannot test please commit if it works for you, thanks.


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 6 Sep 2001, Stas Bekman wrote:
 
> OK, can somebody test this patch? the latest httpd source fails to get
> parsed for me (via 'make source_scan'), so I cannot verify my patch.

whats the error?

> +        (my $old = $old_content) =~ s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}//;
> +        (my $new = $new_content) =~ s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}//;

doesn't work, but this does:
        my $table_header = qr{^\#\s!.*};
        (my $old = $old_content) =~ s/$table_header//mg;
        (my $new = $new_content) =~ s/$table_header//mg;

i would rather rip out the entire header anyhow, since $VERSION might
change, we might add other stuff, etc.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Stas Bekman <st...@stason.org>.
On Wed, 5 Sep 2001, Doug MacEachern wrote:

> On Thu, 6 Sep 2001, Stas Bekman wrote:
>
> > something like that. We need to disregard: 'Sun Aug 19 10:32:24 2001'
>
> that would be fine.  as i suggested eariler, feel free to change the
> format of that header which includes the date to make it easier to rip
> this stuff out.  i'd rather see this than a .info file and the .tmp
> mv-if-diff stuff.

OK, can somebody test this patch? the latest httpd source fails to get
parsed for me (via 'make source_scan'), so I cannot verify my patch.

Thanks.

Index: lib/Apache/ParseSource.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/ParseSource.pm,v
retrieving revision 1.25
diff -u -r1.25 ParseSource.pm
--- lib/Apache/ParseSource.pm	2001/09/06 05:26:52	1.25
+++ lib/Apache/ParseSource.pm	2001/09/06 14:43:55
@@ -410,8 +410,6 @@
         $file = "$tdir/$subdir/$file";
     }

-    open my $pm, '>', $file or die "open $file: $!";
-
     # sort the hashes (including nested ones) for a consistent dump
     canonsort(\$data);

@@ -422,7 +420,7 @@
     my $version = $self->VERSION;
     my $date = scalar localtime;

-    print $pm <<EOF;
+    my $new_content = << "EOF";
 package $name;

 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -435,7 +433,30 @@

 1;
 EOF
-    close $pm;
+
+    my $old_content = '';
+    if (-e $file) {
+        open my $pm, '<', $file or die "open $file: $!";
+        local $/ = undef; # slurp the file
+        $old_content = <$pm>;
+        close $pm;
+    }
+
+    my $overwrite = 1;
+    if ($old_content) {
+        # strip the date line, which will never be the same before
+        # comparing
+        (my $old = $old_content) =~ s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}//;
+        (my $new = $new_content) =~ s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}//;
+        $overwrite = 0 if $old eq $new;
+    }
+
+    if ($overwrite) {
+        open my $pm, '>', $file or die "open $file: $!";
+        print $pm $new_content;
+        close $pm;
+    }
+
 }

 # canonsort(\$data);




_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 6 Sep 2001, Stas Bekman wrote:
 
> something like that. We need to disregard: 'Sun Aug 19 10:32:24 2001'

that would be fine.  as i suggested eariler, feel free to change the
format of that header which includes the date to make it easier to rip
this stuff out.  i'd rather see this than a .info file and the .tmp
mv-if-diff stuff.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Stas Bekman <st...@stason.org>.
On Wed, 5 Sep 2001, Barrie Slaymaker wrote:

> On Thu, Sep 06, 2001 at 10:09:28AM +0800, Stas Bekman wrote:
> > On Wed, 5 Sep 2001, Doug MacEachern wrote:
> >
> > > On Sun, 2 Sep 2001, Stas Bekman wrote:
> > >
> > > > File::Compare is quite useless. We need to compare a variable against the
> > > > file.
> > >
> > > then use 'eq', really, i just don't see a need for checksums here.
> > > but File::Compare should be usable, if changes to the header are made so
> > > date is not included, so you can do something like:
> > > generate FunctionTable.pm.new
> > > if different mv FileTable.pm.new FunctionTable.pm
> > > else unlink FunctionTable.pm.new
> > >
> > > see also mv-if-diff usage in Perl's build.
> >
> > OK, but that will work only if we take the date string out of
> > autogenerated file and put it into a .info file. Is that OK?
>
> Howsabout
>
>    my $new = $new_file_contents ;
>    my $old = slurp $file_name
>
>    s/\d\d\d\d(.\d\d){5}// for ( $new, $old ) ;
>
>    if ( $new ne $old ) {
>        write $file_name, $new_file_contents ;
>    }
>
> or am I missing something?

something like that. We need to disregard: 'Sun Aug 19 10:32:24 2001'
e.g. see xs/tables/current/Apache/ConstantsTable.pm

So probably
s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}//
will do

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Barrie Slaymaker <ba...@slaysys.com>.
On Thu, Sep 06, 2001 at 10:09:28AM +0800, Stas Bekman wrote:
> On Wed, 5 Sep 2001, Doug MacEachern wrote:
> 
> > On Sun, 2 Sep 2001, Stas Bekman wrote:
> >
> > > File::Compare is quite useless. We need to compare a variable against the
> > > file.
> >
> > then use 'eq', really, i just don't see a need for checksums here.
> > but File::Compare should be usable, if changes to the header are made so
> > date is not included, so you can do something like:
> > generate FunctionTable.pm.new
> > if different mv FileTable.pm.new FunctionTable.pm
> > else unlink FunctionTable.pm.new
> >
> > see also mv-if-diff usage in Perl's build.
> 
> OK, but that will work only if we take the date string out of
> autogenerated file and put it into a .info file. Is that OK?

Howsabout

   my $new = $new_file_contents ;
   my $old = slurp $file_name

   s/\d\d\d\d(.\d\d){5}// for ( $new, $old ) ;

   if ( $new ne $old ) {
       write $file_name, $new_file_contents ;
   }

or am I missing something?

- Barrie

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Stas Bekman <st...@stason.org>.
On Wed, 5 Sep 2001, Doug MacEachern wrote:

> On Sun, 2 Sep 2001, Stas Bekman wrote:
>
> > File::Compare is quite useless. We need to compare a variable against the
> > file.
>
> then use 'eq', really, i just don't see a need for checksums here.
> but File::Compare should be usable, if changes to the header are made so
> date is not included, so you can do something like:
> generate FunctionTable.pm.new
> if different mv FileTable.pm.new FunctionTable.pm
> else unlink FunctionTable.pm.new
>
> see also mv-if-diff usage in Perl's build.

OK, but that will work only if we take the date string out of
autogenerated file and put it into a .info file. Is that OK?


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: scan's diff

Posted by Doug MacEachern <do...@covalent.net>.
On Sun, 2 Sep 2001, Stas Bekman wrote:
 
> File::Compare is quite useless. We need to compare a variable against the
> file.

then use 'eq', really, i just don't see a need for checksums here.
but File::Compare should be usable, if changes to the header are made so
date is not included, so you can do something like:
generate FunctionTable.pm.new
if different mv FileTable.pm.new FunctionTable.pm
else unlink FunctionTable.pm.new

see also mv-if-diff usage in Perl's build.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org