alpm_srcinfo::source_info::lints

Function reassigned_cleared_property

Source
pub fn reassigned_cleared_property(
    errors: &mut Vec<SourceInfoError>,
    line: usize,
)
Expand description

Creates a lint error for a package property that is both set and unset.

In SRCINFO data, the overriding of a default keyword assignment in a pkgbase section works by assigning the keyword a new value in a pkgname section. Keyword overriding does not require to first unset a keyword (by assigning it an empty value).

ยงExamples

Parsing the following example SRCINFO data triggers the lint error, because a default set in the pkgbase section is first explicitly unset and then explicitly set again in a pkgname section. However, simply doing the latter is enough to override the keyword assignment!

pkgbase = example
  pkgver = 0.1.0
  pkgrel = 1
  depends = glibc

pkgname = example
  # this is not needed!
  depends =
  depends = gcc-libs

The following example also triggers this lint error and suggests an error in the software that created the SRCINFO data. While representing legal notation, first setting and then unsetting a keyword is no useful behavior, as both setting and unsetting of the keyword can simply be removed.

pkgbase = example
  pkgver = 0.1.0
  pkgrel = 1
  depends = glibc

pkgname = example
  depends = gcc-libs
  # this unsets the previous override for this package!
  depends =