From owner-freebsd-ports Mon Jan 3 3:40:56 2000 Delivered-To: freebsd-ports@freebsd.org Received: from m0.cs.berkeley.edu (m0.CS.Berkeley.EDU [128.32.45.176]) by hub.freebsd.org (Postfix) with ESMTP id 17F7814DAC for ; Mon, 3 Jan 2000 03:40:52 -0800 (PST) (envelope-from asami@cs.berkeley.edu) Received: from silvia.hip.berkeley.edu (sji-ca3-67.ix.netcom.com [209.109.233.67]) by m0.cs.berkeley.edu (8.9.3/8.9.3) with ESMTP id DAA13939 for ; Mon, 3 Jan 2000 03:40:49 -0800 (PST) (envelope-from asami@cs.berkeley.edu) Received: (from asami@localhost) by silvia.hip.berkeley.edu (8.9.3/8.6.9) id DAA11819; Mon, 3 Jan 2000 03:40:45 -0800 (PST) Date: Mon, 3 Jan 2000 03:40:45 -0800 (PST) Message-Id: <200001031140.DAA11819@silvia.hip.berkeley.edu> X-Authentication-Warning: silvia.hip.berkeley.edu: asami set sender to asami@cs.berkeley.edu using -f To: ports@freebsd.org Subject: multi-level categories From: asami@cs.berkeley.edu (Satoshi Asami) Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Folks, Well, a new year is upon us so I thought we'd start thinking about some of the frequently requested items. One of them is more than one level of categorization. Here's a patch you can try. It adds a subdirectory to games ("games/jokes") where you can put stuff like xoj. Change the CATEGORIES line to "games/jokes" and off you go. I'm not sure if stuff like pkg_add's fuzzy package name matching can handle this, but that's a different issue. === Index: /usr/ports/Mk/bsd.port.mk =================================================================== RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v retrieving revision 1.324 diff -u -r1.324 bsd.port.mk --- bsd.port.mk 1999/11/11 02:36:15 1.324 +++ bsd.port.mk 2000/01/03 11:10:05 @@ -1080,7 +1080,7 @@ .else VALID_CATEGORIES+= afterstep archivers astro audio benchmarks biology \ cad chinese comms converters databases deskutils devel \ - editors elisp emulators ftp games german gnome graphics \ + editors elisp emulators ftp games games/jokes german gnome graphics \ irc japanese java kde korean lang \ mail math mbone misc net news \ offix palm perl5 plan9 print python russian \ @@ -1699,7 +1699,7 @@ exit 1; \ fi; \ fi; \ - ${LN} -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ + ${LN} -sf `${ECHO} $$cat | ${SED} -e 'sa[^/]*a..ag'`/${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ done .if !defined(NO_LATEST_LINK) @if [ ! -d ${PKGLATESTREPOSITORY} ]; then \ @@ -2524,6 +2524,7 @@ -e '/%%COMMENT%%/d' \ -e 's%%BUILD_DEPENDS%%'"`${MAKE} ${__softMAKEFLAGS} pretty-print-build-depends-list`"'' \ -e 's%%RUN_DEPENDS%%'"`${MAKE} ${__softMAKEFLAGS} pretty-print-run-depends-list`"'' \ + -e 's%%TOP%%'"`${ECHO} ${CATEGORIES} | ${SED} -e 'sa .*aa' -e 'sa[^/]*a..ag'`"'/..' \ >> $@ # The following two targets require an up-to-date INDEX in ${PORTSDIR} Index: /usr/ports/Mk/bsd.port.subdir.mk =================================================================== RCS file: /usr/cvs/ports/Mk/bsd.port.subdir.mk,v retrieving revision 1.33 diff -u -r1.33 bsd.port.subdir.mk --- bsd.port.subdir.mk 1999/08/25 04:40:22 1.33 +++ bsd.port.subdir.mk 2000/01/03 10:55:56 @@ -194,6 +194,9 @@ HTMLIFY= sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/ Creating README.html" @> $@.tmp Index: /usr/ports/Templates/README.category =================================================================== RCS file: /usr/cvs/ports/Templates/README.category,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 README.category --- README.category 1996/04/01 11:16:00 1.1.1.1 +++ README.category 2000/01/03 10:52:31 @@ -16,6 +16,6 @@


- Go to top of ports tree + Go to parent directory Index: /usr/ports/Templates/README.port =================================================================== RCS file: /usr/cvs/ports/Templates/README.port,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 README.port --- README.port 1996/04/01 11:16:00 1.1.1.1 +++ README.port 2000/01/03 10:58:56 @@ -14,7 +14,7 @@

Please read the file "pkg/DESCR" for a longer description. -

Go to the top of the ports tree for +

Go to the top of the ports tree for a summary on how to use the ports collection.

@@ -25,6 +25,6 @@


Go up one level | - Go to top of ports tree + Go to top of ports tree === The latest link and README.html stuff is really pretty ugly but basically what it does is try to find a relative path from here to the top level. Take the first item in CATEGORIES (which should always match the full subdirectory path) and change each component of the path to "..". (This will fail miserably if you put "CATEGORIES=elisp japanese/editors" in japanese/editors/mule/Makefile. But you're not supposed to do that.) For the category README.html, the only funky thing is that the entry could be another category. I "fixed" this by adding a pseudo package-name target in bsd.port.subdir.mk to print out the last component of the pathname ("/a/my_ports/games/jokes" -> "jokes") but it brings up another interesting question. Namely: How to distinguish between categories and individual ports. Right now, all the directories directly under /usr/ports is considered categories and you'll get all ports one level under that. That will no longer be the case, as you'll get > ls -sF /usr/ports/games : 1 jetpack/ 1 xdemineur/ 1 xtron/ 1 jokes/ 1 xdigger/ 1 xtruco/ 1 jzip/ 1 xdino/ 1 xvier/ : Note that the "jokes" entry looks exactly like the normal ports. This is Not Nice. One solution is to make all subdirectories of a category the same type, i.e., either all subcategories or all ports. In this case, /usr/ports/games will only contain "jokes", "roguelike", "shooting" and such, and everything under "jokes" will be individual ports (unless we further want to divide it up, of course). "shooting" could have things like "space/xasteroids" "scifi/xbat". That way users will probably be able to tell what they're looking at (although they might be slightly surprised if they blindly type "cd /usr/ports/editors/emacs; make install" ;). The problem with this approach is that we'll have to move a lot of stuff every time we decide to split up a category, since we can't just create a new subcategory and only move stuff that fits into there -- everything has to moved to "some" subdirectory. This will cause a lot of "misc" directories in the ports tree, and also make ongoing category maintenance a very painful (I think). Another solution is to add another rule on naming of categories and individual port names. For instance, if we decide to make all categories start with uppercase and all ports with lowercase, the user will see "Jokes" and "Shooting" right at the beginning of the directory listing (assuming they aren't using some brain-damaged software which can only sort case-insensitively). This will be much easier on the normal transition as we can move things piecemeal, except that everything will have to be moved mechanically to the uppercase categories as the first pass. Anyway, just thinking out loud. Comments? -PW To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message