Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

MANIFEST IT!

by crazyinsomniac (Prior)
on Jan 12, 2002 at 02:14 UTC ( [id://138156]=CUFP: print w/replies, xml ) Need Help??

You've used h2xs to start buliding your module? You've got a nice MANIFEST file? You want to build a nice tarball? Then use MANIFESTIT.(warning, DISTNAME and VERSION regex could probably use improving).
usage: perl MANIFESTIT.PL path/2/manifest/holding/dir
#!/usr/bin/perl -wl use strict; use Archive::Tar; use vars qw/ $DISTNAME $VERSION/; my @MANIFEST; my $MANIFEST = shift @ARGV || ''; die "ERROR: `$MANIFEST/MANIFEST' $!" unless(-e "$MANIFEST/MANIFEST" and -r "$MANIFEST/MANIFEST"); open(MANIFEST, '<', "$MANIFEST/MANIFEST") or die "ERROR: `$MANIFEST/MANIFEST' $!"; while(<MANIFEST>) { chomp; next unless length $_; die "ERROR: `$MANIFEST/$_' $!" unless(-e "$MANIFEST/$_" and -r "$MANIFEST/$_"); push @MANIFEST,"$MANIFEST/$_"; &_MAKEFILE( $MANIFEST[-1] ) if $_ =~ /Makefile.PL/i; } print for @MANIFEST; my $tar = Archive::Tar->new(); $tar->add_files(@MANIFEST); $tar->write("$DISTNAME-$VERSION.tar"); print "created `$DISTNAME-$VERSION.tar'"; exit; sub _MAKEFILE { open(MAKEFILE,'<',$_[0]) or die "ERROR: `$_[0]' $!"; while(<MAKEFILE>) { chomp; if(/^\s*?'?NAME'?\s*?\=\>\s*?(?:\'|\")?([a-zA-Z:_]+)(?:\'|\")? +,/) { print; $DISTNAME = $1; } if(/^\s*?'?DISTNAME'?\s*?\=\>\s*?(?:\'|\")?([a-zA-Z_-]+)(?:\'| +\")?,/) { print; $DISTNAME = $1; } if(/^\s*?'?VERSION'?\s*?\=\>\s*?(?:\'|\")?([a-zA-Z_-]+)(?:\'|\ +")?,/) { print; $VERSION = $1; } if(/^\s*?'?VERSION_FROM'?\s*?\=\>\s*?(?:\'|\")?([^'"]+)(?:\'|\ +")?,/) { print; open(VERSION,'<',"$MANIFEST/$1") or die "ERROR: `$1' $!"; while(<VERSION>) { chomp; if(/([\$*])(([\w\:\']*)\bVERSION)\b.*\=/) { eval $_; } } } } } __END__ F:\dev\Pod_Parser>perl MANIFESTIT.PL Pod/Stripper 'NAME' => 'Pod::Stripper', 'VERSION_FROM' => 'Stripper.pm', # finds $VERSION 'DISTNAME' => 'Pod-Stripper', Pod/Stripper/Changes Pod/Stripper/Stripper.pm Pod/Stripper/Makefile.PL Pod/Stripper/MANIFEST Pod/Stripper/README Pod/Stripper/test.pl Pod/Stripper/test.stripped created `Pod-Stripper-0.2.tar' F:\dev\Pod_Parser>

Replies are listed 'Best First'.
Re: MANIFEST IT!
by herveus (Prior) on Jan 12, 2002 at 03:33 UTC
    Howdy!

    I'm curious why you would not just use 'make dist'? That will gather up everything in the manifest and make the .tar.gz file with no coding required on your part.

    yours,
    Michael

      Ignorance?

      Lack of tar?

      Make::Maker generates a makefile which has the following variables:

      # --- MakeMaker dist section: DISTVNAME = $(DISTNAME)-$(VERSION) TAR = tar TARFLAGS = cvf ZIP = zip ZIPFLAGS = -r COMPRESS = gzip --best SUFFIX = .gz SHAR = shar PREOP = @$(NOOP) POSTOP = @$(NOOP) TO_UNIX = @$(NOOP) CI = ci -u RCS_LABEL = rcs -Nv$(VERSION_SYM): -q DIST_CP = best DIST_DEFAULT = tardist
      I don't have zip or tar nor do I plan on installing them anytime soon. I am never afraid of installing perl modules however, and always find Archive::Tar installed wherever I go. It is for these kinds of situations that this script is useful. It is a "perl" solution. That is all (I would like to see `perl make' one of these days, no need for make or nmake or dmake or whatever crazy make there is ;D).

       
      ______crazyinsomniac_____________________________
      Of all the things I've lost, I miss my mind the most.
      perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

        I would like to see `perl make' one of these days, no need for make or nmake or dmake or whatever crazy make there is ;D
        Make.pm?. I came across this beauty a couple of months ago. It comes with pmake, a perl replacement for make/nmake etc. But you can also use the module in your own install scripts.

        Simon Flack ($code or die)
        $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
        =~y'_"' ';eval"die";print $_,lc substr$@,0,3;

        Doesn't Archive::Tar come with a command-line pure-Perl tar, ptar?

        Chris
        M-x auto-bs-mode

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://138156]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-03-29 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found