1 # $NetBSD: import.mk,v 1.4 2011/11/13 23:04:41 joerg Exp $
5 # Imports a package from the outside into pkgsrc.
7 # Command line parameters:
9 # FROM (optional when you are in a pkgsrc-wip package)
10 # The source where the package comes from. A common value
11 # is "pkgsrc-wip" or an empty string.
14 # The main category of the package. This is where the package
18 # The name or mail address of the original package builder.
19 # This is used in the commit message.
22 # The name of your account on cvs.NetBSD.org. Is used for
23 # recording the change in doc/CHANGES.
25 # keywords: wip pkgsrc-wip
28 _IMPORT_ERRORS
= # none
30 _IMPORT_FROM
= # nothing but a leading space
33 _IMPORT_FROM
+= from
${FROM}
35 .elif
!empty
(PKGPATH
:Mwip
/*)
36 _IMPORT_FROM
+= from pkgsrc-wip
38 _IMPORT_ERRORS
+= "[import.mk] You must set FROM."
40 CATEGORY?
= ${CATEGORIES
:[1]}
41 .if
${CATEGORY
:U
} == ""
42 _IMPORT_ERRORS
+= "[import.mk] You must set CATEGORY."
44 .if exists
(${.CURDIR
}/TODO
)
45 _IMPORT_ERRORS
+= "[import.mk] Don't import packages that have something TODO."
47 .if exists
(${PKGSRCDIR}/${CATEGORY
:Unonexistent
}/${PKGPATH
:T
}/Makefile
)
48 _IMPORT_REMOVE_BEFORE_UPDATE
=yes
50 _IMPORT_REMOVE_BEFORE_UPDATE
=no
52 .if
${_EXPERIMENTAL
:U
""} != "yes"
53 _IMPORT_ERRORS
+= "[import.mk] The \"import\" target is experimental."
56 _IMPORT_YEAR
!= date
-u
+%Y
57 _IMPORT_TODAY
!= date
-u
+%Y-
%m-
%d
58 _IMPORT_CHANGES
= ${PKGSRCDIR}/doc
/CHANGES-
${_IMPORT_YEAR}
60 .PHONY
: import _import-check _import-import _import-add-change _import-remove
61 import
: _import-check _import-import _import-add-change _import-remove
64 .if
!empty
(_IMPORT_ERRORS
)
65 ${RUN} ${_IMPORT_ERRORS
:@e@
${ERROR_MSG} ${e
:Q
}; @
} ${FALSE}
67 ${RUN} pkglint
--import
-Wall
70 @
${STEP_MSG} "Importing ${PKGNAME}."
73 { ${ECHO} "Imported ${PKGBASE}${_IMPORT_FROM}."; \
78 *) ${ECHO} ""; ${ECHO} "Packaged by ${BY}.";; \
81 cvs
-d cvs.netbsd.org
:/cvsroot import \
83 pkgsrc
/${CATEGORY}/${PKGPATH
:T
} \
87 @
${STEP_MSG} "Adding CHANGES entry."
88 ${RUN} cd
${PKGSRCDIR}/doc
&& cvs update
${_IMPORT_CHANGES
:T
}
89 ${RUN} printf
"\\tAdded %s version %s [%s %s]\\n" \
90 ${CATEGORY}/${PKGPATH
:T
} ${PKGVERSION} \
91 ${NETBSD_LOGIN_NAME} ${_IMPORT_TODAY} \
93 ${RUN} cd
${PKGSRCDIR}/doc
&& cvs commit \
94 -m
"Imported ${CATEGORY}/${PKGPATH:T}${_IMPORT_FROM}." \
96 .if
${_IMPORT_REMOVE_BEFORE_UPDATE} == "yes"
97 @
${STEP_MSG} "Removing local copy."
98 ${RUN} cd
${PKGSRCDIR}/${CATEGORY}/${PKGPATH
:T
} && rm -f
*
100 @
${STEP_MSG} "Loading the new package from CVS."
101 ${RUN} cd
${PKGSRCDIR}/${CATEGORY}/${PKGPATH
:T
} && rm -f
*
102 ${RUN} cd
${PKGSRCDIR}/${CATEGORY} && cvs update Makefile
${PKGPATH
:T
}
103 @
${STEP_MSG} "Adding the package to the category Makefile."
104 ${RUN} cd
${PKGSRCDIR}/${CATEGORY} && (pkglint
-F
>/dev
/null ||
${TRUE}) && pkglint
-q
105 @
${STEP_MSG} "Committing the modified category Makefile."
106 ${RUN} cd
${PKGSRCDIR}/${CATEGORY} && cvs commit
-m
"Added ${PKGPATH:T}." Makefile
108 _IMPORT_REMOVE_FILES
!= ls
-d
* patches
/* files
/* 2>/dev
/null ||
${TRUE}
109 _IMPORT_REMOVE_FILES
:= ${_IMPORT_REMOVE_FILES
:NCVS
:N
*/CVS
}
114 ${STEP_MSG} "Removing ${PKGNAME} from pkgsrc-wip."; \
115 cvs
rm -f
${_IMPORT_REMOVE_FILES}; \
116 cvs commit
-m
"Imported into pkgsrc as ${CATEGORY}/${PKGBASE}.";; \