summaryrefslogtreecommitdiff
path: root/mk/misc/import.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/misc/import.mk')
-rw-r--r--mk/misc/import.mk12
1 files changed, 11 insertions, 1 deletions
diff --git a/mk/misc/import.mk b/mk/misc/import.mk
index 2d67b6eef83..5ae8761a1cd 100644
--- a/mk/misc/import.mk
+++ b/mk/misc/import.mk
@@ -1,4 +1,4 @@
-# $NetBSD: import.mk,v 1.3 2011/11/13 22:52:43 joerg Exp $
+# $NetBSD: import.mk,v 1.4 2011/11/13 23:04:41 joerg Exp $
#
# import:
@@ -43,6 +43,11 @@ _IMPORT_ERRORS+= "[import.mk] You must set CATEGORY."
.if exists(${.CURDIR}/TODO)
_IMPORT_ERRORS+= "[import.mk] Don't import packages that have something TODO."
.endif
+.if exists(${PKGSRCDIR}/${CATEGORY:Unonexistent}/${PKGPATH:T}/Makefile)
+_IMPORT_REMOVE_BEFORE_UPDATE=yes
+.else
+_IMPORT_REMOVE_BEFORE_UPDATE=no
+.endif
.if ${_EXPERIMENTAL:U""} != "yes"
_IMPORT_ERRORS+= "[import.mk] The \"import\" target is experimental."
.endif
@@ -87,7 +92,12 @@ _import-add-change:
${RUN} cd ${PKGSRCDIR}/doc && cvs commit \
-m "Imported ${CATEGORY}/${PKGPATH:T}${_IMPORT_FROM}." \
${_IMPORT_CHANGES:T}
+.if ${_IMPORT_REMOVE_BEFORE_UPDATE} == "yes"
+ @${STEP_MSG} "Removing local copy."
+ ${RUN} cd ${PKGSRCDIR}/${CATEGORY}/${PKGPATH:T} && rm -f *
+.endif
@${STEP_MSG} "Loading the new package from CVS."
+ ${RUN} cd ${PKGSRCDIR}/${CATEGORY}/${PKGPATH:T} && rm -f *
${RUN} cd ${PKGSRCDIR}/${CATEGORY} && cvs update Makefile ${PKGPATH:T}
@${STEP_MSG} "Adding the package to the category Makefile."
${RUN} cd ${PKGSRCDIR}/${CATEGORY} && (pkglint -F >/dev/null || ${TRUE}) && pkglint -q