Cleaning stale files from the base (Was: Re: cvs commit: src ObsoleteFiles.inc)

From: Doug Barton <DougB_at_FreeBSD.org>
Date: Tue, 26 Jul 2005 12:27:15 -0700 (PDT)
[ Moving to -current to get the discussion off the cvs lists, and get a 
wider audience ]

On Tue, 26 Jul 2005, Peter Jeremy wrote:

> On Sun, 2005-Jul-24 11:45:23 +0200, Maxime Henrion wrote:
>> If files are installed using the -p flag of install(1), which preserves the
>> modification time (I'm not sure we actually use this flag).
>
> We do in /usr/include (and maybe elsewhere).

I have posted this before, but I deal with this issue, and the man page 
issue, as follows:

doinstall ()
{
     cd /usr && [ -d include-old ] && /bin/rm -r include-old;
     [ ! -e include-old ] && mv -i include include-old;
     /bin/rm -r /usr/share/man;
     cd /usr/src && touch /var/tmp/installdate && make installworld
}

I've been doing it this way for several years, and have never run into a 
problem. For production use, we could change the rm of the man pages to a mv 
as the includes are done if people wanted to be more cautious.

>>  Also, a find
>> -ctime +1 is only useful if the installworld was done not long ago; if it's
>> a few days old or more, we'd have to hack the script.  We can also imagine
>> doing an installworld in the morning, and another in the evening.
>
> It's not perfect but it's better than what we had before.  You can
> fairly easily work around the above by adding something like
> 	date > ${DESTDIR}/etc/installworld

As you can see above, I use /var/tmp for this, as it is a little closer to 
hier-clean, but it's not a huge issue.

> into /usr/src/Makefile.inc1 as the first thing installworld does and
> then use '! -newercm /etc/installworld' for find.

I use the script that I posted at 
http://people.freebsd.org/~dougb/after_installworld for this.

Some desirable additions to that script might be a list of files to ignore 
(such as perl symlinks in /usr/bin), and an option to delete the file 
outright, but this is a good proof of concept for what I have in mind.

I did recently discover that this script leaves out some directories in 
/usr/share that could usefully be cleaned, but a lot of that stuff is 
installed with preserved timestamps, which makes this method difficult.

The other thing that makes this method exciting is that if you build world 
with -DNO_CLEAN, then the libraries where code has not changed are not 
updated, and get installed with the old dates. That's why in my script the 
lib directories are last. If I haven't done a clean buildworld, I ^C the 
script at that point.

So like I said, this isn't perfect, but as a POC it's a good place to start.

hth,

Doug

-- 

     This .signature sanitized for your protection
Received on Tue Jul 26 2005 - 17:27:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:39 UTC