ports-mgmt/portmaster distfile expression matching

Doug Barton dougb at FreeBSD.org
Sat Jan 16 07:19:14 UTC 2010


On 1/15/2010 6:32 PM, jhell wrote:
> 
> Hi Doug,
> 
> Recently in upgrading x11-wm/xmonad and x11-wm/xmonad-contrib I had
> noticed that when portmaster asks to delete a distfile, when it asks
> about xmonad-0.9.1 it was also asking to delete the xmonad-contrib-0.9.1
> before it had even upgraded xmonad-contrib. Is this a problem on
> portmasters behalf or is this on ports structure side ?.

Portmaster's. In the earliest versions of portmaster the only facility
for deleting distfiles was the fairly aggressive pattern matching
algorithm that still exists, albeit in a somewhat more sophisticated
form. At the suggestion of a user I added the capability to scan the
distinfo files of the installed ports and generate a comprehensive list
of the distfiles that are actually in use. This list is generated in the
background, and doesn't take too long to create, but it is possible for
a port that doesn't take more than a couple minutes to build and install
to finish before the list is done, which will lead to the situation you
described.

> What do you or anyone else think about each port possibly keeping
> obsolete-distfiles list one much like distinfo but a concatenated list
> of previous distinfo's that had once been used allowing a ( make
> distclean ) or something routine to be built into the ports
> infrastructure to parse that file in each port ?

I actually have what at this point is a fairly well refined proposal
(once again, based on a combination of my ideas and those of other
users) for storing this information on a per-port basis:
http://www.freebsd.org/cgi/query-pr.cgi?pr=106483
Portmaster currently uses this mechanism already, although I would still
like to have it included in bsd.port.mk. I have also come to the
conclusion after doing this for over 3 years now that the information
really does belong in /var/db/pkg, not /var/db/ports, but given that
portmgr doesn't show any signs of moving forward on the PR I haven't
pursued that line of argument.

My long-term plans for portmaster are to refine the distfile deletion
routine to do as follows:

1. If the distinfo list has completed, only offer to delete distfiles
that match the pattern AND are not relevant to installed ports (this is
the current behavior).
2. If the distinfo list has not completed:
a. If we have distfile information in the file from the mechanism
described above (in /var/db/ports) then offer to delete that file or
those files, and if there are any other files that match the pattern
inform the user and suggest the --clean-distfiles option
b. If there is no distfile info from /var/db/ports, I need to be a bit
smarter about what to do. Because this situation isn't going to happen
very often, my instinct is to try a much more restrictive pattern
matching algorithm on possible distfiles to offer the user to delete,
and do the same notification about the --clean-distfiles option as
described in 2.a.

For now you can also avoid the whole issue by routinely using the -D
option and then periodically using --clean-distfiles[-all]. Because the
--clean-distfiles options use the list of active distfiles generated
from the installed ports' distinfo files they are guaranteed not to
offer to delete something that is in use (although there is obviously no
way I can guarantee that you won't have another reason to want to keep
that particular distfile).


hth,

Doug

-- 

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/

	Computers are useless. They can only give you answers.
			-- Pablo Picasso



More information about the freebsd-ports mailing list