diff --git a/Jenkinsfile b/Jenkinsfile index 8f948cd..64a9150 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { } parameters { - string(name: 'LIBRARIES', defaultValue: 'system', description: '') + string(name: 'LIBRARIES', defaultValue: 'system shell', description: '') } stages { @@ -29,6 +29,7 @@ pipeline { stage("${SCHEME}") { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { sh "make SCHEME=${SCHEME} clean test-docker" + archiveArtifacts artifacts: 'tmp/*/*.log', fingerprint: true } } }] diff --git a/Makefile b/Makefile index c4f73be..19386a9 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ .SILENT: build install test test-docker clean ${TMPDIR} -LIBRARY=system -README=${LIBRARY}/README.html -DESCRIPTION=$(shell head -n1 ${LIBRARY}/README.md) -VERSION=$(shell cat ${LIBRARY}/VERSION) -AUTHOR=$(shell cat ${LIBRARY}/AUTHOR | tr '[:upper:]' '[:lower:]') -LIBRARY_FILE=${LIBRARY}/${AUTHOR}/${LIBRARY}.sld -PKG=${AUTHOR}-${LIBRARY}-${VERSION}.tgz SCHEME=chibi +LIBRARY=system +AUTHOR=Retropikzel + +LIBRARY_FILE=foreign/c/${LIBRARY}.sld +VERSION=$(shell cat foreign/c/${LIBRARY}/VERSION) +DESCRIPTION=$(shell head -n1 foreign/c/${LIBRARY}/README.md) +README=foreign/c/${LIBRARY}/README.html +TESTFILE=foreign/c/${LIBRARY}/test.scm + +PKG=foreign-c-${LIBRARY}-${VERSION}.tgz TMPDIR=tmp/${SCHEME} -TESTFILE=${LIBRARY}/test.scm DOCKERIMG=${SCHEME}:head ifeq "${SCHEME}" "chicken" @@ -17,8 +19,8 @@ endif all: build -build: ${LIBRARY}/LICENSE ${LIBRARY}/VERSION ${LIBRARY}/AUTHOR - echo "
$$(cat ${LIBRARY}/README.md)" > ${README}
+build: foreign/c/${LIBRARY}/LICENSE foreign/c/${LIBRARY}/VERSION
+ echo "$$(cat foreign/c/${LIBRARY}/README.md)" > ${README}
snow-chibi package --version=${VERSION} --authors=${AUTHOR} --doc=${README} --description="${DESCRIPTION}" ${LIBRARY_FILE}
install:
@@ -30,7 +32,9 @@ uninstall:
${TMPDIR}:
@mkdir -p ${TMPDIR}
@cp ${TESTFILE} ${TMPDIR}/
- @cp -r ${LIBRARY} ${TMPDIR}/
+ @mkdir -p ${TMPDIR}/foreign/c
+ @cp -r foreign/c/${LIBRARY} ${TMPDIR}/foreign/c/
+ @cp -r foreign/c/${LIBRARY}.s* ${TMPDIR}/foreign/c/
test: ${TMPDIR}
echo "Hello"
diff --git a/foreign/c/shell.scm b/foreign/c/shell.scm
new file mode 100644
index 0000000..a37a46a
--- /dev/null
+++ b/foreign/c/shell.scm
@@ -0,0 +1,2 @@
+(define (shell cmd)
+ (display cmd))
diff --git a/foreign/c/shell.sld b/foreign/c/shell.sld
new file mode 100644
index 0000000..bc88ba7
--- /dev/null
+++ b/foreign/c/shell.sld
@@ -0,0 +1,9 @@
+(define-library
+ (foreign c shell)
+ (import (scheme base)
+ (retropikzel named-pipes))
+ (export shell)
+ (include "shell.scm"))
+
+
+
diff --git a/system/LICENSE b/foreign/c/shell/LICENSE
similarity index 100%
rename from system/LICENSE
rename to foreign/c/shell/LICENSE
diff --git a/foreign/c/shell/README.md b/foreign/c/shell/README.md
new file mode 100644
index 0000000..9c01c80
--- /dev/null
+++ b/foreign/c/shell/README.md
@@ -0,0 +1 @@
+Library to run shell commands and get their output
diff --git a/foreign/c/shell/VERSION b/foreign/c/shell/VERSION
new file mode 100644
index 0000000..3eefcb9
--- /dev/null
+++ b/foreign/c/shell/VERSION
@@ -0,0 +1 @@
+1.0.0
diff --git a/foreign/c/shell/test.scm b/foreign/c/shell/test.scm
new file mode 100644
index 0000000..1fb3b0f
--- /dev/null
+++ b/foreign/c/shell/test.scm
@@ -0,0 +1,12 @@
+(import (scheme base)
+ (scheme write)
+ (scheme file)
+ (scheme process-context)
+ (foreign c shell)
+ (srfi 64))
+
+(test-begin "foreign-c-shell")
+
+(display "Hello")
+
+(test-end "foreign-c-shell")
diff --git a/system/retropikzel/system.scm b/foreign/c/system.scm
similarity index 100%
rename from system/retropikzel/system.scm
rename to foreign/c/system.scm
diff --git a/system/retropikzel/system.sld b/foreign/c/system.sld
similarity index 85%
rename from system/retropikzel/system.sld
rename to foreign/c/system.sld
index 5cb61a4..489fcc0 100644
--- a/system/retropikzel/system.sld
+++ b/foreign/c/system.sld
@@ -1,5 +1,5 @@
(define-library
- (retropikzel system)
+ (foreign c system)
(import (scheme base)
(scheme write)
(foreign c))
diff --git a/foreign/c/system/LICENSE b/foreign/c/system/LICENSE
new file mode 100644
index 0000000..0a04128
--- /dev/null
+++ b/foreign/c/system/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. Execute a shell command.
+
+Built upon [(foreign c)](https://sr.ht/~retropikzel/foreign-c/).
+
+[Repository](https://git.sr.ht/~retropikzel/foreign-c-system)
+
+[Issue tracker](https://sr.ht/~retropikzel/foreign-c/trackers)
+
+[Maling lists](https://sr.ht/~retropikzel/foreign-c/lists)
+
+[Jenkins](https://jenkins.scheme.org/job/retropikzel/job/foreign-c-system/)
+
+
+(**system** _command_)
+
+_command_ is a string containing the command you want to run.
+
+Returns the exit code of the command.
+
+Example:
+
+ (import (scheme base)
+ (scheme write)
+ (scheme file)
+ (retropikzel system))
+
+ (define testfile "test.txt")
+ (system (apply string-append `("echo \"Hello\" > " ,testfile)))
+
+ (define text (with-input-from-file testfile (lambda () (read-line))))
+ (display text)
+ (newline)
diff --git a/system/README.md b/foreign/c/system/README.md
similarity index 100%
rename from system/README.md
rename to foreign/c/system/README.md
diff --git a/system/VERSION b/foreign/c/system/VERSION
similarity index 100%
rename from system/VERSION
rename to foreign/c/system/VERSION
diff --git a/system/test.scm b/foreign/c/system/test.scm
similarity index 85%
rename from system/test.scm
rename to foreign/c/system/test.scm
index c84e363..df09325 100644
--- a/system/test.scm
+++ b/foreign/c/system/test.scm
@@ -2,8 +2,7 @@
(scheme write)
(scheme file)
(scheme process-context)
- (foreign c)
- (retropikzel system)
+ (foreign c system)
(srfi 64))
(test-begin "foreign-c-system")
@@ -20,6 +19,6 @@
(define exit-code2 (system "no-such-command"))
-(test-assert (not (= exit-code1 0)))
+(test-assert (> exit-code2 0))
(test-end "foreign-c-system")
diff --git a/system/AUTHOR b/system/AUTHOR
deleted file mode 100644
index 44dbcb1..0000000
--- a/system/AUTHOR
+++ /dev/null
@@ -1 +0,0 @@
-Retropikzel
diff --git a/system/Jenkinsfile b/system/Jenkinsfile
deleted file mode 100644
index 1fa81ae..0000000
--- a/system/Jenkinsfile
+++ /dev/null
@@ -1,34 +0,0 @@
-pipeline {
- agent any
-
- options {
- disableConcurrentBuilds()
- buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
- }
-
- stages {
- stage('Tests') {
- steps {
- script {
- def implementations = sh(script: 'docker run retropikzel1/compile-r7rs:chibi sh -c "compile-r7rs --list-r7rs-schemes"', returnStdout: true).split()
-
- parallel implementations.collectEntries { SCHEME ->
- [(SCHEME): {
- stage("${SCHEME}") {
- catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
- if("${SCHEME}" == "chicken") {
- DOCKERIMG="chicken:5"
- } else {
- DOCKERIMG="${SCHEME}:head"
- }
- sh "docker build --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=foreign-c-system-test-${SCHEME} -f Dockerfile.test ."
- sh "docker run -v ${WORKSPACE}:/workdir -w /workdir -t foreign-c-system-test-${SCHEME} sh -c \"timeout 120 make SCHEME=${SCHEME} clean all force-install test\""
- }
- }
- }]
- }
- }
- }
- }
- }
-}
diff --git a/system/Makefile b/system/Makefile
deleted file mode 100644
index 01ff3f6..0000000
--- a/system/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-VERSION=1.1.2
-build:
- snow-chibi package \
- --version=${VERSION} \
- --authors="Retropikzel" \
- --doc=README.html \
- --description="Library for running shell commands" \
- retropikzel/system.sld
-
-package-name:
- @echo "retropikzel-system-${VERSION}