distribution-opensuse-1.1.2: Types, functions, and tools to manipulate the openSUSE distribution
Safe HaskellNone
LanguageHaskell2010

OpenSuse.GuessChangeLog

Synopsis

Documentation

guessChangeLog :: FilePath -> FilePath -> IO GuessedChangeLog Source #

Automatically guess the differences between to releases of a package by looking at the change log file provided by upstream. The function as arguments the paths of two directories that contain the extracted release tarballs. The first arguments ought to point to the older release, the second paths ought to point to the updated version.

The function uses the following algorithm to detect the relevant changes:

  1. Scan both directories for files that look like they might be change logs.
  2. If both directories contain the same candidate file, e.g. ChangeLog, then use that.
  3. Compute the differences between the change log files and check that all modifications are additions at the top of the file.
  4. Return those additions as Text.

data GuessedChangeLog Source #

Constructors

GuessedChangeLog FilePath Text

Both releases contained the given change log file, and these files differed so that the given text was added at the top of the new one. The text undergoes some amount of cleanup, i.e. we'll trim leading empty lines at the top, trailing whitespace, and trailing empty lines at the end.

NoChangeLogFiles

Neither release contains a change log file.

UndocumentedUpdate FilePath

A change log file exists (and its name is returned), but it's identical in both releases. In other words, upstream probably forgot to document the release.

NoCommonChangeLogFiles (Set FilePath) (Set FilePath)

Both releases contain a set of files that look like they might be a change log, but their intersection is empty! This happens, for example, when upstream has renamed the file.

MoreThanOneChangeLogFile (Set FilePath)

Multiple change log files exists in both directories. Now, it would probably work out okay if we'd just look at the diffs of both of them, respectively, but it felt like a good idea to err on the side of caution. This case is rare anyways.

UnmodifiedTopIsTooLarge FilePath Word

guessChangelog accepts up to 10 lines of unmodified text at the top of the upstream change log file because some people like to have a short introduction text there etc. If that header becomes too large, however, then we return this error because we expect upstream to add text at the top, not in the middle of the file.

NotJustTopAdditions FilePath

This happens when upstream edits the file in ways other than just adding at the top. Sometimes people re-format old entries or rewrite URLs or fix typos, and in such a case it feels to risky to trust the diff.

Instances

Instances details
Show GuessedChangeLog Source # 
Instance details

Defined in OpenSuse.GuessChangeLog