Browse Source

show a Release-Notes URI if infos were changed

This gives the repository owner a chance to explain why this change was
needed – e.g. explaining the organisational changes or simply detailing
the changes in the new release made. Note that this URI is also shown
if the change is accepted, so it also draws attention to release notes
of minor updates (if users watch apt output closely).
tags/debian/1.5_alpha1
David Kalnischkies 4 years ago
parent
commit
96ebab48c2
5 changed files with 22 additions and 2 deletions
  1. +11
    -0
      apt-pkg/acquire-item.cc
  2. +1
    -0
      apt-pkg/deb/debmetaindex.cc
  3. +3
    -0
      apt-pkg/metaindex.cc
  4. +2
    -0
      apt-pkg/metaindex.h
  5. +5
    -2
      test/integration/test-apt-update-releaseinfo-changes

+ 11
- 0
apt-pkg/acquire-item.cc View File

@@ -1623,6 +1623,7 @@ bool pkgAcqMetaBase::VerifyVendor(string const &) /*{{{*/
{ "Codename", AllowInfoChange, &metaIndex::GetCodename },
{ nullptr, false, nullptr }
};
_error->PushToStack();
auto const CheckReleaseInfo = [&](char const * const Type, bool const AllowChange, decltype(checkers[0].Getter) const Getter) {
std::string const Last = (TransactionManager->LastMetaIndexParser->*Getter)();
std::string const Now = (TransactionManager->MetaIndexParser->*Getter)();
@@ -1655,6 +1656,16 @@ bool pkgAcqMetaBase::VerifyVendor(string const &) /*{{{*/
CRI &= Allow;
}
}
if (_error->empty(GlobalError::NOTICE) == false)
{
auto const notes = TransactionManager->MetaIndexParser->GetReleaseNotes();
if (notes.empty() == false)
{
// TRANSLATOR: the "this" refers to changes in the repository like a new release or owner change
_error->Notice(_("More information about this can be found online in the Release notes at: %s"), notes.c_str());
}
}
_error->MergeWithStack();
if (CRI == false)
{
// TRANSLATOR: %s is the name of the manpage in question, e.g. apt-secure(8)


+ 1
- 0
apt-pkg/deb/debmetaindex.cc View File

@@ -398,6 +398,7 @@ bool debReleaseIndex::Load(std::string const &Filename, std::string * const Erro
SetVersion(Section.FindS("Version"));
Suite = Section.FindS("Suite");
Codename = Section.FindS("Codename");
SetReleaseNotes(Section.FindS("Release-Notes"));
{
std::string const archs = Section.FindS("Architectures");
if (archs.empty() == false)


+ 3
- 0
apt-pkg/metaindex.cc View File

@@ -16,6 +16,7 @@ class metaIndexPrivate /*{{{*/
std::string Label;
std::string Version;
signed short DefaultPin;
std::string ReleaseNotes;
};
/*}}}*/

@@ -67,6 +68,7 @@ APT_PURE std::string metaIndex::GetLabel() const { return d->Label; }
APT_PURE std::string metaIndex::GetVersion() const { return d->Version; }
APT_PURE std::string metaIndex::GetCodename() const { return Codename; }
APT_PURE std::string metaIndex::GetSuite() const { return Suite; }
APT_PURE std::string metaIndex::GetReleaseNotes() const { return d->ReleaseNotes; }
APT_PURE signed short metaIndex::GetDefaultPin() const { return d->DefaultPin; }
APT_PURE bool metaIndex::GetSupportsAcquireByHash() const { return SupportsAcquireByHash; }
APT_PURE time_t metaIndex::GetValidUntil() const { return ValidUntil; }
@@ -164,3 +166,4 @@ void metaIndex::SetOrigin(std::string const &origin) { d->Origin = origin; }
void metaIndex::SetLabel(std::string const &label) { d->Label = label; }
void metaIndex::SetVersion(std::string const &version) { d->Version = version; }
void metaIndex::SetDefaultPin(signed short const defaultpin) { d->DefaultPin = defaultpin; }
void metaIndex::SetReleaseNotes(std::string const &notes) { d->ReleaseNotes = notes; }

+ 2
- 0
apt-pkg/metaindex.h View File

@@ -77,6 +77,7 @@ public:
std::string GetVersion() const;
std::string GetCodename() const;
std::string GetSuite() const;
std::string GetReleaseNotes() const;
signed short GetDefaultPin() const;
bool GetSupportsAcquireByHash() const;
time_t GetValidUntil() const;
@@ -123,6 +124,7 @@ public:
APT_HIDDEN void SetLabel(std::string const &label);
APT_HIDDEN void SetVersion(std::string const &version);
APT_HIDDEN void SetDefaultPin(signed short const defaultpin);
APT_HIDDEN void SetReleaseNotes(std::string const &notes);
};

#endif

+ 5
- 2
test/integration/test-apt-update-releaseinfo-changes View File

@@ -68,10 +68,13 @@ testsuccesswithnotice apt update --allow-releaseinfo-change
testequal "All packages are up to date.
N: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 100 to 1." tail -n 2 rootdir/tmp/testsuccesswithnotice.output

sed -i -e '/^NotAutomatic: / d' $(find ./aptarchive -name 'Release')
sed -i -e '/^NotAutomatic: / d' -e '/^Codename: / a\
Release-Notes: https://example.org/mars/release-notes' $(find ./aptarchive -name 'Release')
signreleasefiles
testfailuremsg "E: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 1 to 500.
N: More information about this can be found online in the Release notes at: https://example.org/mars/release-notes
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update
testsuccesswithnotice apt update --allow-releaseinfo-change-defaultpin
testequal "All packages are up to date.
N: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 1 to 500." tail -n 2 rootdir/tmp/testsuccesswithnotice.output
N: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 1 to 500.
N: More information about this can be found online in the Release notes at: https://example.org/mars/release-notes" tail -n 3 rootdir/tmp/testsuccesswithnotice.output

Loading…
Cancel
Save