pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/41732: add distclean-depends and change distclean to mirror clean wrt CLEANDEPENDS



>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
>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@localhost:/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

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index