1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:07:45 +00:00

Ports: Move packages.db from Ports/ to Build/

When removing and recreating the Build directory, it's quite annoying
having to edit/remove Ports/packages.db as the installer won't install
previously installed port dependencies again if they're still listed.
This problem is easily solved by just considering packages.db a
build-specific file.
This commit is contained in:
Linus Groh 2021-02-01 19:36:18 +01:00 committed by Andreas Kling
parent 878d353c3d
commit 02520f16e3
3 changed files with 16 additions and 14 deletions

1
.gitignore vendored
View file

@ -37,7 +37,6 @@ compile_commands.json
.clang_complete .clang_complete
.clangd .clangd
*Endpoint.h *Endpoint.h
Ports/packages.db
.idea/ .idea/
cmake-build-debug/ cmake-build-debug/
sync-local.sh sync-local.sh

View file

@ -3,7 +3,7 @@ set -eu
SCRIPT=`dirname $0` SCRIPT=`dirname $0`
export SERENITY_ROOT=`realpath $SCRIPT/../` export SERENITY_ROOT=`realpath $SCRIPT/../`
prefix=$SERENITY_ROOT/Ports packagesdb="$SERENITY_ROOT/Build/packages.db"
export CC=i686-pc-serenity-gcc export CC=i686-pc-serenity-gcc
export CXX=i686-pc-serenity-g++ export CXX=i686-pc-serenity-g++
@ -186,18 +186,18 @@ func_defined clean_all || clean_all() {
done done
} }
addtodb() { addtodb() {
if [ ! -f "$prefix"/packages.db ]; then if [ ! -f "$packagesdb" ]; then
echo "Note: $prefix/packages.db does not exist. Creating." echo "Note: $packagesdb does not exist. Creating."
touch "$prefix"/packages.db touch "$packagesdb"
fi fi
if ! grep -E "^(auto|manual) $port $version" "$prefix"/packages.db > /dev/null; then if ! grep -E "^(auto|manual) $port $version" "$packagesdb" > /dev/null; then
echo "Adding $port $version to database of installed ports!" echo "Adding $port $version to database of installed ports!"
if [ "${1:-}" = "--auto" ]; then if [ "${1:-}" = "--auto" ]; then
echo "auto $port $version" >> "$prefix"/packages.db echo "auto $port $version" >> "$packagesdb"
else else
echo "manual $port $version" >> "$prefix"/packages.db echo "manual $port $version" >> "$packagesdb"
if [ ! -z "${dependlist:-}" ]; then if [ ! -z "${dependlist:-}" ]; then
echo "dependency $port$dependlist" >> "$prefix/packages.db" echo "dependency $port$dependlist" >> "$packagesdb"
fi fi
fi fi
else else
@ -209,13 +209,13 @@ installdepends() {
dependlist="${dependlist:-} $depend" dependlist="${dependlist:-} $depend"
done done
for depend in $depends; do for depend in $depends; do
if ! grep "$depend" "$prefix"/packages.db > /dev/null; then if ! grep "$depend" "$packagesdb" > /dev/null; then
(cd "../$depend" && ./package.sh --auto) (cd "../$depend" && ./package.sh --auto)
fi fi
done done
} }
uninstall() { uninstall() {
if grep "^manual $port " "$prefix"/packages.db > /dev/null; then if grep "^manual $port " "$packagesdb" > /dev/null; then
if [ -f plist ]; then if [ -f plist ]; then
for f in `cat plist`; do for f in `cat plist`; do
case $f in case $f in
@ -228,8 +228,8 @@ uninstall() {
esac esac
done done
# Without || true, mv will not be executed if you are uninstalling your only remaining port. # Without || true, mv will not be executed if you are uninstalling your only remaining port.
grep -v "^manual $port " "$prefix"/packages.db > packages.dbtmp || true grep -v "^manual $port " "$packagesdb" > packages.db.tmp || true
mv packages.dbtmp "$prefix"/packages.db mv packages.db.tmp "$packagesdb"
else else
>&2 echo "Error: This port does not have a plist yet. Cannot uninstall." >&2 echo "Error: This port does not have a plist yet. Cannot uninstall."
fi fi

View file

@ -20,7 +20,10 @@ configuration/compilation options, and some other things (see
To install a certain port, `cd` into its directory and run `./package.sh` To install a certain port, `cd` into its directory and run `./package.sh`
Installed ports are being tracked in `Ports/packages.db` (a simple text file). Installed ports are being tracked in `Build/packages.db` (a simple text file).
You can delete this file at any time, in fact it must be edited or removed
when clearing the build directory as port dependencies may not be installed
again otherwise.
Not giving an option is equivalent to `installdepends`, `fetch`, `patch`, Not giving an option is equivalent to `installdepends`, `fetch`, `patch`,
`configure`, `build` and `install`, in that order. This is recommended for a `configure`, `build` and `install`, in that order. This is recommended for a