X-Git-Url: https://pd.if.org/git/?p=zpackage;a=blobdiff_plain;f=bin%2Fzpm-pkginfo;fp=bin%2Fzpm-pkginfo;h=ff55481c27e4022e66cd80caaabe6d1e9189c7b9;hp=0000000000000000000000000000000000000000;hb=0419c62f964b259df1c1816f5870ef62eb97ed7c;hpb=0c2216d1e0dc8565a6bf61c9572e47bb1ae1c1fb diff --git a/bin/zpm-pkginfo b/bin/zpm-pkginfo new file mode 100755 index 0000000..ff55481 --- /dev/null +++ b/bin/zpm-pkginfo @@ -0,0 +1,131 @@ +#!/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