gobolinux / Compile

The GoboLinux build tool
52 stars 15 forks source link

Recipe versioning #61

Open sage-etcher opened 1 month ago

sage-etcher commented 1 month ago

I'm unsure if this should be posted under Recipes, Compile, or Scripts. if this is the wrong place for it feel free to move it or lmk.

Feature Request

Having an internal versioning system for recipes, as a way to check if the recipe you used has had any changes since you compiled the program.

Potentially through logging the recipe's source and commit to a Resources file.

Issue

Say I install Bash 5.1 from Recipe, and then a few days later an issue is found+fixed in the recipe. Currently I'd have no way of knowing (w/o manual checking of dates) if I used the version before or after the Recipe's change.

This issue is found first hand with the installed version of Bzip2 1.0.8 provided in Gobo017, having used an outdated Recipe file, leading to some programs failing to find it's shared library.

Proposed Method

Having Compile (or an adjacent script) log some information about the Recipe, for exanple using git log [FOLDER_PATH] |head -1 > $target/Resources/RecipeCommit to get the commit.

Then be able to check it against the current version in Recipes as follows:

local name="$1"     # program name
local version="$2"  # program version

local recipesfolder="/Data/Compile/Recipes/${name}/${version}"
local installedfolder="/Programs/${name}/${version}"

local recipescommit=$(git log "${recipesfolder}" |head -1)
local installedcommit=$(cat "${installedfolder}/Resources/RecipeCommit")
if [[ "${recipescommit}" == "${installedcommit}" ]]
then
   echo "up to date"
else
   echo "out of date"
fi

Ideally, a bit more than just the commit would be logged, potentially the git repository/fork, branch, and commit; just something concrete, fast to generate, and easy to compare.

mwh commented 1 month ago

Recipes used to have -r1, -r2 suffixes for exactly that, but they were dropped I think in the Git migration. That does mean that the tooling likely still has full support for them and it would be possible to revive those (though it's not clear whether that's the right way to go about things still).