Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2008 16:36:07 +0200
From:      Anton Berezin <tobez@tobez.org>
To:        perl@freebsd.org
Cc:        lbr@freebsd.org, lth@freebsd.org, leeym@leeym.com, linimon@lonesome.com, des@des.no
Subject:   [Request for review] PERL_DEPENDS and PERL_TEST_DEPENDS re-launched
Message-ID:  <20080406143607.GB14452@heechee.tobez.org>

next in thread | raw e-mail | index | archive | help
Hi,

After being lured by des to Oslo Perl QA Hackathon, lth@ and myself have
spent two enjoyable days hacking makefiles.  Before submitting any sort of
PR, we'd like to request people on this list to review the result.

The syntax is essentially what we have described before in this mail:

http://www.freebsd.org/cgi/getmsg.cgi?fetch=48572+0+/usr/local/www/db/text/2008/freebsd-perl/20080302.freebsd-perl

That is, the emphasis is on FreeBSD packages and their versions as opposed
to Perl modules and their versions (the reasons for that are described in
detail in several follow-ups on the mail above).

We also tried to take care of dual-life modules & distributions (those which
are found both in [one or more of] distributions of perl itself and also
separately on CPAN).

Another goal we had in mind was to try to reduce the size of the database of
such dual-life modules, as to avoid the problem with leeym's ports/121313
PR, in which such database consisted of 8451 lines totalling 250 kilobytes.
Our database ended up being 77 lines totalling 3.5 kilobytes.

We also tried to avoid doing shellouts as much as possible.

Below is a patch against ports/Mk from this morning.  Please note that the
distributions in the database were automatically generated and then polished
a little bit by hand.  At this stage there is no guarantee that the database
is 100% correct.  We are going to do the validation, but decided that what
we have is quite useful for testing by interested parties.

Below the patch there are two examples of p5 ports using the new syntax, so
read on!

----------8<-----------8<-----------8<-----------8<-----------8<------
Index: bsd.perl.dist.mk
===================================================================
RCS file: bsd.perl.dist.mk
diff -N bsd.perl.dist.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ bsd.perl.dist.mk	6 Apr 2008 14:01:50 -0000
@@ -0,0 +1,77 @@
+p5-dist-Archive-Extract=	501000:0.24
+p5-dist-Archive-Tar=	501000:1.38
+p5-dist-Attribute-Handlers=	500808:0.78_02 501000:0.79
+p5-dist-AutoLoader=	500602:5.58 500808:5.60 501000:5.63
+p5-dist-CGI.pm=	500602:2.752 500808:3.15 501000:3.29
+p5-dist-CPANPLUS=	501000:0.84
+p5-dist-CPANPLUS-Dist-Build=	501000:0.06_02
+p5-dist-Class-ISA=	500808:0.33 501000:0.33
+p5-dist-Compress-Raw-Zlib=	501000:2.008
+p5-dist-Compress-Zlib=	501000:2.008
+p5-dist-Data-Dumper=	500602:2.121 500808:2.121_08 501000:2.121_14
+p5-dist-Devel-PPPort=	500808:3.06_01 501000:3.13
+p5-dist-Digest=	500808:1.14 501000:1.15
+p5-dist-Digest-MD5=	500808:2.36 501000:2.36_01
+p5-dist-Digest-SHA=	501000:5.45
+p5-dist-Encode=	500808:2.12 501000:2.23
+p5-dist-Errno=	500602:1.111 500808:1.09_01 501000:1.10
+p5-dist-ExtUtils-CBuilder=	501000:0.21
+p5-dist-ExtUtils-Command=	500602:1.05 500808:1.09 501000:1.13
+p5-dist-ExtUtils-Constant=	500808:0.17 501000:0.2
+p5-dist-ExtUtils-MakeMaker=	500602:6.17 500808:6.30 501000:6.42
+p5-dist-ExtUtils-Manifest=	500602:1.42 500808:1.46 501000:1.51_01
+p5-dist-ExtUtils-ParseXS=	501000:2.18_02
+p5-dist-File-Fetch=	501000:0.14
+p5-dist-File-Temp=	500602:0.14 500808:0.16 501000:0.18
+p5-dist-Filter-Simple=	500808:0.82 501000:0.82
+p5-dist-Getopt-Long=	500602:2.25 500808:2.35 501000:2.37
+p5-dist-I18N-LangTags=	500808:0.35 501000:0.35
+p5-dist-IO=	500602:1.20 500808:1.22 501000:1.23_01
+p5-dist-IO-Compress-Base=	501000:2.008
+p5-dist-IO-Zlib=	501000:1.07
+p5-dist-IPC-Cmd=	501000:0.40_1
+p5-dist-Locale-Maketext=	500808:1.09 501000:1.12
+p5-dist-Locale-Maketext-Simple=	501000:0.18
+p5-dist-Log-Message=	501000:0.01
+p5-dist-Log-Message-Simple=	501000:0.04
+p5-dist-MIME-Base64=	500808:3.07 501000:3.07_01
+p5-dist-Math-BigInt=	500602:0.01 500808:1.77 501000:1.88
+p5-dist-Math-BigRat=	500808:0.15 501000:0.21
+p5-dist-Math-Complex=	500602:1.31 500808:1.35 501000:1.37
+p5-dist-Memoize=	500808:1.01 501000:1.01_02
+p5-dist-Module-Build=	501000:0.2808_01
+p5-dist-Module-CoreList=	501000:2.12
+p5-dist-Module-Load=	501000:0.12
+p5-dist-Module-Load-Conditional=	501000:0.22
+p5-dist-Module-Loaded=	501000:0.01
+p5-dist-Module-Pluggable=	501000:3.6
+p5-dist-NEXT=	500808:0.60 501000:0.60_01
+p5-dist-Net-Ping=	500602:2.02 500808:2.31 501000:2.33
+p5-dist-Object-Accessor=	501000:0.32
+p5-dist-Package-Constants=	501000:0.01
+p5-dist-Params-Check=	501000:0.26
+p5-dist-PathTools=	500602:0.86 500808:3.12 501000:3.2501
+p5-dist-Pod-Escapes=	501000:1.04
+p5-dist-Pod-Parser=	500602:1.13 500808:1.32 501000:1.35
+p5-dist-Pod-Simple=	501000:3.05
+p5-dist-Scalar-List-Utils=	500808:1.18 501000:1.19
+p5-dist-Storable=	500808:2.15 501000:2.18
+p5-dist-Switch=	500808:2.10_01 501000:2.13
+p5-dist-Term-UI=	501000:0.18
+p5-dist-Test-Harness=	500602:2.30 500808:2.56 501000:2.64
+p5-dist-Test-Simple=	500602:0.47 500808:0.62 501000:0.72
+p5-dist-Text-Balanced=	500808:1.95 501000:2.0.0
+p5-dist-Text-Tabs+Wrap=	500602:98.112801 500808:2005.0824 501000:2007.1117
+p5-dist-Tie-File=	500808:0.97 501000:0.97_02
+p5-dist-Tie-RefHash=	500602:1.3 500808:1.32 501000:1.37
+p5-dist-Time-HiRes=	500808:1.86 501000:1.9711
+p5-dist-Time-Local=	500602:0 500808:1.11 501000:1.18
+p5-dist-Time-Piece=	501000:1.12
+p5-dist-Unicode-Normalize=	500808:0.32 501000:1.02
+p5-dist-XSLoader=	500602:0.01 500808:0.06 501000:0.08
+p5-dist-base=	500602:1.01 500808:2.07 501000:2.13
+p5-dist-bignum=	500808:0.17 501000:0.22
+p5-dist-podlators=	500602:2.0.1 500808:2.0.1 501000:2.0.6
+p5-dist-threads=	500808:1.07 501000:1.67
+p5-dist-threads-shared=	500808:0.94 501000:1.14
+p5-dist-version=	501000:0.74
Index: bsd.perl.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.perl.mk,v
retrieving revision 1.7
diff -u -r1.7 bsd.perl.mk
--- bsd.perl.mk	29 Sep 2007 03:46:06 -0000	1.7
+++ bsd.perl.mk	6 Apr 2008 14:01:45 -0000
@@ -236,6 +236,83 @@
 .undef HAS_CONFIGURE
 .endif # defined(PERL_CONFIGURE)
 
+# Perl-specific dependencies handling
+.include "${PORTSDIR}/Mk/bsd.perl.dist.mk"
+.if defined(PERL_LEVEL)
+.for __dep_kind in PERL PERL_BUILD PERL_RUN PERL_TEST
+_dep_kind:=${__dep_kind}
+.undef _want_build
+.undef _want_run
+.if ${_dep_kind} == "PERL"
+    _want_build:=1
+    _want_run:=1
+.elif ${_dep_kind} == "PERL_BUILD"
+    _want_build:=1
+.elif ${_dep_kind} == "PERL_RUN"
+    _want_run:=1
+.elif ${_dep_kind} == "PERL_TEST"
+.   if defined(P5PORTER)
+        _want_build:=1
+.   endif # defined(P5PORTER)
+.endif # ${_dep_kind} == ...
+
+_dep_var=${_dep_kind}_DEPENDS
+.if !empty(${_dep_var})
+.for _dep_port in ${${_dep_var}}
+
+    _port:=${_dep_port:C|.*:||}
+    _port:=${_port:C|>=.*||}
+    _dep:=${_dep_port:C|:.*||}
+    _dep:=${_dep:C|.*/||}
+.   if ${_dep:C|.*>=.*||} == ${_dep}
+        _dep:=${_dep}>=0
+.   endif
+
+    _skip_dep:=
+    _pkg:=${_dep:C|>=.*||}
+    _ver:=${_dep:C|.*>=||}
+    _dist_pkg:=${_pkg:C|^p5-|p5-dist-|}
+
+.   if !empty(_dist_pkg)
+        _dist_ver:=
+.       for _perl in ${${_dist_pkg}}
+            _perl_ver:=${_perl:C|:.*||}
+.           if ${_perl_ver} == ${PERL_LEVEL}
+                _dist_ver:=${_perl:C|.*:||}
+.           endif
+.       endfor
+
+.       if !empty(_dist_ver)
+            # do the version comparison - only shellout if necessary
+.           if ${_dist_ver:C|\.||:C|[0-9]+||} == "" && ${_ver:C|\.||:C|[0-9]+||} == ""
+.               if ${_dist_ver} >= ${_ver}
+                    _skip_dep:=1
+.               endif
+.           else
+                _comp_res!=pkg_version -t ${_ver} ${_dist_ver}
+                _comp_res:=${_comp_res}
+.               if ${_comp_res} != ">"
+                    _skip_dep:=1
+.               endif
+.           endif
+.       endif
+
+.   endif
+
+.   if empty(_skip_dep)
+.       if defined(_want_build) && ${_want_build}
+            BUILD_DEPENDS:=	${BUILD_DEPENDS} ${_dep}:${PORTSDIR}/${_port}
+.       endif
+.       if defined(_want_run) && ${_want_run}
+            RUN_DEPENDS:=	${RUN_DEPENDS} ${_dep}:${PORTSDIR}/${_port}
+.       endif
+.   endif
+
+.endfor # _dep_port
+.endif  # !empty(${_dep_var})
+.endfor # __dep_kind
+.endif  # defined(PERL_LEVEL)
+
 .if defined(PERL_CONFIGURE)
 .if !target(do-configure)
 # XXX MCL had to duplicate the first block; implies more refactoring needed
----------8<-----------8<-----------8<-----------8<-----------8<------

Here is an example of modified Makefile for textproc/p5-Data-Report:

----------8<-----------8<-----------8<-----------8<-----------8<------
# New ports collection makefile for:	textproc/p5-Data-Report
# Date created:				24 May 2006
# Whom:					Anton Berezin <tobez@FreeBSD.org>
#
# $FreeBSD: ports/textproc/p5-Data-Report/Makefile,v 1.5 2007/09/08 01:06:11 linimon Exp $
#

PORTNAME=	Data-Report
PORTVERSION=	0.06
CATEGORIES=	textproc perl5
MASTER_SITES=	${MASTER_SITE_PERL_CPAN}
MASTER_SITE_SUBDIR=	Data
PKGNAMEPREFIX=	p5-

MAINTAINER=	tobez@FreeBSD.org
COMMENT=	Data::Report - Framework for flexible reporting

PERL_DEPENDS=	www/p5-HTML-Parser textproc/p5-Text-CSV_XS
PERL_TEST_DEPENDS=	devel/p5-Test-Simple

PERL_MODBUILD=	yes

MAN3=	Data::Report.3 Data::Report::Base.3

.include <bsd.port.mk>
----------8<-----------8<-----------8<-----------8<-----------8<------

And here is an example of modified Makefile for devel/p5-Test-Class.  Please
note that it is an *example* only - in particular, this port should actually
*unconditionally* depend on p5-Test-Exception.  But we made it a test
dependency to test how well test dependencies work.

----------8<-----------8<-----------8<-----------8<-----------8<------
# New ports collection makefile for:    p5-Test-Class
# Date created:				January 27th 2003
# Whom:	      				Erwin Lansing <erwin@FreeBSD.org>
#
# $FreeBSD: ports/devel/p5-Test-Class/Makefile,v 1.26 2008/01/20 14:29:54 miwi Exp $
#

PORTNAME=	Test-Class
PORTVERSION=	0.28
CATEGORIES=	devel perl5
MASTER_SITES=	CPAN
PKGNAMEPREFIX=	p5-

MAINTAINER=	perl@FreeBSD.org
COMMENT=	Test::Class - Easily create test classes in an xUnit style

PERL_DEPENDS=	devel/p5-Devel-Symdump>=2.03 \
		devel/p5-Attribute-Handlers>=0.77 \
		devel/p5-Class-ISA>=0.32 \
		devel/p5-Storable>=2.04
PERL_TEST_DEPENDS=	devel/p5-Test-Exception>=0.25

PERL_MODBUILD=	yes

MAN3=		Test::Class.3 \
		Test::Class::Load.3 \
		Test::Class::MethodInfo.3

.include <bsd.port.mk>
----------8<-----------8<-----------8<-----------8<-----------8<------

At any rate, it is rather instructive to compare those makefiles with their
current versions in the ports collection.  :-)

Any feedback is very welcome,
Cheers,
Lars & Anton.
-- 
We're going for 'working' here. 'clean' is for people with skills...
-- Flemming Jacobsen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080406143607.GB14452>