mirror of
https://codeberg.org/kiss-community/repo
synced 2024-12-21 23:00:06 -07:00
new package manager experiment
This commit is contained in:
commit
0cda243d53
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
build/*
|
||||||
|
pkg/*
|
||||||
|
sources/*
|
108
puke
Executable file
108
puke
Executable file
@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
#
|
||||||
|
# pkg - package manager for kiss linux.
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf '\033[31mERROR>\033[m %s\n' "$@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf '\033[32m=>\033[m %s\n' "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
clean() {
|
||||||
|
rm -rf "$build_dir" "$pkg_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_info() {
|
||||||
|
[ -z "$1" ] && die "No package specified."
|
||||||
|
cd "repo/$1" || die "Package '$1' not in repository."
|
||||||
|
[ -f version ] || die "Version file not found."
|
||||||
|
[ -f depends ] || die "Depends file not found."
|
||||||
|
[ -f sources ] || die "Sources file not found."
|
||||||
|
|
||||||
|
while read -r line; do version=$line; done < version
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_depends() {
|
||||||
|
while read -r dependency; do
|
||||||
|
# TODO: Handle dependencies.
|
||||||
|
log "Found dependency $dependency"
|
||||||
|
done < depends
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_sources() {
|
||||||
|
while read -r source; do
|
||||||
|
source_name=${source##*/}
|
||||||
|
|
||||||
|
if [ -f "$source" ]; then
|
||||||
|
continue
|
||||||
|
|
||||||
|
elif [ -f "$source_dir/$source_name" ]; then
|
||||||
|
log "Found cached $source_name."
|
||||||
|
continue
|
||||||
|
|
||||||
|
elif [ -z "${source##*://*}" ]; then
|
||||||
|
log "Downloading '$source'."
|
||||||
|
wget -P "$source_dir" "$source" || die "Failed to download $source."
|
||||||
|
|
||||||
|
else
|
||||||
|
die "Source file '$source' not found."
|
||||||
|
fi
|
||||||
|
done < sources
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_extract() {
|
||||||
|
while read -r source; do
|
||||||
|
source_name=${source##*/}
|
||||||
|
|
||||||
|
if [ -f "$source" ]; then
|
||||||
|
cp -f "$source" "$build_dir"
|
||||||
|
|
||||||
|
elif [ -f "$source_dir/$source_name" ]; then
|
||||||
|
# TODO: Handle extraction based on file type.
|
||||||
|
tar xf "$source_dir/$source_name" -C "$build_dir" \
|
||||||
|
--strip-components 1 || die "couldn't extract $source_name"
|
||||||
|
fi
|
||||||
|
done < sources
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_build() {
|
||||||
|
log "Building $1-$version"
|
||||||
|
|
||||||
|
cd "$build_dir"
|
||||||
|
set -e
|
||||||
|
. "$OLDPWD/build"
|
||||||
|
set +e
|
||||||
|
cd -
|
||||||
|
}
|
||||||
|
|
||||||
|
args() {
|
||||||
|
pkg_info "$2"
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
b*)
|
||||||
|
pkg_depends
|
||||||
|
pkg_sources
|
||||||
|
pkg_extract
|
||||||
|
pkg_build "$2"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
trap clean EXIT
|
||||||
|
clean
|
||||||
|
|
||||||
|
mkdir -p sources build pkg || die "Couldn't create directories at '$PWD'".
|
||||||
|
|
||||||
|
source_dir=$PWD/sources
|
||||||
|
build_dir=$PWD/build
|
||||||
|
pkg_dir=$PWD/pkg
|
||||||
|
|
||||||
|
args "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
0
repo/zlib/.checksum
Executable file
0
repo/zlib/.checksum
Executable file
21
repo/zlib/.manifest
Executable file
21
repo/zlib/.manifest
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
/usr/share/man/man3/zlib.3
|
||||||
|
/usr/include/zconf.h
|
||||||
|
/usr/include/zlib.h
|
||||||
|
/var/db/pkg/zlib/version
|
||||||
|
/lib/libz.so.1.2.11
|
||||||
|
/lib/libz.so.1
|
||||||
|
/lib/libz.so
|
||||||
|
/lib/libz.a
|
||||||
|
/lib/pkgconfig/zlib.pc
|
||||||
|
/var/db/pkg/zlib/manifest
|
||||||
|
/var/db/pkg/zlib
|
||||||
|
/var/db/pkg
|
||||||
|
/var/db
|
||||||
|
/var
|
||||||
|
/usr/share/man/man3
|
||||||
|
/usr/share/man
|
||||||
|
/usr/share
|
||||||
|
/usr/include
|
||||||
|
/usr
|
||||||
|
/lib/pkgconfig
|
||||||
|
/lib
|
7
repo/zlib/build
Executable file
7
repo/zlib/build
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--libdir=/lib \
|
||||||
|
--shared
|
||||||
|
|
||||||
|
make
|
||||||
|
make DESTDIR="$pkg_dir" install
|
0
repo/zlib/depends
Normal file
0
repo/zlib/depends
Normal file
1
repo/zlib/sources
Normal file
1
repo/zlib/sources
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://zlib.net/zlib-1.2.11.tar.gz
|
1
repo/zlib/version
Normal file
1
repo/zlib/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.2.11
|
Loading…
Reference in New Issue
Block a user