From ff889eb62906c62fbc4b771f86770f484a50b455 Mon Sep 17 00:00:00 2001 From: joerg Date: Sun, 13 Nov 2011 23:04:41 +0000 Subject: If importing into an existing directory, remove the content first. --- mk/misc/import.mk | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3