Documentation
¶
Overview ¶
Package sourcecompare compares two versions of a project's upstream source, as project read them, for what a reviewer would ask about before an update is submitted (Design v3 §6.12): a license file, a build file, or a declared dependency. What it couldn't read it says, so an empty reading never stands for one it couldn't make.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
// Kind is license, build, dependency, or unread: a file the comparison
// couldn't read, or read only in part, or an archive whose project
// wasn't found.
Kind string
// How is what happened to it:
// - a license or build file "added", "removed", or "changed", or
// "years" where only a license's copyright years moved, "party" where
// only the party it names did, or "moved"
// where license text moved between files and none is new, and
// "version" where a build file changed only the project's version
// it declares, or "library" where a Makefile.am's -version-info
// moved, a new library version, or "binaries" where a Cargo
// project's programs change, one removed or renamed, and "new
// binaries" where it only adds programs, or "backend" where a
// Python project's PEP 517 backend moves, Name being the new one;
// - a dependency "adds", "drops", or "moves", or "native" for a crate
// new to a Cargo.lock that links a native library, and "unlinked"
// for one gone from it;
// - an unread file "truncated", "unreadable", or "unfollowed", for
// another file a manifest includes, and "ambiguous" for an archive
// whose project wasn't found.
How string
// Side is the version that couldn't be read, "old" or "new", of an
// unread change.
Side string
// Path is the file, relative to the archive's top directory.
Path string
Message string
// System is the build system the file belongs to, a manifest's
// language or a build file's tool; empty for a license file.
System project.System
// Name is a dependency's name, and Now its version or constraint in
// the new version, as the manifest writes it.
Name, Now string
// Requirements and Before are a Python dependency's declarations in
// the new version and the old, each with its specifier and marker;
// none for every other change.
Requirements, Before []project.Requirement
// Licenses are what a license file's text is in the old version and
// the new (project.File.License), where it has one; zero for every
// other change.
Licenses [2]project.LicenseText
}
Change is one difference between two versions' source that a reviewer would ask about, as a fact: what changed and how. What it means for a port, and whether it holds a submission, is macports/assess's to say.
func Compare ¶
func Compare(older, newer project.Reading, versions Versions, named, sets func(option string) bool, cargo project.CargoFeatures) []Change
Compare reports the license files, build files, and declared dependencies that differ between two versions' readings, the old and the new, and what it couldn't read of them. Each is by its path below its archive's top, whose name, the version's, is set aside so the same file compares across versions. A version whose project couldn't be found is said. named says whether the port's Portfile names a build option, so may set it, in any variant; nil names none. sets says whether a Portfile that was read names it, which a change to it says first: nil where none was read, where named answers yes to everything, and nothing is said to be the Portfile's. cargo is what the port's build turns on, which decides which of a Cargo project's [[bin]]s it builds.