Support linking to "old suites" in the HTML index

This is mainly so that for Ubuntu's asgen we can easily link to the
hints for xenial and yakkety, but could be useful for others too.
This commit is contained in:
Iain Lane 2016-11-22 11:17:21 +00:00
parent 9f1fa032a3
commit ddc1105847
5 changed files with 19 additions and 0 deletions

View File

@ -17,6 +17,9 @@
</p>
<h1>Select a suite</h1>
{{#oldsuites}}
<h3><a href="{{suite}}/index.html">{{suite}}</a></h3>
{{/oldsuites}}
{{#suites}}
<h3><a href="{{suite}}/index.html">{{suite}}</a></h3>
{{/suites}}

View File

@ -17,6 +17,9 @@
</p>
<h1>Select a suite</h1>
{{#oldsuites}}
<h3><a href="{{suite}}/index.html">{{suite}}</a></h3>
{{/oldsuites}}
{{#suites}}
<h3><a href="{{suite}}/index.html">{{suite}}</a></h3>
{{/suites}}

View File

@ -46,6 +46,7 @@ MetadataType | The type of the resulting AppStream metadata. Can be one of `YAML
ArchiveRoot | A local URL to the mirror of your archive, containing the dists/ and pool/ directories
MediaBaseUrl | The http or https URL which should be used in the generated metadata to fetch media like screenshots or icons
HtmlBaseUrl | The http or https URL to the web location where the HTML hints will be published. (This setting is optional, but recommended)
Oldsuites | This key exists to support migration from an alternative appstream generator. Given a list of suite names, the output HTML will link to `suitename/index.html`.
Suites | Suites which should be recognized by the generator. Each suite has the components and architectures which should be searched for metadata as children. See below for more information.
Features | Disable or enable selected generator features. For a detailed description see below.
CAInfo | Set the CA certificate bundle file to use for SSL peer verification. If this is not set, the generator will use the system default.

View File

@ -95,6 +95,7 @@ class Config
Backend backend;
Suite[] suites;
string[] oldsuites;
DataType metadataType;
uint enabledFeatures; // bitfield
@ -331,6 +332,12 @@ class Config
suites ~= suite;
}
if ("Oldsuites" in root.object) {
import std.algorithm.iteration : map;
oldsuites = map!"a.str"(root["Oldsuites"].array).array;
}
// Enable features which are default-enabled
setFeature (GeneratorFeature.PROCESS_DESKTOP, true);
setFeature (GeneratorFeature.VALIDATE, true);

View File

@ -758,6 +758,11 @@ public:
renderPage ("sections_index", format ("%s/index", suite.name), secCtx);
}
foreach (suite; conf.oldsuites) {
auto sub = context.addSubContext("oldsuites");
sub["suite"] = suite;
}
renderPage ("main", "index", context);
// copy static data, if present