summaryrefslogtreecommitdiff
path: root/pkgtools/genpkgng
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2014-04-27 00:10:34 +0000
committeragc <agc@pkgsrc.org>2014-04-27 00:10:34 +0000
commitf5a4a2534da8498af47fb267958f928b92b841d7 (patch)
tree15fa2a979d320e21a5ee05daa429ac3bafc2296d /pkgtools/genpkgng
parent2a0734536a841213dfae3c37ededa8b1b31385fd (diff)
downloadpkgsrc-f5a4a2534da8498af47fb267958f928b92b841d7.tar.gz
Initial import of genpkgng, a utility which will convert a pkgsrc
binary package to a FreeBSD binary pkg. pkgsrc binary packages keep more metadata, and do Dewey matching on package version numbers, so it's not possible to convert in the other direction. The DESCR says: This is a small utility to generate a FreeBSD pkg binary package from a pkgsrc binary package. It is invoked simply, using a command like: genpkgng ssam-1.9nb1.tgz and it will convert the pkgsrc binary package to a pkg one: % ./genpkgng.sh perl-5.18.1nb2.tgz Converting perl-5.18.1nb2.tgz -rw-r--r-- 1 agc users 16597860 Apr 24 19:01 perl-5.18.1nb2.txz %
Diffstat (limited to 'pkgtools/genpkgng')
-rw-r--r--pkgtools/genpkgng/DESCR12
-rw-r--r--pkgtools/genpkgng/Makefile29
-rw-r--r--pkgtools/genpkgng/PLIST4
-rw-r--r--pkgtools/genpkgng/distinfo1
-rw-r--r--pkgtools/genpkgng/files/MTREE_DIRS961
-rw-r--r--pkgtools/genpkgng/files/Makefile9
-rw-r--r--pkgtools/genpkgng/files/genpkgng.177
-rw-r--r--pkgtools/genpkgng/files/genpkgng.sh130
8 files changed, 1223 insertions, 0 deletions
diff --git a/pkgtools/genpkgng/DESCR b/pkgtools/genpkgng/DESCR
new file mode 100644
index 00000000000..fedc940ad59
--- /dev/null
+++ b/pkgtools/genpkgng/DESCR
@@ -0,0 +1,12 @@
+This is a small utility to generate a FreeBSD pkg binary package
+from a pkgsrc binary package. It is invoked simply, using a command
+like:
+
+ genpkgng ssam-1.9nb1.tgz
+
+and it will convert the pkgsrc binary package to a pkg one:
+
+ % ./genpkgng.sh perl-5.18.1nb2.tgz
+ Converting perl-5.18.1nb2.tgz
+ -rw-r--r-- 1 agc users 16597860 Apr 24 19:01 perl-5.18.1nb2.txz
+ %
diff --git a/pkgtools/genpkgng/Makefile b/pkgtools/genpkgng/Makefile
new file mode 100644
index 00000000000..2e8a9adc3e1
--- /dev/null
+++ b/pkgtools/genpkgng/Makefile
@@ -0,0 +1,29 @@
+# $NetBSD: Makefile,v 1.1.1.1 2014/04/27 00:10:34 agc Exp $
+
+DISTNAME= genpkgng-20140425
+CATEGORIES= pkgtools
+MASTER_SITES= # empty
+DISTFILES= # empty
+
+MAINTAINER= agc@NetBSD.org
+HOMEPAGE= http://www.NetBSD.org/
+COMMENT= Convert a pkgsrc binary package to a FreeBSD pkg
+LICENSE= modified-bsd
+
+AUTO_MKDIRS= yes
+
+SUBST_CLASSES+= mtree
+SUBST_STAGE.mtree= pre-configure
+SUBST_MESSAGE.mtree= Fix location of MTREE_DIRS file
+SUBST_FILES.mtree= genpkgng.sh
+SUBST_SED.mtree= -e 's|@MTREE_DIR_DIR@|${PREFIX}/libdata/genpkgng|'
+
+do-extract:
+ ${CP} -R ${FILESDIR} ${WRKSRC}
+
+do-install:
+ ${INSTALL_SCRIPT} ${WRKSRC}/genpkgng ${DESTDIR}${PREFIX}/bin
+ ${INSTALL_DATA} ${WRKSRC}/MTREE_DIRS ${DESTDIR}${PREFIX}/libdata/genpkgng/
+ ${INSTALL_MAN} ${WRKSRC}/genpkgng.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/pkgtools/genpkgng/PLIST b/pkgtools/genpkgng/PLIST
new file mode 100644
index 00000000000..2de015bbe64
--- /dev/null
+++ b/pkgtools/genpkgng/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2014/04/27 00:10:34 agc Exp $
+bin/genpkgng
+libdata/genpkgng/MTREE_DIRS
+man/man1/genpkgng.1
diff --git a/pkgtools/genpkgng/distinfo b/pkgtools/genpkgng/distinfo
new file mode 100644
index 00000000000..1f007e19c5d
--- /dev/null
+++ b/pkgtools/genpkgng/distinfo
@@ -0,0 +1 @@
+$NetBSD: distinfo,v 1.1.1.1 2014/04/27 00:10:34 agc Exp $
diff --git a/pkgtools/genpkgng/files/MTREE_DIRS b/pkgtools/genpkgng/files/MTREE_DIRS
new file mode 100644
index 00000000000..ccb61b05435
--- /dev/null
+++ b/pkgtools/genpkgng/files/MTREE_DIRS
@@ -0,0 +1,961 @@
+#mtree
+# $FreeBSD: /tmp/pcvs/ports/Templates/BSD.local.dist,v 1.3 2010-11-12 20:57:14 pav Exp $
+#
+# Please see the file src/etc/mtree/README before making changes to this file.
+#
+
+/set type=dir uname=root gname=wheel mode=0755
+.
+ bin
+ ..
+ etc
+ devd
+ ..
+ man.d
+ ..
+ pam.d
+ ..
+ rc.d
+ ..
+ ..
+ include
+ X11
+ ..
+ ..
+ info
+ ..
+ lib
+ X11
+ app-defaults
+ ..
+ fonts
+ local
+ ..
+ ..
+ ..
+ ..
+ libdata
+ ldconfig
+ ..
+ ldconfig32
+ ..
+ pkgconfig
+ ..
+ ..
+ libexec
+ ..
+ man
+/set uname=man
+ cat1
+ ..
+ cat2
+ ..
+ cat3
+ ..
+ cat4
+ ..
+ cat5
+ ..
+ cat6
+ ..
+ cat7
+ ..
+ cat8
+ ..
+ cat9
+ ..
+ catl
+ ..
+ catn
+ ..
+ de.ISO8859-1 uname=root
+ cat1
+ ..
+ cat2
+ ..
+ cat3
+ ..
+ cat4
+ ..
+ cat5
+ ..
+ cat6
+ ..
+ cat7
+ ..
+ cat8
+ ..
+ cat9
+ ..
+ catl
+ ..
+ catn
+ ..
+/set uname=root
+ man1
+ ..
+ man2
+ ..
+ man3
+ ..
+ man4
+ ..
+ man5
+ ..
+ man6
+ ..
+ man7
+ ..
+ man8
+ ..
+ man9
+ ..
+ manl
+ ..
+ mann
+ ..
+ ..
+ en.ISO8859-1
+/set uname=man
+ cat1
+ ..
+ cat1aout
+ ..
+ cat2
+ ..
+ cat3
+ ..
+ cat4
+ i386
+ ..
+ ..
+ cat5
+ ..
+ cat6
+ ..
+ cat7
+ ..
+ cat8
+ i386
+ ..
+ ..
+ cat9
+ i386
+ ..
+ ..
+ catn
+ ..
+ ..
+ ja uname=root
+ cat1
+ ..
+ cat2
+ ..
+ cat3
+ ..
+ cat4
+ ..
+ cat5
+ ..
+ cat6
+ ..
+ cat7
+ ..
+ cat8
+ ..
+ cat9
+ ..
+ catl
+ ..
+ catn
+ ..
+/set uname=root
+ man1
+ ..
+ man2
+ ..
+ man3
+ ..
+ man4
+ ..
+ man5
+ ..
+ man6
+ ..
+ man7
+ ..
+ man8
+ ..
+ man9
+ ..
+ manl
+ ..
+ mann
+ ..
+ ..
+ man1
+ ..
+ man2
+ ..
+ man3
+ ..
+ man4
+ ..
+ man5
+ ..
+ man6
+ ..
+ man7
+ ..
+ man8
+ ..
+ man9
+ ..
+ manl
+ ..
+ mann
+ ..
+ ru.KOI8-R
+/set uname=man
+ cat1
+ ..
+ cat2
+ ..
+ cat3
+ ..
+ cat4
+ ..
+ cat5
+ ..
+ cat6
+ ..
+ cat7
+ ..
+ cat8
+ ..
+ cat9
+ ..
+ catl
+ ..
+ catn
+ ..
+/set uname=root
+ man1
+ ..
+ man2
+ ..
+ man3
+ ..
+ man4
+ ..
+ man5
+ ..
+ man6
+ ..
+ man7
+ ..
+ man8
+ ..
+ man9
+ ..
+ manl
+ ..
+ mann
+ ..
+ ..
+ ..
+ sbin
+ ..
+ share
+ aclocal
+ ..
+ applications
+ ..
+ dict
+ ..
+ doc
+ ja
+ ..
+ ..
+ emacs
+ site-lisp
+ ..
+ ..
+ examples
+ ..
+ java
+ classes
+ ..
+ ..
+ locale
+ af
+ LC_MESSAGES
+ ..
+ ..
+ am
+ LC_MESSAGES
+ ..
+ ..
+ ar
+ LC_MESSAGES
+ ..
+ ..
+ az
+ LC_MESSAGES
+ ..
+ ..
+ be
+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
+ ..
+ ..
+ uz
+ LC_MESSAGES
+ ..
+ ..
+ vi
+ LC_MESSAGES
+ ..
+ ..
+ wa
+ LC_MESSAGES
+ ..
+ ..
+ zh
+ LC_MESSAGES
+ ..
+ ..
+ zh_CN
+ LC_MESSAGES
+ ..
+ ..
+ zh_CN.GB2312
+ LC_MESSAGES
+ ..
+ ..
+ zh_TW
+ LC_MESSAGES
+ ..
+ ..
+ zh_TW.Big5
+ LC_MESSAGES
+ ..
+ ..
+ ..
+ misc
+ ..
+ nls
+ C
+ ..
+ af_ZA.ISO8859-1
+ ..
+ af_ZA.ISO8859-15
+ ..
+ af_ZA.UTF-8
+ ..
+ am_ET.UTF-8
+ ..
+ be_BY.CP1131
+ ..
+ be_BY.CP1251
+ ..
+ be_BY.ISO8859-5
+ ..
+ be_BY.UTF-8
+ ..
+ bg_BG.CP1251
+ ..
+ bg_BG.UTF-8
+ ..
+ ca_ES.ISO8859-1
+ ..
+ ca_ES.ISO8859-15
+ ..
+ ca_ES.UTF-8
+ ..
+ cs_CZ.ISO8859-2
+ ..
+ cs_CZ.UTF-8
+ ..
+ da_DK.ISO8859-1
+ ..
+ da_DK.ISO8859-15
+ ..
+ da_DK.UTF-8
+ ..
+ de_AT.ISO8859-1
+ ..
+ de_AT.ISO8859-15
+ ..
+ de_AT.UTF-8
+ ..
+ de_CH.ISO8859-1
+ ..
+ de_CH.ISO8859-15
+ ..
+ de_CH.UTF-8
+ ..
+ de_DE.ISO8859-1
+ ..
+ de_DE.ISO8859-15
+ ..
+ de_DE.UTF-8
+ ..
+ el_GR.ISO8859-7
+ ..
+ el_GR.UTF-8
+ ..
+ en_AU.ISO8859-1
+ ..
+ en_AU.ISO8859-15
+ ..
+ en_AU.US-ASCII
+ ..
+ en_AU.UTF-8
+ ..
+ en_CA.ISO8859-1
+ ..
+ en_CA.ISO8859-15
+ ..
+ en_CA.US-ASCII
+ ..
+ en_CA.UTF-8
+ ..
+ en_GB.ISO8859-1
+ ..
+ en_GB.ISO8859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+ ..
+ zh_CN.UTF-8
+ ..
+ zh_CN.eucCN
+ ..
+ zh_HK.Big5HKSCS
+ ..
+ zh_HK.UTF-8
+ ..
+ zh_TW.Big5
+ ..
+ zh_TW.UTF-8
+ ..
+ ..
+ pixmaps
+ ..
+ sgml
+ ..
+ skel
+ ..
+ xml
+ ..
+ ..
+ tests
+ ..
+ www
+ ..
+..
diff --git a/pkgtools/genpkgng/files/Makefile b/pkgtools/genpkgng/files/Makefile
new file mode 100644
index 00000000000..f28d7e0e629
--- /dev/null
+++ b/pkgtools/genpkgng/files/Makefile
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1.1.1 2014/04/27 00:10:34 agc Exp $
+
+SCRIPTS=genpkgng
+
+all: genpkgng
+
+genpkgng: genpkgng.sh
+ cp genpkgng.sh genpkgng
+ chmod 755 genpkgng
diff --git a/pkgtools/genpkgng/files/genpkgng.1 b/pkgtools/genpkgng/files/genpkgng.1
new file mode 100644
index 00000000000..690cccfc8f5
--- /dev/null
+++ b/pkgtools/genpkgng/files/genpkgng.1
@@ -0,0 +1,77 @@
+.\" $NetBSD: genpkgng.1,v 1.1.1.1 2014/04/27 00:10:34 agc Exp $
+.\"
+.\" Copyright (c) 2014 Alistair Crooks <agc@NetBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd April 25, 2014
+.Dt GENPKGNG 1
+.Os
+.Sh NAME
+.Nm genraidconf
+.Nd utility to configure RAID sets
+.Sh SYNOPSIS
+.Nm
+.Fl nv
+.Op Fl v
+.Ar binpkg ...
+.Sh DESCRIPTION
+The
+.Nm
+command converts from a binary package
+generated from the pkgsrc infratsructure to a binary
+package which can be installed using the
+.Fx
+pkg packaging tool.
+.Pp
+It generates
+.Dq +MANIFEST
+and
+.Dq +COMPACT_MANIFEST
+metadata files, and also preserves the
+.Dq build information
+and
+.Dq build versions
+pkgsrc metadata, placing entries in the file system.
+.Sh RETURN VALUES
+The
+.Nm
+utility will return 0 for success,
+and non-zero for failure.
+.Sh EXAMPLES
+.Bd -literal
+% cp /usr/pkgsrc/packages/All/nettle-2.7.1nb1.tgz .
+% genpkgng nettle-2.7.1nb1.tgz
+Converting nettle-2.7.1nb1.tgz
+-rw-r--r-- 1 agc agc 3962779 Apr 25 16:25 nettle-2.7.1nb1.txz
+%
+.Ed
+.Sh SEE ALSO
+.Xr pkg_info 1
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Nx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+.An Alistair Crooks Aq Mt agc@NetBSD.org
diff --git a/pkgtools/genpkgng/files/genpkgng.sh b/pkgtools/genpkgng/files/genpkgng.sh
new file mode 100644
index 00000000000..9ee3e8dcfac
--- /dev/null
+++ b/pkgtools/genpkgng/files/genpkgng.sh
@@ -0,0 +1,130 @@
+#! /bin/sh
+
+# $NetBSD: genpkgng.sh,v 1.1.1.1 2014/04/27 00:10:34 agc Exp $
+
+# Copyright (c) 2014 Alistair Crooks <agc@NetBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# script to convert from a pkgsrc package to a pkgng one
+# usage: genpkgng [-v] binpkg...
+
+# small function to get information from build info
+getvar() {
+ echo "$1" | awk '/^'$2'=/ { sub("'$2'=", ""); print }'
+}
+
+# process command line args
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -v) set -x ;;
+ *) break ;;
+ esac
+ shift
+done
+
+here=$(pwd)
+
+while [ $# -gt 0 ]; do
+ binpkg=$1
+ echo "Converting ${binpkg}"
+
+ # get the package metadata from the pkgsrc binary package
+ pkgname=${binpkg%.tgz}
+ buildinfo=$(pkg_info -B ${binpkg})
+ name=${binpkg%-*}
+ name=${name##*/}
+ origin=$(getvar "${buildinfo}" PKGPATH)
+ version=${binpkg##*-}
+ version=${version%.tgz}
+ comment=$(pkg_info -qc ${binpkg})
+ os=$(getvar "${buildinfo}" OPSYS)
+ os_version=$(getvar "${buildinfo}" OS_VERSION)
+ os_version=${os_version%%.*}
+ machine_arch=$(getvar "${buildinfo}" MACHINE_ARCH | awk '{ sub("_", ":"); print }')
+ arch="${os}:${os_version}:${machine_arch}"
+ maintainer=$(getvar "${buildinfo}" MAINTAINER)
+ prefix=$(getvar "${buildinfo}" LOCALBASE)
+ www=$(getvar "${buildinfo}" HOMEPAGE)
+ licenselogic="single"
+ flatsize="$(pkg_info -qs ${binpkg})"
+ desc="$(pkg_info -qd ${binpkg} | awk '{ gsub("\"", "\\\""); printf("%s\\\\n", $0) }')"
+ categories=$(getvar "${buildinfo}" CATEGORIES)
+ categories=$(echo "${categories}" | awk 'NF == 1 { printf("\"%s\"", $0) } NF > 1 { gsub("[ ]+", "\",\""); printf("\"%s\"", $0) }' )
+
+ # make the temp dir
+ newpkgdir=$(mktemp -d -t genpkgng)
+ mkdir ${newpkgdir}/metadata ${newpkgdir}/archive
+
+ # create the basis for the compact and large manifests
+ (cd ${newpkgdir} && tar -s'|^[a-z]|archive/usr/pkg/&|' -s'|^\+|metadata/&|' -xzf ${here}/${binpkg})
+ awk -v name="${name}" -v origin="${origin}" -v version="${version}" -v arch="${arch}" \
+ -v comment="${comment}" -v arch="${arch}" -v maintainer="${maintainer}" \
+ -v prefix="${prefix}" -v www="${www}" -v licenselogic="${licenselogic}" \
+ -v flatsize="${flatsize}" -v desc="${desc}" -v categories="${categories}" \
+ 'BEGIN {
+ printf("{\"name\":\"%s\",\"origin\":\"%s\",\"version\":\"%s\",\"comment\":\"%s\",\"arch\":\"%s\",\"maintainer\":\"%s\",\"prefix\":\"%s\",\"www\":\"%s\",\"licenselogic\":\"%s\",\"flatsize\":%s,\"desc\":\"%s\",\"categories\":[%s]",
+ name, origin, version, comment, arch, maintainer, prefix, www, licenselogic, flatsize, desc, categories)
+ }' > ${newpkgdir}/archive/+COMPACT_MANIFEST
+ cp ${newpkgdir}/archive/+COMPACT_MANIFEST ${newpkgdir}/archive/+MANIFEST
+ echo -n '}' >> ${newpkgdir}/archive/+COMPACT_MANIFEST
+
+ # copy metadata information
+ mkdir -p ${newpkgdir}/archive/${prefix}/etc/metadata/${pkgname}
+ cp ${newpkgdir}/metadata/+BUILD_VERSION ${newpkgdir}/archive/${prefix}/etc/metadata/${pkgname}/build_version
+ cp ${newpkgdir}/metadata/+BUILD_INFO ${newpkgdir}/archive/${prefix}/etc/metadata/${pkgname}/build_info
+
+ # add the files and digests to the manifest
+ echo -n ',"files":{' >> ${newpkgdir}/archive/+MANIFEST
+ sep=""
+ for f in $(pkg_info -qL ${binpkg}) ${prefix}/etc/metadata/${pkgname}/build_version ${prefix}/etc/metadata/${pkgname}/build_info; do
+ if [ -f ${newpkgdir}/archive/${f} ]; then
+ # redirect digest input so that filenames are omitted
+ echo -n "${sep}\"${f}\":\"$(digest sha256 < ${newpkgdir}/archive/${f})\"" >> ${newpkgdir}/archive/+MANIFEST
+ fi
+ sep=","
+ done
+ echo -n '},"directories":{' >> ${newpkgdir}/archive/+MANIFEST
+ directories="$(awk '/^[^+@]/ { match($0, ".*/"); a[substr($0, 1, RLENGTH-1)] = 1 } END { for (i in a) print i }' ${newpkgdir}/metadata/+CONTENTS)"
+ sep=""
+ for d in ${directories} etc/metadata etc/metadata/${pkgname}; do
+ if [ -d ${newpkgdir}/archive/${prefix}/${d} ]; then
+ echo -n "${sep}\"${prefix}/${d}\":\"n\"" >> ${newpkgdir}/archive/+MANIFEST
+ fi
+ sep=","
+ done
+ echo -n '}' >> ${newpkgdir}/archive/+MANIFEST
+ if [ -f ${newpkgdir}/metadata/+INSTALL ]; then
+ echo -n ",\"scripts\":{\"pre-install\":\"cd ${prefix}\",\"post-install\":\"cd ${prefix}\",\"pre-install\":\"cd ${prefix}\",\"post-install\":\"cd ${prefix}\"}" >> ${newpkgdir}/archive/+MANIFEST
+ fi
+ echo -n '}' >> ${newpkgdir}/archive/+MANIFEST
+
+ # now make the pkgng binary package
+ cp @MTREE_DIR_DIR@/MTREE_DIRS ${newpkgdir}/archive/+MTREE_DIRS
+ (cd ${newpkgdir}/archive && tar -czf ${here}/${pkgname}.txz *)
+ ls -l ${pkgname}.txz
+ rm -rf ${newpkgdir}
+ shift
+done
+
+exit 0