2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00
Commit graph

212 commits

Author SHA1 Message Date
Christopher Baines
0ef3349ed8 Use a more long lived store connection for loading data
As this will enable registering temporary roots, to avoid store items being
garbage collected.
2020-02-13 23:11:36 +00:00
Christopher Baines
9be7dbac0b Start storing channel instance derivations
These are the ones that relate to Guix pull.
2020-02-11 08:56:24 +00:00
Christopher Baines
406aa5e160 Switch using set-current-system to parameterize
As this is neater.
2020-02-11 08:55:34 +00:00
Christopher Baines
e0ee3d224b Refactor how channel derivations are handled
Yet again...

This makes the channel-derivations for each system accessible within the
load-new-guix-revision procedure, in preparation for storing them in the
database.
2020-02-09 21:40:56 +00:00
Christopher Baines
60d53f898f Collpase store-item-for-channel in to channel->guix-store-item 2020-02-09 21:06:12 +00:00
Christopher Baines
13b0ebe561 Start computing channel instance derivations for multiple systems
These aren't stored yet, but this is a start.
2020-02-09 21:03:05 +00:00
Christopher Baines
beab4babac Further refactor channel->derivation-file-name
To reduce the line length.
2020-02-09 16:44:18 +00:00
Christopher Baines
9c38115c3d Refactor channel->derivation-file-name to reduce line length 2020-02-09 16:39:46 +00:00
Christopher Baines
3ee481110e Shift extracting channel news to later on
To avoid race conditions between jobs, have it happen after the call to
extract-information-from.
2020-02-09 10:20:36 +00:00
Christopher Baines
f1989e8758 Rework cross derivations support
Stop using the system values as targets, and remove package derivation entries
where this is the case.

Switch the non-cross derivation case to have a target of "", rather than
matching the system, as this makes more sense, and is more consistent now that
the target values no longer match the system values.

Hardcode some more correct target values, and use these instead. Hopefully
this can be better integrated with Guix in the future.

This commit also includes a migration attempting to shrink some indexes.
2020-02-08 11:16:08 +00:00
Christopher Baines
8f0d5b51b1 Store information about system tests 2020-02-03 09:57:02 +01:00
Christopher Baines
65850669a0 Log the time to lock package_versions_by_guix_revision_range 2020-02-02 11:14:35 +01:00
Christopher Baines
908f6d3eee Log the time to lock load-new-guix-revision-inserts 2020-02-02 11:14:35 +01:00
Christopher Baines
956aa9ecb0 Log the time taken to acquire advisory session locks 2020-02-02 10:10:25 +01:00
Christopher Baines
f59354ed23 Call add-temp-root for the derivation file names
In an attempt to stop the derivations from being garbage collected between the
time they're generated, and when they're potentially read by the Guix Data
Service.
2020-02-02 08:30:02 +01:00
Christopher Baines
ee82c2c71d Refactor processing lint warnings
Extract out a function to make the code slightly easier to read.
2020-02-01 10:32:49 +01:00
Christopher Baines
1ab6ecd64f Use the line numbers to make the package deduplication more stable
Previously this would just compare on the version if the name was the same,
but there are package definitions that share the name and version (itstool is
one example).

To try and make this more stable, to avoid weird errors, and unstable
comparisons between revisions, use the line number when deduplicating
packages.
2020-01-21 23:55:36 +00:00
Christopher Baines
a66cbd41f9 Fail early if a package lookup fails when loading a revision
I think this might be happening when packages are filtered out as
duplicates (by name and version), but then a reference to a duplicate occurs
somewhere, like in a lint warning.
2020-01-21 23:53:52 +00:00
Christopher Baines
b43fe39ab8 Fix setting GUIX_LOCPATH when using open-inferior/container 2020-01-13 22:24:18 +00:00
Christopher Baines
2062badf51 Add a small table of recent job events
To make it easier to see what recently happened.
2020-01-12 17:30:52 +00:00
Christopher Baines
b26ba82dad Add more timing and debugging output to the load process
To help identify what's taking the most time.
2020-01-04 11:20:02 +00:00
Christopher Baines
f2343b5fc9 Switch to using package-supported-systems, not the transitive one
This seems to work better for both generating the non-cross and cross
derivations. Previously, using the package-transitive-supported-systems
approach didn't generate some cross derivations.
2019-12-31 10:29:02 +00:00
Christopher Baines
df9d0bbdd1 Improve generating derivations for foreign architectures
Use the second argument to package-transitive-supported-systems to correctly
identify the different bootstrap path for non x86_64 and i686-linux. The
previous implementation did work, but only up until a merge of core-updates
changed the bootstrap approach.
2019-12-31 10:23:29 +00:00
Christopher Baines
5163398e54 Add pagination to the jobs page 2019-12-26 23:03:12 +00:00
Christopher Baines
0cea51cc79 Add copyright and license headers to a bunch of source files
That were missing them.
2019-12-26 10:16:55 +00:00
Christopher Baines
dd94f59acf Fix the representation of the fixed output derivation hashes
Previously, they were nix-base32-string encoded, but the representation in the
derivations is base16, so it doesn't make sense to use a different
representation in the database.

Therefore, add some code that runs before the start of each job to convert the
data in the database. It was easier to do this in Guile with the existing
support for working with these bytevector representations. After some
migration period, the code for converting the old hashes can be removed.
2019-12-26 08:53:51 +00:00
Christopher Baines
474d942cbb Better handle errors within process-load-new-guix-revision-job 2019-12-23 19:28:13 +00:00
Christopher Baines
639f24bb22 Extract management of package_derivations_by_guix_revision_range
... entries in to a separate module, to split the code up a little further.
2019-12-22 16:09:32 +00:00
Christopher Baines
ebefc7815e Fix the use of defined? in relation to channel news
This worked fine in a REPL, but here it seems the module needs to be passed.
2019-12-22 15:23:16 +00:00
Christopher Baines
c8b93cb0d0 Add new derivation_output_details_set_id column to the builds table
As this will hopefully provide a faster way of associating derivations with
builds.
2019-12-12 20:07:22 +00:00
Christopher Baines
78695c46a1 Just update the package derivation entries that need updating
Previously, all the entries for the branch were deleted, but not, only the
entries for the branch, that are present in the revision that was loaded will
be deleted. This is more efficient, as it avoids deleting and recreating
entries in the table that shouldn't have changed.
2019-11-24 20:18:08 +00:00
Christopher Baines
f23ee71ea7 Insert channel news entries when loading new guix revisions
If the channel-news-for-commit function is present.
2019-11-21 19:56:19 +00:00
Christopher Baines
2e8ca7f547 Extract out creating the guix-revision from extract-information-from
To allow for using the guix-revision-id when inserting channel news entries.
2019-11-21 19:56:19 +00:00
Christopher Baines
66d726f1fd Refactor channel handling in the load-new-guix-revision module
To allow for passing the channel to channel-news-for-commit.
2019-11-21 19:56:19 +00:00
Christopher Baines
1442d17a3d Add a new table to describe the history of derivations
There's already the package_versions_by_guix_revision_range table, but I think
it would be also useful to be able to see how derivations change over time.
2019-11-09 19:59:55 +00:00
Christopher Baines
5e1808b4c2 Work around a problem loading guix revisions
Between b13b9384bc43bf93c754c037956c8ef9a99c2b41 and
601171a9bc7ca6e4acb932895a07c0ca9aedfdac, this method failed, so catch the
error to allow loading the affected revisions.
2019-11-03 15:46:44 +00:00
Christopher Baines
c9e0e311bb Send inferior error output to stderr
Ideally this would go in to the database somehow as well, but the only idea I
have for that is pass in a pipe, and then spawn a thread to read from the
other end of that pipe in a loop to send the output to the database.

That hasn't been written yet, so just send the output to stderr for now.
2019-10-18 17:15:45 +01:00
Christopher Baines
917d031d4f Remove unused inferior-package-transitive-supported-systems function 2019-10-18 17:15:25 +01:00
Christopher Baines
af1ffc2393 Add a page for queued jobs 2019-10-12 21:16:39 +01:00
Christopher Baines
427063c812 Make it easier to retry jobs
Add a new event 'retry', and run jobs where the number of retry events is
greater or equal to the number of failure events.

Also add an index to the git_branches table to make the finding jobs query a
bit faster.
2019-10-02 21:54:11 +01:00
Christopher Baines
580900b0f4 Fail early if the inferior is #f
This happens when the repl can't be loaded for example.
2019-09-29 10:45:46 +01:00
Christopher Baines
208122317a Try setting the en_US.UTF-8 locale, if the normalised fails
Older versions of the glibc-locales package just contain the UTF-8 variants,
not utf8.
2019-09-29 10:44:53 +01:00
Christopher Baines
d236f05d0f Don't error when processing revisions of Guix without graft support 2019-09-29 10:44:25 +01:00
Christopher Baines
c81d1e04ea Handle loading revisions without the (guix lint) module
This is a recent addition, so to support loading revisions without it, better
handle the error when loading the module.
2019-09-29 00:21:25 +01:00
Christopher Baines
15b94238c5 Unset the GUILE_LOAD_* environment variables when using inferiors
Otherwise modules from outside of the inferior can leak in.
2019-09-28 23:56:41 +01:00
Christopher Baines
43bc7cab91 Add a new table to store package versions by revision ranges
This isn't new information, but derived from information already in the
database. It's collected here to make querying faster.

The table is updated when each new revision is entered.
2019-09-27 17:28:46 +01:00
Christopher Baines
38adedcede Add newline to the end of the duplicate lint warning output 2019-09-05 16:07:23 +02:00
Christopher Baines
1a55022524 Improve the package and package-metadata modules
Add tests around the package module, extract out the use of the
inferior-package record assessors so that they aren't part of the tests, and
switch across the package-metadata module to use
insert-missing-data-and-return-all-ids.
2019-09-05 16:07:23 +02:00
Christopher Baines
91a9ba4349 Add a new table guix_revision_lint_checkers
To associate a set of lint checkers with a specific revision. While there is
the association through the lint warnings, that only works for checkers where
there are lint warnings for that revision.

Therefore, to allow finding all the checkers for a specific revision, also
associate them directly with the revision.
2019-09-01 18:32:09 +01:00
Christopher Baines
3ad100bedc Log the manifest derivation when loading new revisions
As this is useful to know.
2019-09-01 17:40:16 +01:00
Christopher Baines
07f368a54b Include glibc-locales from the inferior guix in the environment
When loading data from an inferior Guix, first build it's latest version of
glibc-locales, and include that in the environment from the inferior.

This improves locale support, which is currently relevant for extracting lint
warnings.

Without this change, you'd only be able to switch to locales supported by the
glibc-utf8-locales package, assuming that the right version is available.
2019-09-01 13:12:10 +01:00
Christopher Baines
af581784b2 Log the guix store path being used
In the load-new-guix-revision module.
2019-09-01 13:12:10 +01:00
Christopher Baines
f118ed0bf9 Improve handling of errors when changing locale
In the load-new-guix-revision module.
2019-09-01 13:12:10 +01:00
Christopher Baines
6b9977f62e Store lint warnings in the database
This commit adds the relevant tables and code to store lint warnings in the
database.

Currently, only lint checkers which don't require access to the network will
be run, as this allows the processing to happen without network access. Also,
this functionality won't work in older versions of Guix which don't expose the
lint warnings in a compatible way.
2019-09-01 13:12:10 +01:00
Christopher Baines
bf469504eb Add buffering to the log handling for jobs
To increase the log output speed, avoiding inserting one character at a time
in to the database.
2019-08-31 12:10:54 +01:00
Christopher Baines
9e80bda4f9 Avoid erroring when processing emails again
These changes allow processing emails again, and just creating job and branch
entries where data is missing.
2019-08-05 20:59:48 +01:00
Christopher Baines
002ae7685c Clear the previous log entry when starting a job 2019-08-04 09:42:21 +01:00
Christopher Baines
91be72df03 Display the jobs related to a revision on the revision page 2019-07-22 20:00:11 +01:00
Christopher Baines
6dd52f08ed Remove restrictions in select-job-for-update
This allows running jobs manually that have failed.
2019-07-19 20:25:53 +01:00
Christopher Baines
71607eff66 Close the logging port once it's been used 2019-07-19 20:25:13 +01:00
Christopher Baines
413ef9ea6e Prioritise processing the latest revisions for branches
Reserve some capacity to process revisions which are the tip of a branch. This
should reduce the time between new revisions appearing, and then being
processed.
2019-07-16 18:20:02 +01:00
Christopher Baines
6904547bf2 Record jobs as failed when they are killed
So that they aren't retried again and again.
2019-07-14 14:43:47 +01:00
Christopher Baines
83ef624b97 Switch to processing jobs in parallel
This should speed up processing new revisions, reduce latency between finding
out about new revisions and processing them, as well as help manage memory
usage, by processing each job in a process that then exits.
2019-07-12 23:00:44 +01:00
Christopher Baines
a6bd46b829 Obtain a lock when inserting the data for a new revision
This is working towards running the jobs in parallel. Each job looks at the
records in the database, and adds missing ones. If other jobs, running in
different transactions insert the same missing records at the same time, this
could cause an error.

Therefore, to just avoid this problem, lock before inserting the data. This
will allow the jobs to be processed in parallel, and it shouldn't have too
much of an effect on performance, as the slow bit is outside of the
transaction.
2019-07-12 19:57:13 +01:00
Christopher Baines
05c8287965 Lock around the channel fetch when loading new revisions
This is in preparation for running jobs in parallel. The channels code in Guix
uses a cached copy of the Git repository. Multiple jobs can't concurrently
access this without causing issues, so use an advisory lock to ensure that
only one job is using the repository at a time.
2019-07-12 19:56:58 +01:00
Christopher Baines
743cec7cb6 Associate a name with database connections
This helps when working out which connection to the database is doing what.
2019-07-12 19:49:26 +01:00
Christopher Baines
1b5db7adac Fix using defined? to check for the open-inferior/container function
It doesn't work as intended unless the module is also specified, so do that.
2019-07-09 19:48:01 +01:00
Christopher Baines
502dc93618 Fix issue inserting the empty log row
If the job started, and then was restarted, the row will already exist. So
don't error on a conflict.
2019-07-09 18:43:21 +01:00
Christopher Baines
f2d28b4def Move around some of the load new revision code
To better separate the code that needs to happen after a lock has been
acquired to allow concurrently loading revisions without concurrent insertion
issues.
2019-07-07 21:59:36 +01:00
Christopher Baines
2ea78cff47 Tweak how logs are stored
Previously, the query for the jobs page was really slow, as it checked the
load_new_guix_revision_job_log_parts table for each job, doing a sequential
scan through the potentially large table.

Adding an index didn't seem to help, as the query planner would belive the
query could return loads of rows, where actually, all that needed checking is
whether a single row existed with a given job_id.

To avoid adding the index to the load_new_guix_revision_job_log_parts table,
and fighting with the query planner, this commit changes the
load_new_guix_revision_job_logs table to include a blank entry for jobs which
are currently being processed. This is inserted at the start of the job, and
then updated at the end to combine and replace all the parts.

This all means that the jobs page should render quickly now.
2019-07-07 21:23:18 +01:00
Christopher Baines
54b9922466 Iterate the log viewing
Replace the Guile-side HTML escaping with a less complete, but hopefully
faster PostgreSQL side HTML escaping approach.

Also, allow reading part of the log, by default, the last 1,000,000
characters, as this should render quickly.
2019-06-24 20:30:47 +01:00
Christopher Baines
f504eec519 Direct the build output to the logging-port
So that this is logged.
2019-06-22 15:53:44 +02:00
Christopher Baines
05165929a5 Stop closing the log-port port
This part of the soft-port seems to be called, but I don't know why, and
trying to close the output port causes issues.
2019-06-22 15:52:09 +02:00
Christopher Baines
d96add30a0 Record the output from loading new revisions to the database
So that it can easily be shown through the web interface. There's two tables
being used. One which temporarily stores the output as it's output while the
job is running, and other which stores the whole log once the job has
finished.
2019-06-22 01:51:49 +02:00
Christopher Baines
baf2b17bf8 Re-arrange some of the load new revision code
Try to isolate the code that inserts in to the database, so that the relevant
tables can be locked during this time.
2019-06-21 15:47:59 +02:00
Christopher Baines
766656086f Add a couple of functions around timing
That don't rely on timing a single function.
2019-06-21 15:47:53 +02:00
Christopher Baines
398b8aab05 Log the time loading new revisions takes 2019-06-21 15:46:53 +02:00
Christopher Baines
548e628398 Set #:fallback? to #t
If a substitute fails, just build it anyway.
2019-06-21 15:45:50 +02:00
Christopher Baines
66364207f4 Process jobs starting with the most recent
Conventionally, you'd process the oldest job in a queue, but at the moment, it
would be more useful to have recent information more promptly, and fill in the
historical gaps later. I'm not sure this'll always be the case, but for now,
flip the order in which jobs are processed.
2019-06-19 23:54:12 +01:00
Christopher Baines
3df0b43146 Use line buffering for the input and output ports
As these are used for logging, which is done on a line by line basis. Remove
the now redundant calls to (force-output).
2019-06-17 18:09:10 +01:00
Christopher Baines
7f0a0ed3b1 Time everywhere a derivation is built when loading a new revision
As this is useful information.
2019-06-17 16:28:11 +01:00
Christopher Baines
ed0745096a Add a new page listing jobs 2019-06-17 11:21:58 +01:00
Christopher Baines
33956b394f Improve the error message when a load revision job fails
It's useful to know the commit.
2019-06-15 11:07:42 +01:00
Christopher Baines
0bd1fc7e87 Display a backtrace for errors in channel->derivation-file-name
To help with debugging.
2019-06-13 23:13:34 +01:00
Christopher Baines
11144a5fe9 Catch the guix available when built
And use it for the hosting the inferiors, rather than computing the guix
package at runtime. This simplifies the behaviour when the Guix Data Service
is deployed as a Guix package.
2019-06-13 23:11:35 +01:00
Christopher Baines
6f379c7937 Rework creating /etc when building the derivation for a revision
Within an inferior. Just use the presence of open-inferior/container directly,
as this is more explicit.
2019-06-13 22:58:15 +01:00
Christopher Baines
5d06a28577 Add more detailed new revision job handling
Create a new events table for the new guix revision jobs, and update this when
processing a job starts, as well as finished with success or failure.

Additionally, remove the dependnency on open-inferior/container, as this
functionality isn't merged in to Guix master yet.
2019-06-02 22:00:29 +01:00
Christopher Baines
4ccf3132b6 Record job success without deleting the job record
Previously, the records for jobs would be deleted. It's useful to know when
jobs were inserted in to the database, as well as when they succeeded (if they
have). This change also makes it possible to keep track of jobs that have
failed, as they won't be deleted.
2019-06-02 21:48:02 +01:00
Christopher Baines
16799a34a9 Store license information for packages
And display this on the package page.

This uses a couple of new tables, and an additional field in the
package_metadata table.

Currently, the order of the licenses in the package definition isn't stored,
as I'm not sure the order in the list is significant.
2019-05-15 08:05:14 +01:00
Christopher Baines
ce4c3c6ed3 Switch to storing Git repositories in a table
Rather than just storing the URL in the guix_revisions and
load_new_guix_revision_jobs tables. This will help when storing more
information like tags and branches in the future.
2019-05-05 14:36:52 +01:00
Christopher Baines
a171287f27 Try harder to handle errors when loading new revisions
If the repl enters a bad state, attempt to exit, and catch failures in the
parent process, and rollback the open transaction.
2019-05-01 09:26:03 +01:00
Christopher Baines
dbec236928 Clear the packages derivation cache
As this should help prevent issues when the previously cached derivation is
removed from the store.
2019-04-10 20:20:42 +01:00
Christopher Baines
d62ea8857d
Better handle failures when computing the transative supported inputs 2019-03-29 09:14:03 +00:00
Christopher Baines
944492bd79
Deduplicate inferior packages
As sometimes there can be duplicates, for example with deprecated packages.
2019-03-29 09:13:29 +00:00
Christopher Baines
76d6027b7c
Try to handle the guix store item being garbage collected 2019-03-28 20:41:05 +00:00
Christopher Baines
0c02de432c
Order the index page guix revision jobs 2019-03-19 21:18:17 +00:00
Christopher Baines
bdfb654233
Add support for processing branch updated emails 2019-03-19 20:21:54 +00:00
Christopher Baines
a092db5007
Further improve load-new-guix-revision-jobs
Split the derivations up in to some groups, and run
invalidate-derivation-caches! inbetween to try and reduce the memory
usage.

Also make a couple of other changes to reduce memory usage or protect
against errors.
2019-03-16 17:26:44 +00:00
Christopher Baines
9f162c3b2c
Time more steps in load-new-guix-revision
This is useful for debugging purposes.
2019-03-15 09:31:52 +00:00
Christopher Baines
c4c1f15050
Better guard against errors in packages when loading revisions
In particular, things like undefined variables in the package
definition.
2019-03-15 09:31:08 +00:00
Christopher Baines
d2697d8dd2
Avoid loading in all derivations
Just load in the ones that are not already in the database, as this
will hopefully be faster and require less memory.
2019-03-14 08:18:01 +00:00
Christopher Baines
a0dd298239
Hopefully speed up the new guix revision processing
Compute all derivations at once in the inferior, avoiding round trips
to hopefully speed it up. Close the inferior earlier to free up
memory, and add more debugging output.
2019-03-13 09:24:47 +00:00
Christopher Baines
e117bb1d87
Many changes
A large proportion of these changes relate to changing the way
packages relate to derivations. Previously, a package at a given
revision had a single derivation. This was OK, but didn't account for
multiple architectures.

Therefore, these changes mean that a package has multiple derivations,
depending on the system of the derivation, and the target system.

There are multiple changes, small and large to the web interface as
well. More pages link to each other, and the visual display has been
improved somewhat.
2019-03-11 22:11:14 +00:00
Christopher Baines
623347d835
Add a list of the queued revisions to the index page 2019-03-03 18:15:29 +00:00
Christopher Baines
ffdd2416f4
Guard against errors getting derivations for packages 2019-03-03 17:06:11 +00:00
Christopher Baines
853a2e4125
Handle failures in load-new-guix-revision
Currently, I think the desired commit can be missing, if patches come
in gradually, and the series changes after the first laminar job has
been run. Therefore, try to ignore some errors and just delete the
job.
2019-03-01 07:29:49 +00:00
Christopher Baines
17e76b4ef1
Support a source for a job
To describe why this job was enqueued.
2019-02-28 18:47:28 +00:00
Christopher Baines
b8543859c9
Show when revisions are missing, but queued for processing 2019-02-24 16:52:45 +00:00
Christopher Baines
a5cc703e18
Load new Guix revisions within a container
Use some experimental functionality to run the inferior repl in a
container. This provides some isolation.
2019-02-24 15:37:08 +00:00
Christopher Baines
83832a7862
Build new Guix revisions within an inferior
Once inferiors can provide some isolation, this will make building
guix in this way safer.
2019-02-23 20:15:35 +00:00
Christopher Baines
c88d8335ba
Improve the model for derivations
These changes mean that more information about derivations is
recorded. There are a number of corresponding changes in the database
schema that are not tracked in the repository unfortunately.
2019-02-10 09:42:22 +00:00
Christopher Baines
5a9262b38d
Initial commit
This is a service designed to provide information about Guix. At the
moment, this initial prototype gathers up information about packages,
the associated metadata and derivations.

The initial primary use case is to compare two different revisions of
Guix, detecting which packages are new, no longer present, updated or
otherwise different.

It's based on the Mumi project.

[1]: https://git.elephly.net/software/mumi.git
2019-02-07 22:26:57 +00:00