summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2011-11-13 23:04:41 +0000
committerjoerg <joerg@pkgsrc.org>2011-11-13 23:04:41 +0000
commitff889eb62906c62fbc4b771f86770f484a50b455 (patch)
tree6f5ea6a88075c5f124db491efd097d161c9d6eff
parentd39716f11f637d5eb2fed7d33ed2713f4b32d447 (diff)
downloadpkgsrc-ff889eb62906c62fbc4b771f86770f484a50b455.tar.gz
If importing into an existing directory, remove the content first.
-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