diff options
author | Kent Fredric <kentfredric@gmail.com> | 2010-08-15 04:04:53 +1200 |
---|---|---|
committer | Kent Fredric <kentfredric@gmail.com> | 2010-08-15 04:04:53 +1200 |
commit | 286ee3f1aecc7b021d12c870aca871ef1b699cc0 (patch) | |
tree | 5e4e0cd0f6d2b57dea18b02402b24d916d6a2aff /dev-perl/TryCatch | |
parent | [new] dev-perl/App-perlbrew-0.09 (diff) | |
download | perl-overlay-286ee3f1aecc7b021d12c870aca871ef1b699cc0.tar.gz perl-overlay-286ee3f1aecc7b021d12c870aca871ef1b699cc0.tar.bz2 perl-overlay-286ee3f1aecc7b021d12c870aca871ef1b699cc0.zip |
[rversion-patched,unkeyworded] dev-perl/TryCatch-1.002000-r1 : Better perl-5.12 support. Still fails tests.
(Portage version: 2.2_rc67/git/Linux x86_64)
(Signed Manifest commit)
Diffstat (limited to 'dev-perl/TryCatch')
-rw-r--r-- | dev-perl/TryCatch/ChangeLog | 13 | ||||
-rw-r--r-- | dev-perl/TryCatch/Manifest | 22 | ||||
-rw-r--r-- | dev-perl/TryCatch/TryCatch-1.002000-r1.ebuild | 35 | ||||
-rw-r--r-- | dev-perl/TryCatch/files/0001-Change-how-wantarray-is-tweaked-to-work-better-with-.patch | 284 |
4 files changed, 348 insertions, 6 deletions
diff --git a/dev-perl/TryCatch/ChangeLog b/dev-perl/TryCatch/ChangeLog index 1cb04fb12..29c1c3860 100644 --- a/dev-perl/TryCatch/ChangeLog +++ b/dev-perl/TryCatch/ChangeLog @@ -1,7 +1,18 @@ # ChangeLog for dev-perl/TryCatch -# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ +*TryCatch-1.002000-r1 (14 Aug 2010) + + 14 Aug 2010; Kent Fredric <kentfredric@gmail.com> + +files/0001-Change-how-wantarray-is-tweaked-to-work-better-with-.patch, + +TryCatch-1.002000-r1.ebuild: + Added patched version to get closer to upstream for perl-5.12 users. + Presenty its kinda broken on 5.12, but this makes it less broken, and most + tests pass. It appears to only lack support for a few syntax checking + nicities. However, its unofficial hackery, so its unsupported, and thus + unkeyworded. If you unmask it, expect it to fail tests. =). + *TryCatch-1.002000 (14 Sep 2009) 14 Sep 2009; Kent Fredric <kentfredric@gmail.com> diff --git a/dev-perl/TryCatch/Manifest b/dev-perl/TryCatch/Manifest index e86f772cf..9b989ea2c 100644 --- a/dev-perl/TryCatch/Manifest +++ b/dev-perl/TryCatch/Manifest @@ -1,16 +1,28 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 +AUX 0001-Change-how-wantarray-is-tweaked-to-work-better-with-.patch 8127 RMD160 2a4ab8fca653b2be91ca97785a9544653bc81c68 SHA1 32444e2850f12c87324ac84d70ea885ed082d5a0 SHA256 310731246fe97c2376036750870034abfed699f0f31c51a1ca5340b339313f4f DIST TryCatch-1.001001.tar.gz 72853 RMD160 d1cc57ce7fc07fa3d390271ff1a92f718da69a6b SHA1 066895656ff44b477be52b9644cf59cffbd3c517 SHA256 e7d5c60910dee6923187c3cb8f0d7c3b69dd7e7d1915130f365b51a2a012d72e DIST TryCatch-1.002000.tar.gz 83199 RMD160 fea153ae6d11798495eebd5a25bcb2c7eced2a3f SHA1 17dc0d41964370ebcf603beccd4d04205eec2904 SHA256 1ac163e3ccaf4b445f832a80f57a89f7a5de714470732fe4613d76a5382d7960 EBUILD TryCatch-1.001001.ebuild 751 RMD160 8117766b5b0637c9bfabaf3d3065bb7aea805b7e SHA1 2364c18df1513a049b58535105099f14865838d1 SHA256 bda8f1950938e1ff9cfb6b152599997b218d1f12546d80d5ab5cc970578bff97 +EBUILD TryCatch-1.002000-r1.ebuild 831 RMD160 6734d4a195f58561b56973178d0cda492b1d1d32 SHA1 1c0c81a5616c0a7b6e05edbaa9dd271b979446c7 SHA256 d47b09bab1fcf49614b8b08aa0b54e71de1de8de4a4b83b95f8b4d1b0ca2ea67 EBUILD TryCatch-1.002000.ebuild 751 RMD160 17d3cad0717a821f11a435716f0b537715ae66df SHA1 72f0975f810f9d1f843cd08c1431f04294197d44 SHA256 85410b3cec4a916d50b90a388a4f8c1f4c4d1b68155e33cc2234ebb1a63af8c6 -MISC ChangeLog 382 RMD160 5e8899248485c088f8f65dbc6abce4d4d413aa28 SHA1 4268e691e2e94fdafe9c2e6658637434f2904e5c SHA256 a1b27179bc502c0b89509f61b7507358c607667b0365cb6888ba2f15171b65ef +MISC ChangeLog 935 RMD160 a5ed2a7aca693f5a9d69cdce4cc736eccfbc5fff SHA1 c0c3cf6f55ffe275af1007749e339da7dbbfaf04 SHA256 e3acc16a8f37228fb4b9dc7a4398f187edcb4513d468e93017c73d31080774eb MISC metadata.xml 275 RMD160 d7980d8f5e665a018b30c566bba02d451db23047 SHA1 a7a485be470b9fbb06c3ce88dffce811ffce282c SHA256 45455d078243c6abc929fd08947c2728292cb506ca452ab4ec33221cd7cb6f6c -----BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.11 (GNU/Linux) +Version: GnuPG v2.0.16 (GNU/Linux) -iEYEARECAAYFAkqtl08ACgkQ1aBWYMk6l078tQCfXZ/BgLCZI1SL3BMnfmhqiEqu -N3EAoJo9D0nhoWm6Vc6SYup2ELNVn/6e -=vRGV +iQIcBAEBAgAGBQJMZr6lAAoJECvPD7taxqSkF50QALPj1GvcZ4+x3C9HqUg9cLA9 +uwOpl94I/RQsA7bJBVsfrw+TsfW4+5fCnA8FFTV7eEGgxvwbzVoCJ3LanF+vgEzX +fHivc1il8hqaHEvL9Pi7xB1q61Rg/HFMvFFlgDnAZp8IrT0YY4fPe+rsIiIOLSA5 +t9/AfmNWvrwoDPVl/l4g8nwznPA/UB9gcJrTbFW/L+qo3r5wd+llb3hkm8Tiaefu +oa68bS1jYg4N+XNnuE/XsofOKksMdiSnNXj89TERMdFir7g1debitOVfMraHm6hY +3F7Fr1kuf0BItaC4Jtm/KxZhU4/yGvmiTtWTgCVUeJYQIvAiZh5bcpEIq8IkkB2I +DwHf0RSrty+aubZd9RIrdtePw+Z8ZP4w7ygmYVFlEkH3HEdrG/c7sLTF31oH2LpF +FMEZDQdxCAImbX8cadpHh9SbVSGDWQTkDFiX3ykNnIhN+tyN4OAGmnt922VRBv4I +Vh5GD/IztoRkCU06/WHrBD43KF1Lx632Wspk1SHtzYuZ2qdtFyTe0y9xBxrT4jVx +78Yrpms0Jx08FDerJMl/cCwmbla8y69KNUIoUMBRrTjagDkr+eazVSufB7UcLxGO +LepAVNobnqtHK/I1BdxI4gOeT7033g1N1ALzuOYf2JEF5Ckg252lOFMaT6RKfZnz +r3biw20t9x/lK6mCsxgV +=kZ95 -----END PGP SIGNATURE----- diff --git a/dev-perl/TryCatch/TryCatch-1.002000-r1.ebuild b/dev-perl/TryCatch/TryCatch-1.002000-r1.ebuild new file mode 100644 index 000000000..eafd7fdfa --- /dev/null +++ b/dev-perl/TryCatch/TryCatch-1.002000-r1.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ +EAPI=2 +MODULE_AUTHOR=ASH +inherit perl-module + +DESCRIPTION="first class try catch semantics for Perl, without source filters" +LICENSE="|| ( Artistic GPL-2 )" +SLOT="0" +KEYWORDS="" +IUSE="" +COMMON_DEPEND=" + >=dev-perl/Parse-Method-Signatures-1.003012 + >=dev-perl/B-Hooks-EndOfScope-0.08 + >=dev-perl/B-Hooks-OP-Check-0.18 + >=dev-perl/B-Hooks-OP-PPAddr-0.03 + >=dev-perl/Devel-Declare-0.005007 + dev-perl/Moose + dev-perl/MooseX-Types + >=dev-perl/Scope-Upper-0.06 + >=dev-perl/Variable-Magic-0.28 + >=dev-perl/Sub-Exporter-0.979 +" +DEPEND=" + dev-perl/extutils-depends + ${COMMON_DEPEND} +" +RDEPEND=" + ${COMMON_DEPEND} +" +PATCHES=( + "${FILESDIR}/0001-Change-how-wantarray-is-tweaked-to-work-better-with-.patch" +) +SRC_TEST="do" diff --git a/dev-perl/TryCatch/files/0001-Change-how-wantarray-is-tweaked-to-work-better-with-.patch b/dev-perl/TryCatch/files/0001-Change-how-wantarray-is-tweaked-to-work-better-with-.patch new file mode 100644 index 000000000..623e3a2bd --- /dev/null +++ b/dev-perl/TryCatch/files/0001-Change-how-wantarray-is-tweaked-to-work-better-with-.patch @@ -0,0 +1,284 @@ +From 29999fe32d3832815ca6cc1f02ae1e044b6fce46 Mon Sep 17 00:00:00 2001 +From: Ash Berlin <ash_github@firemirror.com> +Date: Tue, 8 Jun 2010 12:09:05 +0100 +Subject: [PATCH] Change how wantarray is tweaked to work better with 5.12 + +--- + TryCatch.xs | 163 +++++++++++++++++++++++-------------------------------- + lib/TryCatch.pm | 8 +-- + 2 files changed, 70 insertions(+), 101 deletions(-) + +diff --git a/TryCatch.xs b/TryCatch.xs +index 67c4ef7..46e7d5d 100644 +--- a/TryCatch.xs ++++ b/TryCatch.xs +@@ -11,8 +11,13 @@ + # define CvISXSUB(cv) CvXSUB(cv) + #endif + ++#ifndef SVf_IVisUV ++ #define SvUV(x) SvIV(x) ++#endif ++ + static int trycatch_debug = 0; + ++// A debug function. Dump the context stack so i can see if i'm unwinding to the right place + STATIC I32 + dump_cxstack() + { +@@ -23,11 +28,11 @@ dump_cxstack() + default: + continue; + case CXt_EVAL: +- printf("***\n* cx stack %d: WA: %d\n", (int)i, cx->blk_gimme); +- sv_dump((SV*)cx->blk_eval.cv); ++ printf("***\n* ecal cx stack %d: WA: %d\n", (int)i, cx->blk_gimme); ++ //sv_dump((SV*)cx->blk_eval.cv); + break; + case CXt_SUB: +- printf("***\n* cx stack %d: WA: %d\n", (int)i, cx->blk_gimme); ++ printf("***\n* sub cx stack %d: WA: %d\n", (int)i, cx->blk_gimme); + sv_dump((SV*)cx->blk_sub.cv); + break; + } +@@ -102,109 +107,74 @@ STATIC OP* unwind_return (pTHX_ OP *op, void *user_data) { + } + + +-/* After the scope has been created, fix up the context */ +-STATIC OP* op_after_entertry(pTHX_ OP *op, void *user_data) { +- PERL_CONTEXT * cx = cxstack+cxstack_ix; ++STATIC OP* try_wantarray (pTHX_ OP *op, void *user_data) { ++ PERL_UNUSED_VAR(op); ++ PERL_UNUSED_VAR(user_data); + +- // Sanity check the gimme, since we'll reset it in leavetry +- if (cx->blk_gimme != G_VOID) { +- fprintf(stderr, "Try Catch Internal Error: ENTERTRY op did not have " +- "VOID context (it was %d)\n", cx->blk_gimme); +- abort(); ++ dVAR; ++ dSP; ++ EXTEND(SP, 1); ++ ++ /* We want the context from the closest subroutine, not from the closest ++ * block ++ */ ++ switch ( get_sub_context() ) { ++ case G_ARRAY: ++ RETPUSHYES; ++ case G_SCALAR: ++ RETPUSHNO; ++ default: ++ RETPUSHUNDEF; + } +- cx->blk_gimme = get_sub_context(); +- return op; + } + +-STATIC OP* op_before_leavetry(pTHX_ OP *op, void *user_data) { +- PERL_CONTEXT * cx = cxstack+cxstack_ix; +- cx->blk_gimme = G_VOID; +- return op; +-} +- +- +-/* Hook the OP_RETURN iff we are in hte same file as originally compiling. */ +-STATIC OP* check_return (pTHX_ OP *op, void *user_data) { ++STATIC OP* hook_if_correct_file (pTHX_ OP *op, void* user_data) { + + const char* file = SvPV_nolen( (SV*)user_data ); + const char* cur_file = CopFILE(&PL_compiling); + if (strcmp(file, cur_file)) { + if (trycatch_debug & 4) +- Perl_warn(aTHX_ "Not hooking OP_return since its in '%s'", cur_file); ++ Perl_warn(aTHX_ "Not hooking OP %d since its in '%s'", op->op_type, cur_file); + return op; + } + if (trycatch_debug & 1) { +- Perl_warn(aTHX_ "hooking OP_return"); +- } +- +- hook_op_ppaddr(op, unwind_return, NULL); +- return op; +-} +- +- +- +-// If this eval scope should be marked by TryCatch, hook the ops +-STATIC OP* check_leavetry (pTHX_ OP *op, void *user_data) { +- +- SV* eval_is_try = get_sv("TryCatch::NEXT_EVAL_IS_TRY", 0); +- +- if (SvOK(eval_is_try) && SvTRUE(eval_is_try)) { +- +- OP* entertry = ((LISTOP*)op)->op_first; +- +- if (trycatch_debug & 2) { +- const char* cur_file = CopFILE(&PL_compiling); +- int is_try = SvIVx(eval_is_try); +- Perl_warn(aTHX_ "entertry op 0x%x try=%d", op, is_try); +- } +- +- SvIV_set(eval_is_try, 0); +- hook_op_ppaddr_around(entertry, NULL, op_after_entertry, NULL); +- hook_op_ppaddr_around(op, op_before_leavetry, NULL, NULL); ++ Perl_warn(aTHX_ "hooking OP %d", op->op_type); + } +- return op; +-} + +-// eval {} starts off as an OP_ENTEREVAL, and then the PL_check[OP_ENTEREVAL] +-// returns a newly created ENTERTRY (and LEAVETRY) ops without calling the +-// PL_check for these new ops into OP_ENTERTRY. How ever versions prior to perl +-// 5.10.1 didn't call the PL_check for these new opes +-STATIC OP* check_entereval (pTHX_ OP *op, void *user_data) { +- if (op->op_type == OP_LEAVETRY) { +- return check_leavetry(aTHX_ op, user_data); +- } ++ hook_op_ppaddr(op, (op->op_type == OP_RETURN ? unwind_return : try_wantarray), NULL); + return op; + } + ++SV* xs_install_op_checks() { ++/*(int op_code, hook_op_ppaddr_cb_t* hook_fn) {*/ ++ SV *hook_id, *sv_curfile; ++ AV *av; ++ UV id; + +-void dualvar_id(SV* sv, UV id) { ++ av = newAV(); ++ sv_curfile = newSV(0); + ++ /* Get the filename we install check op hooks into */ + char* file = CopFILE(&PL_compiling); + STRLEN len = strlen(file); + +- (void)SvUPGRADE(sv,SVt_PVNV); ++ (void)SvUPGRADE(sv_curfile,SVt_PVNV); + +- sv_setpvn(sv,file,len); +-#ifdef SVf_IVisUV +- SvUV_set(sv, id); +- SvIOK_on(sv); +- SvIsUV_on(sv); +-#else +- SvIV_set(sv, id); +- SvIOK_on(sv); +-#endif +-} ++ sv_setpvn(sv_curfile,file,len); ++ av_push(av, sv_curfile); ++ ++ id = hook_op_check( OP_RETURN, hook_if_correct_file, sv_curfile ); ++ av_push(av, newSVuv(OP_RETURN) ); ++ av_push(av, newSVuv(id) ); + +-SV* install_op_check(int op_code, hook_op_ppaddr_cb_t hook_fn) { +- SV* ret; +- UV id; + +- ret = newSV(0); ++ id = hook_op_check( OP_WANTARRAY, hook_if_correct_file, sv_curfile ); + +- id = hook_op_check( op_code, hook_fn, ret ); +- dualvar_id(ret, id); ++ av_push(av, newSVuv(OP_WANTARRAY) ); ++ av_push(av, newSVuv(id) ); + +- return ret; ++ // Get an array ref form the array, return that. This keeps the sv_curfile alive ++ return newRV_noinc( (SV*) av ); + } + + MODULE = TryCatch PACKAGE = TryCatch::XS +@@ -212,28 +182,29 @@ MODULE = TryCatch PACKAGE = TryCatch::XS + PROTOTYPES: DISABLE + + void +-install_return_op_check() ++install_op_checks() + CODE: +- ST(0) = install_op_check(OP_RETURN, check_return); ++ ST(0) = xs_install_op_checks(); + XSRETURN(1); + + void +-install_try_op_check() ++uninstall_op_checks(aref) ++SV* aref; ++ PREINIT: ++AV* av; ++SV *op, *id; + CODE: +- // TODO: Deal with perl 5.10.1+ +- ST(0) = install_op_check(OP_ENTEREVAL, check_entereval); +- XSRETURN(1); +- +-void +-uninstall_return_op_check(id) +-SV* id +- CODE: +-#ifdef SVf_IVisUV +- UV uiv = SvUV(id); +-#else +- UV uiv = SvIV(id); +-#endif +- hook_op_check_remove(OP_RETURN, uiv); ++ if ( !SvROK(aref) && SvTYPE(SvRV(aref)) != SVt_PVAV ) { ++ Perl_croak(aTHX_ "ArrayRef expected"); ++ } ++ av = (AV*)(SvRV(aref)); ++ /* throw away cur_file */ ++ av_shift(av); ++ while (av_len(av) != -1) { ++ op = av_shift(av); ++ id = av_shift(av); ++ hook_op_check_remove( SvUV(op), SvUV(id) ); ++ } + OUTPUT: + + void dump_stack() +diff --git a/lib/TryCatch.pm b/lib/TryCatch.pm +index ca33952..1a5e7a0 100644 +--- a/lib/TryCatch.pm ++++ b/lib/TryCatch.pm +@@ -39,8 +39,6 @@ use Sub::Exporter -setup => { + my $pack = $args->{into}; + my $ctx_class = $args->{parser} || 'TryCatch'; + +- TryCatch::XS::install_try_op_check(); +- + foreach my $name (@$to_export) { + if (my $parser = __PACKAGE__->can("_parse_${name}")) { + Devel::Declare->setup_for( +@@ -102,7 +100,7 @@ sub _parse_try { + #$ctx->debug_linestr("try"); + if (! $TryCatch::CHECK_OP_DEPTH) { + $TryCatch::CHECK_OP_DEPTH++; +- $TryCatch::CHECK_OP_HOOK = TryCatch::XS::install_return_op_check(); ++ $TryCatch::CHECK_OP_HOOK = TryCatch::XS::install_op_checks(); + } + + $ctx->debug_linestr('post try'); +@@ -153,7 +151,7 @@ sub inject_scope { + if ($opts->{hook}) { + if (! $TryCatch::CHECK_OP_DEPTH) { + $TryCatch::CHECK_OP_DEPTH++; +- $TryCatch::CHECK_OP_HOOK = TryCatch::XS::install_return_op_check(); ++ $TryCatch::CHECK_OP_HOOK = TryCatch::XS::install_op_checks(); + } + } + +@@ -186,7 +184,7 @@ sub block_postlude { + } + + if ($TryCatch::CHECK_OP_DEPTH && --$TryCatch::CHECK_OP_DEPTH == 0) { +- TryCatch::XS::uninstall_return_op_check($TryCatch::CHECK_OP_HOOK); ++ TryCatch::XS::uninstall_op_checks($TryCatch::CHECK_OP_HOOK); + $TryCatch::CHECK_OP_HOOK = ''; + } + +-- +1.7.2 + |