From owner-freebsd-ports Wed Dec 17 06:17:42 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id GAA13906 for ports-outgoing; Wed, 17 Dec 1997 06:17:42 -0800 (PST) (envelope-from owner-freebsd-ports) Received: from home.gtcs.com (home.gtcs.com [206.54.69.238]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id GAA13899 for ; Wed, 17 Dec 1997 06:17:29 -0800 (PST) (envelope-from bruce@gtcs.com) Received: from gtcs.com (localhost.gtcs.com [127.0.0.1]) by home.gtcs.com (8.8.5/8.8.5) with ESMTP id HAA15618; Wed, 17 Dec 1997 07:16:47 -0700 (MST) Disposition-Notification-To: bgingery@gtcs.com X-Comment1: in most cases both the Return-Receipt and Delivery-Notification X-Comment2: requests are part of an ongoing poll to determine what clients X-Comment3: and MTAs respond to the headers. Message-Id: <199712171416.HAA15618@home.gtcs.com> Date: Wed, 17 Dec 1997 07:16:44 -0700 (MST) From: bgingery@gtcs.com Reply-To: bgingery@gtcs.com Subject: Re: Recommended added target for bsd.port.mk To: asami@cs.berkeley.edu cc: freebsd-ports@FreeBSD.ORG In-Reply-To: <199712171149.DAA16651@silvia.HIP.Berkeley.EDU> MIME-Version: 1.0 Content-Type: TEXT/plain; CHARSET=US-ASCII Sender: owner-freebsd-ports@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On 17 Dec, Satoshi Asami wrote: -} "size" is fine, can someone send me a patch? As for the others, I -} don't think we should start adding things that can be done by simple -} aliases. bsd.port.mk is long and complicated enough as it is. Okay, it's not QUITE a patch (and evidently I don't have the most current bsd.port.mk which you'd want a patch against, anyways). DESCRIPTION =========== Here's the idea. In FILESDIR, we add a file called "sizes" makesizes is the logical equivalent to makesum. It creates that file from scratch. The biggest difference is that "make makesizes" depends on "make package" .. which depends on "make install" .... The only thing I've NOT taken into account is the package registry database, which will vary according to subsequent depends, anyways. I don't allow for those, but I'd think that they'd rarely make a k difference. Makesizes target creates line entries for each "stage" of the sizing. Just for the consistency, each line has THREE entries, an ident, the size in k, and the file or directory to which it applies. Although the ident is followed by a colon, that's for raw readability. The fields are whitespace delimited. package: dist: ... dist may reoccur depending on number of distfiles for port. make: work: work/ installed: port: other size targets merely extract that info. In order to get "size", we need "make" and "installed", anyways. The others are just gravy, because they'd certainly be useful, either to users or CD builders. E.g. someone with a slow link, building from the net, might want to "make fetch-list sizedist" to get an idea of the time it's apt to take on that connection - BEFORE attempting a make fetch. Someone building a ports-and-distfiles CD might do JUST sizedist and sizeport, while if packages also were being put on that same CD, a sizecd gives the total size for it all. Someone with "close space" on their filesystem would do a "make size" to find out if they have enough workspace to build it, or "make sizepkg installed" to see if they even have room to install the binaries. SYNOPSIS ======== Size target below (gather information) makesizes: Creates ${FILESDIR}/sizes by analyzing fully created and present port. Could replace "make package" as a "standard target" for ppl used to just using that target to "do it all". Size targets below (informational) size: Normal user's size to install sizemax: Size with EVERYTHING made and installed and not cleaned - including package. This is the "port tester's required size". sizepkg: Size of binary dist package sizeport: Size of just the port (within a few bytes) in k sizedist: Size of the "fetch files" sizemake: Size to make but not install - e.g. just test it. sizeinst: Size installed, distclean (not counting port dir). sizecd: Size of port plus size of package plus size of distfiles and I left off the other total, size-of-work with port built, which is really just for makesizes use, but COULD also be included. I had each size target return JUST the size-in-k, figuring that if the full record was wanted, 'grep' would easily handle it in an alias. Approximate code, off the top of my (tired) head. Its been a few weeks since I did anything in awk, and a year or two since I did anything serious in awk/gawk.... Feel free to improve! Excuse the sometimes weirdly line wrapped. CODE ===== for bsd.port.mk ... SIZES=${FILESDIR}/sizes makesizes: ${WRKDIR}/.package-done @echo -n "package: " > ${SIZES} @ls -ks ${PKGNAME}.tar.gz >> ${SIZES} @foreach $f in ${DISTFILES}; do \ echo -n "dist: " >> ${SIZES}; \ ls -ks ${DISTDIR}/$f >> ${SIZES}; \ done @echo -n "make: "`du -s .` >> ${SIZES} @echo -n "work: "`du -s work/` >> ${SIZES} @tar -tvzf ${PKGNAME}.tar.gz | awk -v n=0 '{n += $$2}; \ END {printf "installed: %d ",n;}' >>${SIZES} @echo ${PKGNAME}.tar.gz >> ${SIZES} @awk <${SIZES}'/^make/ {n += $$2};/^work/ {n -= $$2}; \ /^package/ {n -= $$2}; END {print "port:",n," ."};' \ >> ${SIZES} ${SIZES}: makesizes # size of actual portdir in k (within a few bytes). sizeport: ${SIZES} awk < $> '/^port/ {print $$2;}' # size of binary "package" in k sizepkg: ${SIZES} awk < $> '/^package/ {print $$2;}' # size for make [build] in k sizemake: ${SIZES} awk < $> '/^make/ {print $$2;}' # fetch size in k sizedist: ${SIZES} awk < $> '/^dist/ {n += $$2}; END {print n;}' # size for make package in k - larger than make install sizemax: ${SIZES} awk < $> '/^dist/ {n += $$2}; /^make/ {n += $$2}; \ /^package/ {n += $$2}; END {print n;}' # size installed, not including port, package, dist, in k sizeinst: ${SIZES} awk < $> '/^installed/ {print $$2;}' # size to make install in k size: ${SIZES} awk < $> '/^dist/ {n += $$2}; /^make/ {n += $$2}; \ /^installed/ {n += $$2}; END {print n;} # size of package PLUS size of port+distfiles, e.g. for CD-ROM sizecd: ${SIZES} awk < $> '/^dist/ {n += $$2}; /^package/ {n += $$2};\ /^port/ {n += $$2}; END {print n;}' Presumes that "make package" puts package in ${CURDIR}, not in ../pkg/ or other site tree. for bsd.port.subdir.mk I'll leave that as an exercise for someone fresher. Same targets could easily accumulate from each subdir. Bruce Gingery Advanced Integrators, LC