Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / bulk / sort-packages
blobb45e746add61db8e43e90f7f1e8d52dd81c0eb9e
1 #! /bin/sh
2 # $NetBSD: sort-packages,v 1.15 2010/04/10 21:44:44 wiz Exp $
4 # This program scans all binary packages in the current directory and
5 # creates two lists of files in OUTDIR:
7 # restricted_packages
8 # contains all packages that must not be published on the FTP
9 # server, for whatever reason
11 # regular_packages
12 # contains all the other ("good") packages.
15 set -eu
17 : ${OUTDIR="/tmp"}
18 : ${PKG_SUFX=".tgz"}
19 : ${PKG_ADMIN="pkg_admin"}
20 : ${PKG_INFO="pkg_info"}
22 regular_packages="${OUTDIR}/regular_packages"
23 restricted_packages="${OUTDIR}/restricted_packages"
24 newline="
27 : > "${regular_packages}"
28 : > "${restricted_packages}"
30 for pkg in *${PKG_SUFX}; do
31 build_info=`${PKG_INFO} -B "${pkg}"`
33 # Note: this code needs to be that complicated because licensing
34 # issues are critical to pkgsrc, and we really don't want
35 # anything unexpected to happen here. The worst case would be
36 # that some file is sorted wrongly because some change in the
37 # output of pkg_info which had not been foreseen. Therefore it
38 # is better to check as strictly as possible to make those
39 # changes immediately visible.
41 no_bin_on_ftp="unknown"
42 case "${newline}${build_info}${newline}" in
43 *"${newline}NO_BIN_ON_FTP=${newline}"*)
44 no_bin_on_ftp="no"
46 *"${newline}NO_BIN_ON_FTP="*)
47 no_bin_on_ftp="yes"
49 esac
51 restricted="unknown"
52 case "${newline}${build_info}${newline}" in
53 *"${newline}RESTRICTED=${newline}"*)
54 restricted="no"
56 *"${newline}RESTRICTED="*)
57 restricted="yes"
59 esac
61 category="unknown"
62 if [ "${restricted}" = "no" ] && [ "${no_bin_on_ftp}" = "no" ]; then
63 category="regular"
64 else
65 if [ "${restricted}" = "yes" ] || [ "${no_bin_on_ftp}" = "yes" ]; then
66 category="restricted"
70 : echo "upload> ${pkg} is ${category}."
72 case "${category}" in
73 "regular")
74 echo "${pkg}" >> "${regular_packages}"
76 "restricted")
77 echo "${pkg}" >> "${restricted_packages}"
80 echo "sort-packages> WARNING: Could not sort ${pkg} into a category." 1>&2
82 esac
83 done