GenerateSuiteIndexes task
This server task generates Packages
, Sources
, and Release
files
(and their variants) for a debian:suite
collection.
The task_data
for this task contains the following keys:
suite_collection
(Single lookup, required): the debian:suite collection to operate ongenerate_at
(datetime, required): generate indexes for packages that were in the suite at this timestamp
To keep track of which indexes were current at any given time, the task operates in the following phases within a transaction:
It finds the previous generation of
index:*/*/Sources*
,index:*/*/Packages*
, andindex:Release
items in the collection: that is, the items with the latestcreated_at
beforegenerate_at
. If there are any such items, it marks them as having been removed atgenerate_at
(settingremoved_by_user
,removed_by_workflow
, andremoved_at
).It searches for the next generation of
index:*/*/Sources*
,index:*/*/Packages*
, andindex:Release
items in the collection: that is, the items with the earliestcreated_at
aftergenerate_at
. If there are any such items, it uses any one of them for information on when the indexes it is about to generate stopped being valid.It searches for packages that were in the suite at the given time, builds the appropriate index files from them (setting
Date
in theRelease
file to the same timestamp asgenerate_at
), and adds them to the collection. It sets thecreated_at
fields of the new collection items togenerate_at
. If it found a next generation of index files in the previous phase, then it marks the collection items from this generation as being removed at the creation time of the next generation.
Todo
Debian uses Extra-Source-Only: yes
to indicate that a source package is only present in an index due to
being referenced by a binary package in the suite (via Built-Using
or Source
). Debusine has all the necessary information about which
source and binary packages are in the suite and how they relate to each
other, so it can add this field when generating Sources
files. (We
may find that checking the relationships efficiently requires some
additional database indexes.)