Check-Script: rules
Author: Russ Allbery <rra@debian.org>
Type: source
Needs-Info: debfiles
Info: Check targets and actions in debian/rules.
Abbrev: rul

Tag: debian-rules-is-symlink
Severity: normal
Certainty: certain
Info: The file <tt>debian/rules</tt> is a symlink instead of a regular
 file. This is unnecessary and makes package checking and manipulation
 more difficult. If the rules file should be available in the source
 package under multiple names, make <tt>debian/rules</tt> the real
 file and the other names symlinks to it.
 .
 This problem may have prevented lintian from performing other checks,
 leading to undetected changelog errors.

Tag: debian-rules-not-a-makefile
Severity: serious
Certainty: certain
Ref: policy 4.9
Info: The <tt>debian/rules</tt> file for this package does not appear to
 be a makefile or does not start with the required line.
 <tt>debian/rules</tt> must be a valid makefile and must have
 "<tt>#!/usr/bin/make -f</tt>" as its first line.

Tag: debian-rules-missing-required-target
Severity: serious
Certainty: certain
Ref: policy 4.9
Info: The <tt>debian/rules</tt> file for this package does not provide one
 of the required targets.  All of build, binary, binary-arch,
 binary-indep, and clean must be provided, even if they don't do anything
 for this package.

Tag: debian-rules-missing-recommended-target
Severity: normal
Certainty: certain
Ref: policy 4.9
Info: The <tt>debian/rules</tt> file for this package does not provide
 one of the recommended targets.  All of build-arch and build-indep
 should be provided, even if they don't do anything for this package.
 If this package does not currently split building of architecture
 dependent and independent packages, the following rules may be added
 to fall back to the build target:
 .
   build-arch: build
   build-indep: build
 .
 Note that the following form is recommended however:
 .
   build: build-arch build-indep
   build-arch: build-stamp
   build-indep: build-stamp
   build-stamp:
	build here
 .
 These targets will be required by policy in the future, so should be
 added to prevent future breakage.

Tag: debian-rules-uses-deprecated-makefile
Severity: normal
Certainty: certain
Info: The <tt>debian/rules</tt> file for this package appears to
 include a Makefile that has been deprecated.  Please refer to the
 documentation of the providing package for a replacement (if any).

Tag: debian-rules-uses-pwd
Severity: normal
Certainty: certain
Info: The <tt>debian/rules</tt> file for this package appears to use the
 variable $(PWD) to refer to the current directory.  This variable is not
 set by GNU make and therefore will have whatever value it has in the
 environment, which may not be the actual current directory.  Some ways of
 building Debian packages (such as through sudo) will clear the PWD
 environment variable.
 .
 Instead of $(PWD), use $(CURDIR), which is set by GNU make, ignores the
 environment, and is guaranteed to always be set.

Tag: debian-rules-ignores-make-clean-error
Severity: normal
Certainty: certain
Info: A rule in the <tt>debian/rules</tt> file for this package calls the
 package's clean or distclean target with a line like:
 .
  -$(MAKE) distclean
 or
  $(MAKE) -i distclean
 .
 The leading "-" or the option -i tells make to ignore all errors.
 Normally this is done for packages using Autoconf since Makefile may not
 exist.  However, this line ignores all other error messages, not just
 the missing Makefile error.  It's better to use:
 .
  [ ! -f Makefile ] || $(MAKE) distclean
 .
 so that other error messages from the clean or distclean rule will still
 be caught (or just remove the "-" if the package uses a static makefile).

Tag: debian-rules-uses-DEB_BUILD_OPTS
Severity: normal
Certainty: certain
Info: The standard environment variable for build options is
 DEB_BUILD_OPTIONS.  Usually, referring to DEB_BUILD_OPTS is a mistake and
 DEB_BUILD_OPTIONS was intended instead.

Tag: debian-rules-automatically-updates-control
Severity: serious
Certainty: possible
Info: DEB_AUTO_UPDATE_DEBIAN_CONTROL appears to be set to <tt>yes</tt> in
 the <tt>debian/rules</tt> file.  This activates a feature of CDBS which
 may not be used in packages uploaded to the Debian archive.
Ref: http://ftp-master.debian.org/REJECT-FAQ.html

Tag: debian-rules-sets-DH_COMPAT
Severity: normal
Certainty: certain
Ref: debhelper(7)
Info: As of debhelper version 4, the DH_COMPAT environment variable is
 only to be used for temporarily overriding <tt>debian/compat</tt>.  Any
 line in <tt>debian/rules</tt> that sets it globally should be deleted and
 a separate <tt>debian/compat</tt> file created if needed.

Tag: binary-arch-rules-but-pkg-is-arch-indep
Severity: normal
Certainty: certain
Info: It looks like you try to run code in the binary-arch target of 
 <tt>debian/rules</tt>, even though your package is architecture-
 independent.

Tag: debian-rules-calls-debhelper-in-odd-order
Severity: normal
Certainty: certain
Info: One of the targets in the <tt>debian/rules</tt> file for this
 package calls debhelper programs in an odd order.  Normally,
 dh_makeshlibs should be run before dh_shlibdeps or dh_installdeb, and
 dh_shlibdeps should be run before dh_gencontrol.  dh_builddeb should be
 the last debhelper action when building the package, after any of the
 other programs mentioned.  Calling these programs in the wrong order may
 cause incorrect or missing package files and metadata.

Tag: missing-build-dependency
Severity: serious
Certainty: possible
Ref: policy 4.2
Info: The package doesn't specify a build dependency on a package that is
 used in <tt>debian/rules</tt>.
 .
 lintian intentionally does not take into account transitive dependencies.
 Even if the package build-depends on some package that in turn
 depends on the needed package, an explicit build dependency should
 be added.  Otherwise, a latent bug is created that will appear without
 warning if the other package is ever updated to change its dependencies.
 Even if this seems unlikely, please always add explicit build
 dependencies on every non-essential, non-build-essential package that is
 used directly during the build.

Tag: missing-python-build-dependency
Severity: important
Certainty: certain
Ref: policy 4.2
Info: The package appears to use Python as part of its build process in
 <tt>debian/rules</tt> but doesn't depend on Python.
 .
 Normally, packages that use Python as part of the build process should
 build-depend on one of python, python-all, python-dev, or python-all-dev
 depending on whether they support multiple versions of Python and whether
 they're building modules or only using Python as part of the package
 build process.  Packages that depend on a specific version of Python may
 build-depend on the appropriate pythonX.Y or pythonX.Y-dev package
 instead.

Tag: clean-should-be-satisfied-by-build-depends
Severity: important
Certainty: certain
Ref: policy 7.7
Info: The specified package is required to run the clean target of
 <tt>debian/rules</tt> and therefore must be listed in Build-Depends, not
 Build-Depends-Indep, even if no architecture-dependent packages are
 built.

Tag: debian-rules-makemaker-prefix-is-deprecated
Severity: normal
Certainty: possible
Ref: perl-policy 4.3
Info: The package appears to use an <tt>ExtUtils::MakeMaker</tt>
 (Makefile.PL) build system and sets the temporary installation path by
 overriding <tt>PREFIX</tt> when calling <tt>make install</tt>.  This only
 works because of a Debian-specific change to <tt>ExtUtils::MakeMaker</tt>
 that the maintainers of the Debian perl package intend to remove.
 .
 The correct way to set the installation directory is with DESTDIR.
 Setting PREFIX should not be necessary at all.
 .
 For example, the line
   make install PREFIX=$(TMP)/usr          # WRONG
 should be replaced with
   make install DESTDIR=$(TMP)             # RIGHT

Tag: debian-rules-uses-or-modifies-user-only-variable
Severity: normal
Certainty: possible
Ref: #631786
Info: The rules files appear to be reading or modifying a variable not
 intended for use by package maintainers.  The special variables
 .
 DEB_*FLAGS_{SET,APPEND}
 .
 can be used by users, who wants to re-compile debian packages with
 special (or non-standard) build flags.

Tag: package-would-benefit-from-build-arch-targets
Severity: normal
Certainty: certain
Ref: #629385, https://wiki.debian.org/ReleaseGoals/BuildArchTarget
Info: The source package does not have both a build-arch and a build-indep
 target.  Furthermore it is part of the selected set of packages to
 be fixed for Wheezy.
 .
 Please consider adding both the build-arch and build-indep targets.

