Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 135 lines (118 sloc) 3.987 kB
8c76ea3 Apply my fix for PR 35091: do a check-vulnerable step first in "make
dholland authored
1 # $NetBSD: bsd.pkg.update.mk,v 1.21 2010/06/15 04:14:26 dholland 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")
3f4247b If using "make package", default to recursion with package-install.
joerg authored
19 . if ${_USE_DESTDIR} != "no" || make(package)
0d9f172 Prefer package-destdir as default for update with USE_DESTDIR.
joerg authored
20 UPDATE_TARGET= package-install
42bdc0c Move definitions for UPDATE_TARGET and DEPENDS_TARGET closer to where
jlam authored
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"
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
47 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
48 . endif
49 .else
50 RESUMEUPDATE?= NO
51 CLEAR_DIRLIST?= YES
52
53 update:
8c76ea3 Apply my fix for PR 35091: do a check-vulnerable step first in "make
dholland authored
54 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} check-vulnerable
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
55 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} update-create-ddir
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
56 . if ${UPDATE_TARGET} != "replace"
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
57 ${RUN} 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
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
63 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} KEEP_WRKDIR=YES DEPENDS_TARGET=${DEPENDS_TARGET:Q}
e4d337a Replaced _PKG_SILENT and _PKG_DEBUG with RUN.
rillig authored
64 ${RUN} \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
65 [ ! -s ${_DDIR} ] || for dep in `${CAT} ${_DDIR}` ; do \
66 (if cd ../.. && cd "$${dep}" ; then \
53183b6 Use PHASE_MSG, STEP_MSG, WARNING_MSG, and ERROR_MSG in place of ECHO_MSG
jlam authored
67 ${PHASE_MSG} "Installing in $${dep}" && \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
68 if [ "(" "${RESUMEUPDATE}" = "NO" -o \
69 "${REINSTALL}" != "NO" ")" -a \
70 "${UPDATE_TARGET}" != "replace" ] ; then \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
71 ${RECURSIVE_MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES; \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
72 fi && \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
73 ${RECURSIVE_MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} \
8174e3c Don't require pkg_delete or pkg_info -r to list packages in full
joerg authored
74 _PKGSRC_UPDATE_CHECK=yes \
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"
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
81 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} clean-update CLEAR_DIRLIST=YES
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
82 .endif
83
84
85 .PHONY: clean-update
86 clean-update:
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
87 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} update-create-ddir
e4d337a Replaced _PKG_SILENT and _PKG_DEBUG with RUN.
rillig authored
88 ${RUN} \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
89 if [ -s ${_DDIR} ] ; then \
90 for dep in `${CAT} ${_DDIR}` ; do \
91 (if cd ../.. && cd "$${dep}" ; then \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
92 ${RECURSIVE_MAKE} ${MAKEFLAGS} clean ; \
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
93 else \
53183b6 Use PHASE_MSG, STEP_MSG, WARNING_MSG, and ERROR_MSG in place of ECHO_MSG
jlam authored
94 ${PHASE_MSG} "Skipping removed directory $${dep}";\
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
95 fi) ; \
96 done ; \
97 fi
98 .if ${CLEAR_DIRLIST} != "NO"
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
99 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} clean
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
100 .else
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
101 ${RUN} ${RECURSIVE_MAKE} ${MAKEFLAGS} clean update-dirlist DIRLIST="`${CAT} ${_DDIR}`" PKGLIST="`${CAT} ${_DLIST}`"
7e8ae1a 1.) Remove all instances of '@${WARNING_MSG} "Warning: ...' which res…
tron authored
102 @${WARNING_MSG} "preserved leftover directory list. Your next"
103 @${WARNING_MSG} "\`\`${MAKE} update'' may fail. It is advised to use"
104 @${WARNING_MSG} "\`\`${MAKE} update REINSTALL=YES'' instead!"
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
105 .endif
106
107 .endif # !target(update)
108
109
110 .PHONY: update-dirlist
111 update-dirlist:
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
112 ${RUN} ${MKDIR} -p ${WRKDIR}
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
113 .if defined(PKGLIST)
114 . for __tmp__ in ${PKGLIST}
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
115 ${RUN} ${ECHO} >>${_DLIST} "${__tmp__}"
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
116 . endfor
117 .endif
118 .if defined(DIRLIST)
119 . for __tmp__ in ${DIRLIST}
a887ebc Replaced ${_PKG_SILENT}${_PKG_DEBUG} with ${RUN}, since it is shorter.
rillig authored
120 ${RUN} ${ECHO} >>${_DDIR} "${__tmp__}"
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
121 . endfor
122 .endif
123
124
125 ${_DDIR}: ${_DLIST}
c28f839 Correct typo, really fixes PR 36940.
obache authored
126 ${RUN} pkgs=`${CAT} ${_DLIST}`; \
3492e1f pkg_info needs at least one package name. Fixes PR 36940.
rillig authored
127 if [ "$$pkgs" ]; then ${PKG_INFO} -Q PKGPATH $$pkgs; fi > ${_DDIR}
5ca7ed6 First pass at implementing support for package system flavors other
jlam authored
128
4d383ea Use pkg_info -r if present and fall back to pkg_delete for pkg_install
joerg authored
129 ${_DLIST}: ${WRKDIR}
76b3f2b make update might be called without having the package installed, so
joerg authored
130 if ${PKG_INFO} -qe "${PKGWILDCARD}"; then \
131 ${PKG_INFO} -qr "${PKGWILDCARD}" > ${_DLIST}; \
132 else \
133 ${TOUCH} ${_DLIST}; \
134 fi
Something went wrong with that request. Please try again.