From fcc34978034b1c409a3d084889bf81f168a3781c Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 22 Apr 2023 16:09:01 +0300 Subject: [PATCH] Ports: Rename packages.db => installed.db The /usr/Ports/packages.db will be used later for tracking available ports by the upcoming package manager, which will use it to do search queries, providing metadata on available ports, etc. Ports that are installed will be registered from now on in the file of /usr/Ports/installed.db, so that file will be used later on to allow further management of what is actually installed on the system. --- Ports/.port_include.sh | 24 ++++++++++++------------ Ports/README.md | 2 +- Ports/build_installed.sh | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index 7608f70d080..55d4b584e51 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -80,7 +80,7 @@ host_env() { enable_ccache } -packagesdb="${DESTDIR}/usr/Ports/packages.db" +installedpackagesdb="${DESTDIR}/usr/Ports/installed.db" makeopts=("-j${MAKEJOBS}") installopts=() @@ -454,27 +454,27 @@ addtodb() { return fi if [ "${1:-}" = "--auto" ]; then - echo "auto $port $version" >> "$packagesdb" + echo "auto $port $version" >> "$installedpackagesdb" else - echo "manual $port $version" >> "$packagesdb" + echo "manual $port $version" >> "$installedpackagesdb" fi if [ "${#depends[@]}" -gt 0 ]; then - echo "dependency $port ${depends[@]}" >> "$packagesdb" + echo "dependency $port ${depends[@]}" >> "$installedpackagesdb" fi echo "Successfully installed $port $version." } -ensure_packagesdb() { - if [ ! -f "$packagesdb" ]; then - mkdir -p "$(dirname $packagesdb)" - touch "$packagesdb" +ensure_installedpackagesdb() { + if [ ! -f "$installedpackagesdb" ]; then + mkdir -p "$(dirname $installedpackagesdb)" + touch "$installedpackagesdb" fi } package_install_state() { local port=$1 local version=${2:-} - ensure_packagesdb - grep -E "^(auto|manual) $port $version" "$packagesdb" | cut -d' ' -f1 + ensure_installedpackagesdb + grep -E "^(auto|manual) $port $version" "$installedpackagesdb" | cut -d' ' -f1 } installdepends() { for depend in "${depends[@]}"; do @@ -514,8 +514,8 @@ uninstall() { esac done # Without || true, mv will not be executed if you are uninstalling your only remaining port. - grep -v "^manual $port " "$packagesdb" > packages.db.tmp || true - mv packages.db.tmp "$packagesdb" + grep -v "^manual $port " "$installedpackagesdb" > installed.db.tmp || true + mv installed.db.tmp "$installedpackagesdb" } do_installdepends() { buildstep_intro "Installing dependencies of $port..." diff --git a/Ports/README.md b/Ports/README.md index de69c8d54ee..c3fac6bf106 100644 --- a/Ports/README.md +++ b/Ports/README.md @@ -37,7 +37,7 @@ configuration/compilation options, and some other things (see script in this directory. This is sometimes required when LibC changes, for example. Pass `clean` as first argument to remove old build files beforehand. -Installed ports are being tracked in `Build/x86_64/Root/usr/Ports/packages.db` (a simple text file). +Installed ports are being tracked in `Build/x86_64/Root/usr/Ports/installed.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. diff --git a/Ports/build_installed.sh b/Ports/build_installed.sh index 8df89e097f2..39beea19140 100755 --- a/Ports/build_installed.sh +++ b/Ports/build_installed.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash . ".hosted_defs.sh" -packagesdb="${SERENITY_INSTALL_ROOT}/usr/Ports/packages.db" +installedpackagesdb="${SERENITY_INSTALL_ROOT}/usr/Ports/installed.db" clean=false case "$1" in @@ -33,7 +33,7 @@ while IFS= read -r line; do echo "ERROR: Previously installed port $port doesn't exist!" some_failed=true fi -done < <(grep -E "^(auto|manual)" "$packagesdb") +done < <(grep -E "^(auto|manual)" "$installedpackagesdb") if [ "$some_failed" == false ]; then exit 0