1 # $NetBSD: developer.mk,v 1.19 2011/09/15 21:45:52 wiz Exp $
3 # Public targets for developers:
5 # changes-entry-noupdate:
6 # Appends a correctly-formatted entry to the pkgsrc CHANGES file,
7 # and removes any TODO entries that were completed with this
8 # update from the TODO file.
9 # The CHANGES and TODO files are presumed to be up to date and writable.
10 # Note that the first assumption is often wrong and that the
11 # second is wrong for those that set CVSREAD.
13 # Command-line variables:
16 # The type of entry to add. Must be one of "Added",
17 # "Updated", "Renamed" (when the PKGNAME has changed),
18 # "Moved" (when the package has a new directory, but the
19 # PKGNAME is still the same), or "Removed".
20 # The default is "Updated".
23 # When a package is renamed, this is the new name of the
27 # The login name assigned by the NetBSD Project.
28 # The default is the local login name.
31 # The path to the CHANGES file to which the entry
33 # The default is ${PKGSRCDIR}/doc/CHANGES-YYYY.
36 # The path to the TODO file from which now possibly
37 # obsolete entries are removed
38 # The default is ${PKGSRCDIR}/TODO.
41 # Explicitly use cvs.netbsd.org:/cvsroot for all cvs commands
42 # issues by changes-entry and co.
45 # % cd /usr/pkgsrc/category/package
46 # % make changes-entry CTYPE=Added
49 # Like changes-entry-noupdate, plus the CHANGES and TODO files
50 # are updated, and if not writable, "cvs edit" is done.
52 # commit-changes-entry:
54 # Like changes-entry, plus the CHANGES and TODO files are committed.
56 # Keywords: commit update add rename changes
60 NETBSD_LOGIN_NAME?
= ${_NETBSD_LOGIN_NAME_cmd
:sh
}
62 PKGSRC_CHANGES_DIR
= ${PKGSRCDIR}/doc
/
63 PKGSRC_CHANGES_BASE
= CHANGES-
${_CYEAR_cmd
:sh
}
64 PKGSRC_CHANGES?
= ${PKGSRC_CHANGES_DIR}/${PKGSRC_CHANGES_BASE}
65 PKGSRC_TODO?
= ${PKGSRC_CHANGES_DIR}/TODO
67 _CYEAR_cmd
= ${DATE} -u
+%Y
68 _CDATE_cmd
= ${DATE} -u
+%Y-
%m-
%d
69 _NETBSD_LOGIN_NAME_cmd
= ${ID} -nu
73 .if
!empty
(USE_NETBSD_REPO
:M
[Yy
][Ee
][Ss
])
74 _NB_CVSROOT
= -d
${NETBSD_LOGIN_NAME
:Q
}@cvs.NetBSD.org
:/cvsroot
77 .if
!empty
(CTYPE
:tl
:Mup
*) # updated
78 _CE_MSG1
= Updated
${PKGPATH} to
${PKGVERSION}
79 .elif
!empty
(CTYPE
:tl
:Mrem
*) ||
!empty
(CTYPE
:tl
:Mrm
) # removed
80 # XXX Check OLDNAME, and if so add " successor ${OLDNAME}".
81 _CE_MSG1
= Removed
${PKGPATH}
82 .elif
!empty
(CTYPE
:tl
:Madd
*) # added
83 _CE_MSG1
= Added
${PKGPATH} version
${PKGVERSION}
84 .elif
!empty
(CTYPE
:tl
:Mren
*) ||
!empty
(CTYPE
:tl
:Mmov
*) ||
!empty
(CTYPE
:tl
:Mmv
)
86 _CE_ERRORS
+= "[developer.mk] The TO variable must be set."
87 . elif
!exists
(${PKGSRCDIR}/${TO})
88 _CE_ERRORS
+= "[developer.mk] The package directory ${TO} does not exist."
90 . if
!empty
(CTYPE
:M
[Mm
]*)
91 _CE_MSG1
= Moved
${PKGPATH} to
${TO}
93 _CE_MSG1
= Renamed
${PKGPATH} to
${TO}
96 _CE_ERRORS
+= "[developer.mk] Invalid value "${CTYPE
:Q
}" for CTYPE."
98 _CE_MSG2
= [${NETBSD_LOGIN_NAME} ${_CDATE_cmd
:sh
}]
99 _CE_MSG
= ${_CE_MSG1} ${_CE_MSG2}
101 # XXX Accumulate commit message during each operation, so that a final
102 # commit operation will have a sensible message with all of the
103 # previous operations.
105 # XXX Fail if uid is 0, or perhaps != CVS meta files owner, to catch
106 # the case of invoking these targets as root.
108 # Targets for the update, add, commit elementary operations.
109 changes-entry-update
: .PHONY ce-error-check
110 @
${STEP_MSG} "Updating ${PKGSRC_CHANGES:T} and ${PKGSRC_TODO:T}"
111 ${RUN} cd
${PKGSRC_CHANGES_DIR} && cvs
${_NB_CVSROOT} update
${PKGSRC_CHANGES
:T
} ${PKGSRC_TODO
:T
}
112 ${RUN} cd
${PKGSRC_CHANGES_DIR} && test -w
${PKGSRC_CHANGES
:T
} || cvs
${_NB_CVSROOT} edit
${PKGSRC_CHANGES
:T
}
113 ${RUN} cd
${PKGSRC_CHANGES_DIR} && test -w
${PKGSRC_TODO
:T
} || cvs
${_NB_CVSROOT} edit
${PKGSRC_TODO
:T
}
115 changes-entry-add
: .PHONY ce-error-check
116 @
${STEP_MSG} "Adding the change"
117 ${RUN} ${ECHO} " "${_CE_MSG
:Q
} >> ${PKGSRC_CHANGES}
120 ${RUN} PKG_ADMIN
=${PKG_ADMIN_CMD
:Q
} ${SH} ${PKGSRCDIR}/mk
/scripts
/remove_todo
${PKGSRC_TODO} ${PKGBASE} ${PKGVERSION}
122 changes-entry-commit
: .PHONY ce-error-check
123 @
${STEP_MSG} "Committing the change"
124 ${RUN} cd
${PKGSRC_CHANGES_DIR} && cvs
${_NB_CVSROOT} commit
-m
${_CE_MSG1
:Q
} ${PKGSRC_CHANGES
:T
} ${PKGSRC_TODO
:T
}
126 ce-error-check
: .PHONY
127 .if defined
(_CE_ERRORS
) && !empty
(_CE_ERRORS
:M
*)
128 ${RUN} for msg in
${_CE_ERRORS}; do
${ERROR_MSG} "$$msg"; done
; exit
1
134 changes-entry-noupdate
: .PHONY ce-error-check changes-entry-add todo-entry-remove
137 changes-entry
: .PHONY ce-error-check changes-entry-update changes-entry-add todo-entry-remove
140 commit-changes-entry cce
: .PHONY ce-error-check changes-entry-update changes-entry-add todo-entry-remove changes-entry-commit