Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/update_artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function get_artifact(data; version::String)
url = "https://packages.gurobi.com/$minorversion/gurobi$(version)_$(data.platform).tar.gz"
run(`wget $url`)
ret = Dict(
"git-tree-sha1" => Tar.tree_hash(`gzcat $filename`),
"git-tree-sha1" => Tar.tree_hash(`gzcat $filename`; skip_empty = true),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay so this was documented in the docstring of Tar.tree_hash. And it's quite a detailed explanation. But I didn't connect the dots.

"arch" => data.arch,
"os" => data.os,
"download" => Any[
Expand Down
49 changes: 49 additions & 0 deletions scripts/update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
#
# Version update script that tries to adjust all hard-coded values for a
# new Gurobi x.y.z release and updates the artifacts. Check results with
# care.

set -euo pipefail

if [ $# -ne 1 ]; then
echo "Usage: $0 <version> (e.g. 13.0.2)"
exit 1
fi

VERSION="$1"
IFS='.' read -r MAJOR MINOR TECHNICAL <<< "$VERSION"

DIR_VER="${MAJOR}${MINOR}${TECHNICAL}"
LIB_VER="${MAJOR}${MINOR}"

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

cd "$SCRIPT_DIR"

julia --project=. -e 'using Pkg; Pkg.instantiate()'

julia --project=. update_artifacts.jl "$VERSION"

sedi() { sed -i '' "$@" 2>/dev/null || sed -i "$@"; }

for f in "$REPO_ROOT/src/wrappers"/*.jl; do
sedi \
-e "s/libgurobi[0-9]*\.so/libgurobi${LIB_VER}.so/g" \
-e "s/libgurobi[0-9]*\.dylib/libgurobi${LIB_VER}.dylib/g" \
-e "s/gurobi[0-9]*\.dll/gurobi${LIB_VER}.dll/g" \
"$f"
done

sedi "s/const GUROBI_DIR = \"gurobi[0-9]*\"/const GUROBI_DIR = \"gurobi${DIR_VER}\"/g" "$REPO_ROOT/src/Gurobi_jll.jl"

sedi "s/^version = \".*\"/version = \"${VERSION}\"/" "$REPO_ROOT/Project.toml"

sedi \
-e "s/@test majorP\[\] == [0-9]*/@test majorP[] == ${MAJOR}/" \
-e "s/@test minorP\[\] == [0-9]*/@test minorP[] == ${MINOR}/" \
-e "s/@test technicalP\[\] == [0-9]*/@test technicalP[] == ${TECHNICAL}/" \
"$REPO_ROOT/test/runtests.jl"

echo "Updated to version ${VERSION}"
Loading