aboutsummaryrefslogtreecommitdiff
path: root/www/p5-CGI-Cookie-XS/mkcomm
blob: 3fa680912d4b13969535b4b6791341793bfae47d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/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);