1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00
freebsd-ports/www/p5-Cookie-XS/mkcomm
2008-04-18 16:51:23 +00:00

77 lines
2.0 KiB
Perl

#!/usr/bin/perl -w
# $Id$
use strict;
use warnings;
use Getopt::Std;
use GDSL::Args;
use GDSL::File qw(load_file save_file);
use GDSL::Util::Format;
use GDSL::FreeBSD::Port::Makefile;
###############################################################################
my $mf = GDSL::FreeBSD::Port::Makefile->new();
my $makefile_name = 'Makefile';
###############################################################################
$mf->init_freebsd();
#$mf->load_file('/etc/defaults/make.conf');
$mf->load_file('/etc/make.conf');
$mf->load_file($makefile_name);
##############################################################################
my $portname = $mf->PORTNAME;
my $portversion = $mf->PORTVERSION;
my ($pm1) = ($portname =~ m!([^-]+)$!);
(my $pm2 = $portname) =~ s/-/\//g;
(my $pkgname = $portname) =~ s/-/::/g;
##############################################################################
print "portname=", $portname, "\n";
print "portversion=", $portversion, "\n";
print "pkgname=$pkgname\n";
#exit;
##############################################################################
my $pmfile = undef;
my $wrksrc = $mf->WRKSRC;
for my $try_pmfile ("$wrksrc/$pm1.pm",
"$wrksrc/lib/$pm2.pm"
) {
print "try $try_pmfile\n";
if(-f $try_pmfile) {
$pmfile = $try_pmfile;
last;
}
}
die "can't find pm"
unless defined $pmfile;
print "pmfile=$pmfile\n";
my $pm = load_file($pmfile);
#=head1 NAME
#
#POE::Component::Client::POP3 - Impliment a POP3 client POE component
if($pm =~ /^=head1 NAME\s*\n\s*\n${pkgname} - (.*)$/m) {
#if($pm=~/=head1 NAME/sm) {
#if($pm=~/NAME/sm) {
my $comment = $1;
print "wow! i find comment:\n", $comment, "\n";
save_file('pkg-comment', $comment, "\n");
}
if($pm =~ /^=head1 DESCRIPTION\s*\n\s*\n(.*?)(?=\s*\n\s*\n)/ms) {
my $desc = $1;
print "wwow! i find desc:\n", $desc, "\n";
save_file('pkg-descr', $desc, "\n");
}
$pm =~ s/^(.*?)(?==head1)//s;
#skip SYNOPSIS
$pm =~s /(=head1 SYNOPSIS.*?)(?==head1)//s;
save_file('pkg-PM', $pm);