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

102 commits

Author SHA1 Message Date
Ludovic Courtès
fdf47d6df3 base: Add missing argument.
* src/cuirass/base.scm (build-packages): In 'filter-map' call, add
missing argument to 'db-get-build'.
2018-01-23 22:22:22 +01:00
Ludovic Courtès
f1b3a12c1d base: Use 'log-message' some more.
* src/cuirass/base.scm (build-packages): Use 'log-message' instead of
'format'.
2018-01-23 18:31:35 +01:00
Ludovic Courtès
d7306a4f48 base: Update build status and start/stop time according to build log.
Now the database is updated as things are built, rather than after the
whole batch of derivation builds has completed.

* src/cuirass/base.scm (handle-build-event): Call
'db-update-build-status!'.
(build-packages)[register]: Set #:starttime and #:stoptime to 0.
Set #:status to 'scheduled'.
Define 'build-ids' and use it to determine the overall result.
2018-01-23 18:29:38 +01:00
Ludovic Courtès
fe0a98315d database: Add 'db-update-build-status!'.
* src/cuirass/database.scm (build-status): Add 'scheduled' and
'started'.
(db-add-build): Make sure #:timestamp, #:starttime, #:stoptime, and
 #:status are integers.
(db-update-build-status!): New procedure.
* tests/database.scm ("database")["db-update-build-status!"]: New test.
2018-01-23 18:17:31 +01:00
Ludovic Courtès
b0f1a438ff Add a 'build-status' enumeration.
* src/cuirass/utils.scm (define-enumeration): New macro.
* src/cuirass/database.scm (build-status): New macro.
* src/cuirass/base.scm (build-packages)[hydra-build-status]: Remove.
Use the 'build-status' macro instead.
2018-01-23 17:37:08 +01:00
Ludovic Courtès
f92ad7001f Fix scope mismatch.
* src/cuirass/base.scm (process-specs): Add new 'with-database' within
the fiber.
2018-01-23 09:31:11 +01:00
Ludovic Courtès
ee11ba1d93 Introduce concurrency with Fibers.
* README: Mark Fibers as required.
* configure.ac: Check for Guile 2.2 only.  Check for (fibers).
* bin/cuirass.in (main): Use (fibers).  Run 'process-specs' and web
server in separate fibers.
* src/cuirass/base.scm (with-store): New macro.
(non-blocking-port): New procedure.
(evaluate): Use 'non-blocking-port'.  Use 'read-string' followed by 'read'.
(process-specs): Move 'db-add-stamp' right after 'string=?' comparison.
Run evaluation and subsequent builds in a separate fiber.
* src/cuirass/http.scm (run-cuirass-server): Pass 'fibers as the second
argument to 'run-server'.  Use 'log-message' instead of 'format'.
* src/cuirass/database.scm (with-database): Remove 'dynamic-wind'.
2018-01-22 23:39:51 +01:00
Ludovic Courtès
f9481e2222 database: Change default file name to /var/run/cuirass/cuirass.db.
* src/cuirass/database.scm (%package-database): Change default file name
from /var/cuirass.db (or similar) to /var/run/cuirass/cuirass.db.
2018-01-22 14:51:14 +01:00
Ludovic Courtès
0d3225a08b Improve build event logging.
* src/cuirass/base.scm (handle-build-event): Add 'build-failed'; shorten
message for 'build-remote'.
2018-01-22 14:50:43 +01:00
Ludovic Courtès
47cd2d7470 Log activity of the main loop.
* src/cuirass/base.scm (process-specs): Add 'log-message' calls.
2018-01-22 13:30:03 +01:00
Ludovic Courtès
70f21349bd Add (cuirass logging) module.
* src/cuirass/logging.scm: New file.
* Makefile.am (dist_pkgmodule_DATA): Add it.
* src/cuirass/base.scm (handle-build-event): Use 'log-message' instead
of 'log'.
2018-01-22 13:29:55 +01:00
Ludovic Courtès
327d7be013 Initialize libgit's TLS certificate directory once and for all.
* src/cuirass/base.scm (prepare-git): New procedure.  Body moved from...
(process-specs): ... here.  Remove it.
* bin/cuirass.in (main): Call 'prepare-git'.
2018-01-22 13:16:10 +01:00
Ludovic Courtès
1f701262e1 Monitor and report build events.
* src/cuirass/base.scm (%newline): New variable.
(build-event-output-port, handle-build-event): New procedures.
(build-packages): Use 'handle-build-event'.
2018-01-22 10:11:37 +01:00
Ludovic Courtès
9588e4d4a7 http: /build/N/log/raw redirects to /log.
This moves log handling responsibility to 'guix publish'.

* src/cuirass/http.scm (handle-log-request): Remove.
(url-handler): Change /log/raw URI handler to return 302 to /log/OUTPUT.
* tests/http.scm (log-file-name): Remove, and remove code to create and
delete it.
("fill-db"): Change #:log value.
("/build/1/log/raw"): Expect 302.
2018-01-07 23:59:30 +01:00
Ludovic Courtès
60b6c6fcc5 database: Extend and test 'db-get-builds'.
* src/cuirass/database.scm (db-get-builds): Make 'order' a separate
filter.  Add 'format-limit-clause'.  Reverse OUTPUTS.
* tests/database.scm (make-dummy-eval, make-dummy-derivation)
(make-dummy-build): New procedures.
(with-temporary-database): New macro.
("database"): Use 'make-dummy-build'.
("db-get-builds"): New test.
2018-01-07 23:59:30 +01:00
Ludovic Courtès
9cfea9fe2e Do not mistakenly use 'GIT_SSL_CAINFO' as a directory name.
'GIT_SSL_CAINFO' designates a single-file certificate bundle, not a
directory; thus it must be passed as the second argument to
'set-tls-certificate-locations!'.

* src/cuirass/base.scm (process-specs): Pass $SSL_CERT_DIR as the first
argument to 'set-tls-certificate-locations!', and $GIT_SSL_CAINFO or
$SSL_CERT_FILE as the second argument.
2017-09-29 09:46:23 +02:00
Jan Nieuwenhuizen
2a4d493e28
cuirass: Add --listen command line option.
* bin/cuirass.in (show-help): Add help for --listen option.
(%options): Add listen option.
(main): Pass host to run-cuirass-server.
* doc/cuirass.texi (Invocation): Add --listen option.
* src/cuirass/http.scm (run-cuirass-server): Add named #:host parameter.
2017-09-18 21:57:05 +02:00
Jan Nieuwenhuizen
87ad259dba
base: Show feedback when build has finished.
* src/cuirass/base.scm (build-packages): Print some feedback when derivations
have been built.
2017-09-17 21:53:12 +02:00
Jan Nieuwenhuizen
88363faa83
base: Make working copy writable.
* src/cuirass/base.scm (copy-repository-cache): Make working copy writable.
Fixes guix .po build errors.
2017-09-17 21:47:28 +02:00
Mathieu Othacehe
8a7483a3bb
cuirass: add Hydra compatible HTTP API.
* doc/cuirass.texi (Sections)[Web API]: New section describing the HTTP API.
* src/cuirass/http.scm (spec->json-string): Move it to utils.scm and rename it
  object->json-string.
(object->json-scm): Move it utils.scm.
(handle-*-request): New helpers procedures.
(request-parameters): New procedure to parse a request query.
(url-handler): Add new API's.
* src/cuirass/utils.scm (object->json-scm, object->json-string): Exported
procedures moved from http.scm.
* tests/http.scm: Add various tests on new HTTP API.
2017-09-08 21:15:32 +02:00
Mathieu Othacehe
e550cb6a9a
cuirass: Store new information in database to prepare new HTTP API
integration.

* bin/evaluate.in (fill-job): New procedure.
(main): Use it to fill informations (nix-name, system) that will later be
added to database.
* doc/cuirass.texi (Database)[Derivation]: Add system and nix_name fields.
(Database)[Builds]: Add id, status, timestamp, starttime and stoptime
fields. Remove output field.
(Database)[Outputs]: New table describing the build outputs.
* src/cuirass/base.scm (build-packages): Add new fields to build object before
adding it to database.
* src/cuirass/database.scm (db-get-build, db-get-builds): New procedures to get
a build by id from database and a list of builds using filter parameters
respectively.
* src/schema.sql (Outputs) : New table.
(Derivations): Add system and nix_name columns.
(Builds): Remove output column and add id, status, timestamp, starttime and
stoptime columns.
2017-09-08 21:00:57 +02:00
Ricardo Wurmus
cf96567db7
base: Set certificate location.
* src/cuirass/base.scm (process-specs): Set certificate location to the value
in GIT_SSL_CAINFO or SSL_CERT_DIR.
2017-08-26 13:57:26 +02:00
Ludovic Courtès
72f2b6b77c database: 'db-add-build' is now idempotent.
Fixes <https://bugs.gnu.org/28094>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* src/cuirass/database.scm (SQLITE_CONSTRAINT)
(SQLITE_CONSTRAINT_PRIMARYKEY): New variables.
(db-add-build): Catch 'sqlite-error, and swallow
SQLITE_CONSTRAINT_PRIMARYKEY errors.
* tests/database.scm ("db-add-build"): New test.
2017-08-26 10:45:43 +02:00
Mathieu Othacehe
6f85bc04f3
cuirass: Fix Guile current-processor-count deprecation warnings.
When current-processor-count is used without (ice-9 threads) being used, Guile
complains with the following warning:

Import (ice-9 threads) to have access to `current-processor-count'.

* src/cuirass/base.scm: Use (ice-9 threads).
2017-08-02 15:34:54 +02:00
Mathieu Othacehe
a919c25328
base: Report git errors.
* src/cuirass/base.scm (report-git-error): New procedure.
(with-git-error-handling): New macro.
(process-specs): Use with-git-error-handling to catch and report git errors.
* build-aux/guix.scm (package)[inputs]: Add guile-git.
* configure.ac: Check for (git) module. Also check that (git) exports
git-error-message procedure.
2017-07-31 15:46:50 +02:00
Mathieu Othacehe
c6ee3d9b1a
base: Report evaluation error.
* src/cuirass/base.scm (&evaluation-error): New condition type.
(evaluate): Report an &evaluation-error if eof-object? is true on
data read from port. Otherwise, suppose that data are correct and keep things
going.
(process-specs): Catch &evaluation-error, report the error in the log and keep
going.
2017-07-30 12:35:56 +02:00
Mathieu Othacehe
efcef52883
cuirass: Add fallback parameter.
* src/cuirass/base.scm (%fallback?): New exported parameter.
(process-specs)[set-build-options]: Pass fallback parameter.
* bin/cuirass.in (%options): Add fallback.
(main): Set %fallback? parameter.
(show-help): Update.
2017-07-12 16:28:41 +02:00
Mathieu Othacehe
707b053024
database: Fix typo.
* src/cuirass/database.scm (db-get-stamp, db-add-stamp): Replace #:id
  by #:name. There is no #:id in specifications. Plus, the primary key
  of Specifications is #:name.
2017-07-12 16:28:41 +02:00
Mathieu Othacehe
56ac3e24ac
base: Fix time-monotonic Guile issue.
* src/cuirass/base.scm: Replace time-monotonic with time-tai with
  Guile 2.2, to avoid wrong evaluation durations.
2017-07-12 16:28:41 +02:00
Mathieu Othacehe
d7dc7cb92c
cuirass: Stop λ/lambda mixing.
* bin/cuirass.in: Replace λ by lambda.
* bin/evaluate.in: Ditto.
* build-aux/guix.scm: Ditto.
* examples/gnu-system.scm: Ditto.
* examples/guix-track-git.scm: Ditto.
* src/cuirass.scm: Ditto.
* src/cuirass/base.scm: Ditto.
* src/cuirass/database.scm: Ditto.
* src/cuirass/ui.scm: Ditto.
* src/cuirass/utils.scm: Remove λ* macro.
2017-07-06 10:03:16 +02:00
Mathieu Othacehe
4666142ca5
repo: Remove dead code.
* Makefile.am (dist_pkgmodule_DATA): Remove repo.scm,
(TESTS): Remove repo.scm.
* build-aux/guix.scm (package)[disable-repo-tests]: Remove phase.
* src/cuirass/repo.scm: Remove.
* tests/repo.scm: Remove.
2017-07-06 09:20:52 +02:00
Mathieu Othacehe
1b79b7bf6e
base: Use (guix git) module.
* src/cuirass/base.scm (copy-repository-cache) : New procedure.
(fetch-repository): Use latest-repository-commit to fetch git
repository instead of raw git system commands.
(process-specs): Use fetch-repository to get a store directory
containing the repository described in SPEC, add copy it to cache with
"copy-repository-cache".
* configure.ac: Check (guix git) module presence.
2017-07-05 13:52:18 +02:00
Mathieu Othacehe
f301378d94
utils: Remove useless procedures.
* src/cuirass/utils.scm (mkdir-p, make-user-module,
  call-with-temporary-directory, with-directory-excursion): Remove because
  already defined in guix.
* tests/utils (with-directory-excursion): Remove associated test.
* src/cuirass/base.scm: Use (guix build utils) to provide procedure removed
  from (cuirass utils).
* bin/evaluate.in: Ditto.
* bin/cuirass.in: Use "make-user-module" provided by (guix ui).
2017-07-01 18:47:18 +02:00
Mathieu Othacehe
706c80c6a0
repo: remove git-repo.
* src/cuirass/repo.scm (git-repo): Remove it.
* tests/repo.scm: Remove related tests.

git-repo is not used and it's usecases will be covered by (guix git).
2017-07-01 18:47:18 +02:00
Ludovic Courtès
7f8029d33c base: Send build output to the bit bucket.
Fixes a regression introduced in
a42cf16fec whereby build logs would go the
Cuirass' stderr.

* src/cuirass/base.scm (build-packages): Parameterize
'current-build-output-port' to a void output port.
2017-06-04 22:13:16 +02:00
Ludovic Courtès
a42cf16fec
base: Provide 'build-derivations' with the full list of derivations.
This improves parallelism when 'max-jobs' is large.

* src/cuirass/base.scm (build-packages): Rewrite to pass the complete
list of derivations to 'build-derivations' at once.  Handle multiple outputs.
* src/schema.sql (Builds): Make "output" part of the primary key.

Co-authored-by: Mathieu Lirzin <mthl@gnu.org>
2017-02-24 19:33:41 +01:00
Ludovic Courtès
8c811abb31
base: Remove unnecessary 'file-exists?' call.
* src/cuirass/base.scm (fetch-repository): Remove 'file-exists?' call
before 'mkdir-p'.
2017-02-24 19:32:22 +01:00
Ludovic Courtès
61f8f75e93
base: Do not stop on the first build failure.
* src/cuirass/base.scm (process-specs): Systematically call
'set-build-options'.  Pass #:keep-going? #t.
2017-02-24 19:32:22 +01:00
Mathieu Othacehe
aebad5184d
base: Handle multi-directories in load-path.
* src/cuirass/base.scm (set-guix-package-path!): Parse colon separated
directories in load-path.

Co-authored-by: Mathieu Lirzin <mthl@gnu.org>
2017-02-06 12:47:36 +01:00
Mathieu Othacehe
abd52046d5
base: Handle 'git clone' errors correctly.
Fixes https://notabug.org/mthl/cuirass/issues/1.

* src/cuirass/base.scm (fetch-repository): Return #f when 'git clone' fails.
(process-specs): Test if commit is not #f before using its value.

Signed-off-by: Mathieu Lirzin <mthl@gnu.org>
2017-01-29 17:28:38 +01:00
Mathieu Othacehe
5127c6797c
cuirass: Add "--load-path" option.
* bin/cuirass.in (%options): Add "--load-path" and "-L" command line options.
(show-help): Adapt.
* src/cuirass/base.scm (%guix-package-path): New parameter.
(set-guix-package-path!): New procedure.
(evaluate): Call "evaluate" script with '%guix-package-path'.
* bin/evaluate.in (main): Match 'guix-package-path' command line argument and
handle it.

Signed-off-by: Mathieu Lirzin <mthl@gnu.org>
2017-01-29 17:19:20 +01:00
Mathieu Lirzin
d0a5801e39
database: db-add-derivation: Don't try to add a derivation twice.
This fixes the issue of having multiple identical derivations associated with
an evaluation as reported by Ludovic Courtès <ludo@gnu.org> at
<https://lists.gnu.org/archive/html/guix-devel/2017-01/msg00109.html>.

* src/cuirass/database.scm (db-add-derivation): Ignore if JOB is already
present in DB.
2017-01-09 10:55:58 +01:00
Mathieu Lirzin
49fae56c95
maint: Add new mailing list and webpage.
* configure.ac: Declare <bug-cuirass@framalistes.org> as package mailing list,
and <https://notabug.org/mthl/cuirass/> as package website.
* src/cuirass/ui.scm (show-package-information): Display them.
2017-01-09 00:35:19 +01:00
Mathieu Lirzin
8a782b3e84
cuirass: Add "--port" command line option.
* bin/cuirass.in (%options): Add "--port" and "-p" command line options.
(show-help): Adapt.
(main): Set default to 8080.  Call 'run-cuirass-server' with this.
* src/cuirass/http.scm (run-cuirass-server): Display the port number.
* doc/cuirass.texi (Invocation): Document new option.
2016-12-28 18:49:21 +01:00
Mathieu Lirzin
b59b8e5567
http: Add 'port' keyword argument to 'run-cuirass-server'.
* src/cuirass/http.scm (run-cuirass-server): Add 'port' keyword argument.
2016-12-28 18:19:03 +01:00
Mathieu Lirzin
96be568de4
config: Remove references to '$prefix' expansion hack.
* src/cuirass/config.scm.in (%datadir, %localstatedir): Don't refer to
previous '$prefix' expansion hack in comments.
2016-12-28 18:19:03 +01:00
Mathieu Lirzin
16aec469d4
repo: Add <repo> record datatype.
* src/cuirass/utils.scm (call-with-temporary-directory): New procedure.
* src/cuirass/repo.scm: Use it.  New file.
* tests/repo.scm: New tests.
* Makefile.am (dist_pkgmodule_DATA, TESTS): Add them.
2016-12-28 18:18:37 +01:00
Mathieu Lirzin
05eba838ea
base: Create the parent directories of '%package-cachedir'.
* src/cuirass/base.scm (fetch-repository): Use 'mkdir-p' instead of 'mkdir'
for 'cachedirectory'.
2016-12-01 20:59:43 +01:00
Mathieu Lirzin
5898e6f8f8
base: Use inner definitions instead of big anonymous procedures.
* src/cuirass/base.scm (build-packages, process-specs): Use an inner
definition instead of a big anonymous procedure.
2016-11-17 01:19:05 +01:00
Mathieu Lirzin
bfd395c09f
db: Forbid inserting the same specification twice.
* src/schema.sql (Specifications): Make 'repo_name' the primary key.
(Stamps, Evaluations): Adapt.
* src/cuirass/database.scm (db-get-specifications): Likewise.
(db-add-specification): Ignore if SPEC has already been added.
* tests/database.scm (example-spec): Adapt.
2016-11-17 01:19:05 +01:00