Convert minimal, basic, and all sets to ports.
This commit is contained in:
parent
91952d7e51
commit
1444f907c6
10 changed files with 70 additions and 25 deletions
build-aux
ports
share/man/man5
tix
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 2018, 2022, 2023 Jonas 'Sortie' Termansen.
|
||||
# Copyright (c) 2018, 2022, 2023, 2024 Jonas 'Sortie' Termansen.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -106,10 +106,32 @@ isinset() {
|
|||
exit 0)
|
||||
}
|
||||
|
||||
. "$thisdir/ports.conf"
|
||||
escape_extended_regex() {
|
||||
printf "%s\n" "$1" | sed -E -e 's/[[$()*?\+.^{|}]/\\\0/g'
|
||||
}
|
||||
|
||||
list_set_recurse() {
|
||||
if [ "$1" = '*' ]; then
|
||||
grep -Ev '^all' repository/packages.list
|
||||
elif [ ! -e "repository/$1.visited" ]; then
|
||||
echo "$1"
|
||||
touch "repository/$1.visited"
|
||||
for dep in $(tix-vars -d '' "repository/$1.info" RUNTIME_DEPS); do
|
||||
list_set_recurse "$dep"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
list_set() {
|
||||
rm -f repository/*.visited
|
||||
list_set_recurse "$1" | LC_ALL=C sort -u
|
||||
rm -f repository/*.visited
|
||||
}
|
||||
|
||||
cd "$directory"
|
||||
|
||||
sets=$(grep -Ev '^all$' repository/sets.list || true)
|
||||
|
||||
kernel=$(maybe_compressed boot/sortix.bin)
|
||||
live_initrd=$(maybe_compressed boot/live.tar)
|
||||
overlay_initrd=$(maybe_compressed boot/overlay.tar)
|
||||
|
@ -247,7 +269,7 @@ printf " hook_port_set_no\n"
|
|||
echo "}"
|
||||
for set in $sets; do
|
||||
echo
|
||||
set_content=$(eval echo \$set_$set)
|
||||
set_content=$(list_set "$set")
|
||||
echo "function select_ports_set_$set {"
|
||||
for port in $ports; do
|
||||
printf " port_%s=%s\n" "$(portvar "$port")" "$(isinset "$port" "$set_content")"
|
||||
|
@ -272,7 +294,7 @@ printf " hook_tix_set_no\n"
|
|||
echo "}"
|
||||
for set in $sets; do
|
||||
echo
|
||||
set_content=$(eval echo \$set_$set)
|
||||
set_content=$(list_set "$set")
|
||||
echo "function select_tix_set_$set {"
|
||||
for port in $ports; do
|
||||
printf " tix_%s=%s\n" "$(portvar "$port")" "$(isinset "$port" "$set_content")"
|
||||
|
@ -550,7 +572,6 @@ EOF
|
|||
|
||||
for set in $sets; do
|
||||
echo
|
||||
set_content=$(eval echo \$set_$set)
|
||||
printf 'menuentry "Load only '"$set"' ports" {\n'
|
||||
printf " select_ports_set_%s\n" "$set"
|
||||
printf ' configfile /boot/grub/ports.cfg\n'
|
||||
|
@ -610,7 +631,6 @@ EOF
|
|||
|
||||
for set in $sets; do
|
||||
echo
|
||||
set_content=$(eval echo \$set_$set)
|
||||
printf 'menuentry "Load only '"$set"' binary packages" {\n'
|
||||
printf " select_tix_set_%s\n" "$set"
|
||||
printf ' configfile /boot/grub/tix.cfg\n'
|
||||
|
|
|
@ -26,3 +26,5 @@ for PACKAGE in $PACKAGES; do
|
|||
cp "$SORTIX_REPOSITORY_DIR/$PACKAGE.tix.tar.xz" "$1"
|
||||
cp "$SORTIX_REPOSITORY_DIR/$PACKAGE.version" "$1"
|
||||
done
|
||||
|
||||
tix-repository --generation=3 metadata "$1"
|
||||
|
|
|
@ -5,8 +5,7 @@ if [ -z "$SORTIX_PORTS_DIR" ]; then
|
|||
SORTIX_PORTS_DIR="$(dirname -- "$0")/../ports"
|
||||
fi
|
||||
|
||||
# Load the ports sets.
|
||||
. "$(dirname -- "$0")/ports.conf"
|
||||
RUNTIME_DEPS=RUNTIME_DEPS
|
||||
|
||||
get_all_packages() {(
|
||||
for package in $(ls "$SORTIX_PORTS_DIR"); do
|
||||
|
@ -18,15 +17,7 @@ get_all_packages() {(
|
|||
|
||||
get_package_dependencies_raw() {(
|
||||
if [ -f "$SORTIX_PORTS_DIR/$1/$1.port" ]; then
|
||||
tix-vars -d '' "$SORTIX_PORTS_DIR/$1/$1.port" BUILD_LIBRARIES
|
||||
elif [ "$1" = "all" ]; then
|
||||
get_all_packages
|
||||
else
|
||||
for set in $sets; do
|
||||
if [ $set = $1 ]; then
|
||||
echo $(eval echo \$set_$set)
|
||||
fi
|
||||
done
|
||||
tix-vars -d '' "$SORTIX_PORTS_DIR/$1/$1.port" BUILD_LIBRARIES $RUNTIME_DEPS
|
||||
fi
|
||||
)}
|
||||
|
||||
|
@ -34,6 +25,10 @@ get_package_dependencies_raw() {(
|
|||
get_package_dependencies_recursive() {(
|
||||
for dependency in $(get_package_dependencies_raw $1); do
|
||||
want=false
|
||||
if [ "$dependency" = '*' ]; then
|
||||
get_all_packages | grep -Ev '^all$'
|
||||
continue
|
||||
fi
|
||||
if [ "$2" = "!!" ]; then
|
||||
want=true
|
||||
else
|
||||
|
@ -79,10 +74,7 @@ list_package() {(
|
|||
fi
|
||||
recursion=$(echo "$package" | grep -Eo '!*$')
|
||||
package=$(echo "$package" | grep -Eo '^[^!]*')
|
||||
# TODO: Better way of detecting if a port is a set.
|
||||
if [ -f "$SORTIX_PORTS_DIR/$package/$package.port" ]; then
|
||||
echo "$package"
|
||||
fi
|
||||
echo "$package"
|
||||
if [ -n "$recursion" ]; then
|
||||
get_package_dependencies_recursive "$package" "$recursion"
|
||||
fi
|
||||
|
@ -90,6 +82,7 @@ list_package() {(
|
|||
|
||||
if [ "$1" = "--dependencies" ]; then
|
||||
shift
|
||||
RUNTIME_DEPS=
|
||||
PACKAGES=$("$0" PACKAGES)
|
||||
for package; do
|
||||
list_dependencies "$package"
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
set_minimal="cut dash e2fsprogs grep grub grub-i386-pc mdocml sed xargs"
|
||||
set_basic="$set_minimal binutils bison bzip2 diffutils ed flex gawk gcc git grub-i386-efi grub-x86_64-efi gzip irssi libcurl libcurses libssl libstdc++ m4 make nano ntpd patch perl pkg-config python ssh tar texinfo vim wget xz xorriso"
|
||||
sets="basic minimal"
|
5
ports/all/all.port
Normal file
5
ports/all/all.port
Normal file
|
@ -0,0 +1,5 @@
|
|||
NAME=all
|
||||
LOCATION_INDEPENDENT=true
|
||||
BUILD_SYSTEM=none
|
||||
RUNTIME_DEPS='*'
|
||||
IS_SET=true
|
5
ports/basic/basic.port
Normal file
5
ports/basic/basic.port
Normal file
|
@ -0,0 +1,5 @@
|
|||
NAME=basic
|
||||
LOCATION_INDEPENDENT=true
|
||||
BUILD_SYSTEM=none
|
||||
RUNTIME_DEPS='minimal binutils bison bzip2 diffutils ed flex gawk gcc git grub-i386-efi grub-x86_64-efi gzip irssi libcurl libcurses libssl libstdc++ m4 make nano ntpd patch perl pkg-config python ssh tar texinfo vim wget xz xorriso'
|
||||
IS_SET=true
|
5
ports/minimal/minimal.port
Normal file
5
ports/minimal/minimal.port
Normal file
|
@ -0,0 +1,5 @@
|
|||
NAME=minimal
|
||||
LOCATION_INDEPENDENT=true
|
||||
BUILD_SYSTEM=none
|
||||
RUNTIME_DEPS='cut dash e2fsprogs grep grub grub-i386-pc mdocml sed xargs'
|
||||
IS_SET=true
|
|
@ -94,6 +94,9 @@ command line options and standard environment variables.
|
|||
A
|
||||
.Pa Makefile
|
||||
using the below set of conventional environment variables.
|
||||
.It Sy none
|
||||
The port is not built and contains no files.
|
||||
Useful for port sets depending on other ports.
|
||||
.El
|
||||
.It Sy CONFIGURE
|
||||
The path to the configure script relative to the source directory.
|
||||
|
@ -190,6 +193,10 @@ variable can be used in combination with
|
|||
.Sy EDITION
|
||||
to rename and split packages.
|
||||
The default edition is 1.
|
||||
.It Sy IS_SET Ns = Ns Oo Sy false "|" true Oc
|
||||
Whether the bootloader should offer this port as a reasonable subset of ports
|
||||
expressed recursively in
|
||||
.Sy RUNTIME_DEPS .
|
||||
.It Sy LICENSE
|
||||
Primary license identifier for the installed files from the
|
||||
.Lk https://spdx.org/licenses/ "SPDX License List" .
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2016, 2020, 2022-2023 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2013-2016, 2020, 2022-2024 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -793,6 +793,8 @@ static void TixInfo(struct metainfo* minfo)
|
|||
bool location_independent =
|
||||
parse_boolean(metainfo_get_def(minfo,
|
||||
"LOCATION_INDEPENDENT", "pkg.location-independent", "false"));
|
||||
bool is_set =
|
||||
parse_boolean(metainfo_get_def(minfo, "IS_SET", "pkg.is-set", "false"));
|
||||
|
||||
FILE* tixinfo_fp = fopen(tixinfo_rel, "w");
|
||||
if ( !tixinfo_fp )
|
||||
|
@ -827,6 +829,8 @@ static void TixInfo(struct metainfo* minfo)
|
|||
const char* renames = metainfo_get(minfo, "RENAMES", "pkg.renames");
|
||||
if ( renames )
|
||||
fwrite_variable(tixinfo_fp, "RENAMES", renames);
|
||||
if ( is_set )
|
||||
fwrite_variable(tixinfo_fp, "IS_SET", "true");
|
||||
}
|
||||
// TODO: After releasing Sortix 1.1, remove generation 2 compatibility.
|
||||
else
|
||||
|
@ -952,6 +956,9 @@ static void Compile(struct metainfo* minfo)
|
|||
if ( !build_system )
|
||||
errx(1, "%s: pkg.build-system was not found", minfo->package_info_path);
|
||||
|
||||
if ( !strcmp(build_system, "none") )
|
||||
return;
|
||||
|
||||
// Determine whether need to do an out-of-directory build.
|
||||
const char* subdir = metainfo_get(minfo, "SUBDIR", "pkg.subdir");
|
||||
const char* use_build_dir_var =
|
||||
|
|
|
@ -92,6 +92,7 @@ metadata)
|
|||
true > dependencies.list
|
||||
true > renames.list
|
||||
true > manifest.list
|
||||
true > sets.list
|
||||
|
||||
for package in $(cat packages.list); do
|
||||
tar -xOf "$package.tix.tar.xz" "tix/tixinfo/$package" > "$package.info"
|
||||
|
@ -100,6 +101,9 @@ metadata)
|
|||
tix-vars -d '' "$package.info" RENAMES | tr , '\n' | sed -E '/^$/d' >> renames.list
|
||||
(printf "%s: " "$package" && tix-vars -d '' "$package.info" RUNTIME_DEPS | sed -E 's/ +$//') >> dependencies.list
|
||||
sed -E "s/$/:$package/" "$package.manifest" >> manifest.list
|
||||
if [ "$(tix-vars -d false "$package.info" IS_SET)" = true ]; then
|
||||
echo "$package" >> sets.list
|
||||
fi
|
||||
done
|
||||
|
||||
LC_ALL=C sort -t: -k1,1 manifest.list -o manifest.list
|
||||
|
|
Loading…
Add table
Reference in a new issue