Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Feb 1998 01:57:38 -0800 (PST)
From:      David Muir Sharnoff <muir@idiom.com>
To:        freebsd-ports@FreeBSD.ORG
Subject:   Ports that need updating.  Conditional port compilation.
Message-ID:  <199802200957.BAA11271@idiom.com>

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

Hi.  This is a three part message...

First, I've noticed two ports that don't currently work: imap-gw and
icon.

Second, I wrote a program that will look at what ports you've got 
installed and tell you which ones are out of date.  I enclose the
program.  It's meant for ports - not packages.

Third, I have some makefile modifications that allow ports to be
off by default.   This makes it much easier to do a 
(cd /usr/ports; make install)...   I enclose the patches.

I would appreciate it if someone took over the make changes from
me.  I think they are quite useful.  If there's a better way to do
it, then that's fine.  I would like to make it easier to build
my own ports.  More could be done.  For example, if the current version is
installed, then the make should immediately terminate...

I am happy to continue working on the port checking program (ckports)
for a while longer.  In addition to being enclosed below, it can
be found at:
	ftp://ftp.idiom.com/users/muir/CPAN/scripts/ckports

-Dave

The program and then the patches...

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	ckports
#
echo x - ckports
sed 's/^X//' >ckports << 'END-of-ckports'
X#!/usr/local/bin/perl 
X
X# VERSION 1.0
X
Xmy $pkgdbdir = "/var/db/pkg";
Xmy $portsdir = "/usr/ports";
Xmy $enable = ".enable";
X
Xuse File::Slurp;
X#use strict;
X
Xmy $pdb = {};
X
Xsub getversion
X{
X	my ($pkg, $dirname) = @_;
X	my $i;
X	my $one = 1;
X	my $prefix = '';
X	my $p = $pkg;
X	if ($dirname) {
X		if ($p =~ s/^\Q$dirname\E-//) {
X			$one = 0;
X			$prefix = $dirname;
X		}
X	}
X	my @c = split('-', $p);
X	if (! $dirname) {
X		my $p = $pdb;
X		my @f = @c;
X		my $n1 = 0;
X		while (@f) {
X			last unless exists $p->{$f[0]};
X			$p = $p->{$f[0]};
X			shift(@f);
X			$n1++;
X		}
X		$one = $n1 if exists $p->{' '};
X#print "one = $one on $pkg\n" if $one > 1;
X	}
X	if ($one == $#c) {
X		$i = $one;
X	} else {
X		for ($i = $#c; $i >= $one; $i--) {
X			last if $c[$i-1] !~ /^\d/;
X		}
X	}
X	my $name = join('-', @c[0..($i-1)]);
X	$name = "$prefix-$name" if $prefix && $name;
X	$name = $prefix unless $name;
X	return () unless $name;
X	if ($prefix && $prefix =~ /-\d/) {
X		my @f = split('-', $dirname);
X		my $p = $pdb;
X#print "adding prefix ... \n";
X		while (@f) {
X			my $f = shift(@f);
X#print "'$f' ... ";
X			$p->{$f} = {}
X				unless exists $p->{$f};
X			$p = $p->{$f};
X		}
X		$p->{' '} = $dirname;
X#print "\n";
X	}
X	my $version = join('-', @c[$i..$#c]);
X#	if ($name =~ /-$/) {
X#		printf "%20s %15s %s (%s)\n", $name, $version, $pkg, $dirname;
X#	}
X	return ($name, $version);
X}
X
Xmy %name;
Xmy %version;
Xmy %requested;
Xmy %byname;
Xmy %count;
Xmy %package;
Xmy %cv;
X
Xfor my $category (read_dir($portsdir)) {
X	next unless -d "$portsdir/$category";
X	next unless -e "$portsdir/$category/Makefile";
X
X	for my $port (read_dir("$portsdir/$category")) {
X		next unless -e "$portsdir/$category/$port/Makefile";
X		open(MAKEFILE, "<$portsdir/$category/$port/Makefile")
X			or die "open $portsdir/$category/$port/Makefile: $!";
X		my $distname;
X		my $pkgname;
X		my %vars;
X		$vars{'DISTNAME'} = $port;
X		while (<MAKEFILE>) {
X			next unless /^(\w+)=\s*(\S+)/;
X			$vars{$1} = $2;
X		}
X		close(MAKEFILE);
X		$pkgname = $vars{'PKGNAME'} || $vars{'DISTNAME'};
X		1 while ($pkgname =~ s/\$\{([^{}]+)\}/$vars{$1}/);
X
X		my ($p, $v) = getversion($pkgname, $port);
X
X		$name{$pkgname} = $p;
X		$version{$pkgname} = $v;
X		$byname{$p} = $v if $p;
X		$count{$p}++ if $p;
X		$package{$p} = $pkgname if $p;
X		$cv{$p} .= " $v";
X
X		if ($enable && -e "$portsdir/$category/$port/$enable") {
X			warn "can't figure out $category/$port"
X				unless $p;
X			$requested{$pkgname} = 1;
X		}
X	}
X}
X
Xmy %done;
Xfor my $i (read_dir($pkgdbdir)) {
X	my ($p, $v) = getversion($i);
X
X
X	if (exists $name{$i}) {
X		# installed matches available
X		printf "%20s: installed but not enabled\n", $i
X			if $enable && ! $requested{$i};
X
X		$done{$i} = 1;
X#print "done{$i} = 1\n";
X	} elsif ($count{$p} == 1) {
X		printf "%20s: version available: $byname{$p}\n", $i;
X		$done{$package{$p}} = 1;
X#print "done{$package{$p}} = 1\n";
X	} elsif ($count{$p} > 1) {
X		printf "%20s: current versions of %s:%s%s\n", $i, $p, $cv{$p};
X	} else {
X		printf "%20s: cannot find matching port\n", $i;
X	}
X}
X
Xmy $r = \%name;
X$r = \%requested if $enable;
X
Xfor my $n (sort keys %$r) {
X	# we already know it's not installed in any form
X	next if exists $done{$n};
X	printf "%20s: not installed\n", $n;
X}
X
END-of-ckports
exit


Index: etc/make.conf
===================================================================
RCS file: /usr/cvs/src/etc/make.conf,v
retrieving revision 1.37.2.6
diff -c -r1.37.2.6 make.conf
*** make.conf	1998/01/11 02:45:16	1.37.2.6
--- make.conf	1998/02/20 09:41:35
***************
*** 44,49 ****
--- 44,56 ----
  #COMPAT20=	yes
  #COMPAT21=	yes
  #
+ # If you wish to have ports only build if there is a file called
+ # ".enable" in their directory, then uncomment the following.  This
+ # is useful if you want to recursively build ports, but not all of
+ # them.
+ #
+ # MUST_ENABLE_PORTS=	true
+ #
  #
  # If you do not want additional documentation (some of which are
  # a few hundred KB's) for ports to be installed:
Index: share/mk/bsd.port.mk
===================================================================
RCS file: /usr/cvs/src/share/mk/bsd.port.mk,v
retrieving revision 1.227.2.32
diff -c -r1.227.2.32 bsd.port.mk
*** bsd.port.mk	1998/02/04 10:37:30	1.227.2.32
--- bsd.port.mk	1998/02/20 09:33:06
***************
*** 796,801 ****
--- 796,805 ----
  IGNORE=	"uses X11, but ${X11BASE} not found"
  .elif defined(BROKEN)
  IGNORE=	"is marked as broken: ${BROKEN}"
+ .elif (defined(MUST_ENABLE_PORTS) && (! defined(AUTO_ENABLE)) && (! exists(${.CURDIR}/.enable)))
+ IGNORE= "disabled by lack of ${.CURDIR}/.enable"
+ .elif exists(${.CURDIR}/.broken)
+ IGNORE= "disabled by ${.CURDIR}/.broken"
  .endif
  
  .if (defined(MANUAL_PACKAGE_BUILD) && defined(PACKAGE_BUILDING))
***************
*** 1500,1506 ****
  package-depends:
  	@for dir in `${ECHO} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
  		if [ -d $$dir ]; then \
! 			(cd $$dir ; ${MAKE} package-name package-depends); \
  		else \
  			${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
  		fi; \
--- 1504,1510 ----
  package-depends:
  	@for dir in `${ECHO} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
  		if [ -d $$dir ]; then \
! 			(cd $$dir ; ${MAKE} AUTO_ENABLE=yes package-name package-depends); \
  		else \
  			${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
  		fi; \
***************
*** 1580,1586 ****
  			if [ ! -d "$$dir" ]; then \
  				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
  			else \
! 				(cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
  				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
  			fi; \
  		fi; \
--- 1584,1590 ----
  			if [ ! -d "$$dir" ]; then \
  				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
  			else \
! 				(cd $$dir; ${MAKE} AUTO_ENABLE=yes ${.MAKEFLAGS} $$target) ; \
  				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
  			fi; \
  		fi; \
***************
*** 1614,1620 ****
  			if [ ! -d "$$dir" ]; then \
  				${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
  			else \
! 				(cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
  				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
  			fi; \
  		fi; \
--- 1618,1624 ----
  			if [ ! -d "$$dir" ]; then \
  				${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
  			else \
! 				(cd $$dir; ${MAKE} AUTO_ENABLE=yes ${.MAKEFLAGS} $$target) ; \
  				${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
  			fi; \
  		fi; \
***************
*** 1639,1645 ****
  		if [ ! -d $$dir ]; then \
  			${ECHO_MSG} ">> No directory for $$dir.  Skipping.."; \
  		else \
! 			(cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
  		fi \
  	done
  	@${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
--- 1643,1649 ----
  		if [ ! -d $$dir ]; then \
  			${ECHO_MSG} ">> No directory for $$dir.  Skipping.."; \
  		else \
! 			(cd $$dir; ${MAKE} AUTO_ENABLE=yes ${.MAKEFLAGS} $$target) ; \
  		fi \
  	done
  	@${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
***************
*** 1656,1669 ****
  	|| defined(RUN_DEPENDS)
  	@for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
  		if [ -d $$dir ] ; then \
! 			(cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
  		fi \
  	done
  .endif
  .if defined(DEPENDS)
  	@for dir in `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
  		if [ -d $$dir ] ; then \
! 			(cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
  		fi \
  	done
  .endif
--- 1660,1673 ----
  	|| defined(RUN_DEPENDS)
  	@for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
  		if [ -d $$dir ] ; then \
! 			(cd $$dir; ${MAKE} AUTO_ENABLE=yes NOCLEANDEPENDS=yes clean clean-depends); \
  		fi \
  	done
  .endif
  .if defined(DEPENDS)
  	@for dir in `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
  		if [ -d $$dir ] ; then \
! 			(cd $$dir; ${MAKE} AUTO_ENABLE=yes NOCLEANDEPENDS=yes clean clean-depends); \
  		fi \
  	done
  .endif
***************
*** 1672,1678 ****
  .if !target(depends-list)
  depends-list:
  	@for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
! 		(cd $$dir; ${MAKE} package-name depends-list); \
  	done
  .endif
  
--- 1676,1682 ----
  .if !target(depends-list)
  depends-list:
  	@for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
! 		(cd $$dir; ${MAKE} AUTO_ENABLE=yes package-name depends-list); \
  	done
  .endif
  
***************
*** 1704,1715 ****
  	${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
  	case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
  		ABCDE) ;; \
! 		*) cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`;; \
  	esac; \
  	${ECHO} -n "|"; \
  	case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
  		ABCD) ;; \
! 		*) cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`;; \
  	esac; \
  	${ECHO} ""
  .endif
--- 1708,1719 ----
  	${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
  	case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
  		ABCDE) ;; \
! 		*) cd ${.CURDIR} && ${ECHO} -n `make AUTO_ENABLE=yes depends-list|sort -u`;; \
  	esac; \
  	${ECHO} -n "|"; \
  	case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
  		ABCD) ;; \
! 		*) cd ${.CURDIR} && ${ECHO} -n `make AUTO_ENABLE=yes package-depends|sort -u`;; \
  	esac; \
  	${ECHO} ""
  .endif

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



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