Skip to content

Commit

Permalink
treewide: fix outstanding lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jaen committed Jun 17, 2024
1 parent 5578d42 commit 9443b63
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/grapheneos-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ jobs:
# buildNumber is the only quoted string inside upstream-params.nix so we can
# just use grep to extract the first quoted string and use xargs to strip the
# quotes
OLD_BUILD_NUMBER=$(grep -o -m 1 '"[^"]*"' ./flavors/grapheneos/upstream-params.nix | xargs)
echo "OLD_BUILD_NUMBER=$OLD_BUILD_NUMBER" | tee -a $GITHUB_ENV
OLD_BUILD_NUMBER="$(grep -o -m 1 '"[^"]*"' ./flavors/grapheneos/upstream-params.nix | xargs)"
echo "OLD_BUILD_NUMBER=$OLD_BUILD_NUMBER" | tee -a "$GITHUB_ENV"
nix develop -c ./flavors/grapheneos/extract-upstream-params.sh
NEW_BUILD_NUMBER=$(grep -o -m 1 '"[^"]*"' ./flavors/grapheneos/upstream-params.nix | xargs)
echo "NEW_BUILD_NUMBER=$NEW_BUILD_NUMBER" | tee -a $GITHUB_ENV
NEW_BUILD_NUMBER="$(grep -o -m 1 '"[^"]*"' ./flavors/grapheneos/upstream-params.nix | xargs)"
echo "NEW_BUILD_NUMBER=$NEW_BUILD_NUMBER" | tee -a "$GITHUB_ENV"
- name: "Update devices"
if: env.OLD_BUILD_NUMBER != env.NEW_BUILD_NUMBER
run: |
for DEVICE in crosshatch sunfish oriole; do
METADATA=$(curl -sSfL "https://releases.grapheneos.org/$DEVICE-beta")
BUILD_PREFIX=$(echo "$METADATA" | cut -d" " -f3)
METADATA="(curl -sSfL "https://releases.grapheneos.org/$DEVICE-beta")"
BUILD_PREFIX="$(echo "$METADATA" | cut -d" " -f3)"
git mv "./flavors/grapheneos/repo-$BUILD_PREFIX.$OLD_BUILD_NUMBER.json" \
"./flavors/grapheneos/repo-$BUILD_PREFIX.$NEW_BUILD_NUMBER.json"
nix develop -c ./flavors/grapheneos/update.sh "$BUILD_PREFIX.$NEW_BUILD_NUMBER"
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/instantiate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ jobs:
extra_nix_config: |
experimental-features = nix-command flakes
- run: |
nix run github:nix-community/nix-eval-jobs/3f305f4538e056e6f6f775e1f75410b6d4d8d9aa -- --workers $(nproc) --option allow-import-from-derivation false --show-trace ./release.nix | tee eval.json
nix run github:nix-community/nix-eval-jobs/3f305f4538e056e6f6f775e1f75410b6d4d8d9aa -- --workers "$(nproc)" --option allow-import-from-derivation false --show-trace ./release.nix | tee eval.json
jq -c 'select(.error)' eval.json | tee errors.json
if [[ "$(wc -l < errors.json)" > 0 ]]; then exit 1; fi
if [[ "$(wc -l < errors.json)" -gt 0 ]]; then exit 1; fi
robotnix-eval-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v12
- run: |
OUTPUT=$(nix-instantiate --eval --strict tests/eval.nix)
OUTPUT="$(nix-instantiate --eval --strict tests/eval.nix)"
if [[ "$OUTPUT" != "[ ]" ]]; then
echo "Instantiation tests failed:"
echo $OUTPUT
echo "$OUTPUT"
fi
nixos-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -55,10 +55,10 @@ jobs:
experimental-features = nix-command flakes
- run: |
nix flake check
export ORIG_DIR=$PWD
cd $(mktemp -d)
nix flake init -t $ORIG_DIR
nix flake check --override-input robotnix $ORIG_DIR
export ORIG_DIR="$PWD"
cd "$(mktemp -d)"
nix flake init -t "$ORIG_DIR"
nix flake check --override-input robotnix "$ORIG_DIR"
checks:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion flavors/lineageos/update_device_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from typing import Any
import json
import urllib.request
import os
import pathlib

Expand Down
12 changes: 6 additions & 6 deletions scripts/robotnix_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ def save(filename: str, data: Any) -> None:
)


def get_store_path(path):
def get_store_path(path_str: str) -> str:
"""Get actual path to a Nix store path; supports handling local remotes"""
prefix = os.getenv("NIX_REMOTE")
prefix_str = os.getenv("NIX_REMOTE")

if not prefix:
return path
if not prefix_str:
return path_str

prefix = Path(prefix)
prefix = Path(prefix_str)

if not prefix.is_absolute():
raise Exception(
f"Must be run on a local Nix store. Current Nix store: {prefix}"
)

path = Path(path).resolve()
path = Path(path_str).resolve()
remote_path = prefix.resolve().joinpath(
path.relative_to(f"{path.drive}{path.root}")
)
Expand Down

0 comments on commit 9443b63

Please sign in to comment.