source: pkgtools/genpkglist

Last change on this file was d70d2bd, checked in by Paweł Foremski <pjf@…>, 10 years ago

general update, new env vars, etc.

  • Property mode set to 100755
File size: 2.5 KB
Line 
1#!/bin/sh
2#
3# Quite simple script which generates package.list.gz and package.md5.gz files
4# needed by Lintrack package repositories
5#
6# Copyright (C) 2006-2009 ASN Sp. z o.o.
7#
8# Authors: Pawel Foremski <pjf@asn.pl>
9#          Michal Wrobel <xmxwx@asn.pl>
10#
11# This program is free software; you can redistribute it and/or modify it under
12# the terms of the GNU General Public License as published by the Free Software
13# Foundation; either version 2 of the License, or (at your option) any later
14# version.
15#
16# This program is distributed in the hope that it will be useful, but WITHOUT
17# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19# details.
20#
21# You should have received a copy of the GNU General Public License along with
22# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23# Place - Suite 330, Boston, MA 02111-1307, USA.
24#
25
26pkgs="`ls *.pkg.tar.gz`"
27[ $? -ne 0 ] && exit 1
28
29(
30        echo "#"
31        echo "# Lintrack package repository listing"
32        echo "# Latest package versions as of `date`"
33        echo "#"
34        echo "# package | pkgver | pkgrel | fixrel"
35        echo "#"
36        echo
37
38        # 1. sort by pkgrel
39        # 2. add fields containing parts of pkgver and use them as sort keys
40        #    (all non-digits are neglected, digits are interpreted as numbers)
41        # 3. select only the last packages (achieved by sort -r and sort -u)
42        # 4. cut the split pkgver off
43        #
44        # To sort pkgver multiple stable sorts with subsequent fields as keys are
45        # used (poor man's radix-sort). Also, sed's greediness is of use :P
46        echo -e "$pkgs" \
47                | grep -v '\-big.pkg.tar.gz' \
48                | sed -re 's/(.*)-(.*)-(.*)-(.*).pkg.tar.gz/\1 \2 \3 \4/g' \
49                | sort -rn -k1,4 \
50                | awk '{v=$2; gsub("[^0-9]+", " ", v); print $1" "$2" "$3" "$4" "v}' \
51                | sort -srn -k10,10 | sort -srn -k9,9 | sort -srn -k8,8 \
52                | sort -srn -k7,7 | sort -srn -k6,6 | sort -srn -k5,5 \
53                | sort -s -k1,1 -u | cut -d' ' -f1-4
54) > package.list
55echo "$((`cat package.list | wc -l` - 7)) packages listed in package.list"
56
57(
58        echo "#"
59        echo "# Lintrack package repository listing"
60        echo "# MD5 and SHA1 sums, file sizes"
61        echo "#"
62        echo "# file | md5sum | sha1sum | size"
63        echo "#"
64        echo
65
66        for file in $pkgs; do
67                echo -n "$file "
68                echo -n "`md5sum $file | cut -b1-32` "
69                echo -n "`sha1sum $file | cut -b1-40` "
70                echo "`du -b $file | cut -f1`"
71        done
72) > package.md5
73echo "$((`cat package.md5 | wc -l` - 7)) packages listed in package.md5"
74
75# TODO: sign package.md5 with GPG
Note: See TracBrowser for help on using the repository browser.