Skip to content

Commit

Permalink
chore: making bbup a shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Dec 5, 2024
1 parent b6f9733 commit 4336cd4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion barretenberg/bbup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ curl -L bbup.dev | bash
```

> [!IMPORTANT]
> *Always* check what scripts do. The above one redirects to [the install script](https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/bbup/install).
> *Always* check what scripts do. The above one redirects to [the install script](https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/bbup/install) which installs [bbup](https://github.com/AztecProtocol/aztec-packages/blob/master/barretenberg/bbup/bbup) in your system's PATH
## Usage

Expand Down
16 changes: 13 additions & 3 deletions barretenberg/bbup/bbup
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ print_spinner() {
get_bb_version_for_noir() {
local noir_version=$1
local url=""
local resolved_version=""

if [ "$noir_version" = "stable" ] || [ "$noir_version" = "nightly" ]; then
printf "${BLUE}Resolving noir version ${noir_version}...${NC}\n"

# Get releases from GitHub API
local releases=$(curl -s "https://api.github.com/repos/noir-lang/noir/releases")

Expand All @@ -41,7 +40,6 @@ get_bb_version_for_noir() {
resolved_version=$(echo "$releases" | grep -o '"tag_name": "nightly[^"]*"' | head -1 | cut -d'"' -f4)
fi

printf "${GREEN}${SUCCESS} Resolved noir version ${noir_version} to ${resolved_version}${NC}\n"
url="https://raw.githubusercontent.com/noir-lang/noir/${resolved_version}/scripts/install_bb.sh"
else
url="https://raw.githubusercontent.com/noir-lang/noir/v${noir_version}/scripts/install_bb.sh"
Expand Down Expand Up @@ -163,6 +161,18 @@ main() {

if [ -n "$noir_version" ]; then
printf "${BLUE}Getting compatible barretenberg version for noir version ${noir_version}${NC}\n"
if [ "$noir_version" = "stable" ] || [ "$noir_version" = "nightly" ]; then
printf "${BLUE}Resolving noir version ${noir_version}...${NC}\n"
# Get releases from GitHub API to show the resolved version
local releases=$(curl -s "https://api.github.com/repos/noir-lang/noir/releases")
local resolved_version=""
if [ "$noir_version" = "stable" ]; then
resolved_version=$(echo "$releases" | grep -o '"tag_name": "[^"]*"' | grep -v "aztec\|nightly" | head -1 | cut -d'"' -f4)
else
resolved_version=$(echo "$releases" | grep -o '"tag_name": "nightly[^"]*"' | head -1 | cut -d'"' -f4)
fi
printf "${GREEN}${SUCCESS} Resolved noir version ${noir_version} to ${resolved_version}${NC}\n"
fi
version=$(get_bb_version_for_noir "$noir_version")
printf "${GREEN}${SUCCESS} Resolved to barretenberg version ${version}${NC}\n"
fi
Expand Down

0 comments on commit 4336cd4

Please sign in to comment.