NetBSD Problem Report #41732

From Ephaeton@gmx.net  Wed Jul 15 01:50:44 2009
Return-Path: <Ephaeton@gmx.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id A1FF963BADF
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 15 Jul 2009 01:50:44 +0000 (UTC)
Message-Id: <20090715015039.AFEBC13645@agamemnon.entropie.local>
Date: Tue, 14 Jul 2009 21:50:39 -0400 (EDT)
From: Ephaeton@gmx.net
Reply-To: Ephaeton@gmx.net
To: gnats-bugs@gnats.NetBSD.org
Subject: add distclean-depends and change distclean to mirror clean wrt CLEANDEPENDS
X-Send-Pr-Version: 3.95

>Number:         41732
>Category:       pkg
>Synopsis:       add distclean-depends and change distclean to mirror clean wrt CLEANDEPENDS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 15 01:55:00 +0000 2009
>Last-Modified:  Thu Jul 16 00:15:01 +0000 2009
>Originator:     Martin S. Weber
>Release:        NetBSD 5.0_STABLE
>Organization:

>Environment:
	pkgsrc-2009Q2


System: NetBSD agamemnon.entropie.local 5.0_STABLE NetBSD 5.0_STABLE (AGAMEMNON5) #0: Sat Jun 27 14:44:07 EDT 2009 root@agamemnon.entropie.local:/home/netbsd/obj/sys/arch/i386/compile/AGAMEMNON5 i386
Architecture: i386
Machine: i386
>Description:
	Attached patch adds a target 'distclean-depends' to mirror 'clean-depends', and also
	extends 'distclean' to mirror behaviour of 'clean' with regard to setting the
	CLEANDEPENDS variable. IMO that's an useful addition.

>How-To-Repeat:

	Try to use make CLEANDEPENDS=yes distclean (makes dependencies clean but leaves their
	distfiles). Try to use make distclean-depends (doesn't work).
>Fix:

Index: fetch/distclean.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/fetch/distclean.mk,v
retrieving revision 1.5
diff -w -u -i -t -r1.5 distclean.mk
--- fetch/distclean.mk	16 Dec 2007 02:51:24 -0000	1.5
+++ fetch/distclean.mk	15 Jul 2009 01:46:46 -0000
@@ -5,6 +5,18 @@
 # distclean:
 #       Removes the distfiles of the current package.
 #
+# distclean-depends:
+#       Removes the distfiles of the current package and its
+#       dependencies, implied and direct.
+#
+# The following variables may be set by the package Makefile and
+# specify how cleaning happens:
+#
+#    CLEANDEPENDS specifies whether "dist-cleaning" will also dist-clean
+#       in all dependencies, implied and direct.  CLEANDEPENDS
+#       defaults to "no".
+
+CLEANDEPENDS?=  no

 .PHONY: pre-distclean
 .if !target(pre-distclean)
@@ -12,9 +24,20 @@
         @${DO_NADA}
 .endif

-.PHONY: distclean
-.if !target(distclean)
-distclean: pre-distclean clean
+.PHONY: distclean-depends
+.if !target(distclean-depends)
+distclean-depends:
+        ${RUN}                                                          \
+        ${_DEPENDS_WALK_CMD} ${PKGPATH} |                               \
+        while read dir; do                                              \
+                cd ${.CURDIR}/../../$$dir &&                            \
+                ${RECURSIVE_MAKE} ${MAKEFLAGS} CLEANDEPENDS=no distclean;\
+        done
+.endif
+
+.PHONY: do-distclean
+.if !target(do-distclean)
+do-distclean: pre-distclean
         @${PHASE_MSG} "Dist cleaning for ${PKGNAME}"
         ${RUN} [ -d ${_DISTDIR} ] || exit 0;                            \
         cd ${_DISTDIR};                                                 \
@@ -23,4 +46,16 @@
         ${RUN} ${RMDIR} ${_DISTDIR} 2>/dev/null || ${TRUE}
 .  endif
         ${RUN} ${RM} -f README.html
+        @${RECURSIVE_MAKE} ${MAKEFLAGS} CLEANDEPENDS=no clean
+.endif
+
+_DISTCLEAN_TARGETS+=    pre-distclean
+.if empty(CLEANDEPENDS:M[nN][oO])
+_DISTCLEAN_TARGETS+=    distclean-depends
+.endif
+_DISTCLEAN_TARGETS+=    do-distclean
+
+.PHONY: distclean
+.if !target(distclean)
+distclean:      ${_DISTCLEAN_TARGETS}
 .endif

>Audit-Trail:
From: "Martin S. Weber" <Ephaeton@gmx.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/41732: add distclean-depends and change distclean to mirror clean wrt CLEANDEPENDS
Date: Wed, 15 Jul 2009 20:10:46 -0400

 I just noticed while looking at it again, that the dependency of
 do-distclean on pre-distclean is unnecessary and can be removed.
 I'm choosing not to pollute the audit-trail with another patch
 though, as it's only one word of change. Just noting it.

 -Martin

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.