Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ ENV/
build/
!scripts/lib/build/
!services/kasm-base/scripts/build/
!services/opencloud/scripts/build/
!services/ocis/scripts/build/
develop-eggs/
dist/
downloads/
Expand Down
28 changes: 0 additions & 28 deletions services/cernbox-revad/versions.nuon
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,6 @@
}
}
}
},
{
"name": "sta-ocm-m6",
"latest": false,
"overrides": {
"sources": {
"revad": {
"url": "https://github.com/MahdiBaghbani/reva-opencloud.git",
"ref": "sta-milestone-6/ocm-code-flow"
}
},
"platforms": {
"production": {
"dependencies": {
"revad-base": {
"version": "sta-ocm-m6-production"
}
}
},
"development": {
"dependencies": {
"revad-base": {
"version": "sta-ocm-m6-development"
}
}
}
}
}
}
]
}
5 changes: 5 additions & 0 deletions services/nextcloud-contacts/versions.nuon
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"url": "https://github.com/MahdiBaghbani/nextcloud-contacts",
"ref": "mahdi/fix/ui-optional-email"
}
},
"external_images": {
"build": {
"tag": "24-trixie-slim"
}
}
}
},
Expand Down
62 changes: 62 additions & 0 deletions services/ocis/scripts/build/reva-override.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env nu
# Reva override for the ocis build stage.
# Reads OCIS_REVA_* env vars; clones or copies reva when override is
# enabled; applies go mod replace and runs go mod download.

def checkout-sha [work_dir: string, sha: string]: nothing -> nothing {
let first = (^git -C $work_dir checkout $sha | complete)
if $first.exit_code == 0 {
return
}
^git -C $work_dir fetch --depth 1 origin $sha
let second = (^git -C $work_dir checkout $sha | complete)
if $second.exit_code != 0 {
error make {
msg: $"Failed to checkout SHA ($sha) in ($work_dir). The clone may be too shallow; ensure the SHA is reachable from REF or fetch with full depth."
}
}
}

def main [] {
let mode = $env.OCIS_REVA_MODE? | default ""
let url = $env.OCIS_REVA_URL? | default ""
let ref_ = $env.OCIS_REVA_REF? | default ""
let sha = $env.OCIS_REVA_SHA? | default ""
let goproxy = $env.GO_BUILD_GOPROXY? | default ""

let override_enabled = (($mode == "local") or (not ($url | is-empty)))

if not $override_enabled {
return
}

if (not ($url | is-empty)) and ($ref_ | is-empty) {
error make {msg: "OCIS_REVA_REF is required when OCIS_REVA_URL is set"}
}

let work_dir = "/src/ocis-reva"
let git_cache = "/src/ocis-reva-git-cache"

^rm -rf $work_dir
^mkdir -p $work_dir

if $mode == "local" {
^cp -a "/mnt/reva/." $work_dir
} else {
if not ($"($git_cache)/.git" | path exists) {
^git clone --depth 1 --recursive --shallow-submodules --branch $ref_ $url $git_cache
}
^cp -a $"($git_cache)/." $work_dir
if not ($sha | is-empty) {
checkout-sha $work_dir $sha
}
}

^go mod edit $"-replace=github.com/owncloud/reva/v2=($work_dir)"

if not ($goproxy | is-empty) {
with-env {GOPROXY: $goproxy} { ^go mod download }
} else {
^go mod download
}
}
160 changes: 160 additions & 0 deletions services/ocis/scripts/build/web-override.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
#!/usr/bin/env nu
# Web asset override for the ocis generate stage.
# Reads OCIS_WEB_* env vars; builds web from local or git source when
# override is enabled; always runs make ci-node-generate at /ocis.
# Makefile patching is inlined; no dependency on patch-web-makefile.nu.

# Returns first line index after the recipe block beginning at rule_idx.
def find-recipe-end [lines: list<string>, rule_idx: int]: nothing -> int {
let total = $lines | length
mut j = $rule_idx + 1
while $j < $total {
if not ($lines | get $j | str starts-with "\t") {
return $j
}
$j = $j + 1
}
$j
}

# Returns true if line is a Makefile rule for the given target at column 0.
# Rejects variable assignments like target:= and target:= value.
def is-target-rule [line: string, target: string]: nothing -> bool {
let prefix = $"($target):"
if not ($line | str starts-with $prefix) {
return false
}
let prefix_len = $prefix | str length
let rest = $line | str substring $prefix_len..
(($rest | is-empty) or ($rest | str starts-with " ") or ($rest | str starts-with "\t"))
}

# Returns true if any .PHONY line in the file already declares the target.
def has-phony-target [lines: list<string>, target: string]: nothing -> bool {
$lines | any {|l|
if not ($l | str starts-with ".PHONY:") {
false
} else {
let phony_targets = (
$l
| str replace ".PHONY:" ""
| split row " "
| each {|t| $t | str trim}
| where {|t| not ($t | is-empty)}
)
$target in $phony_targets
}
}
}

# Replaces or stubs one target rule in lines. Ensures .PHONY is declared.
# If the target appears multiple times, keeps exactly one stub; removes extras.
def patch-target [
lines: list<string>
target: string
message: string
]: nothing -> list<string> {
let phony_line = $".PHONY: ($target)"
let stub = [$"($target):", $"\t@echo \"($message)\""]
let has_phony = has-phony-target $lines $target
let has_target = $lines | any {|l| is-target-rule $l $target}

if not $has_target {
mut result = $lines
if not $has_phony {
$result = ($result | append $phony_line)
}
$result = ($result | append $stub)
return $result
}

mut result = []
mut stub_placed = false
mut i = 0
let total = $lines | length

while $i < $total {
let line = $lines | get $i
if (is-target-rule $line $target) {
if not $stub_placed {
if not $has_phony {
$result = ($result | append $phony_line)
}
$result = ($result | append $stub)
$stub_placed = true
}
$i = find-recipe-end $lines $i
} else {
$result = ($result | append $line)
$i = $i + 1
}
}

$result
}

# Patches a Makefile by replacing named target recipes with no-op stubs.
def patch-makefile [
makefile: path
targets: list<string>
message: string
]: nothing -> nothing {
mut lines = open --raw $makefile | split row "\n"
for target in $targets {
$lines = patch-target $lines $target $message
}
if ($lines | is-empty) or (($lines | last) != "") {
$lines = ($lines | append "")
}
$lines | str join "\n" | save --force $makefile
}

def main [] {
let mode = $env.OCIS_WEB_MODE? | default ""
let url = $env.OCIS_WEB_URL? | default ""
let ref_ = $env.OCIS_WEB_REF? | default ""
let sha = $env.OCIS_WEB_SHA? | default ""
let node_opts = $env.OCIS_WEB_NODE_OPTIONS? | default ""

let override_enabled = (($mode == "local") or (not ($url | is-empty)))

if $override_enabled {
if (not ($url | is-empty)) and ($ref_ | is-empty) {
error make {msg: "OCIS_WEB_REF is required when OCIS_WEB_URL is set"}
}

let work_dir = "/tmp/ocis-web"
let git_cache = "/src/ocis-web-git-cache"

^rm -rf $work_dir
^mkdir -p $work_dir

if $mode == "local" {
^cp -a "/mnt/web/." $work_dir
} else {
^mkdir -p $git_cache
if not ($"($git_cache)/.git" | path exists) {
^git clone --depth 1 --recursive --shallow-submodules --branch $ref_ $url $git_cache
}
^cp -a $"($git_cache)/." $work_dir
if not ($sha | is-empty) {
^git -C $work_dir checkout $sha
}
}

if not ($node_opts | is-empty) {
$env.NODE_OPTIONS = $node_opts
}

^make -C $work_dir dist

let assets_core = "/ocis/services/web/assets/core"
^rm -rf $assets_core
^mkdir -p $assets_core
^tar xzf $"($work_dir)/release/web.tar.gz" -C $assets_core

patch-makefile "/ocis/services/web/Makefile" ["pull-assets"] "DockyPody: using preseeded ownCloud Web assets"
}

^make ci-node-generate
}
62 changes: 62 additions & 0 deletions services/opencloud/scripts/build/reva-override.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env nu
# Reva override for the opencloud build stage.
# Reads OPENCLOUD_REVA_* env vars; clones or copies reva when override is
# enabled; applies go mod replace and runs go mod download.

def checkout-sha [work_dir: string, sha: string]: nothing -> nothing {
let first = (^git -C $work_dir checkout $sha | complete)
if $first.exit_code == 0 {
return
}
^git -C $work_dir fetch --depth 1 origin $sha
let second = (^git -C $work_dir checkout $sha | complete)
if $second.exit_code != 0 {
error make {
msg: $"Failed to checkout SHA ($sha) in ($work_dir). The clone may be too shallow; ensure the SHA is reachable from REF or fetch with full depth."
}
}
}

def main [] {
let mode = $env.OPENCLOUD_REVA_MODE? | default ""
let url = $env.OPENCLOUD_REVA_URL? | default ""
let ref_ = $env.OPENCLOUD_REVA_REF? | default ""
let sha = $env.OPENCLOUD_REVA_SHA? | default ""
let goproxy = $env.GO_BUILD_GOPROXY? | default ""

let override_enabled = (($mode == "local") or (not ($url | is-empty)))

if not $override_enabled {
return
}

if (not ($url | is-empty)) and ($ref_ | is-empty) {
error make {msg: "OPENCLOUD_REVA_REF is required when OPENCLOUD_REVA_URL is set"}
}

let work_dir = "/src/opencloud-reva"
let git_cache = "/src/opencloud-reva-git-cache"

^rm -rf $work_dir
^mkdir -p $work_dir

if $mode == "local" {
^cp -a "/mnt/reva/." $work_dir
} else {
if not ($"($git_cache)/.git" | path exists) {
^git clone --depth 1 --recursive --shallow-submodules --branch $ref_ $url $git_cache
}
^cp -a $"($git_cache)/." $work_dir
if not ($sha | is-empty) {
checkout-sha $work_dir $sha
}
}

^go mod edit $"-replace=github.com/opencloud-eu/reva/v2=($work_dir)"

if not ($goproxy | is-empty) {
with-env {GOPROXY: $goproxy} { ^go mod download }
} else {
^go mod download
}
}
Loading
Loading