#!/bin/sh package=${1:-$ZPMPACKAGE} pkgver=${ZPMPACKAGEVER:-1.0} pkgrel=${ZPMPACKAGEREL:-1} pkgroot=/ # option for "multipackage" just to let the system know that's what you meant # option to take filenames from stdin # parse package, version, release from file if not given while getopts :f:v:r:d:a:u:l:p:b:P: opt; do case $opt in R) pkgroot="$OPTARG" ;; S) format=shell ;; f) pkgfile="$OPTARG" ;; v) pkgver="$OPTARG" ;; r) pkgrel="$OPTARG" ;; d) description="$OPTARG" ;; a) arch="$OPTARG" ;; u) url="$OPTARG" ;; l) licenses="$OPTARG" ;; p) packager="$OPTARG" ;; b) builddate="$OPTARG" ;; P) prefix="$OPTARG" ;; esac done pkgfile=$1 set -e if [ -z "$pkgfile" ]; then pkgfile="$package-$pkgver-$pkgrel.zpm" fi zpm-test -v $pkgfile pkg=$(zpm-findpkg -f $pkgfile) #.mode line { zpm shell $pkgfile <<-EOS select printf('Package: %s Version: %s Release: %s URL: %s License: %s Packager: %s Description: %s Buildtime: %s Content-Checksum: %s ', package, version, release, url, licenses, packager,description, strftime('%Y-%m-%dT%H:%M:%S', build_time, 'unixepoch'), NULL ) from packages where '$pkg' = package||'-'||version||'-'||release ; EOS #mode user group hash mtime csvtags path zpm shell $pkgfile <<-EOS .header off select printf('%s %s %s %s %s %s %s', F.mode, F.username, F.groupname, case when F.filetype = 'c' then F.devmajor || ',' || F.devminor when F.filetype = 'd' then 'directory' else F.hash end ,strftime('%Y-%m-%dT%H:%M:%S', F.mtime, 'unixepoch') , coalesce(T.tags, '-') ,F.path) from packagefiles as F left join ( select TG.package, TG.version, TG.release, TG.path ,group_concat(tag) as tags from pathtags TG group by package, version, release, path ) T on T.package = F.package and T.version = F.version and T.release = F.release and T.path = F.path -- apparently going to have to do this in C because there's -- no way to order the aggregated tags where '$pkg' = F.package||'-'||F.version||'-'||F.release ; EOS } exit 0 path text, -- filesystem path mode text, -- perms, use text for octal rep? username text, -- name of owner groupname text, -- group of owner uid integer, -- numeric uid, generally ignored gid integer, -- numeric gid, generally ignored filetype varchar default 'r', -- r regular file -- d directory -- s symlink -- h hard link -- not supported -- c character special and b device special files add dev number column -- b block special -- p fifos (i.e. pipe) target text, -- link target for links -- device file dev numbers, should probably be a separate table devmajor integer, devminor integer, hash text, -- null if no actual content, i.e. anything but a regular file mtime integer, Package: Version: Release: URL: License: Packager: Description: Buildtime: Content-Checksum: mode user group hash mtime csvtags path following order by path