Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F3999555
sprint1-Installation1.xreate
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 9, 2:31 AM
Size
1 KB
Mime Type
text/plain
Expires
Sat, Jul 11, 2:31 AM (1 d, 6 h)
Engine
blob
Format
Raw Data
Handle
272586
Attached To
rXR Xreate
sprint1-Installation1.xreate
View Options
import raw ("core/dependencies.lp")
import raw ("core/control-context.lp")
import raw ("core/unit-tests.lp")
InstallationStatus = type variant(NOT_INSTALLED, INSTALLED).
interface(adhoc){
pre function expectNoErrors:: InstallationStatus {
case Error {NOT_INSTALLED}
case Success {INSTALLED}
}
}
interface(extern-c){
libFake = library:: pkgconfig("libxml-2.0").
include {
libFake = ["stdio.h", "stdlib.h"]
}.
}
exec = pre function(comm:: string) {
result = system(comm):: num.
if (result==0)::InstallationStatus
{ad hoc "Success"}
else {ad hoc "Error"}
}
start = function:: int; entry {
context:: goal(artefact(gcc)).
provideGoals()
}
provideGoals = function:: int {
loop context ("goal") {
provideArtefact()
}
}
provideArtefact = function:: int{
switch (actionEXISTS())::int
case INSTALLED {0}
case NOT_INSTALLED {
sequence [
provideDependencies(),
actionPROVIDE()
]
}
case default {-1}
}
provideDependencies = function::int {
rule context:: childs(Child)
case artefact(Item) {
artefact_depends(Item, Child)
}
loop context ("childs") {
provideArtefact()
}
}
case context:: artefact(subversion) {
actionEXISTS = function::int {
context:: expectNoErrors.
exec("svn --version")
}
actionPROVIDE = function::int {
context:: expectNoErrors.
exec("sudo apt-get install subversion")
}
}
actionEXISTS = function::int {
-1
}
actionPROVIDE = function::int {
-1
}
// DRAFT
/*
flagIsProvided = if(dictProvided(<item>)) {true} else
dictProvided = dictProvided + <item>
expectErrorCode = pre function(x::int){
if (x==0)::bool {ad hoc "Success"}
else {ad hoc "Error"}
}
*/
Event Timeline
Log In to Comment