I remember why I did not do it before... there is a technical.
The way we build FULLPKGNAMEs with the interaction with flavors makes this
rather awkward.

Anyways, my make-fu did improve markedly since last time I tried, so this
ought to do the trick.

If you get a headache while reading this, you've been warned !

(note that we pass REVISION and EPOCH to pkg_create, as we do pass
flavor markers. Who knows ? might add some more checks eventually)
Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1017
diff -u -p -r1.1017 bsd.port.mk
--- bsd.port.mk 8 Jul 2010 20:48:39 -0000       1.1017
+++ bsd.port.mk 9 Jul 2010 09:34:07 -0000
@@ -401,9 +401,15 @@ SUBPACKAGE ?= -main
 .endif
 
 _MULTI_PACKAGES =
+
+REVISION ?=
+EPOCH ?=
+
 .for _s in ${MULTI_PACKAGES}
+REVISION${_s} ?= ${REVISION}
+EPOCH${_s} ?= ${EPOCH}
 
-# ONLY_FOR_ARCHS is special, since it can be undefined
+# ONLY_FOR_ARCHS/NOT_FOR_ARCHS are special
 .  if defined(ONLY_FOR_ARCHS)
 ONLY_FOR_ARCHS${_s} ?= ${ONLY_FOR_ARCHS}
 .  endif
@@ -542,7 +548,25 @@ _MASTER ?=
 _SOLVING_DEP ?= No
 
 _READMES =
+
 .if ${MULTI_PACKAGES} == "-"
+# XXX "parse" FULLPKGNAME: is there a flavor after the version number
+.    if ${FULLPKGNAME:M*-[0-9]*-*}
+.      if !empty(REVISION)
+# XXX simplest way is to alter FULLPKGNAME in place, even though := is evil...
+FULLPKGNAME := ${FULLPKGNAME:C/-([0-9][^-]*)-/-\1p${REVISION}-/}
+.      endif
+.      if !empty(EPOCH)
+FULLPKGNAME := ${FULLPKGNAME:C/-([0-9][^-]*)-/-\1v${EPOCH}-/}
+.      endif
+.    else
+.      if defined(REVISION)
+FULLPKGNAME := ${FULLPKGNAME}p${REVISION}
+.      endif
+.      if defined(EPOCH)
+FULLPKGNAME := ${FULLPKGNAME}v${EPOCH}
+.      endif
+.    endif
 FULLPKGNAME- = ${FULLPKGNAME}
 _READMES += ${READMES_TOP}/${PKGPATH}/${FULLPKGNAME}.html
 .else
@@ -558,6 +582,22 @@ FULLPKGNAME${_s} = ${PKGNAME${_s}}${FLAV
 FULLPKGNAME${_s} = ${PKGNAME}${_s}${FLAVOR_EXT}
 .      endif
 .    endif
+# XXX see comments above for !MULTI_PACKAGES case
+.    if ${FULLPKGNAME${_s}:M*-[0-9]*-*}
+.      if !empty(REVISION${_s})
+FULLPKGNAME${_s} := ${FULLPKGNAME${_s}:C/-([0-9][^-]*)-/-\1p${REVISION${_s}}-/}
+.      endif
+.      if !empty(EPOCH${_s})
+FULLPKGNAME${_s} := ${FULLPKGNAME${_s}:C/-([0-9][^-]*)-/-\1v${EPOCH${_s}}-/}
+.      endif
+.    else
+.      if defined(REVISION${_s})
+FULLPKGNAME${_s} := ${FULLPKGNAME${_s}}p${REVISION${_s}}
+.      endif
+.      if defined(EPOCH${_s})
+FULLPKGNAME${_s} := ${FULLPKGNAME${_s}}v${EPOCH${_s}}
+.      endif
+.    endif
 _READMES += ${READMES_TOP}/${PKGPATH}/${FULLPKGNAME${_s}}.html
 .  endfor
 .endif
@@ -889,6 +929,12 @@ _tmpvars += ${_v}=${${_v:S/^^//}:Q}
 PKG_ARGS${_S} += -DFULLPKGPATH=${FULLPKGPATH${_S}}
 PKG_ARGS${_S} += -DPERMIT_PACKAGE_CDROM=${PERMIT_PACKAGE_CDROM${_S}:Q}
 PKG_ARGS${_S} += -DPERMIT_PACKAGE_FTP=${PERMIT_PACKAGE_FTP${_S}:Q}
+.  if !empty(REVISION${_S})
+PKG_ARGS${_S} += -DREVISION=${REVISION${_S}}
+.  endif
+.  if !empty(EPOCH${_S})
+PKG_ARGS${_S} += -DEPOCH=${EPOCH${_S}}
+.  endif
 .endfor
 
 SUBST_CMD = perl ${PORTSDIR}/infrastructure/build/pkg_subst

Reply via email to