Skip to content

Commit

Permalink
Merge pull request #23 from kreatolinux/major-refactor
Browse files Browse the repository at this point in the history
Major refactor
  • Loading branch information
kreatoo authored Feb 14, 2023
2 parents 8a8ea97 + 808d831 commit 5085b51
Show file tree
Hide file tree
Showing 48 changed files with 338 additions and 344 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
container:
image: ghcr.io/kreatolinux/builder:latest
volumes:
- /etc/nyaa.tarballs:/etc/nyaa.tarballs
- /var/cache/kpkg/archives:/var/cache/kpkg/archives

steps:
- name: Checkout
Expand All @@ -20,12 +20,12 @@ jobs:
- name: Cache built packages
uses: actions/cache@v3
with:
path: /etc/nyaa.tarballs
path: /var/cache/kpkg/archives
key: cache-nyaa-tarballs

- name: Build packages
run: |
nimble install --depsOnly -Y
nimble nyaastrap
./src/nyaastrap/nyaastrap buildPackages
./build.sh deps
./build.sh kreastrap
./src/kreastrap/kreastrap buildPackages
30 changes: 15 additions & 15 deletions .github/workflows/build-rootfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
container:
image: kreato/builder:latest
volumes:
- /etc/nyaa.tarballs:/etc/nyaa.tarballs
- /var/cache/kpkg/archives:/var/cache/kpkg/archives

steps:

Expand All @@ -26,20 +26,20 @@ jobs:
- name: Cache built packages
uses: actions/cache@v3
with:
path: /etc/nyaa.tarballs
path: /var/cache/kpkg/archives
key: cache-nyaa-tarballs

- name: Build nocc rootfs tarball
run: |
ln -s $GITHUB_WORKSPACE /nyaa
ln -s $GITHUB_WORKSPACE /work
mkdir /out
ln -s /out /nyaa/out
cd /nyaa
nimble install --depsOnly -Y
nimble nyaastrap
/nyaa/src/nyaastrap/nyaastrap rootfs --buildType=nocc --arch=amd64
ln -s /out /work/out
cd /work
./build.sh deps
./build.sh kreastrap
/work/src/kreastrap/kreastrap rootfs --buildType=nocc --arch=amd64
cd /out
tar -czvf /nyaa/kreato-linux-nocc-"$(date +%d-%m-%Y)"-amd64.tar.gz *
tar -czvf /work/kreato-linux-nocc-"$(date +%d-%m-%Y)"-amd64.tar.gz *

- name: Upload nocc Rootfs
Expand All @@ -55,10 +55,10 @@ jobs:
- name: Build builder rootfs tarball
run: |
rm -rf /out/*
cd /nyaa
/nyaa/src/nyaastrap/nyaastrap rootfs --buildType=builder --arch=amd64
cd /work
/work/src/kreastrap/kreastrap rootfs --buildType=builder --arch=amd64
cd /out
tar -czvf /nyaa/kreato-linux-builder-"$(date +%d-%m-%Y)"-amd64.tar.gz *
tar -czvf /work/kreato-linux-builder-"$(date +%d-%m-%Y)"-amd64.tar.gz *
- name: Upload Builder Rootfs
uses: actions/upload-artifact@v3.1.1
Expand All @@ -73,10 +73,10 @@ jobs:
- name: Build server rootfs tarball
run: |
rm -rf /out/*
cd /nyaa
/nyaa/src/nyaastrap/nyaastrap rootfs --buildType=server --arch=amd64
cd /work
/work/src/kreastrap/kreastrap rootfs --buildType=server --arch=amd64
cd /out
tar -czvf /nyaa/kreato-linux-builder-"$(date +%d-%m-%Y)"-amd64.tar.gz *
tar -czvf /work/kreato-linux-builder-"$(date +%d-%m-%Y)"-amd64.tar.gz *
- name: Upload Server Rootfs
uses: actions/upload-artifact@v3.1.1
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ jobs:
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: 'stable' # default is 'stable'
- run: nimble build --threads:on -Y
- run: ./build.sh deps
- run: ./build.sh kpkg
- uses: actions/upload-artifact@v3
with:
name: nyaa3-withoutssl
path: ${{ github.workspace }}/out/*
- run: rm -rf out/ && nimble ssl -Y
- uses: actions/upload-artifact@v3
with:
name: nyaa3-withssl
name: kpkg
path: ${{ github.workspace }}/out/*

- run: |
nimble tests
sudo ./out/nyaa # This is done to generate the config, purr cant seem to generate them by itself for now
./build.sh tests
sudo ./out/kpkg # This is done to generate the config, purr cant seem to generate them by itself for now
sudo ./out/purr
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
out
packages
src/nyaastrap/nyaastrap
src/kreastrap/kreastrap
37 changes: 15 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
<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/pkg.png" height="10%" width="10%">
<img src="https://github.com/Kreato-Linux/logo/blob/master/core.png" height="10%" width="10%">
</p>

# nyaa3
`nyaa3` is a rewrite of the `nyaa` package manager. It is written in Nim, and is mainly for use with Kreato Linux.
`nyaa3` is heavily inspired by package managers such as `kiss`, `dnf` and `pacman`.
# src
Welcome to the Kreato Linux source tree. The source tree includes everything you need to build, test, and maintain Kreato Linux.
It includes multiple tools to accomplish this goal. You will find them below.

# Why?
Speed, code readability and efficiency get harder and harder on shell and i consider nyaa2 to be a complete project.

# Building and installation
Installation is done by choosing to install the `nyaa` package manager on `nyaastrap`.

You can also build through `nimble`.
Please note that using `nyaa3` in a environment other than Kreato Linux is not supported, and support will not be given.
We recommend using the ssl task to build since repositories that nyaa3 is configured with need SSL.
Run `nimble ssl` to build, and `nimble install` to install.

nyaa3 also includes optional utilities in its source tree. These use nyaa3's library functions which is why they are on nyaa3's source tree.
# Build variables

There are a couple of build variables;

* -d:branch: Repository branch that is gonna be used for the default repositories, is set to `stable` by default

You can find how to build/use them below.
# Projects

## kpkg
`kpkg` is a rewrite of the nyaa2 package manager. It is written in Nim, and is mainly for use with Kreato Linux.
`kpkg` is heavily inspired by package managers such as `kiss`, `dnf` and `pacman`. Run `./build.sh kpkg` to build.

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

## purr
purr is nyaa3's testing utility. You can build it by running `nimble tests`. The binary will be located on the usual `out` folder.
purr is kpkg's testing utility. You can build it by running `./build.sh tests`. The binary will be located on the usual `out` folder.

## chkupd
chkupd is a tool to check if a package is up-to-date on a nyaa repository. It also has the ability to attempt to autoupdate the package. You can build it by running `nimble chkupd`. The binary will be located on the usual `out` folder.
chkupd is a tool to check if a package is up-to-date on a kpkg repository. It also has the ability to attempt to autoupdate the package. You can build it by running `./build.sh chkupd`. The binary will be located on the usual `out` folder.

# License
Licensed under GPLv3. Check LICENSE file for details
Expand Down
42 changes: 42 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
OUTDIR="$(dirname $0)/out/"
SRCDIR="$(dirname $0)/src/"

run() {
echo "Running $@"
"$@"
}

case $1 in
"kpkg")
shift
run nim c -d:release -d:branch=master --threads:on -d:ssl "$@" -o="$OUTDIR" "$SRCDIR/kpkg/kpkg.nim"
;;
"prettify")
run nimpretty src/*/*/*
;;
"tests")
shift
run nim c -d:release --threads:on -d:ssl "$@" -o="$OUTDIR" "$SRCDIR/purr/purr.nim"
;;
"chkupd")
shift
run nim c -d:release -d:ssl "$@" -o="$OUTDIR" "$SRCDIR/chkupd/chkupd.nim"
;;
"kreastrap")
shift
run nim c --threads:on -d:ssl "$@" -o="$SRCDIR/kreastrap/kreastrap" "$SRCDIR/kreastrap/kreastrap.nim"
;;
"deps")
shift
run nimble install cligen libsha "$@" -y
;;
*)
echo """./build.sh kpkg: builds kpkg
./build.sh prettify: uses nimpretty to prettify code
./build.sh tests: builds tests
./build.sh chkupd: builds chkupd
./build.sh kreastrap: builds kreastrap
./build.sh deps: Install dependencies through Nimble"""
;;
esac
25 changes: 0 additions & 25 deletions docker-compose.yml

This file was deleted.

20 changes: 10 additions & 10 deletions man/nyaa3.8 → man/kpkg.8
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "nyaa3" "8" "" "" ""
.TH "kpkg" "8" "" "" ""
.hy
.SH NAME
.PP
nyaa3 - package manager
kpkg - package manager
.SH SYNOPSIS
.PP
\f[B]nyaa\f[R] [h] [b] [ins] [inf] [r] [upd] [upg] [PACKAGES] [-y] [-o]
\f[B]kpkg\f[R] [h] [b] [ins] [inf] [r] [upd] [upg] [PACKAGES] [-y] [-o]
[-r] [ROOTFS]
.SH DESCRIPTION
.PP
Nyaa3 is a package manager written in Nim.
kpkg is a package manager written in Nim.
It is under 700> LOC and is meant to be used with Kreato Linux.
.PP
Nyaa uses simple build scripts called runfiles, similar to PKGBUILDs
kpkg uses simple build scripts called runfiles, similar to PKGBUILDs
found in the pacman package manager.
You can learn more about runfiles in nyaa_run(8).
You can learn more about runfiles in kpkg_run(8).
.SH COMMANDS
.PP
\f[B]h\f[R] Output help
Expand All @@ -41,22 +41,22 @@ You can learn more about runfiles in nyaa_run(8).
.PP
\f[B]-y\f[R] Auto-accept installation.
.PP
For full arguments, please see \f[C]nyaa help\f[R]
For full arguments, please see \f[C]kpkg help\f[R]
.SH AUTHOR
.PP
Written by Kreato.
.SH COPYRIGHT
.PP
nyaa is free software: you can redistribute it and/or modify it under
kpkg is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
.PP
nyaa is distributed in the hope that it will be useful, but WITHOUT ANY
kpkg is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along
with nyaa.
with kpkg.
If not, see <https://www.gnu.org/licenses/>.
24 changes: 12 additions & 12 deletions man/nyaa.conf.5 → man/kpkg.conf.5
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "nyaa.conf" "5" "" "" ""
.TH "kpkg.conf" "5" "" "" ""
.hy
.SH NAME
.PP
nyaa.conf - Configuration file for nyaa3
kpkg.conf - Configuration file for kpkg
.SH DESCRIPTION
.PP
/etc/nyaa.conf is the main configuration file on nyaa3.
A default one is included when you launch nyaa3 for the first time.
/etc/kpkg/kpkg.conf is the main configuration file on kpkg.
A default one is included when you launch kpkg for the first time.
.SH SYNTAX
.PP
nyaa.conf uses a INI format.
kpkg.conf uses a INI format.
The default configuration file currently looks like this;
.IP
.nf
Expand All @@ -20,8 +20,8 @@ The default configuration file currently looks like this;
cc=gcc

[Repositories]
RepoDirs=/etc/nyaa /etc/nyaa-bin
RepoLinks=\[dq]https://github.com/kreatolinux/nyaa-repo.git https://github.com/kreatolinux/nyaa-repo-bin.git\[dq]
RepoDirs=/etc/kpkg/repos/main /etc/kpkg/repos/main-bin
RepoLinks=\[dq]https://github.com/kreatolinux/kpkg-repo.git https://github.com/kreatolinux/kpkg-repo-bin.git\[dq]

[Upgrade]
buildByDefault=yes
Expand All @@ -40,11 +40,11 @@ Seperate by space.
RepoLinks: Repository links.
Must line up with RepoDirs.
Seperate by space.
Has nyaa-repo and nyaa-repo-bin repositories by default.
Has kpkg-repo and kpkg-repo-bin repositories by default.
.PP
Repositories also support branches/commits like this;
.PP
\f[C]RepoLinks=\[dq]https://github.com/kreatolinux/nyaa-repo.git::BRANCHNAME\[dq]\f[R]
\f[C]RepoLinks=\[dq]https://github.com/kreatolinux/kpkg-repo.git::BRANCHNAME\[dq]\f[R]
.SS UPGRADE
.IP \[bu] 2
buildByDefault: Enable building by default on upgrades or not.
Expand All @@ -54,16 +54,16 @@ Is enabled by default.
Written by Kreato.
.SH COPYRIGHT
.PP
nyaa is free software: you can redistribute it and/or modify it under
kpkg is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
.PP
nyaa is distributed in the hope that it will be useful, but WITHOUT ANY
kpkg is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along
with nyaa.
with kpkg.
If not, see <https://www.gnu.org/licenses/>.
Loading

0 comments on commit 5085b51

Please sign in to comment.