Commit Graph

202 Commits

Author SHA1 Message Date
Christopher Baines 276c4ecd71 Vacuum the log parts table after deleting entries from it
To help keep the number of dead tuples down.
2020-11-17 20:49:47 +00:00
Christopher Baines e07b3291e8 Vacuum the package derivations table after each job
As each job deletes lots of rows in the table, vacuum it to free up space for
the next job.

I don't think this is something to do widely, but I wanted to try it out for
the tables which have a lot of churn.
2020-11-17 20:47:16 +00:00
Christopher Baines 6c47212c4d Improve the failed comparison page 2020-10-23 16:23:16 +01:00
Christopher Baines 4f3be14c16 Split the jobs metric in to succeede, queued and failed
Rather than just completed or not.
2020-10-09 20:19:28 +01:00
Christopher Baines 6023aa8caf Improve select-job-for-commit
It now returns #f or a list, rather than the empty list or a nested list.
2020-10-09 19:31:51 +01:00
Christopher Baines da8586f62d Guard against errors when recording job stderr output
This might help at least handle errors when inserting data in to PostgreSQL.
2020-10-09 19:28:06 +01:00
Christopher Baines 03ea66cf33 Use the git repository fetch with authentication value 2020-10-07 18:51:30 +01:00
Christopher Baines 6bc1da014f Better handle loading the (guix i18n) module in the inferior
Previously it would only be loaded if the (guix lint) module exists.
2020-09-26 16:07:53 +01:00
Christopher Baines 53341c70fc Change the locale codeset representation
From the normalized one, to the one actually contained within glibc. Recent
versions of glibc also contain symlinks linking the normalized codeset to the
locales with the .UTF-8 ending, but older ones do not.

Maybe handling codeset normalisation for queries would be good, but the locale
values ending in .UTF-8 are more compatible and allow the code to be
simplified. For querying, maybe there should be a locales table which handles
different representations.
2020-09-26 11:45:57 +01:00
Christopher Baines af2e12a9ef Add some new metrics about load new revision jobs 2020-09-20 19:13:23 +01:00
Danjela Lura 7984179f5e Guard against null package metadata ids
Signed-off-by: Christopher Baines <mail@cbaines.net>
2020-08-13 08:58:09 +01:00
Danjela Lura 5b3e5d9441 Update the package_metadata_tsvectors with new entries
Signed-off-by: Christopher Baines <mail@cbaines.net>
2020-08-12 08:53:49 +01:00
Christopher Baines a6a4a84b20 Avoid problems with lint warnings for duplicate packages
Use the deduplicated list of packages when fetching lint warnings, to avoid
duplicates. This was first seen in the following Guix commit
843344273c6a587b8e6c84d8406500fd64d8908a.
2020-08-09 16:53:26 +01:00
Danjela Lura 8d9a4d105c Get the translated package synopsis and descriptions into the database
Signed-off-by: Christopher Baines <mail@cbaines.net>
2020-06-19 16:03:32 +01:00
Danjela Lura f67bea719d Get the translated lint checker descriptions into the database
Signed-off-by: Christopher Baines <mail@cbaines.net>
2020-06-07 20:17:03 +01:00
Christopher Baines 4d4ee801c0 Guard against strange derivations for packages
Where the requested system doesn't match that of the returned derivation. This
seems to happen for packages like dev86, wine and go.
2020-04-24 21:37:35 +01:00
Christopher Baines d09a1ca791 Actually load the (guix lint) module if it's available 2020-04-20 14:29:33 +01:00
Christopher Baines 780ce66272 Adapt to the different inferior error handling
In recent versions of Guix on the Guix Data Service side, I don't think these
are system-error's, but a different type. For compatibility, just catch any
error.
2020-04-20 08:18:59 +01:00
Christopher Baines c4969eb33f Improve detecting if the (guix lint) module is available
Previously it would cause an error when it's not available, which is a bit
unnecessary.
2020-04-20 08:18:19 +01:00
Christopher Baines 1b197884d0 Print out the system tests as the derivations are being computed
This might help with debugging failures in the load jobs around this point.
2020-04-07 20:08:26 +01:00
Christopher Baines cdcc6140aa Guard against errors loading system tests 2020-04-07 18:22:13 +01:00
Christopher Baines 7db6a8fa03 Guard against errors when inserting log data
PostgreSQL seems to be unhappy with some data, I guess because it gets a bit
jumbled. Rather than failing the job, or getting stuck not inserting logs, try
and capture the error, log the details, and then keep going.
2020-04-07 17:38:57 +01:00
Christopher Baines 994318782a Pass #:store to checkers that support it
The derivation checker currently opens a store connection on its own, but by
passing the already open connection in, it won't have to do that, and
hopefully this will make checking all the packages faster.
2020-03-24 21:36:13 +00:00
Christopher Baines ca0d3ee754 Stop using package_versions_by_guix_revision_range
It's been replaced by the package_derivations_by_guix_revision_range table.
2020-03-24 20:44:57 +00:00
Christopher Baines c44297b615 Generate and store system test derivations for all supported systems
Rather than just the native system. I'm not quite sure of the value here, as I
guess system tests should behave the same regardless of the way the software
is compiled, but this seems like it could be useful, and being explicit about
the system the derivation is for is good.
2020-03-20 08:28:55 +00:00
Christopher Baines e0f920bb14 Fix marking jobs as failed when exceptions are raised
The switch away from catch broke this, I obviously still don't quite get how
with-exception-handler works. Therefore, use it twice as that seems to help.
2020-03-19 20:43:37 +00:00
Christopher Baines 185ba36853 Log the time spent in a locked section 2020-02-28 20:41:44 +00:00
Christopher Baines f23223f16d Improve the locking around fetching channel instances
I think there's still the potential for a race condition when working with the
cached checkout of the repository, but this lock was far too wide. The
sensitive section is just the latest-channel-instances call, as it adds the
relevant files to the store, and that's what's returned.
2020-02-28 20:40:31 +00:00
Christopher Baines a95c5ca5c9 Improve the error reporting within process-load-new-guix-revision-job
By including a backtrace.
2020-02-27 21:14:58 +00:00
Christopher Baines b166177dbd Prevent inlining for a number of procedures
So that the load-new-guix-revision tests work with Guile 3.
2020-02-27 21:14:34 +00:00
Christopher Baines 71f483c816 Add a few imports in preparation for Guile 3 2020-02-27 21:12:16 +00:00
Christopher Baines 2f41fe79be Adapt some license related code to work without mock in the tests
With Guile 3, there's a potential for mock to work in even fewer
circumstances. So, adapt the code to enable writing the tests without mock.
2020-02-24 21:47:34 +00:00
Christopher Baines ce10833459 Switch to using some shorter syntax for logging time taken
In the load-new-guix-revision module.
2020-02-24 21:31:04 +00:00
Christopher Baines f57b5c4a9a Add missing ROLLBACK for transaction 2020-02-24 18:50:34 +00:00
Christopher Baines cee9acaa87 Refactor the logging setup out of process-load-new-guix-revision-job
To simplify both procedures.
2020-02-24 18:46:53 +00:00
Christopher Baines 36254f98e3 Improve the job logging
Switch to using a sequence for the ids in the log parts table, and spawn a
thread to listen for output from the inferior processes, and enter it in to
the database.
2020-02-15 17:42:07 +00:00
Christopher Baines 40f6de27f6 Make deleting the existing log parts optional 2020-02-15 16:49:37 +00:00
Christopher Baines 46c8ce5b82 Define a new parameter for a port used for the inferior error output 2020-02-15 13:41:17 +00:00
Christopher Baines f6f51bbe0d Fake the store connection in the tests
So that the tests don't require a store connection.
2020-02-14 09:18:28 +00:00
Christopher Baines 5410961f65 Add temporary roots for channel instance derivations 2020-02-13 23:11:36 +00:00
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