File: getdist.awk

package info (click to toggle)
apt-move 4.2.26-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 256 kB
  • ctags: 79
  • sloc: sh: 1,569; awk: 257; cpp: 116; perl: 85; makefile: 27
file content (25 lines) | stat: -rw-r--r-- 600 bytes parent folder | download | duplicates (8)
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
# getdist --- Get Debian component name from a section string.
#
# Copyright (c) 2002 Herbert Xu <herbert@debian.org>
# $Id: getdist.awk,v 1.4 2003/03/25 09:02:13 herbert Exp $

function getdist(section, dist, a) {
	if (section in _getdist) {
		return _getdist[section]
	}

	dist = section
	ldist = tolower(dist)

	if (match(ldist, /^non-us\/[^\/]*/)) {
		dist = "non-US" substr(dist, 7, RLENGTH - 6)
	} else if (ldist == "non-us") {
		dist = "non-US/main"
	} else if (match(dist, /^[^\/]*\//)) {
		dist = substr(dist, 1, RLENGTH - 1)
	} else {
		dist = "main"
	}

	return _getdist[section] = dist
}