Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-16 Thread Ruslan Ermilov
On Sun, Feb 15, 2004 at 05:57:14AM -0600, Matthew D. Fuller wrote:
 On Sun, Feb 15, 2004 at 09:20:56AM + I heard the voice of
 Bruce M Simpson, and lo! it spake thus:
  
  It would be helpful if it were pointed out in documentation somewhere
  that the path to the compile and source directories, when doing NFS
  kernel installs, has to be identical to those which were in effect on
  the build box due to the treatment of MAKEOBJDIRPREFIX during the modules
  build (and subsequent modules/* path creation).
 
 And, last time I tried it (which admittedly was a long time ago, so
 grab your salt grainer), the same applied to world builds too.
 
To stop this from being happening, Jun Kuriyama has done a cleanup
lately to replace lots of symlink created during buildworld with
cp(1) commands.


Cheers,
-- 
Ruslan Ermilov
FreeBSD committer
[EMAIL PROTECTED]


pgp0.pgp
Description: PGP signature


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread Bruce M Simpson
On Sun, Feb 15, 2004 at 02:42:07AM -0500, Garance A Drosihn wrote:
 It occurs to me that the simple, reliable solution to this is to
 add a 'realclean' target to /usr/src/Makefile, such as:

I don't have a problem with this.

However, on a related but somewhat separate note:

It would be helpful if it were pointed out in documentation somewhere
that the path to the compile and source directories, when doing NFS
kernel installs, has to be identical to those which were in effect on
the build box due to the treatment of MAKEOBJDIRPREFIX during the modules
build (and subsequent modules/* path creation).

BMS
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread Matthew D. Fuller
On Sun, Feb 15, 2004 at 09:20:56AM + I heard the voice of
Bruce M Simpson, and lo! it spake thus:
 
 It would be helpful if it were pointed out in documentation somewhere
 that the path to the compile and source directories, when doing NFS
 kernel installs, has to be identical to those which were in effect on
 the build box due to the treatment of MAKEOBJDIRPREFIX during the modules
 build (and subsequent modules/* path creation).

And, last time I tried it (which admittedly was a long time ago, so
grab your salt grainer), the same applied to world builds too.


-- 
Matthew Fuller (MF4839)   |  [EMAIL PROTECTED]
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/

The only reason I'm burning my candle at both ends, is because I
  haven't figured out how to light the middle yet
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread Richard Coleman
Bruce M Simpson wrote:
On Sun, Feb 15, 2004 at 02:42:07AM -0500, Garance A Drosihn wrote:

It occurs to me that the simple, reliable solution to this is to
add a 'realclean' target to /usr/src/Makefile, such as:


I don't have a problem with this.

However, on a related but somewhat separate note:

It would be helpful if it were pointed out in documentation somewhere
that the path to the compile and source directories, when doing NFS
kernel installs, has to be identical to those which were in effect on
the build box due to the treatment of MAKEOBJDIRPREFIX during the modules
build (and subsequent modules/* path creation).
BMS
I believe this is mentioned in the development(7) man page.  But I do 
not believe it is not mentioned in the relevant handbook section.

And this (very useful) man page is never mentioned in the handbook 
anywhere.  I found it by accident one day when looking for something else.

Richard Coleman
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Garance A Drosihn [EMAIL PROTECTED] writes:
: realclean :
:   rm -Rf ${.OBJDIR}/*

I'd make that be more like:

realclean :
@chflags -R 0 ${.OBJDIR}/*
@rm -Rf ${.OBJDIR}/*

since sometimes you wind up files that have flags set on them.  I once
looked into hacking rm to do that in one step, but couldn't figure out
a way to do it race free and punted.  There was no notion of a
funlink.  this is conceptually as close as I got:

 fd = open(path, O_RDRW);   /*1*/
 fchflags(fd, 0);
 unlink(path);  /*2*/

which races between /*1*/ and /*2*/.

If you can tolerate errors in the output, the following is faster
because the chflags has lots less work to do:

realclean :
@rm -Rf ${.OBJDIR}/*
@chflags -R 0 ${.OBJDIR}/*
@rm -Rf ${.OBJDIR}/*


Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Bruce M Simpson [EMAIL PROTECTED] writes:
: It would be helpful if it were pointed out in documentation somewhere
: that the path to the compile and source directories, when doing NFS
: kernel installs, has to be identical to those which were in effect on

: the build box due to the treatment of MAKEOBJDIRPREFIX during the modules
: build (and subsequent modules/* path creation).

Remove the word kernel.  It has to be identical for *ALL* installs.
*OR* you have to play games with symbolic links (which is what Timing
Solutions does for their chroot build environments).

Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread Marcel Moolenaar
On Sun, Feb 15, 2004 at 10:19:00AM -0700, M. Warner Losh wrote:
 In message: [EMAIL PROTECTED]
 Garance A Drosihn [EMAIL PROTECTED] writes:
 : realclean :
 : rm -Rf ${.OBJDIR}/*
 
 I'd make that be more like:
 
 realclean :
   @chflags -R 0 ${.OBJDIR}/*
   @rm -Rf ${.OBJDIR}/*
 
 since sometimes you wind up files that have flags set on them.

Sounds like a bug to me. Do you have examples?

 If you can tolerate errors in the output, the following is faster
 because the chflags has lots less work to do:
 
 realclean :
   @rm -Rf ${.OBJDIR}/*
   @chflags -R 0 ${.OBJDIR}/*
   @rm -Rf ${.OBJDIR}/*

Since there should be no flags on files in the object directory in
principle, the errors are probably useful to track down where these
get set.

In any case: I think a realclean target based on a recursive rm is
generally useful. Adding a chflags in there makes it more foolproof
and thus ideal for UPDATING and other user oriented documentation.

-- 
 Marcel Moolenaar USPA: A-39004  [EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Marcel Moolenaar [EMAIL PROTECTED] writes:
: On Sun, Feb 15, 2004 at 10:19:00AM -0700, M. Warner Losh wrote:
:  In message: [EMAIL PROTECTED]
:  Garance A Drosihn [EMAIL PROTECTED] writes:
:  : realclean :
:  :   rm -Rf ${.OBJDIR}/*
:  
:  I'd make that be more like:
:  
:  realclean :
:  @chflags -R 0 ${.OBJDIR}/*
:  @rm -Rf ${.OBJDIR}/*
:  
:  since sometimes you wind up files that have flags set on them.
: 
: Sounds like a bug to me. Do you have examples?

libc.so.4 in the installed libraries in MAKEOBJDIRPREFIX if you have a
really old obj tree.  This is supposed to be foolproof, no?

:  If you can tolerate errors in the output, the following is faster
:  because the chflags has lots less work to do:
:  
:  realclean :
:  @rm -Rf ${.OBJDIR}/*
:  @chflags -R 0 ${.OBJDIR}/*
:  @rm -Rf ${.OBJDIR}/*
: 
: Since there should be no flags on files in the object directory in
: principle, the errors are probably useful to track down where these
: get set.
: 
: In any case: I think a realclean target based on a recursive rm is
: generally useful. Adding a chflags in there makes it more foolproof
: and thus ideal for UPDATING and other user oriented documentation.

Yup.

Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread Garance A Drosihn
At 10:19 AM -0700 2/15/04, M. Warner Losh wrote:
In message: [EMAIL PROTECTED]
Garance A Drosihn [EMAIL PROTECTED] writes:
: realclean :
:   rm -Rf ${.OBJDIR}/*
I'd make that be more like:

realclean :
@chflags -R 0 ${.OBJDIR}/*
@rm -Rf ${.OBJDIR}/*
If you can tolerate errors in the output, the following is
faster because the chflags has lots less work to do:
realclean :
@rm -Rf ${.OBJDIR}/*
@chflags -R 0 ${.OBJDIR}/*
@rm -Rf ${.OBJDIR}/*
The more foolproof/reliable we can make it for everybody, the
more I like it.  I'll see your chflags, and add one redirection
of stderr so the user won't see errors that we don't really
care about:
realclean :
@rm -Rf ${.OBJDIR}/*  2/dev/null
@chflags -R 0 ${.OBJDIR}/*
@rm -Rf ${.OBJDIR}/*
Any errors that showed up on the first 'rm' should also show up
on the second 'rm', so we shouldn't really lose any useful info.
I might also try wrapping the second two commands in an 'if', so
they will be executed only if there's still something left over
after the first 'rm'.
--
Garance Alistair Drosehn=   [EMAIL PROTECTED]
Senior Systems Programmer   or  [EMAIL PROTECTED]
Rensselaer Polytechnic Instituteor  [EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding 'realclean' target to /usr/src/Makefile

2004-02-15 Thread Garance A Drosihn
At 10:19 AM -0700 2/15/04, M. Warner Losh wrote:
If you can tolerate errors in the output, the following is
faster because the chflags has lots less work to do:
realclean :
@rm -Rf ${.OBJDIR}/*
@chflags -R 0 ${.OBJDIR}/*
@rm -Rf ${.OBJDIR}/*


After some testing, I am planning to go with:

Index: Makefile
===
RCS file: /home/ncvs/src/Makefile,v
retrieving revision 1.292
diff -u -r1.292 Makefile
--- Makefile9 Dec 2003 02:08:19 -   1.292
+++ Makefile16 Feb 2004 00:29:54 -
@@ -104,6 +104,21 @@
 .endif
 #
+# This 'realclean' target is not included in TGTS, because it is not
+# a recursive target.  All of the work for it is done right here.
+# The first 'rm' will usually remove all files and directories.  If
+# it does not, then there are probably some files with chflags set.
+# Unset all special chflags, and try the 'rm' a second time.
+realclean :
+   -rm -Rf ${.OBJDIR}/* 2/dev/null
+   @-if [ `echo ${.OBJDIR}/*` != ${.OBJDIR}/* ] ; then \
+   echo chflags -R 0 ${.OBJDIR}/* ; \
+   chflags -R 0 ${.OBJDIR}/* ;  \
+   echo rm -Rf ${.OBJDIR}/* ; \
+   rm -Rf ${.OBJDIR}/* ; \
+   fi
+
+#
 # Handle the user-driven targets, using the source relative mk files.
 #
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

If the first 'rm' works, the other two commands will not be
executed, and the user will only see the first 'rm'.  If the
other two commands are executed, then the user will also see
echoed-versions of those commands before they are executed.
So, if there is some chflag'ed file in /usr/obj/..., what the
user sees is:
(330) keep-talking/root # make realclean
rm -Rf /usr/obj/usr/src/* 2/dev/null
*** Error code 1 (ignored)
chflags -R 0 /usr/obj/usr/src/*
rm -Rf /usr/obj/usr/src/*
--
Garance Alistair Drosehn=   [EMAIL PROTECTED]
Senior Systems Programmer   or  [EMAIL PROTECTED]
Rensselaer Polytechnic Instituteor  [EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Adding 'realclean' target to /usr/src/Makefile

2004-02-14 Thread Garance A Drosihn
In the instructions I am writing up for a sparc64 change, I wrote
that people should:
rm -Rf /usr/obj/usr/src/*
to make sure they got rid of everything in the previous buildworld.
Some developers reminded me that this isn't always the right thing
to do (depending on symlinks or on various settings the user may
have set).  Some suggested 'rm /usr/obj/*', but I do not like that
because I have other things in /usr/obj that I don't want to blow
away.  And besides, even that can be wrong if the user has set
something like MAKEOBJDIRPREFIX.
It occurs to me that the simple, reliable solution to this is to
add a 'realclean' target to /usr/src/Makefile, such as:
realclean :
rm -Rf ${.OBJDIR}/*
Another option is to put that into /usr/src/Makefile as the
'cleandir' target.  Right now that 'cleandir' target goes to the
extra work of looping through all subdirectories, and having
*those* Makefiles do whatever they want for a 'cleandir' target.
This includes printing out all kinds of status messages, and
frankly seems like a waste of time to me.  I'd rather type in the
'rm' command by hand then wait for that target, but I expect that
behavior serves a purpose, so I'm suggesting the new target.
Seeing that this is in /usr/src/Makefile, and that it's a simple
two-line change, I'm sure there's at least a hundred developers
who will have strong opinions about it.  So, should I do it, or
will I be beaten around the head and shoulders for suggesting it?
--
Garance Alistair Drosehn=   [EMAIL PROTECTED]
Senior Systems Programmer   or  [EMAIL PROTECTED]
Rensselaer Polytechnic Instituteor  [EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]