summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-05-28 13:24:33 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-06-28 19:18:47 +0200
commit96ebab48c25fcd1ee83729cdba4be8a6343a8766 (patch)
treef7fdd7f2a561beb89dbfe70ca194b289b40362e5
parent081fbea14d12f79c8d91ce4fe1f1004c7bc08656 (diff)
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).
-rw-r--r--apt-pkg/acquire-item.cc11
-rw-r--r--apt-pkg/deb/debmetaindex.cc1
-rw-r--r--apt-pkg/metaindex.cc3
-rw-r--r--apt-pkg/metaindex.h2
-rwxr-xr-xtest/integration/test-apt-update-releaseinfo-changes7
5 files changed, 22 insertions, 2 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index f5ff8288b..ddcff5808 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -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)
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 424ef08f6..df7419ddd 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -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)
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc
index 8765851d6..695cf8804 100644
--- a/apt-pkg/metaindex.cc
+++ b/apt-pkg/metaindex.cc
@@ -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; }
diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h
index eeeb9d807..1951f118f 100644
--- a/apt-pkg/metaindex.h
+++ b/apt-pkg/metaindex.h
@@ -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
diff --git a/test/integration/test-apt-update-releaseinfo-changes b/test/integration/test-apt-update-releaseinfo-changes
index 822ae7ce7..e4bca3658 100755
--- a/test/integration/test-apt-update-releaseinfo-changes
+++ b/test/integration/test-apt-update-releaseinfo-changes
@@ -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