File: getdist.awk

package info (click to toggle)
apt-move 4.2.27-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 524 kB
  • sloc: sh: 7,946; awk: 275; cpp: 235; perl: 170; makefile: 69
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
}