fixup! Add ports to the Sortix repository.

This commit is contained in:
Jonas 'Sortie' Termansen 2022-01-30 22:40:04 +01:00
parent d270769e4f
commit c86b3d202d
3 changed files with 65 additions and 33 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
builds
mirror
ports/*/*/
ports/*/*.version
release
repository
sysroot

View File

@ -287,34 +287,64 @@ download_package() {(
fi
)}
desired_version() {(
#unset ARCHIVE
#unset ARCHIVE_2
#. "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.info"
VERSION_STAMP="$NAME"
if [ -n "$ARCHIVE" ]; then
VERSION_STAMP="$VERSION_STAMP.$VERSION.$SHA256SUM"
if [ -n "$ARCHIVE_2" ]; then
VERSION_STAMP="$VERSION_STAMP.$VERSION_2.$SHA256SUM_2"
fi
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.patch" ]; then
VERSION_STAMP="$VERSION_STAMP.$(cat "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.patch" | sha256sum | grep -Eo '^[^ ]*')"
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.execpatch" ]; then
VERSION_STAMP="$VERSION_STAMP.$(cat "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.execpatch" | sha256sum | grep -Eo '^[^ ]*')"
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.normalize" ]; then
VERSION_STAMP="$VERSION_STAMP.$(cat "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.normalize" | sha256sum | grep -Eo '^[^ ]*')"
fi
echo "$VERSION_STAMP"
)}
extract_package() {(
PACKAGE="$1"
VERSION_STAMP="$2"
unset ARCHIVE
unset ARCHIVE_2
unset NEED_WRITABLE
. "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.info"
# TODO: Only reextract if actually needed.
rm -rf "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE"
mkdir "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE"
if [ -n "$ARCHIVE" ]; then
announce "Extracting $1: $ARCHIVE"
tar -C "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" -xf "$SORTIX_MIRROR_DIR/$PACKAGE/$ARCHIVE" --strip-components=1
if [ -n "$ARCHIVE_2" ]; then
announce "Extracting $1: $ARCHIVE_2"
tar -C "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" -xf "$SORTIX_MIRROR_DIR/$PACKAGE/$ARCHIVE_2" --strip-components=1
VERSION_STAMP="$(desired_version)"
if [ ! -e "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version" ] ||
[ "$(cat "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version")" != "$VERSION_STAMP" ] ||
[ ! -e "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version" ]; then
echo "$VERSION_STAMP" > "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version.new"
rm -rf "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE"
mkdir "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE"
if [ -n "$ARCHIVE" ]; then
announce "Extracting $1: $ARCHIVE"
tar -C "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" -xf "$SORTIX_MIRROR_DIR/$PACKAGE/$ARCHIVE" --strip-components=1
if [ -n "$ARCHIVE_2" ]; then
announce "Extracting $1: $ARCHIVE_2"
tar -C "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" -xf "$SORTIX_MIRROR_DIR/$PACKAGE/$ARCHIVE_2" --strip-components=1
fi
fi
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.patch" ]; then
patch -d "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" -p1 < "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.patch"
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.execpatch" ]; then
tix-execpatch --directory "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.execpatch"
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.normalize" ]; then
tix-rmpatch --directory "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.normalize"
fi
if [ "$NEED_WRITABLE" != true ]; then
find "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" '!' -type d -exec chmod -w '{}' +
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.patch" ]; then
patch -d "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" -p1 < "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.patch"
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.execpatch" ]; then
tix-execpatch --directory "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.execpatch"
fi
if [ -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.normalize" ]; then
tix-rmpatch --directory "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.normalize"
fi
if [ "$NEED_WRITABLE" != true ]; then
find "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" '!' -type d -exec chmod -w '{}' +
fi
mv "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version.new" "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version"
fi
)}

View File

@ -34,19 +34,20 @@ get_all_packages() {
# Clean all the packages.
for PACKAGE in $(get_all_packages); do
# TODO: Check for marker the source code was correctly extracted.
[ ! -e "$SORTIX_PORTS_DIR/$PACKAGE/tixbuildinfo" ] ||
tix-build \
--sysroot="/" \
--host=$HOST \
--prefix= \
--destination="/" \
--start=clean \
--end=clean \
"$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE"
# TODO: New top-level makefile target for this.
if [ -e "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE" ]; then
if [ -e "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version" -o \
-e "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version.new" ]; then
tix-build \
--sysroot="/" \
--host=$HOST \
--prefix= \
--destination="/" \
--start=clean \
--end=clean \
"$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE"
# TODO: New top-level makefile target for this.
echo "Removing '$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE'"
rm -rf "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE"
rm -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version"
rm -f "$SORTIX_PORTS_DIR/$PACKAGE/$PACKAGE.version.new"
fi
done