[BACK]Return to alternatives_test.go CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / pkgtools / pkglint / files

File: [cvs.NetBSD.org] / pkgsrc / pkgtools / pkglint / files / Attic / alternatives_test.go (download)

Revision 1.2, Sun Aug 12 16:31:56 2018 UTC (5 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.1: +1 -1 lines

pkgtools/pkglint: update to 5.6.0

Changes since 5.5.16:

* Check for negated shell commands (if ! test -z "foo"); they are not
  supported by Solaris.

* Don't check variable permissions for infrastructure files. A warning
  like "may not be set by any package" doesn't make sense for them.

* Check that PLIST_VARS matches PLIST.*, which is especially useful in
  options.mk files.

* Improve checks for options.mk files (for PKG_OPTIONS_SET).

* Prefer options handling with !empty() over checking empty() first.

* Prefer ${MACHINE_ARCH} == i386 over !empty(MACHINE_ARCH:Mi386), for
  single-valued variables.

package main

import "gopkg.in/check.v1"

func (s *Suite) Test_Alternatives_PLIST(c *check.C) {
	t := s.Init(c)

	t.SetupFileLines("ALTERNATIVES",
		"sbin/sendmail @PREFIX@/sbin/sendmail.postfix@POSTFIXVER@",
		"sbin/sendmail @PREFIX@/sbin/sendmail.exim@EXIMVER@",
		"bin/echo bin/gnu-echo",
		"bin/editor bin/vim -e")

	G.Pkg = NewPackage("")
	G.Pkg.PlistFiles["bin/echo"] = true
	G.Pkg.PlistFiles["bin/vim"] = true
	G.Pkg.PlistFiles["sbin/sendmail.exim${EXIMVER}"] = true

	CheckfileAlternatives(t.File("ALTERNATIVES"), G.Pkg.PlistFiles)

	t.CheckOutputLines(
		"ERROR: ~/ALTERNATIVES:1: Alternative implementation \"@PREFIX@/sbin/sendmail.postfix@POSTFIXVER@\" must appear in the PLIST as \"sbin/sendmail.postfix${POSTFIXVER}\".",
		"NOTE: ~/ALTERNATIVES:1: @PREFIX@/ can be omitted from the file name.",
		"NOTE: ~/ALTERNATIVES:2: @PREFIX@/ can be omitted from the file name.",
		"ERROR: ~/ALTERNATIVES:3: Alternative wrapper \"bin/echo\" must not appear in the PLIST.",
		"ERROR: ~/ALTERNATIVES:3: Alternative implementation \"bin/gnu-echo\" must appear in the PLIST.")
}