blob: 29213459d94cf3371f6a4da84324eead17c3fddf (
plain)
1 #
2 # 05_file_check.awk
3 #
4 # Version 0.2.0 - 2008-05-21
5 # Juergen Daubert <jue at jue dot li>
6 #
7 # Tests for the mandatory port files
8 #
9 # Sets some global variables
10 # - PORTDIR the full path of the port
11 # - PORT the name of the port
12 # - COLLPORT a shortcut for Collection/Port like core/gcc
13 #
14 # PORT_FILES and WHITE_LIST are set by prtverify
15
16
17
18 function readwhitelist(filelist, f,af,line)
19 {
20 split(filelist,af)
21
22 for (f in af) {
23 if (system("test -f " af[f]) != 0) {
24 usr_error("Error: file " af[f] " not found!")
25 continue
26 }
27 while ((getline line < af[f]) > 0)
28 WLIST[line]
29 }
30 }
31
32
33 BEGIN {
34
35 PORTDIR = ARGV[1]
36 if (system("test -d " PORTDIR) != 0) {
37 usr_error(PORTDIR " is not a directory, ignoring")
38 exit
39 }
40
41 PORTDIR = fullpath(PORTDIR)
42 PORT = gensub(/^.*\//, "", 1, PORTDIR)
43 COLLPORT = collectionport(PORTDIR)
44
45 delete ARGV
46 ARGC = 1
47
48 split(PORT_FILES, af)
49
50 for (f in af) {
51 p = PORTDIR "/" af[f]
52 if (system("test -f " p) == 0)
53 ARGV[ARGC++] = p
54 else
55 if(loglevel_ok(FATAL))
56 perror(FATAL, "file not found: " af[f])
57 }
58
59 if (ARGC == 1)
60 exit
61
62 readwhitelist(WHITE_LIST)
63 }
|