summaryrefslogtreecommitdiff
path: root/pkgtools/pkglint/files/globalvars.go
blob: 40b1842b13d91d3a0cbaced91e5f666f2953267c (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package main

import (
	"io"
	"netbsd.org/pkglint/histogram"
)

type GlobalVars struct {
	opts       CmdOpts    //
	globalData GlobalData //
	Pkg        *Package   // The package that is currently checked.
	Mk         *MkLines   // The Makefile (or fragment) that is currently checked.

	Todo            []string // The files or directories that still need to be checked.
	CurrentDir      string   // The currently checked directory, relative to the cwd
	CurPkgsrcdir    string   // The pkgsrc directory, relative to currentDir
	Wip             bool     // Is the currently checked directory from pkgsrc-wip?
	Infrastructure  bool     // Is the currently checked item from the pkgsrc infrastructure?
	Testing         bool     // Is pkglint in self-testing mode (only during development)?
	CurrentUsername string   // For checking against OWNER and MAINTAINER
	CvsEntriesDir   string   // Cached to avoid I/O
	CvsEntriesLines []Line

	Hash         map[string]*Hash // Maps "alg:fname" => hash (inter-package check).
	UsedLicenses map[string]bool  // Maps "license name" => true (inter-package check).

	errors                int
	warnings              int
	logged                map[string]bool
	explanationsAvailable bool
	explanationsGiven     map[string]bool
	autofixAvailable      bool
	logOut                io.Writer
	logErr                io.Writer

	loghisto *histogram.Histogram
}

type CmdOpts struct {
	CheckAlternatives,
	CheckBuildlink3,
	CheckDescr,
	CheckDistinfo,
	CheckExtra,
	CheckGlobal,
	CheckInstall,
	CheckMakefile,
	CheckMessage,
	CheckMk,
	CheckPatches,
	CheckPlist bool

	WarnAbsname,
	WarnDirectcmd,
	WarnExtra,
	WarnOrder,
	WarnPerm,
	WarnPlistDepr,
	WarnPlistSort,
	WarnQuoting,
	WarnSpace,
	WarnStyle,
	WarnTypes bool

	Explain,
	Autofix,
	GccOutput,
	PrintHelp,
	DumpMakefile,
	Import,
	LogVerbose,
	Profiling,
	Quiet,
	Recursive,
	PrintAutofix,
	PrintSource,
	PrintVersion bool

	args []string
}

type Hash struct {
	hash string
	line Line
}

var G GlobalVars