Stop handing dnf the comments that explain the package lists
Every list in setup/packages/ is annotated -- which package exists for which settings page, why an exception was made -- and install-packages passed the whole file to dnf, comment lines included. dnf does not ignore an argument it cannot match. It reports "No match for argument: #" and exits 1, and with set -euo pipefail at the top of that script the first annotated list ends the stage. initial-packages carries four comments and is the first list read, so a fresh machine got the repositories, the group updates, and then nothing. Two things hid it. On a machine that already has everything, a re-run matches every real name and fails only on the comments, so the failure looks like noise rather than the stage dying. And every contract that reads these lists strips comments with sed before comparing -- the tests were reading a file the installer was not, which is why a repository with a dependency contract, an assets contract and a doctor still reported PASS across the board. The fix is one filter used at all five call sites. The contract lifts that filter out of the script and runs it, rather than describing what it should do, so deleting or renaming it fails here instead of passing quietly. It also checks the inverse -- that stripping comments does not strip packages -- because trading a loud failure for a silent one would be worse than the bug. Found while adding the extras lists for phase 4, which are annotated the same way and would have hit the same wall. Claude-Session: https://claude.ai/code/session_01NvgBuSWB5sE43yWmg21ozj
This commit is contained in:
@@ -6,6 +6,22 @@ set -euo pipefail
|
||||
log() { echo -e "\033[1;34m[INFO]\033[0m $*"; }
|
||||
exists() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
# The package names in a list, without the comments that explain them.
|
||||
#
|
||||
# The lists are annotated -- which package exists for which settings page, why
|
||||
# an exception was made -- and those annotations are for whoever reads the file
|
||||
# next. dnf is not so forgiving: it does not ignore an argument it cannot
|
||||
# match, it reports "No match for argument: #" and exits 1, and with `set -e`
|
||||
# above that ends this stage on the first annotated list it reaches.
|
||||
#
|
||||
# It could not be seen from here. On a machine that already has everything, a
|
||||
# re-run matches every real name and fails only on the comments; and every
|
||||
# contract that reads these lists strips comments before comparing, so the
|
||||
# tests were reading a file this script was not.
|
||||
packages_in() {
|
||||
sed 's/#.*//' "$1" | tr "\n" " "
|
||||
}
|
||||
|
||||
# --- Defined Paths ---
|
||||
PANAMA_PATH="$HOME/.local/share/Panama"
|
||||
|
||||
@@ -46,7 +62,7 @@ sudo dnf install -y gstreamer1-plugins-{bad-\*,good-\*,base} \
|
||||
# --- Install all initial packages ---
|
||||
PACKAGES_FILE="$PANAMA_PATH/setup/packages/initial-packages"
|
||||
if [[ -f "$PACKAGES_FILE" ]]; then
|
||||
INITIAL_PACKAGES=$(tr "\n" " " <"$PACKAGES_FILE")
|
||||
INITIAL_PACKAGES=$(packages_in "$PACKAGES_FILE")
|
||||
log "Installing Initial Packages"
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$PACKAGES_FILE")"
|
||||
@@ -59,7 +75,7 @@ fi
|
||||
# --- Install Desktop Packages ---
|
||||
DESKTOP_FILE="$PANAMA_PATH/setup/packages/desktop-packages"
|
||||
if [[ -f "$DESKTOP_FILE" ]]; then
|
||||
DESKTOP_PACKAGES=$(tr "\n" " " <"$DESKTOP_FILE")
|
||||
DESKTOP_PACKAGES=$(packages_in "$DESKTOP_FILE")
|
||||
log "Installing Desktop Packages"
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$DESKTOP_FILE")"
|
||||
@@ -72,7 +88,7 @@ fi
|
||||
# --- Install Development Packages needed for Neovim ---
|
||||
DEV_FILE="$PANAMA_PATH/setup/packages/development-packages"
|
||||
if [[ -f "$DEV_FILE" ]]; then
|
||||
DEV_PACKAGES=$(tr "\n" " " <"$DEV_FILE")
|
||||
DEV_PACKAGES=$(packages_in "$DEV_FILE")
|
||||
log "Installing Development Packages. Mostly for Neovim."
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$DEV_FILE")"
|
||||
@@ -88,7 +104,7 @@ HYPR_FILE="$PANAMA_PATH/setup/packages/hyprland-packages"
|
||||
if [[ -f "$HYPR_FILE" ]]; then
|
||||
log "Enabling Hyprland COPR"
|
||||
sudo dnf copr enable -y lionheartp/Hyprland > /dev/null
|
||||
HYPR_PACKAGES=$(tr "\n" " " <"$HYPR_FILE")
|
||||
HYPR_PACKAGES=$(packages_in "$HYPR_FILE")
|
||||
log "Installing Hyprland desktop packages"
|
||||
echo -e "Includes the following packages:"
|
||||
echo -e "$(<"$HYPR_FILE")"
|
||||
@@ -153,7 +169,7 @@ fi
|
||||
# --- Install Flatpak Packages ---
|
||||
FLATPAK_FILE="$PANAMA_PATH/setup/packages/flatpak-packages"
|
||||
if [[ -f "$FLATPAK_FILE" ]]; then
|
||||
FLATPAK_PACKAGES=$(tr "\n" " " <"$FLATPAK_FILE")
|
||||
FLATPAK_PACKAGES=$(packages_in "$FLATPAK_FILE")
|
||||
log "Adding Flathub remote"
|
||||
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo > /dev/null
|
||||
log "Installing Flatpak Packages"
|
||||
|
||||
Reference in New Issue
Block a user