Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 145 lines (128 sloc) 4.46 kb
00901b8 Suppress the message that ".DDIR is up-to-date" by introducing a .PHONY
rillig authored
1 # $NetBSD: bsd.pkg.update.mk,v 1.7 2006/10/05 12:56:27 rillig Exp $
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
2 #
3 # This Makefile fragment is included by bsd.pkg.mk and contains the targets
4 # and variables for "make update".
5 #
6 # There is no documentation on what "update" actually does. This is merely
7 # an attempt to separate the magic into a separate module that can be
8 # reimplemented later.
9 #
10
792b2ee Move some "update"-only variables from bsd.pkg.mk to bsd.pkg.update.mk.
jlam authored
11 NOCLEAN?= NO # don't clean up after update
12 REINSTALL?= NO # reinstall upon update
13
42bdc0c Move definitions for UPDATE_TARGET and DEPENDS_TARGET closer to where
jlam authored
14 # UPDATE_TARGET is the target that is invoked when updating packages during
15 # a "make update". This variable is user-settable within /etc/mk.conf.
16 #
17 .if !defined(UPDATE_TARGET)
18 . if defined(DEPENDS_TARGET) && (${DEPENDS_TARGET} == "update")
19 . if make(package)
20 UPDATE_TARGET= package
21 . else
22 UPDATE_TARGET= install
23 . endif
24 . else
25 UPDATE_TARGET= ${DEPENDS_TARGET}
26 . endif
27 .endif
28
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
29 # The 'update' target can be used to update a package and all
30 # currently installed packages that depend upon this package.
31
32 _DDIR= ${WRKDIR}/.DDIR
33 _DLIST= ${WRKDIR}/.DLIST
34
00901b8 Suppress the message that ".DDIR is up-to-date" by introducing a .PHONY
rillig authored
35 .PHONY: update-create-ddir
36 update-create-ddir: ${_DDIR}
37
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
38 .PHONY: update
39 .if !target(update)
40 .if exists(${_DDIR})
41 RESUMEUPDATE?= YES
42 CLEAR_DIRLIST?= NO
43
44 update:
53183b6 Use PHASE_MSG, STEP_MSG, WARNING_MSG, and ERROR_MSG in place of ECHO_MSG
jlam authored
45 @${PHASE_MSG} "Resuming update for ${PKGNAME}"
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
46 . if ${REINSTALL} != "NO" && ${UPDATE_TARGET} != "replace"
47 ${_PKG_SILENT}${_PKG_DEBUG} \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
48 ${RECURSIVE_MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
49 . endif
50 .else
51 RESUMEUPDATE?= NO
52 CLEAR_DIRLIST?= YES
53
54 update:
00901b8 Suppress the message that ".DDIR is up-to-date" by introducing a .PHONY
rillig authored
55 ${_PKG_SILENT}${_PKG_DEBUG}${RECURSIVE_MAKE} ${MAKEFLAGS} update-create-ddir
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
56 . if ${UPDATE_TARGET} != "replace"
57 ${_PKG_SILENT}${_PKG_DEBUG}if ${PKG_INFO} -qe ${PKGBASE}; then \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
58 ${RECURSIVE_MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
59 || (${RM} ${_DDIR} && ${FALSE}); \
60 fi
61 . endif
62 .endif
63 ${_PKG_SILENT}${_PKG_DEBUG} \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
64 ${RECURSIVE_MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} KEEP_WRKDIR=YES DEPENDS_TARGET=${DEPENDS_TARGET:Q}
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
65 ${_PKG_SILENT}${_PKG_DEBUG} \
66 [ ! -s ${_DDIR} ] || for dep in `${CAT} ${_DDIR}` ; do \
67 (if cd ../.. && cd "$${dep}" ; then \
53183b6 Use PHASE_MSG, STEP_MSG, WARNING_MSG, and ERROR_MSG in place of ECHO_MSG
jlam authored
68 ${PHASE_MSG} "Installing in $${dep}" && \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
69 if [ "(" "${RESUMEUPDATE}" = "NO" -o \
70 "${REINSTALL}" != "NO" ")" -a \
71 "${UPDATE_TARGET}" != "replace" ] ; then \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
72 ${RECURSIVE_MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES; \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
73 fi && \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
74 ${RECURSIVE_MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
75 DEPENDS_TARGET=${DEPENDS_TARGET:Q} ; \
76 else \
53183b6 Use PHASE_MSG, STEP_MSG, WARNING_MSG, and ERROR_MSG in place of ECHO_MSG
jlam authored
77 ${PHASE_MSG} "Skipping removed directory $${dep}"; \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
78 fi) ; \
79 done
80 .if ${NOCLEAN} == "NO"
81 ${_PKG_SILENT}${_PKG_DEBUG} \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
82 ${RECURSIVE_MAKE} ${MAKEFLAGS} clean-update CLEAR_DIRLIST=YES
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
83 .endif
84
85
86 .PHONY: clean-update
87 clean-update:
00901b8 Suppress the message that ".DDIR is up-to-date" by introducing a .PHONY
rillig authored
88 ${_PKG_SILENT}${_PKG_DEBUG}${RECURSIVE_MAKE} ${MAKEFLAGS} update-create-ddir
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
89 ${_PKG_SILENT}${_PKG_DEBUG} \
90 if [ -s ${_DDIR} ] ; then \
91 for dep in `${CAT} ${_DDIR}` ; do \
92 (if cd ../.. && cd "$${dep}" ; then \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
93 ${RECURSIVE_MAKE} ${MAKEFLAGS} clean ; \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
94 else \
53183b6 Use PHASE_MSG, STEP_MSG, WARNING_MSG, and ERROR_MSG in place of ECHO_MSG
jlam authored
95 ${PHASE_MSG} "Skipping removed directory $${dep}";\
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
96 fi) ; \
97 done ; \
98 fi
99 .if ${CLEAR_DIRLIST} != "NO"
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
100 ${_PKG_SILENT}${_PKG_DEBUG}${RECURSIVE_MAKE} ${MAKEFLAGS} clean
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
101 .else
102 ${_PKG_SILENT}${_PKG_DEBUG} \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
103 ${RECURSIVE_MAKE} ${MAKEFLAGS} clean update-dirlist DIRLIST="`${CAT} ${_DDIR}`" PKGLIST="`${CAT} ${_DLIST}`"
7e8ae1a 1.) Remove all instances of '@${WARNING_MSG} "Warning: ...' which result...
tron authored
104 @${WARNING_MSG} "preserved leftover directory list. Your next"
105 @${WARNING_MSG} "\`\`${MAKE} update'' may fail. It is advised to use"
106 @${WARNING_MSG} "\`\`${MAKE} update REINSTALL=YES'' instead!"
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
107 .endif
108
109 .endif # !target(update)
110
111
112 .PHONY: update-dirlist
113 update-dirlist:
114 ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} -p ${WRKDIR}
115 .if defined(PKGLIST)
116 . for __tmp__ in ${PKGLIST}
117 ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} >>${_DLIST} "${__tmp__}"
118 . endfor
119 .endif
120 .if defined(DIRLIST)
121 . for __tmp__ in ${DIRLIST}
122 ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} >>${_DDIR} "${__tmp__}"
123 . endfor
124 .endif
125
126
127 ${_DDIR}: ${_DLIST}
128 ${_PKG_SILENT}${_PKG_DEBUG} \
129 ddir=`${SED} 's:-[^-]*$$::' ${_DLIST}`; \
130 ${ECHO} >${_DDIR}; \
131 for pkg in $${ddir} ; do \
132 if ${PKG_INFO} -b "$${pkg}" >/dev/null 2>&1 ; then \
133 ${PKG_INFO} -b "$${pkg}" | ${SED} -ne \
134 's,\([^/]*/[^/]*\)/Makefile:.*,\1,p' | \
135 ${HEAD} -1 >>${_DDIR}; \
136 fi ; \
137 done
138
139 ${_DLIST}: ${WRKDIR}
140 ${_PKG_SILENT}${_PKG_DEBUG} \
141 { ${PKG_DELETE} -n "${PKGWILDCARD}" 2>&1 | \
142 ${GREP} '^ ' | \
143 ${AWK} '{ l[NR]=$$0 } END { for (i=NR;i>0;--i) print l[i] }' \
144 || ${TRUE}; } > ${_DLIST}
Something went wrong with that request. Please try again.