Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Nov 2002 08:57:59 +0100
From:      dirk.meyer@dinoex.sub.org (Dirk Meyer)
To:        ports@freebsd.org
Subject:   request for comments on a new scriot to reduce build time on packages
Message-ID:  <qoub40nuR9@dmeyer.dinoex.sub.org>

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

I use this script to move obsolte packages away,
so my package directory is always up to date.

after such a run the mising packages are rebuild,
so the subset of packages I need are build
nightly without any extra work.

This way i don't have to clean the package dir fully
and it saves me a lot of time to rebuild only what I need.

portupgrade fails in most of my cases,
when you need packages that are not default.

e.G. apache13-modssl, or build options like WITH_PHYTON.
If this usefull, we can add it under /usr/ports/Tools/scripts/

kind regards Dirk

- Dirk Meyer, Im Grund 4, 34317 Habichtswald, Germany
- [dirk.meyer@dinoex.sub.org],[dirk.meyer@guug.de],[dinoex@FreeBSD.org]

# 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:
#
#	clean-packages.sh
#
echo x - clean-packages.sh
sed 's/^X//' >clean-packages.sh << 'END-of-clean-packages.sh'
X#!/bin/sh
X#	Id$: clean-packages.sh	1.0	01.11.2002
X#
X# Copyright (c) 2001,2002
X#	by Dirk Meyer, All rights reserved.
X#	Im Grund 4, 34317 Habichtswald, Germany
X#	Email: dirk.meyer@dinoex.sub.org
X#
X# Redistribution and use in source and binary forms, with or without
X# modification, are permitted provided that the following conditions
X# are met:
X# 1. Redistributions of source code must retain the above copyright
X#    notice, this list of conditions and the following disclaimer.
X# 2. Redistributions in binary form must reproduce the above copyright
X#    notice, this list of conditions and the following disclaimer in the
X#    documentation and/or other materials provided with the distribution.
X# 3. Neither the name of the author nor the names of any co-contributors
X#    may be used to endorse or promote products derived from this software
X#    without specific prior written permission.
X#
X# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
X# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
X# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X# SUCH DAMAGE.
X#
X# -------------------------------------------------------------------------
X#
X#	Synopsis:
X#	Find obsolete packages and move them out of the way
X#
X#	Problem:
X#	Installation of a package with multiple dependencys.
X#	pkg_add installs the depended package, and its requirements.
X#	When the depended package has been updated,
X#	The packages that require this are no longer up to date.
X#
X#	Common solution:
X#	Cleaning the whole package directorys before each build.
X#
X#	My solution:
X#	use pkg_info on each package and compare the versions
X#	with the new versions in the ports tree, if they don't
X#	match report it, and move it out of the "All" directory.
X#	then remove all stale links to the old packages.
X#
X#
X#	get all path information from /etc/make.conf
Xportsdir="$(make -f /usr/ports/Mk/bsd.port.mk -V PORTSDIR)"
Xpkgdir="$(make -f /usr/ports/Mk/bsd.port.mk -V PACKAGES)"
Xext="$(make -f /usr/ports/Mk/bsd.port.mk -V PKG_SUFX)"
X#
X#	the directorys with contain the package files
Xpkgall="${pkgdir}/All"
Xpkgold="${pkgdir}/Old"
X#
X#	EX_UNAVAILABLE
Xcd ${pkgall} || exit 69
Xfor i in *
Xdo
X	#
X	#	check each depended package
X	pkg_info -q -r ${i} |
X	while read dummy dep
X	do
X		pmade="${dep}${ext}"
X		if test -f "${pmade}"
X		then
X			#
X			#	find matching port directory (origin)
X			depdir="${portsdir}/$(pkg_info -q -o ${pmade})"
X			pnew="$(cd "${depdir}"; make -V PKGFILE)"
X			if test "${pnew}" = "${pkgall}/${pmade}"
X			then
X				#
X				#	up to date
X				continue
X			fi
X			echo "${i}: dependency ${pmade} is obsolete => ${pnew}"
X		else
X			echo "${i}: dependency ${pmade} missing!"
X		fi
X		if test -d "${pkgold}"
X		then
X			#
X			#	move it if the "Old" directory exists.
X			mv -f "${i}" "${pkgold}/${i}"
X		fi
X		break
X	done
Xdone
X#
X#	find all links
Xfind ${pkgdir} -type l |
Xwhile read link
Xdo
X	if test -s "${link}"
X	then
X		#
X		#	it results in a real file
X		continue
X	fi
X	#
X	#	remove stale link
X	rm -f "${link}"
Xdone
X#
X# eof
END-of-clean-packages.sh
exit


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?qoub40nuR9>