Patch for sidekick v0.02

[email protected] (Autrijus Tang) Sun, 16 Sep 2001 21:54:04 +0800
Newsgroups perl.sdk
Message-ID <[email protected]>
--M9NhX3UHpAaciwkO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 in=
clude/.

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;
 =20
   WriteMakefile(
   -    NAME       =3D> 'sidekick',
   -    VERSION    =3D> '0.02',
   +    NAME         =3D> 'sidekick',
   +    VERSION_FROM =3D> 'sidekick',
   +    EXE_FILES    =3D> [ '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 @@
=20
=20
 package Sidekick;=20
+
+$VERSION =3D $1=20
+    if '$Id: sidekick,v 1.5 2001/09/10 00:26:58 vipul Exp $' =3D~ /,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 =3D CPAN::Shell->expand ('Module', $_);
         $CPAN::Config->{keep_source_where} =3D "$$self{source}/cpan";
         $CPAN::Config->{build_dir} =3D "$$self{source}/cpan/build";
+	if (!$obj) {
+	    warn "Cannot fetch $_!\n";
+	    next;
+	}
         $obj->get();
     }
     close SL;
@@ -93,6 +103,7 @@
             by_depth =3D> 1,
            }, "$src/cpan", "$src/non-cpan"=20
     );
+    mkdir "$src/patches" unless -d "$src/patches";
     find ( { wanted =3D>=20
                 sub {
                 if (/--patch$/) {=20
@@ -121,7 +132,7 @@
                         my $module =3D $_;
                         open PM, $module; my @PM =3D <PM>; close PM;
                         for (@PM) {=20
-                            /(?:use|require) ([^";\s\$\<\>]+)\s*(?:qw\(.*?=
\))?\s*;/ &&
+                            /(?:use|require) ([\"\']?\w[^\w\d\.\:\'\"\/]*)=
\s*(?:qw\(.*?\))?\s*;/ &&
                             push @{$$self{deps}{$1}{files}}, $module;
                             /package ([^";\s\$\<\>]+)\s*;/ &&=20
                             $$self{deps}{$1}{present}++;
@@ -234,11 +245,13 @@
     }
 }
=20
+use vars qw/$AUTOLOAD/;
=20
 sub AUTOLOAD {=20
     my $self =3D shift;
     my $method =3D $AUTOLOAD;
     $method =3D~ s/.*:://;=20
+    print "calling $method\n";
     my %methods =3D (=20
         clean =3D> 'make clean',
         perlmake =3D> 'perl Makefile.PL',=20
@@ -303,7 +316,7 @@
 sub new {=20
     my ($class) =3D @_;
     my %self =3D ();
-    my @ACTIONS =3D qw(fetch unpack depend manifest make test dist build c=
lean tear depend);
+    my @ACTIONS =3D qw(fetch unpack depend manifest perlmake make test dis=
t build clean tear depend);
     my %ACTIONS; @ACTIONS{@ACTIONS} =3D @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 @@
=20
 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>.
=20

--M9NhX3UHpAaciwkO
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjukrvwACgkQtLPdNzw1AaB6xACfRaUC9rmT7B94RT33CqnhcXX7
qbwAnRmTM6X9tfP0vz5YldzBLCAMvp0h
=llIm
-----END PGP SIGNATURE-----

--M9NhX3UHpAaciwkO--