Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src v5.0.0 #42

Merged
merged 58 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
eec56e0
src: first attempt at a major refactor
kreatoo Aug 6, 2023
6021c0f
Commit from GitHub Actions (Build manpages)
kreatoo Aug 6, 2023
06d9745
refactor part 2
kreatoo Aug 6, 2023
d8d2dc6
ci: change when it'll run
kreatoo Aug 6, 2023
9e8949f
[skip ci] chkupd: move jsontomd.sh to scripts
kreatoo Aug 6, 2023
cb54dd0
kreastrap: remove buildPackages
kreatoo Aug 6, 2023
7be4976
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
677b8cb
[skip ci] remove .envrc
kreatoo Aug 6, 2023
7f8e02d
kpkg: build: WIP: add the ability to use local files in SOURCES
kreatoo Aug 6, 2023
b5ddac9
kpkg: build: attempt to fix last commit
kreatoo Aug 6, 2023
140c5c7
jumpstart: check pid if it is 1 or not
kreatoo Aug 6, 2023
a83784d
jumpstart: fix build errors
kreatoo Aug 6, 2023
aed8d45
kpkg: feat: implement multiple packages off same runfile
kreatoo Aug 6, 2023
5cfaed4
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
b7d7ca4
kpkg: build: add warning about deprecation of install()
kreatoo Aug 6, 2023
189bfe6
kpkg: feat: add conflicts support
kreatoo Aug 6, 2023
663672f
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
e654219
kpkg: remove reprod check
kreatoo Aug 6, 2023
f509765
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
6242bdc
oops forgot to remove enforce reprod on buildcmd
kreatoo Aug 6, 2023
4a57688
Merge branch 'v5.0.0' of github.com:kreatolinux/src into v5.0.0
kreatoo Aug 6, 2023
b30b414
remove the last remaints last 2 commits didnt remove
kreatoo Aug 6, 2023
59fd47d
ahhhhhhh i suck at removing shit
kreatoo Aug 6, 2023
4e3e487
install: remove unnecessary download
kreatoo Aug 6, 2023
061d36a
kpkg: downloader: if progress can't be calculated dont show it
kreatoo Aug 6, 2023
2d07d26
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
7aeeff8
downloader: fix syntax error, also set precision to -1 so it looks nicer
kreatoo Aug 6, 2023
fe6ec4c
Update downloader.nim
kreatoo Aug 6, 2023
b170bcb
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
815a594
kpkg: feat: move deps to the runfile itself
kreatoo Aug 6, 2023
0701b63
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
cb9279b
kpkg: feat: remove legacy install function support
kreatoo Aug 6, 2023
e449f41
Merge branch 'v5.0.0' of github.com:kreatolinux/src into v5.0.0
kreatoo Aug 6, 2023
cf3cd4f
runparser: depends/bdepends: get rid of quotes
kreatoo Aug 6, 2023
3a122d2
[skip ci] scripts: make a migratefromv4 script
kreatoo Aug 6, 2023
a39c38a
scripts: improve on migratefromv4
kreatoo Aug 6, 2023
a052653
[skip ci] scripts: migratefromv4: fix bug
kreatoo Aug 6, 2023
84576ca
migratefromv4: remove old depfiles once converted
kreatoo Aug 6, 2023
cf050bd
update manpages to reflect changes
kreatoo Aug 6, 2023
3e5da2d
Commit from GitHub Actions (Build manpages)
kreatoo Aug 6, 2023
00bddbf
[skip ci] readme: removed icons cuz they looked cheesy
kreatoo Aug 6, 2023
f969fe1
kpkg: feat: build: use fakeroot for install step
kreatoo Aug 6, 2023
9e4da82
kpkg: wip: attempt to use threadpool
kreatoo Aug 6, 2023
0bfef9b
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
21b4fc7
kpkg: downloader: make it non-async
kreatoo Aug 6, 2023
3787579
cant make buildcmd parallel for now
kreatoo Aug 6, 2023
f221b47
experimenting with parallelization x2
kreatoo Aug 6, 2023
1e6c554
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 6, 2023
5f6501a
kpkg: feat: parallelization on installcmd (now complete)
kreatoo Aug 7, 2023
f9dfa72
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 7, 2023
f5c8a6e
add threadsUsed config option, make all options use camelCase, and fi…
kreatoo Aug 7, 2023
99f8417
Merge branch 'v5.0.0' of github.com:kreatolinux/src into v5.0.0
kreatoo Aug 7, 2023
42846d0
Commit from GitHub Actions (Format Nim Files)
kreatoo Aug 7, 2023
9a22f36
kpkg: threadsUsed: set the default to a sane 4
kreatoo Aug 7, 2023
6b73104
Merge branch 'v5.0.0' of github.com:kreatolinux/src into v5.0.0
kreatoo Aug 7, 2023
94c5c20
kpkg: config: update documentation and a comment
kreatoo Aug 7, 2023
22e2c7e
Commit from GitHub Actions (Build manpages)
kreatoo Aug 7, 2023
3eb8470
runparser: CONFLICTS: remove quotes
kreatoo Aug 7, 2023
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
4 changes: 0 additions & 4 deletions .envrc

This file was deleted.

22 changes: 11 additions & 11 deletions .github/workflows/build-rootfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:

- name: Build nocc rootfs tarball
run: |
IS_ACTIONS=y sh $GITHUB_WORKSPACE/src/scripts/build-ci.sh init
IS_ACTIONS=y sh $GITHUB_WORKSPACE/src/scripts/build-ci.sh build nocc
IS_ACTIONS=y sh $GITHUB_WORKSPACE/scripts/build-ci.sh init
IS_ACTIONS=y sh $GITHUB_WORKSPACE/scripts/build-ci.sh build nocc

- name: Upload nocc Rootfs
uses: actions/upload-artifact@v3.1.1
Expand All @@ -44,7 +44,7 @@ jobs:

- name: Build builder rootfs tarball
run: |
IS_ACTIONS=y sh $GITHUB_WORKSPACE/src/scripts/build-ci.sh build builder
IS_ACTIONS=y sh $GITHUB_WORKSPACE/scripts/build-ci.sh build builder

- name: Upload Builder Rootfs
uses: actions/upload-artifact@v3.1.1
Expand All @@ -58,7 +58,7 @@ jobs:

- name: Build server rootfs tarball
run: |
IS_ACTIONS=y sh $GITHUB_WORKSPACE/src/scripts/build-ci.sh build server
IS_ACTIONS=y sh $GITHUB_WORKSPACE/scripts/build-ci.sh build server

- name: Upload Server Rootfs
uses: actions/upload-artifact@v3.1.1
Expand All @@ -72,7 +72,7 @@ jobs:

- name: Build builder-gnu rootfs tarball
run: |
IS_ACTIONS=y sh $GITHUB_WORKSPACE/src/scripts/build-ci.sh build builder-gnu
IS_ACTIONS=y sh $GITHUB_WORKSPACE/scripts/build-ci.sh build builder-gnu

- name: Upload builder-gnu Rootfs
uses: actions/upload-artifact@v3.1.1
Expand All @@ -86,7 +86,7 @@ jobs:

- name: Build builder-systemd rootfs tarball
run: |
IS_ACTIONS=y sh $GITHUB_WORKSPACE/src/scripts/build-ci.sh build builder-systemd
IS_ACTIONS=y sh $GITHUB_WORKSPACE/scripts/build-ci.sh build builder-systemd

- name: Upload builder-systemd Rootfs
uses: actions/upload-artifact@v3.1.1
Expand All @@ -112,11 +112,11 @@ jobs:
- name: Prepare for Docker
run: |
mkdir /tmp/docker.tmp /tmp/docker.tmp.nocc /tmp/docker.tmp.builder-gnu /tmp/docker.tmp.server /tmp/docker.tmp.builder-systemd
cp $GITHUB_WORKSPACE/src/docker/Dockerfile /tmp/docker.tmp.nocc || exit 1
cp $GITHUB_WORKSPACE/src/docker/Dockerfile /tmp/docker.tmp/ || exit 1
cp $GITHUB_WORKSPACE/src/docker/Dockerfile /tmp/docker.tmp.builder-gnu || exit 1
cp $GITHUB_WORKSPACE/src/docker/Dockerfile /tmp/docker.tmp.server || exit 1
cp $GITHUB_WORKSPACE/src/docker/Dockerfile /tmp/docker.tmp.builder-systemd || exit 1
cp $GITHUB_WORKSPACE/docker/Dockerfile /tmp/docker.tmp.nocc || exit 1
cp $GITHUB_WORKSPACE/docker/Dockerfile /tmp/docker.tmp/ || exit 1
cp $GITHUB_WORKSPACE/docker/Dockerfile /tmp/docker.tmp.builder-gnu || exit 1
cp $GITHUB_WORKSPACE/docker/Dockerfile /tmp/docker.tmp.server || exit 1
cp $GITHUB_WORKSPACE/docker/Dockerfile /tmp/docker.tmp.builder-systemd || exit 1
tar -xvpf $GITHUB_WORKSPACE/builder-gnu-rootfs/kreato-linux-builder-gnu-*.tar.gz -C "/tmp/docker.tmp.builder-gnu"
tar -xvpf $GITHUB_WORKSPACE/builder-systemd-rootfs/kreato-linux-builder-systemd-*.tar.gz -C "/tmp/docker.tmp.builder-systemd"
tar -xvpf $GITHUB_WORKSPACE/builder-rootfs/kreato-linux-builder-*.tar.gz -C "/tmp/docker.tmp"
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: ["master"]
pull_request:
branches: ["master"]
paths:
- '**.nim'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -28,7 +26,7 @@ jobs:

- name: build (amd64)
run: |
nim c --threads=on -o=/tmp/kpkg-amd64-linux --passL:-static -d:ssl --passL:-lssl --dynlibOverride:ssl --passL:-lcrypto --dynlibOverride:crypto src/kpkg/kpkg.nim
nim c --threads=on -o=/tmp/kpkg-amd64-linux --passL:-static -d:ssl --passL:-lssl --dynlibOverride:ssl --passL:-lcrypto --dynlibOverride:crypto kpkg/kpkg.nim

- uses: actions/upload-artifact@v3
with:
Expand All @@ -43,5 +41,5 @@ jobs:

- name: build and run purr
run: |
nim c --threads=on -o=/tmp/ci --passL:-static -d:ssl --passL:-lssl --dynlibOverride:ssl --passL:-lcrypto --dynlibOverride:crypto src/purr/purr.nim
nim c --threads=on -o=/tmp/ci --passL:-static -d:ssl --passL:-lssl --dynlibOverride:ssl --passL:-lcrypto --dynlibOverride:crypto purr/purr.nim
/tmp/ci
4 changes: 2 additions & 2 deletions .github/workflows/man.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build manpages
on:
push:
paths:
- 'src/man/*.md'
- 'man/*.md'
workflow_dispatch:

jobs:
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Build manpages
run: |
[ ! -d "man" ] && mkdir man
for i in src/man/*.md; do
for i in man/*.md; do
pandoc --standalone --to man "$i" -o man/"$(basename $i .md)"
done

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
out
packages
src/kreastrap/kreastrap
kreastrap/kreastrap
result
kpkg-repo
archives
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SRCDIR = $(shell pwd)/src
SRCDIR = $(shell pwd)
PREFIX = ./out

nimbuild = nim c -d:release -d:branch=master --threads:on -d:ssl -o=$(PREFIX)/$1 $(SRCDIR)/$1/$1.nim
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<p align="left">
<img src="https://github.com/Kreato-Linux/logo/blob/master/withtext.png">
<img src="https://github.com/Kreato-Linux/logo/blob/master/core.png" height="10%" width="10%">
<img src="https://github.com/Kreato-Linux/logo/blob/master/withtext.png">
</p>

# src
Expand All @@ -21,7 +20,7 @@ There are a couple of build variables;

## kreastrap
There is also kreastrap v3, a rootfs building utility.
You can build it by running `make kreastrap`. The binary will be located on `src/kreastrap/kreastrap`.
You can build it by running `make kreastrap`. The binary will be located on `kreastrap/kreastrap`.

## mari
Mari is a very simple http server that uses httpbeast. It is mainly used to run Kreato Linux binary repository. You can build it by running `make mari`. The binary will be located on the usual `out` folder.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/jumpstart/logging.nim → common/logging.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import terminal

proc debug*(message: string) =
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/jumpstart/jumpstart.nim → jumpstart/jumpstart.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import std/net
import json
include serviceHandler/main

if getCurrentProcessId() != 1:
error "jumpstart needs to be ran as PID 1 (init) to function correctly"

## Initialize the entire system, such as mounting /proc etc.
initSystem()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
include ../commonImports
import ../logging
import ../../common/logging

proc disableService*(service: string, isMount: bool) =
## Disables an service.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
include ../commonImports
import ../logging
import ../../common/logging

proc enableService*(service: string, isMount: bool) =
## Enables an service.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import parsecfg
import ../../logging
import ../../../common/logging
import os
import strutils
import osproc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import parsecfg
import osproc
import os
import strutils
import ../../logging
import ../../../common/logging
include ../../commonImports

proc stopMount*(mountName: string) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include ../commonImports
import enable, disable, start, stop
import os, osproc
import parsecfg
import ../logging
import ../../common/logging
import jumpmount/main
import jumpmount/umount

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import parsecfg
import os, osproc
import std/threadpool
import status
import ../logging
import ../../common/logging
include ../commonImports
import globalVariables

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ../logging
import ../../common/logging
import osproc
import os
import globalVariables
Expand Down
79 changes: 43 additions & 36 deletions src/kpkg/build.nim → kpkg/commands/buildcmd.nim
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import os
import osproc
import installcmd
import strutils
import sequtils
import libsha/sha256
include modules/dephandler
include modules/runparser
include modules/downloader
include install
import modules/shadow
import os
import ../modules/logger
import ../modules/shadow
import ../modules/config
import ../modules/runparser
import ../modules/dephandler
import ../modules/downloader

const lockfile = "/tmp/kpkg.lock"

Expand All @@ -14,11 +18,9 @@ proc cleanUp() {.noconv.} =
removeFile(lockfile)
quit(0)

proc builder(package: string, destdir: string,
proc builder*(package: string, destdir: string,
root = "/tmp/kpkg/build", srcdir = "/tmp/kpkg/srcdir", offline = false,
dontInstall = false, useCacheIfAvailable = false,
binrepo = "mirror.kreato.dev",
enforceReproducibility = false): bool =
dontInstall = false, useCacheIfAvailable = false): bool =
## Builds the packages.

if not isAdmin():
Expand Down Expand Up @@ -75,7 +77,11 @@ proc builder(package: string, destdir: string,
return true

var filename: string
var existsPrepare = execShellCmd(". "&path&"/run"&" && command -v prepare")

let existsPrepare = execCmdEx(". "&path&"/run"&" && command -v prepare").exitCode
let existsInstall = execCmdEx(". "&path&"/run"&" && command -v package").exitCode
let existsPackageInstall = execCmdEx(
". "&path&"/run"&" && command -v package_"&package).exitCode

var int = 0
var usesGit: bool
Expand All @@ -95,7 +101,10 @@ proc builder(package: string, destdir: string,

folder = @[lastPathPart(i.split("::")[1])]
else:
waitFor download(i, filename)
if fileExists(path&"/"&i):
copyFile(path&"/"&i, i)
else:
download(i, filename)

# git cloning doesn't support sha256sum checking
var actualDigest = sha256hexdigest(readAll(open(
Expand Down Expand Up @@ -129,21 +138,27 @@ proc builder(package: string, destdir: string,
# Run ldconfig beforehand for any errors
discard execProcess("ldconfig")

var cmdStr = ". "&path&"/run"&" && export CC="&getConfigValue("Options",
"cc")&" && export CCACHE_DIR=/tmp/kpkg/cache && build"
var cmd2Str = ". "&path&"/run"&" && export DESTDIR="&root&" && export ROOT=$DESTDIR &&"

if existsPackageInstall == 0:
cmd2Str = cmd2Str&" package_"&package
elif existsInstall == 0:
cmd2Str = cmd2Str&" package"
else:
err "install stage of package doesn't exist, invalid runfile"

if pkg.sources.split(";").len == 1:
if existsPrepare == 0:
cmd = execShellCmd("su -s /bin/sh _kpkg -c '. "&path&"/run"&" && export CC="&getConfigValue(
"Options", "cc")&" && export CCACHE_DIR=/tmp/kpkg/cache && build'")
cmd2 = execShellCmd(". "&path&"/run"&" && export DESTDIR="&root&" && export ROOT=$DESTDIR && install")
cmd = execShellCmd(sboxWrap(cmdStr))
cmd2 = execShellCmd("fakeroot -- "&cmd2Str)
else:
cmd = execShellCmd("su -s /bin/sh _kpkg -c 'cd "&folder[
0]&" && . "&path&"/run"&" && export CC="&getConfigValue(
"Options", "cc")&" && export CCACHE_DIR=/tmp/kpkg/cache && build'")
cmd2 = execShellCmd("cd "&folder[
0]&" && . "&path&"/run"&" && export DESTDIR="&root&" && export ROOT=$DESTDIR && install")
cmd = execShellCmd(sboxWrap("cd "&folder[0]&" && "&cmdStr))
cmd2 = execShellCmd("fakeroot -- cd "&folder[0]&" && "&cmd2Str)
else:
cmd = execShellCmd("su -s /bin/sh _kpkg -c '. "&path&"/run"&" && export CC="&getConfigValue(
"Options", "cc")&" && export CCACHE_DIR=/tmp/kpkg/cache && build'")
cmd2 = execShellCmd(". "&path&"/run"&" && export DESTDIR="&root&" && export ROOT=$DESTDIR && install")
cmd = execShellCmd(sboxWrap(cmdStr))
cmd2 = execShellCmd("fakeroot -- "&cmd2Str)

if cmd != 0:
err("build failed")
Expand All @@ -166,9 +181,7 @@ proc builder(package: string, destdir: string,
install_pkg(repo, package, "/")

if not dontInstall:
install_pkg(repo, package, destdir,
enforceReproducibility = enforceReproducibility,
binrepo = binrepo, builddir = root)
install_pkg(repo, package, destdir, builddir = root)

removeFile(lockfile)

Expand All @@ -178,11 +191,9 @@ proc builder(package: string, destdir: string,

return false

proc build(no = false, yes = false, root = "/",
proc build*(no = false, yes = false, root = "/",
packages: seq[string],
useCacheIfAvailable = false, binrepo = "mirror.kreato.dev",
enforceReproducibility = false,
forceInstallAll = false): string =
useCacheIfAvailable = false, forceInstallAll = false): string =
## Build and install packages
var deps: seq[string]

Expand Down Expand Up @@ -217,9 +228,7 @@ proc build(no = false, yes = false, root = "/",
discard
else:
builderOutput = builder(i, fullRootPath, offline = false,
useCacheIfAvailable = useCacheIfAvailable,
enforceReproducibility = enforceReproducibility,
binrepo = binrepo)
useCacheIfAvailable = useCacheIfAvailable)
if not builderOutput:
cacheAvailable = false

Expand All @@ -233,9 +242,7 @@ proc build(no = false, yes = false, root = "/",
for i in packages:
try:
discard builder(i, fullRootPath, offline = false,
useCacheIfAvailable = cacheAvailable,
enforceReproducibility = enforceReproducibility,
binrepo = binrepo)
useCacheIfAvailable = cacheAvailable)
echo("kpkg: installed "&i&" successfully")

except CatchableError:
Expand Down
7 changes: 6 additions & 1 deletion src/kpkg/info.nim → kpkg/commands/infocmd.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
proc info(package: seq[string], testing = false): string =
import os
import ../modules/logger
import ../modules/config
import ../modules/runparser

proc info*(package: seq[string], testing = false): string =
## Get information about packages

if package.len == 0:
Expand Down
Loading