2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-07-02 14:02:27 +00:00
repo/README.md

181 lines
6.4 KiB
Markdown
Raw Normal View History

2019-05-10 18:24:31 +00:00
# KISS Alternative Package System
2019-05-09 07:59:27 +00:00
2019-06-13 17:44:01 +00:00
This is a package system I am experimenting with. This format is an alternative to the usual `PKGBUILD`, `APKBUILD` and `Pkgfile` systems and explores a more unixy approach.
2019-05-09 07:59:27 +00:00
2019-06-13 14:51:08 +00:00
**NOTE**: The package manager can be found here: [kiss](https://github.com/kissx/kiss)
2019-05-09 07:59:27 +00:00
Each Package is split into multiple files.
```sh
zlib/ # Package name.
├─ build # Build script.
2019-05-16 14:59:20 +00:00
├─ depends # Dependencies (one per line) (sometimes optional).
2019-06-19 14:13:41 +00:00
├─ licenses # Licenses (see below).
2019-05-09 07:59:27 +00:00
├─ sources # Sources (one per line).
├─ version # Package version.
# Files generated by the package manager.
├─ manifest # The built package's files and directories.
├─ checksums # The checksums for the source files.
# Optional files.
├─ post_install # Script to run after package installation.
2019-05-16 14:20:32 +00:00
├─ patches/* # Directory to store patches.
├─ files/* # Directory to misc files.
2019-06-20 07:05:53 +00:00
├─ nostrip # Don't strip binaries for this package (empty file).
2019-05-16 14:59:20 +00:00
2019-05-09 07:59:27 +00:00
```
2019-05-09 08:05:09 +00:00
2019-06-13 14:46:05 +00:00
When a built package is installed, this entire directory tree is copied to `/var/db/kiss` where it becomes a database entry. Listing the dependencies for a package is a simple as printing the contents of the `depends` file. Searching for which package owns a file is as simple as checking each `manifest` file.
2019-05-09 08:05:09 +00:00
This new structure also allows the package manager to be stupid simple. POSIX `sh` has no arrays. However, they are mimicked by looping over each line of each file. No more insecure `depends="pkg pkg pkg"` and `for pkg in $depends`.
Instead, the following can be done.
```sh
while read -r depend; do
# do thing.
done < depends
```
2019-05-09 08:12:31 +00:00
2019-05-16 14:04:05 +00:00
This also means anyone can write a tool to manipulate the repository or even their own package manager. It's all plain text files delimited by a new line or a space.
2019-05-09 08:12:31 +00:00
## Table of Contents
<!-- vim-markdown-toc GFM -->
2019-05-09 12:58:14 +00:00
* [The package format](#the-package-format)
* [`build`](#build)
* [`manifest`](#manifest)
* [`sources`](#sources)
* [`depends`](#depends)
* [`version`](#version)
* [`checksums`](#checksums)
2019-06-19 14:14:46 +00:00
* [`licenses`](#licenses)
2019-05-10 18:44:26 +00:00
* [`post-install`](#post-install)
2019-05-09 08:12:31 +00:00
<!-- vim-markdown-toc -->
2019-05-09 13:05:22 +00:00
2019-05-09 12:58:14 +00:00
## The package format
### `build`
2019-05-09 08:12:31 +00:00
2019-06-13 14:46:05 +00:00
The `build` file should contain the necessary steps to patch, configure, build and install the package. The build script is sent a single argument. This argument points to the package directory. Whatever is in this directory will become part of the package's manifest and will be copied to `/` (or `$kiss_ROOT`). The first argument is frequently used in `make DESTDIR="$1" install` for example.
The `build` file can be written in any language. The only requirement is that the file be executable.
2019-05-09 08:33:24 +00:00
```sh
./configure \
--prefix=/usr \
--libdir=/lib \
--shared
make
2019-06-11 09:17:42 +00:00
make DESTDIR="$1" install
2019-05-09 08:33:24 +00:00
```
2019-05-09 12:58:14 +00:00
### `manifest`
2019-05-09 08:33:24 +00:00
2019-06-11 09:17:42 +00:00
The `manifest` file contains the built package's file and directory list. The full paths to files are listed first and the directories (*in reverse*) follow. This allows the package manager to remove the directories if they are empty without needing checks in-between.
2019-05-09 08:33:24 +00:00
2019-06-13 14:46:05 +00:00
The manifest also includes the package's database entry. You can install the package with or without `kiss` and it will be recognized.
2019-05-10 07:06:18 +00:00
2019-05-09 08:33:24 +00:00
```
/usr/share/man/man3/zlib.3
/usr/include/zconf.h
/usr/include/zlib.h
2019-06-13 14:46:05 +00:00
/var/db/kiss/zlib/sources
/var/db/kiss/zlib/manifest
/var/db/kiss/zlib/checksums
/var/db/kiss/zlib/build
/var/db/kiss/zlib/version
2019-05-09 08:33:24 +00:00
/lib/libz.so.1.2.11
/lib/libz.so.1
/lib/libz.so
/lib/libz.a
/lib/pkgconfig/zlib.pc
2019-06-13 14:46:05 +00:00
/var/db/kiss/zlib
/var/db/kiss
2019-05-10 07:06:18 +00:00
/var/db
/var
2019-05-09 08:33:24 +00:00
/usr/share/man/man3
/usr/share/man
/usr/share
/usr/include
/usr
/lib/pkgconfig
/lib
```
2019-05-09 08:44:02 +00:00
2019-05-09 12:58:14 +00:00
### `sources`
2019-05-09 08:44:02 +00:00
The `sources` file contains the package's sources one per line. Sources can be local or remote.
2019-06-13 06:17:04 +00:00
An optional destination field can be added to tell the package manager where to extract the source. This is relative to the regular extraction directory. The passed directories are also created.
2019-05-09 08:44:02 +00:00
```
https://www.openssl.org/source/openssl-X.X.X.tar.gz
patches/fix-musl.patch
2019-06-12 18:08:18 +00:00
https://www.openssl.org/source/openssl-X.X.X.tar.gz lib/example/
2019-06-15 06:27:06 +00:00
git:https://github.com/dylanaraps/neofetch
2019-05-09 08:44:02 +00:00
```
2019-05-09 12:58:14 +00:00
### `depends`
2019-05-09 08:44:02 +00:00
2019-06-15 09:29:16 +00:00
The `depends` file contains the package's dependencies one per line. An optional field can be added to specify whether a dependency is needed at compile time. This may later be extended to allow for optional runtime dependencies.
**NOTE**: A dependency without a secondary field is assumed to be a runtime dependency.
2019-05-09 08:44:02 +00:00
```
2019-06-15 09:29:16 +00:00
zlib make
binutils make
2019-05-09 08:44:02 +00:00
openssl
```
2019-05-09 08:52:34 +00:00
2019-05-09 12:58:14 +00:00
### `version`
2019-05-09 08:52:34 +00:00
The `version` file contains the package's version as well as its release number. The format of this file is `version release`. The `release` portion allows a package upgrade without the modification of the version number.
2019-05-10 07:06:18 +00:00
The version can also be `git 1` to specify that the package is built from the latest `git` head.
2019-05-09 08:52:34 +00:00
```
1.2.11 1
```
2019-05-09 12:51:37 +00:00
2019-05-09 12:58:14 +00:00
### `checksums`
2019-05-09 12:51:37 +00:00
The `checksums` file contains the `sha256` sums of each entry in the `sources` file. This is generated and verified automatically.
```
c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 zlib-1.2.11.tar.gz
```
2019-05-10 18:44:26 +00:00
2019-06-19 14:13:41 +00:00
### `licenses`
The `licenses` file contains the license(s) of the package. Licenses such as `GPL`, `AGPL`, `LGPL`, `MPL`, `Artistic`, `CDDL`, or `Apache` can be written with [SPDX Short Identifier](https://spdx.org/licenses/) one per line, but for license exceptions or copyright notice licenses such as `BSD`, `MIT`, or `ISC`, the copyright notice must be included verbatim.
```
GPL-3.0-or-later
The ISC License
Copyright <YEAR> <OWNER>
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
2019-05-10 18:44:26 +00:00
### `post-install`
The `post-install` file should contain any steps required directly after the package is installed. This includes updating font databases and creating any post-install symlinks which may be required.