Skip to content

Commit

Permalink
When NIXPKGS_REVIEW_OFBORG_GIST_URL is set, use it as the default URL…
Browse files Browse the repository at this point in the history
… from which to fetch the ofborg evalation.

This is not required for normal users, but can be useful when nixpkgs-review is run as part of a distributed
system like r-rmcgibbo, and you want to use an ofborg evaluation that has since been invalidated by a force-push
to the PR and you do not want to fall back to local evaluation.
  • Loading branch information
rmcgibbo committed Mar 30, 2021
1 parent ea72686 commit 5b5393b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions nixpkgs_review/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def pull_request(self, number: int) -> Any:
def get_borg_eval_gist(self, pr: Dict[str, Any]) -> Optional[Dict[str, Set[str]]]:
packages_per_system: DefaultDict[str, Set[str]] = defaultdict(set)
statuses = self.get(pr["statuses_url"])
raw_gist_url = os.environ.get("NIXPKGS_REVIEW_OFBORG_GIST_URL")
for status in statuses:
url = status.get("target_url", "")
if (
Expand All @@ -125,12 +126,15 @@ def get_borg_eval_gist(self, pr: Dict[str, Any]) -> Optional[Dict[str, Set[str]]
raw_gist_url = (
f"https://gist.githubusercontent.com/GrahamcOfBorg{url.path}/raw/"
)
for line in urllib.request.urlopen(raw_gist_url):
if line == b"":
break
system, attribute = line.decode("utf-8").split()
packages_per_system[system].add(attribute)
return packages_per_system
break

if raw_gist_url is not None:
for line in urllib.request.urlopen(raw_gist_url):
if line == b"":
break
system, attribute = line.decode("utf-8").split()
packages_per_system[system].add(attribute)
return packages_per_system
return None

def upload_gist(self, name: str, content: str, description: str) -> Dict[str, Any]:
Expand Down

0 comments on commit 5b5393b

Please sign in to comment.