summaryrefslogtreecommitdiffstats
path: root/files/pkglist.awk
blob: c4065801c5dbc977e3efa82c588e931a5017d436 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
!/source\// && !/\.asc$/ {
		INPUT=$NF
		fs=FS
		FS="/" ; OFS="/"
		$0=INPUT
		if ( $(NF-3) != "var" ) {
			DIR=$2
			FULLPACK=$NF
		} else {
			DIR="local"
			FULLPACK=$NF".tgz"
		}
		NF=NF-1
		PATH=$0
		FS="-" ; OFS="-"
		$0=FULLPACK
		if ( NF > 3 ) {
			SIZE=split($NF,RELEXT,".")
			EXTENSION=RELEXT[SIZE]
			LAST=length($NF)-4
			RELEASE=substr($NF,1,LAST)
			ARCH=$(NF-1)
			VERSION=$(NF-2)
			NF=NF-3
			NAME=$0

			PKGNAME=NAME"-"VERSION"-"ARCH"-"RELEASE
			if (VERSION == "") { VERSION="UNKNOWN" ; }
			if (ARCH == "") { ARCH= "UNKNOWN" ; }
			if (RELEASE == "") { RELEASE= "UNKNOWN" ; }
		} else {
			RELEASE=none
			ARCH=none
			VERSION=none
			EXTENSION=tgz
			NAME=$0

			PKGNAME=NAME"-"VERSION"-"ARCH"-"RELEASE
		}
		FS=fs 
		print DIR" "NAME" "VERSION" "ARCH" "RELEASE" "PKGNAME" "PATH" "EXTENSION
}