From owner-freebsd-ports Tue Feb 20 8: 0:58 2001 Delivered-To: freebsd-ports@freebsd.org Received: from blizzard.sabbo.net (ns.sabbo.net [193.193.218.18]) by hub.freebsd.org (Postfix) with ESMTP id 5D4A237B4EC; Tue, 20 Feb 2001 08:00:24 -0800 (PST) (envelope-from sobomax@FreeBSD.org) Received: from vic.sabbo.net (root@vic.sabbo.net [193.193.218.112]) by blizzard.sabbo.net (8.10.1/8.10.1) with ESMTP id f1KFuTD04533; Tue, 20 Feb 2001 17:56:39 +0200 Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vic.sabbo.net (8.11.2/8.11.2) with ESMTP id f1KFu1m84341; Tue, 20 Feb 2001 17:56:01 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3A929386.4E78F425@FreeBSD.org> Date: Tue, 20 Feb 2001 17:55:50 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: uk,ru,en MIME-Version: 1.0 To: ports@FreeBSD.org Cc: asami@FreeBSD.org Subject: Proposal: PLIST filtering rules Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi folks, I do not know what others feel, but recent "legalisation" of PLIST %%PORTDOC:%% hack is really pissses me off and forced to think about other ways to do the same thing. The following reasons caused my bad feelings about massive %%PORTDOC:%% usage in PLISTs: 1. It makes PLIST more cryptic and less human-readable; 2. It makes impossible to sort PLIST using simple tools; 3. As a consequence of 1 and 2 it makes ports updates more difficult. After thinking this out, I found that at least one option was left unexplored. I mean possibility to introduce simple egrep(1) filtering rules for PLIST. Let me show a simple typical example of the %%PORTDOC:%% infected PLIST: --*pkg-plist*-- bin/foo share/foo/foo.dat %%PORTDOC:%%share/doc/foo/1.txt %%PORTDOC:%%share/doc/foo/2.txt %%PORTDOC:%%share/doc/foo/3.txt @dirrm share/foo %%PORTDOC:%%@dirrm share/doc/foo As you can see, even such simple example looks really ugly, while many real-world ports do have much more that 3 files and several subdirectory levels in share/doc, so to speak. However, as it should be clear from the example above, in the most cases all those complexities could be avoided if there is an ability to filter out lines matching two simple regex patterns: "^share/doc/foo" and "^@dirrm share/doc/foo". It should be noted, however, that line filtering is not intended to replace PLIST_SUB, and in some complex cases PLIST_SUB should be used instead. Hence, it is proposed to introduce PLIST filtering rules, say PLIST_FIN and PLIST_FOUT, which are to be a set of egrep(1)-style patterns for lines that are to be included into and filtered out of PLIST. By default PLIST_FIN should be a pattern matching any string, while PLIST_FOUT a pattern that doesn't match anything. After such feature has been introduced %%PORTDOC:%% could be removed from the exmple above and replaced with: --*Makefile*-- PLIST_FOUT= "^share/doc/foo" "^@dirrm share/doc/foo" It most cases it could be simplified even further: --*bsd.port.mk*-- .if defined(NOPORTDOCS) PLIST_FOUT?= "^share/doc/${PORTNAME}" "^@dirrm share/doc/${PORTNAME}" .endif Another interesting possibility opens by combining proposed PLIST_FOUT with existing PLIST_SUB. This combination allows introduce possibility to flag conditional files in the PLIST, for example: --*pkg-plist*-- bin/gnome-foo %%GNOME%% bin/foo bin/kde-foo %%KDE%% --*Makefile*-- [...] .if !defined(HAVE_KDE) PLIST_FOUT+= ${KDE_PATTERN} .else PLIST_SUB+= 's|${KDE_PATTERN}||' .endif .if !defined(HAVE_GNOME) PLIST_FOUT+= ${GNOME_PATTERN} .else PLIST_SUB+= 's|${GNOME_PATTERN}||' .endif --*bsd.kde.mk*-- [...] KDE_PATTERN= \t%%KDE%%$$ --*bsd.gnome.mk*-- [...] GNOME_PATTERN= \t%%GNOME%%$$ ------------------ As you can see, unlike current PLIST_SUB solution, PLIST in this case looks clean, more eye candy and could be sorted easily either using standard tools like sort(1) or by the hand. As usually, I would like to hear comments/opinions/suggestions/bikesheds/etc regarding this proposal. If they are positive, I'm ready to provide a patch implementing this feature. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message