tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Patch for mk/flavor/pkg/package



Hi,

this patch tries to prevent binary package files from existing before it is clear that they had been created successfully. Since pkg_create (and maybe the other pkgsrc tools) are full of surprises, I better ask here whether this change will probably work or not.

One change that I noticed is that the @name directive in the +CONTENTS file is no longer in line 1, but in line 3, after @cwd and @src. Is this a problem for one of the package tools?

Roland
? package.patch
Index: metadata.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/metadata.mk,v
retrieving revision 1.27
diff -u -p -r1.27 metadata.mk
--- metadata.mk 20 Sep 2007 18:30:34 -0000      1.27
+++ metadata.mk 4 Jan 2008 14:47:07 -0000
@@ -311,6 +311,7 @@ _DEPENDS_PLIST=             ${WRKDIR}/.PLIST_deps
 
 ${_DEPENDS_PLIST}: ${PLIST}
        ${RUN} { \
+       ${ECHO} "@name ${PKGNAME}"; \
        ${AWK} '$$1 == "full" { printf "@blddep %s\n@pkgdep %s\n", $$3, $$2; }' 
< ${_RDEPENDS_FILE}; \
        ${AWK} '$$1 == "bootstrap" || $$1 == "build" { printf "@blddep %s\n", 
$$3; }' < ${_RDEPENDS_FILE}; \
        ${CAT} ${PLIST}; } > ${.TARGET}
Index: package.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/package.mk,v
retrieving revision 1.14
diff -u -p -r1.14 package.mk
--- package.mk  4 Jan 2008 14:22:06 -0000       1.14
+++ package.mk  4 Jan 2008 14:47:07 -0000
@@ -40,7 +40,12 @@ _PKG_ARGS_PACKAGE+=  -E
 
 ${PKGFILE}: ${_CONTENTS_TARGETS}
        ${RUN} ${MKDIR} ${.TARGET:H}
-       ${RUN} ${PKG_CREATE} ${_PKG_ARGS_PACKAGE} ${.TARGET}
+       ${RUN} tmpname=${.TARGET:S,${PKG_SUFX}$,.tmp${PKG_SUFX},};      \
+       if ${PKG_CREATE} ${_PKG_ARGS_PACKAGE} "$$tmpname"; then         \
+               ${MV} -f "$$tmpname" ${.TARGET};                        \
+       else                                                            \
+               exitcode=$$?; ${RM} -f "$$tmpname"; exit $$exitcode;    \
+       fi
 
 ######################################################################
 ### package-remove (PRIVATE)


Home | Main Index | Thread Index | Old Index