Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Guix Cuirass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Panda
Guix Cuirass
Commits
efb249b0
Unverified
Commit
efb249b0
authored
8 years ago
by
Mathieu Lirzin
Browse files
Options
Downloads
Patches
Plain Diff
evaluate: Use (cuirass ...) modules.
This avoids code duplication.
parent
69e9709b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.dir-locals.el
+1
-0
1 addition, 0 deletions
.dir-locals.el
bin/evaluate.in
+4
-31
4 additions, 31 deletions
bin/evaluate.in
src/cuirass/base.scm
+7
-5
7 additions, 5 deletions
src/cuirass/base.scm
with
12 additions
and
36 deletions
.dir-locals.el
+
1
−
0
View file @
efb249b0
...
...
@@ -11,6 +11,7 @@
(
scheme-mode
.
((
indent-tabs-mode
.
nil
)
(
eval
.
(
put
'call-with-time
'scheme-indent-function
1
))
(
eval
.
(
put
'test-error
'scheme-indent-function
1
))
(
eval
.
(
put
'make-parameter
'scheme-indent-function
1
))
(
eval
.
(
put
'with-database
'scheme-indent-function
1
)))))
This diff is collapsed.
Click to expand it.
bin/evaluate.in
+
4
−
31
View file @
efb249b0
#
!/bin/sh
#
-*-
scheme
-*-
GUILE_LOAD_PATH=
"$1"
GUILE_LOAD_PATH=
"$1
${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH
"
export
GUILE_LOAD_PATH
exec
$
{
GUILE:-@GUILE@
}
--no-auto-compile
-e
main
-s
"$0"
"$@"
!
#
...
...
@@ -23,38 +23,11 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
;;; You should have received a copy of the GNU General Public License
;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>.
(
use-modules
(
ice-9
format
)
(
use-modules
(
cuirass
base
)
(
cuirass
utils
)
(
ice-9
match
)
(
ice-9
pretty-print
)
(
guix
store
)
(
srfi
srfi-19
))
(
define-syntax-rule
(
with-directory-excursion
dir
body
...
)
"Run BODY with DIR as the process's current directory."
(
let
((
init
(
getcwd
)))
(
dynamic-wind
(
λ
()
(
chdir
dir
))
(
λ
()
body
...
)
(
λ
()
(
chdir
init
)))))
(
define
(
call-with-time
thunk
kont
)
"Call THUNK and pass KONT the elapsed time followed by THUNK's return
value."
(
let*
((
start
(
current-time
time-monotonic
))
(
result
(
thunk
))
(
end
(
current-time
time-monotonic
)))
(
kont
(
time-difference
end
start
)
result
)))
(
define
(
call-with-time-display
thunk
)
"Call THUNK and write to the current output port its duration."
(
call-with-time
thunk
(
λ
(
time
result
)
(
let
((
duration
(
+
(
time-second
time
)
(
/
(
time-nanosecond
time
)
1
e9
))))
(
format
(
current-error-port
)
"evaluate '~A': ~,3f seconds~%"
(
assq-ref
result
#
:job-name
)
duration
)
(
acons
#
:duration
duration
result
)))))
(
guix
store
))
(
define*
(
main
#
:optional
(
args
(
command-line
)))
(
match
args
...
...
This diff is collapsed.
Click to expand it.
src/cuirass/base.scm
+
7
−
5
View file @
efb249b0
...
...
@@ -47,8 +47,10 @@ values."
(
define
(
call-with-time-display
thunk
)
"Call THUNK and write to the current output port its duration."
(
call-with-time
thunk
(
λ
(
time
.
results
)
(
format
#t
"~,3f seconds~%"
(
+
(
time-second
time
)
(
/
(
time-nanosecond
time
)
1
e9
)))
(
apply
values
results
))))
(
λ
(
time
result
)
(
let
((
duration
(
+
(
time-second
time
)
(
/
(
time-nanosecond
time
)
1
e9
))))
(
format
(
current-error-port
)
"evaluate '~A': ~,3f seconds~%"
(
assq-ref
result
#
:job-name
)
duration
)
(
acons
#
:duration
duration
result
)))))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment