skraus-dev / cherryrgb-rs

Cherry RGB Keyboard - Multi platform tool to set RGB LEDs for Cherry keyboards
MIT License
35 stars 3 forks source link

Update Cargo.lock #49

Closed felfert closed 1 year ago

felfert commented 1 year ago

Description

This PR fixes a small glitch in the latest release: Cargo.lock is not up-to-date (It still references 0.2.6). This affects the source archives of the github release only. It does NOT affect the release on crates.io.

Type of change

Please delete options that are not relevant.

@skraus-dev Here is a pre-push hook script, that checks Cargo.lock whenever a tag is pushed and prevents the push if Cargo.lock is not up-to-date:

#!/bin/bash
## hook to check if Cargo.lock is up to date when pushing a tag

tagref=$(grep -Po 'refs/tags/([^ ]*) ' </dev/stdin | head -n1 | cut -c11- | tr -d '[:space:]')

if [[ "$tagref" == ""  ]]; then
    ## pushing without --tags , exit normally
    exit 0
fi

echo "Checking Cargo.lock state ..."
if cargo fetch --locked >/dev/null 2>&1 ; then
    # Cargo.lock is up-to-date
    exit 0
fi

echo "Pushing a tag, but Cargo.lock is out of date" >&2
exit 1

In order to use this, save this as .git/hooks/pre-push in your local working copy and make it executable.

felfert commented 1 year ago

Why I stumbled over this:

In my rpm packaging, during setu and build phase, the following commands are run:

cargo fetch --locked

cargo build --frozen --all-features --all

This is done in order to make shure, that exactly the same dependencies like in the upstream the release are used. I believe, the same applies to the AUR package by @mpldr

For my rpm package, I simply removed the --locked temporarily for the 0.2.7 packaging.