develooper Front page | perl.sdk | Postings from September 2001

Patch for sidekick v0.02

Thread Next
From:
Autrijus Tang
Date:
September 16, 2001 18:01
Subject:
Patch for sidekick v0.02
Message ID:
20010916215404.A13883@not.autrijus.org
Hi there. I've been using Sidekick to convert a Bundle:: to a SDK,
and patched various things along the way. Attached is an assortment
of fixes, some of which you might find unneccessary to apply. :-)

in Makefile.PL:

* grab the version from script itself.
* install it to /usr/local/bin so 'man sidekick' works.

in sidekick:

* determine $VERSION from the RCS tag.
* strict + warnings.
* shouldn't die with cryptic messages if one modules failed CPAN fetch.
* the source/patches path needs to be created first.
* fix the depend so it won't grab modules with illegal names (punctuation, 5.006, etc)
* the AUTOLOAD won't work without a use vars now.
* 'sidekick perlmake' wasn't included in the opts.
* the include directory mentioned in POD should be sources/include/, not include/.

sidekick is quite nice, thanks. i was unrolling my own after seeing Tim
Bunce's idea, but fortunately i checked the list frequently. :)

i'm working on PPM support of SDKs with XS modules. will update
after I patched the PPM on CPAN to support FreeBSD.

best wishes,
/Autrijus/

diff -du ../sidekick-0.02/Makefile.PL ./Makefile.PL
--- ../sidekick-0.02/Makefile.PL	Mon Sep 10 08:26:45 2001
+++ ./Makefile.PL	Sat Sep 15 06:50:57 2001
@@ -1,6 +1,7 @@
 use ExtUtils::MakeMaker;
  
   WriteMakefile(
   -    NAME       => 'sidekick',
   -    VERSION    => '0.02',
   +    NAME         => 'sidekick',
   +    VERSION_FROM => 'sidekick',
   +    EXE_FILES    => [ 'sidekick' ],
);
diff -du ../sidekick-0.02/sidekick ./sidekick
--- ../sidekick-0.02/sidekick	Mon Sep 10 08:26:58 2001
+++ ./sidekick	Sun Sep 16 10:41:04 2001
@@ -10,6 +10,12 @@
 
 
 package Sidekick; 
+
+$VERSION = $1 
+    if '$Id: sidekick,v 1.5 2001/09/10 00:26:58 vipul Exp $' =~ /,v ([^\s]+)/;
+
+use strict;
+use warnings;
 use File::Find qw(find);
 # use Data::Dumper qw(Dumper);
 use CPAN qw();
@@ -54,6 +60,10 @@
         my $obj = CPAN::Shell->expand ('Module', $_);
         $CPAN::Config->{keep_source_where} = "$$self{source}/cpan";
         $CPAN::Config->{build_dir} = "$$self{source}/cpan/build";
+	if (!$obj) {
+	    warn "Cannot fetch $_!\n";
+	    next;
+	}
         $obj->get();
     }
     close SL;
@@ -93,6 +103,7 @@
             by_depth => 1,
            }, "$src/cpan", "$src/non-cpan" 
     );
+    mkdir "$src/patches" unless -d "$src/patches";
     find ( { wanted => 
                 sub {
                 if (/--patch$/) { 
@@ -121,7 +132,7 @@
                         my $module = $_;
                         open PM, $module; my @PM = <PM>; close PM;
                         for (@PM) { 
-                            /(?:use|require) ([^";\s\$\<\>]+)\s*(?:qw\(.*?\))?\s*;/ &&
+                            /(?:use|require) ([\"\']?\w[^\w\d\.\:\'\"\/]*)\s*(?:qw\(.*?\))?\s*;/ &&
                             push @{$$self{deps}{$1}{files}}, $module;
                             /package ([^";\s\$\<\>]+)\s*;/ && 
                             $$self{deps}{$1}{present}++;
@@ -234,11 +245,13 @@
     }
 }
 
+use vars qw/$AUTOLOAD/;
 
 sub AUTOLOAD { 
     my $self = shift;
     my $method = $AUTOLOAD;
     $method =~ s/.*:://; 
+    print "calling $method\n";
     my %methods = ( 
         clean => 'make clean',
         perlmake => 'perl Makefile.PL', 
@@ -303,7 +316,7 @@
 sub new { 
     my ($class) = @_;
     my %self = ();
-    my @ACTIONS = qw(fetch unpack depend manifest make test dist build clean tear depend);
+    my @ACTIONS = qw(fetch unpack depend manifest perlmake make test dist build clean tear depend);
     my %ACTIONS; @ACTIONS{@ACTIONS} = @ACTIONS;
     Getopt::Long::Configure( 'bundling_override', 'getopt_compat' );
          GetOptions(
@@ -327,6 +340,7 @@
 $sdk->depend()   if $$opts{depend};
 $sdk->manifest() if $$opts{manifest};
 $sdk->tear()     if $$opts{tear};
+$sdk->perlmake() if $$opts{perlmake};
 $sdk->make()     if $$opts{make};
 $sdk->test()     if $$opts{test};
 $sdk->dist()     if $$opts{dist};
@@ -409,7 +423,7 @@
 
 Put all the extra files that need to go in the bundle, like README,
 Makefile.PL (sidekick can write a Makefile.PL for you, but more on that
-later), TODO & Changes in C<$BASE/include>. Run C<sidekick manifest>,
+later), TODO & Changes in C<$BASE/source/include>. Run C<sidekick manifest>,
 which will copy these files to the build directory and create a
 C<MANIFEST>.
 


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About