The function preparePackageVersion is now responsible for doing
everything we need to do to be able to include the package in the index.
The function also returns a denormalised view of the package information
which can be taken as a proof that everything is consistent.
Lazy IO tends to keep file handles open until the entire file is read,
which in this case may never happen. This leads to the process exceeding
the system's file descriptor limit, resulting in #35.
Implement a new flag "--write-metadata" which will create, in the output
directory, a file "foliage/packages.json" with metadata about the
package provenance.
The file package.json file looks like this
```
{
"Win32-network-0.1.0.0": {
"source": {
"url": "github:input-output-hk/Win32-network/3825d3abf75f83f406c1f7161883c438dac7277d"
},
"timestamp": "2022-10-17T00:00:00Z"
},
"Win32-network-0.1.1.0": {
...
```
The idea is that tools fetching the repo can also fetch this file to
obtain information about the package provenance.
- Summary page has the list of all packages available (with details of the latest version)
- Timeline page has the list of all entries as they appear in the index
Also:
- Rebuild sdists is they are missing
Also introduce sanity checks for the following cases
- Package timestamp is later than any revision timestamp
- Package has no timestamp but has revisions
The above cases do not make any sense and are considered invalid.