On Mon, Apr 21, 2008 at 7:49 PM, James Keenan via RT
<[EMAIL PROTECTED]> wrote:
> On Mon Apr 21 07:11:23 2008, [EMAIL PROTECTED] wrote:
>
>  >
>
> > I prefer the die behavior, because with it, I don't forget to add tests
>  > with auto::crypto.
>  >
>
>  So I'm not alone, after all ;-)
>
>
>  > Now, I think the name gen::digest is not good.
>  > I prefer gen::crypto because :
>  > 1) same as auto::crypto
>  > 2) libcrypto contains cypher algo (not only digest), so we could add
>  > some PMC wrapper (for example : DES, ...)
>  >
>
>
>  The patch attached renames gen::digest to gen::crypto and makes
>  associated changes.
>
>
>  I had one problem pulling the patch.  For some reason,
>  config/gen/digest.pm was showing up in Subversion as a "binary" type.  I
>  couldn't figure out how to fix that, so if we decide to change the
>  file's name and apply this patch, we may have to do a separate 'svn rm
>  config/gen/digest.pm' to get everything in place.

Fixed. The mime type was incorrectly set to "plain/text" instead of
"text/plain". Since this is a subtle, easy to miss typo, I added
another metadata distro test to catch it sooner next time.

>  But that should be no impediment to reviewing the patch.
>
>
>
>  Thank you very much.
>
>  kid51
>
> Index: lib/Parrot/Configure/Step/List.pm
>  ===================================================================
>  --- lib/Parrot/Configure/Step/List.pm   (.../trunk)     (revision 27092)
>  +++ lib/Parrot/Configure/Step/List.pm   (.../branches/gencrypto)        
> (revision 27100)
>  @@ -69,7 +69,7 @@
>      auto::icu
>      gen::config_h
>      gen::core_pmcs
>  -    gen::digest
>  +    gen::crypto
>      gen::parrot_include
>      gen::opengl
>      gen::languages
>  Index: MANIFEST
>  ===================================================================
>  --- MANIFEST    (.../trunk)     (revision 27092)
>  +++ MANIFEST    (.../branches/gencrypto)        (revision 27100)
>  @@ -1,7 +1,7 @@
>   # ex: set ro:
>   # $Id$
>   #
>  -# generated by tools\dev\mk_manifest_and_skip.pl Mon Apr 21 20:09:14 2008 UT
>  +# generated by tools/dev/mk_manifest_and_skip.pl Mon Apr 21 23:13:41 2008 UT
>   #
>   # See tools/dev/install_files.pl for documentation on the
>   # format of this file.
>  @@ -299,8 +299,8 @@
>   config/gen/config_pm/config_lib.in                          []
>   config/gen/config_pm/myconfig.in                            []
>   config/gen/core_pmcs.pm                                     []
>  -config/gen/digest.pm                                        []
>  -config/gen/digest/digest_pmc.in                             []
>  +config/gen/crypto.pm                                        []
>  +config/gen/crypto/digest_pmc.in                             []
>   config/gen/languages.pm                                     []
>   config/gen/makefiles.pm                                     []
>   config/gen/makefiles/CFLAGS.in                              []
>  @@ -3526,6 +3526,7 @@
>   t/steps/gen_config_h-01.t                                   []
>   t/steps/gen_config_pm-01.t                                  []
>   t/steps/gen_core_pmcs-01.t                                  []
>  +t/steps/gen_crypto-01.t                                     []
>   t/steps/gen_languages-01.t                                  []
>   t/steps/gen_makefiles-01.t                                  []
>   t/steps/gen_opengl-01.t                                     []
>  Index: MANIFEST.SKIP
>  ===================================================================
>  --- MANIFEST.SKIP       (.../trunk)     (revision 27092)
>  +++ MANIFEST.SKIP       (.../branches/gencrypto)        (revision 27100)
>  @@ -1,6 +1,6 @@
>   # ex: set ro:
>   # $Id$
>  -# generated by tools/dev/mk_manifest_and_skip.pl Sat Apr 19 12:18:20 2008 UT
>  +# generated by tools/dev/mk_manifest_and_skip.pl Mon Apr 21 23:13:41 2008 UT
>   #
>   # This file should contain a transcript of the svn:ignore properties
>   # of the directories in the Parrot subversion repository. (Needed for
>  @@ -1183,6 +1183,9 @@
>   ^languages/scheme/t/syn/.*\.pir/
>   ^languages/scheme/t/syn/.*\.scheme$
>   ^languages/scheme/t/syn/.*\.scheme/
>  +# generated from svn:ignore of 'languages/squaak/'
>  +^languages/squaak/Makefile$
>  +^languages/squaak/Makefile/
>   # generated from svn:ignore of 'languages/tcl/'
>   ^languages/tcl/.*\.pdb$
>   ^languages/tcl/.*\.pdb/
>  Index: t/steps/gen_crypto-01.t
>  ===================================================================
>  --- t/steps/gen_crypto-01.t     (.../trunk)     (revision 0)
>  +++ t/steps/gen_crypto-01.t     (.../branches/gencrypto)        (revision 
> 27100)
>  @@ -0,0 +1,50 @@
>  +#! perl
>  +# Copyright (C) 2007-2008, The Perl Foundation.
>  +# $Id$
>  +# gen_crypto-01.t
>  +
>  +use strict;
>  +use warnings;
>  +use Test::More tests =>  2;
>  +use Carp;
>  +use lib qw( lib );
>  +use_ok('config::gen::crypto');
>  +
>  +=for hints_for_testing This is just a stub so that Configure.pl will run.
>  +
>  +=cut
>  +
>  +pass("Completed all tests in $0");
>  +
>  +################### DOCUMENTATION ###################
>  +
>  +=head1 NAME
>  +
>  +  gen_crypto-01.t - test config::gen::crypto
>  +
>  +=head1 SYNOPSIS
>  +
>  +    % prove t/steps/gen_crypto-01.t
>  +
>  +=head1 DESCRIPTION
>  +
>  +The files in this directory test functionality used by F<Configure.pl>.
>  +
>  +The tests in this file test config::gen::crypto.
>  +
>  +=head1 AUTHOR
>  +
>  +James E Keenan
>  +
>  +=head1 SEE ALSO
>  +
>  +config::gen::crypto, F<Configure.pl>.
>  +
>  +=cut
>  +
>  +# Local Variables:
>  +#   mode: cperl
>  +#   cperl-indent-level: 4
>  +#   fill-column: 100
>  +# End:
>  +# vim: expandtab shiftwidth=4:
>
>  Property changes on: t/steps/gen_crypto-01.t
>  ___________________________________________________________________
>  Name: svn:eol-style
>    + native
>  Name: svn:mime-type
>    + text/plain
>  Name: svn:keywords
>    + Author Date Id Revision
>
>  Index: config/gen/digest.pm
>  ===================================================================
>  Cannot display: file marked as a binary type.
>  svn:mime-type = plain/text
>  Index: config/gen/crypto/digest_pmc.in
>  ===================================================================
>  --- config/gen/crypto/digest_pmc.in     (.../trunk)     (revision 0)
>  +++ config/gen/crypto/digest_pmc.in     (.../branches/gencrypto)        
> (revision 27100)
>  @@ -0,0 +1,160 @@
>  +/*
>  +Copyright (C) 2008, The Perl Foundation.
>  +$Id$
>  +
>  +=head1 NAME
>  +
>  +src/dynpmc/@[EMAIL PROTECTED] - @md_name@ wrapper of libcrypto (libssl)
>  +
>  +=head1 DESCRIPTION
>  +
>  +See L<www.openssl.org>
>  +
>  +=head2 Methods
>  +
>  +=over 4
>  +
>  +=cut
>  +
>  +*/
>  +
>  +#include <openssl/@[EMAIL PROTECTED]>
>  +
>  +pmclass @md_name@
>  +    dynpmc
>  +    need_ext
>  +    group digest_group {
>  +
>  +/*
>  +
>  +=item C<void init()>
>  +
>  +=cut
>  +
>  +*/
>  +    void init() {
>  +#ifndef [EMAIL PROTECTED]@
>  +        @md_ctx@ *c     = mem_allocate_zeroed_typed(@md_ctx@);
>  +        PMC_data(SELF) = c;
>  +        PObj_active_destroy_SET(SELF);
>  +#else
>  +        real_exception(interp, NULL, ILL_INHERIT, "@md_name@ is disabled");
>  +#endif
>  +    }
>  +
>  +/*
>  +
>  +=item C<void destroy()>
>  +
>  +=cut
>  +
>  +*/
>  +    void destroy() {
>  +#ifndef [EMAIL PROTECTED]@
>  +        @md_ctx@ *c = PMC_data_typed(SELF, @md_ctx@ *);
>  +        if (c) {
>  +            mem_sys_free(c);
>  +            PMC_data(SELF) = NULL;
>  +        }
>  +#endif
>  +    }
>  +
>  +/*
>  +
>  +=item C<PMC* clone()>
>  +
>  +=cut
>  +
>  +*/
>  +    PMC* clone() {
>  +#ifndef [EMAIL PROTECTED]@
>  +        PMC     *retval  = pmc_new_noinit(INTERP, SELF->vtable->base_type);
>  +        @md_ctx@ *c       = mem_allocate_zeroed_typed(@md_ctx@);
>  +
>  +        memcpy(c, PMC_data(SELF), sizeof (@md_ctx@));
>  +        PMC_data(retval) = c;
>  +
>  +        PObj_active_destroy_SET(retval);
>  +        return retval;
>  +#else
>  +        return NULL;
>  +#endif
>  +    }
>  +
>  +
>  +/*
>  +
>  +=back
>  +
>  +=head2 Specific Methods
>  +
>  +=over 4
>  +
>  +=item C<void Init()>
>  +
>  +=cut
>  +
>  +*/
>  +    METHOD void Init() {
>  +#ifndef [EMAIL PROTECTED]@
>  +        @md_ctx@ *c = PMC_data_typed(SELF, @md_ctx@ *);
>  +        (void)@[EMAIL PROTECTED](c);
>  +#endif
>  +    }
>  +
>  +/*
>  +
>  +=item C<void Update(STRING *buf)>
>  +
>  +=cut
>  +
>  +*/
>  +    METHOD void Update(STRING *buf) {
>  +#ifndef [EMAIL PROTECTED]@
>  +        @md_ctx@ *c = PMC_data_typed(SELF, @md_ctx@ *);
>  +        (void)@[EMAIL PROTECTED](c, (unsigned char *)buf->strstart, 
> buf->bufused);
>  +#endif
>  +    }
>  +
>  +/*
>  +
>  +=item C<STRING* Final()>
>  +
>  +=cut
>  +
>  +*/
>  +    METHOD STRING* Final() {
>  +#ifndef [EMAIL PROTECTED]@
>  +        unsigned char [EMAIL PROTECTED]@_LENGTH];
>  +        @md_ctx@      *c = PMC_data_typed(SELF, @md_ctx@ *);
>  +        STRING       *retval;
>  +
>  +        (void)@[EMAIL PROTECTED](digest, c);
>  +        retval = string_from_cstring(INTERP, (char *)digest, @[EMAIL 
> PROTECTED]);
>  +
>  +        RETURN(STRING *retval);
>  +#else
>  +        return NULL;
>  +#endif
>  +    }
>  +
>  +}
>  +
>  +/*
>  +
>  +=back
>  +
>  +=head1 AUTHORS
>  +
>  +Francois Perrad
>  +
>  +=cut
>  +
>  +*/
>  +
>  +/*
>  + * Local variables:
>  + *   c-file-style: "parrot"
>  + * End:
>  + * vim: expandtab shiftwidth=4:
>  + */
>
>  Property changes on: config/gen/crypto/digest_pmc.in
>  ___________________________________________________________________
>  Name: svn:mime-type
>    + text/plain
>  Name: svn:keywords
>    + Author Date Id Revision
>  Name: svn:eol-style
>    + native
>
>  Index: config/gen/crypto.pm
>  ===================================================================
>  --- config/gen/crypto.pm        (.../trunk)     (revision 0)
>  +++ config/gen/crypto.pm        (.../branches/gencrypto)        (revision 
> 27100)
>  @@ -0,0 +1,81 @@
>  +# Copyright (C) 2008, The Perl Foundation.
>  +# $Id: crypto.pm 27096 2008-04-21 23:11:53Z jkeenan $
>  +
>  +=head1 NAME
>  +
>  +config/gen/crypto.pm - Digest PMC Files
>  +
>  +=head1 DESCRIPTION
>  +
>  +Generates Digest PMC files.
>  +
>  +=cut
>  +
>  +package gen::crypto;
>  +
>  +use strict;
>  +use warnings;
>  +
>  +
>  +use base qw(Parrot::Configure::Step);
>  +
>  +use Parrot::Configure::Utils ':gen';
>  +
>  +sub _init {
>  +    my $self = shift;
>  +    my %data;
>  +    $data{description} = q{Generating Digest PMC files};
>  +    $data{result}      = q{};
>  +    return \%data;
>  +}
>  +
>  +my %digest = (
>  +    MD2         => {},
>  +    MD4         => {},
>  +    MD5         => {},
>  +    RIPEMD160   => {
>  +        md_inc => 'ripemd',
>  +    },
>  +    SHA         => {},
>  +    SHA1        => {
>  +        md_inc => 'sha',
>  +        md_ctx => 'SHA_CTX',
>  +        md_digest => 'SHA_DIGEST',
>  +    },
>  +    SHA256      => {},
>  +    SHA512      => {},
>  +);
>  +
>  +sub runstep {
>  +    my ( $self, $conf ) = @_;
>  +
>  +    my $verbose  = $conf->options->get('verbose');
>  +    unless ( $conf->data->get('has_crypto') ) {
>  +        $self->set_result('skipped');
>  +        return 1;
>  +    }
>  +
>  +    while (my ($md, $val) = each(%digest)) {
>  +        my $file = lc $md;
>  +        $conf->data->set( md_name => $md );
>  +        $conf->data->set( md_file => $file );
>  +        $conf->data->set( md_inc => $val->{md_inc} || $file );
>  +        $conf->data->set( md_ctx => $val->{md_ctx} || $md . '_CTX' );
>  +        $conf->data->set( md_digest => $val->{md_digest} || $md . '_DIGEST' 
> );
>  +        $conf->genfile(
>  +            'config/gen/crypto/digest_pmc.in' => "src/dynpmc/${file}.pmc",
>  +            comment_type => '/*',
>  +        );
>  +    }
>  +
>  +    return 1;
>  +}
>  +
>  +1;
>  +
>  +# Local Variables:
>  +#   mode: cperl
>  +#   cperl-indent-level: 4
>  +#   fill-column: 100
>  +# End:
>  +# vim: expandtab shiftwidth=4:
>
>



-- 
Will "Coke" Coleda

Reply via email to