Subject: Re: make replace still broken - losing +REQUIRED_BY
To: None <tech-pkg@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-pkg
Date: 08/10/2007 18:27:00
--OgqxwSJOaUobr8KG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Aug 10, 2007 at 11:08:48AM -0400, Greg Troxel wrote:
> I noticed that 'make replace' was not marking depending packages
> unsafe_depends, and found that in addition +REQUIRED_BY is going away
> across a make replace.

You might find the attached script handy for the second part of the
problem. I'll sit down next week and add that functionality directly to
pkg_admin.

Joerg

--OgqxwSJOaUobr8KG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=regen-required

#!/bin/sh

cd /var/db/pkg
echo "Removing old +REQUIRED_BY files..."
rm */+REQUIRED_BY

echo "Rebuilding +REQUIRED_BY files..."
pkg_info -e "*" | while read pkg; do
	pkg_info -qn "$pkg" | while read pattern; do
		# ignore empty lines
		[ -z "$pattern" ] && continue
		best=`pkg_admin -S -d . lsbest "$pattern"`
		if [ -n "$best" ]; then
			echo "$pkg" >> "$best/+REQUIRED_BY"
		else
			>&2 echo "No $pattern for $pkg"
		fi
	done
done

--OgqxwSJOaUobr8KG--