- git_revision: str
- old_git_revision: str
- table: Dict[str, ChannelTableEntry]
-
- def pin(self, v: Verification, conf: configparser.SectionProxy) -> None:
- if hasattr(self, 'alias_of'):
- assert not hasattr(self, 'git_repo')
- return
-
- if hasattr(self, 'git_revision'):
- self.old_git_revision = self.git_revision
- del self.git_revision
-
- if 'channel_url' in conf:
- pin_channel(v, self)
- conf['release_name'] = self.release_name
- conf['tarball_url'] = self.table['nixexprs.tar.xz'].absolute_url
- conf['tarball_sha256'] = self.table['nixexprs.tar.xz'].digest
- else:
- git_fetch(v, self)
- conf['release_name'] = git_revision_name(v, self)
- conf['git_revision'] = self.git_revision
+
+ def pin(self, v: Verification, old_pin: Optional[Pin]) -> ChannelPin:
+ if old_pin is not None:
+ assert isinstance(old_pin, ChannelPin)
+
+ channel_html, forwarded_url = fetch_channel(v, self)
+ table, new_gitpin = parse_channel(v, channel_html)
+ if old_pin is not None and old_pin.git_revision == new_gitpin.git_revision:
+ return old_pin
+ fetch_resources(v, new_gitpin, forwarded_url, table)
+ git_cache.ensure_rev_available(
+ self.git_repo, self.git_ref, new_gitpin.git_revision)
+ if old_pin is not None:
+ verify_git_ancestry(
+ v, self, old_pin.git_revision, new_gitpin.git_revision)
+ check_channel_contents(v, self, table, new_gitpin)
+ return ChannelPin(
+ release_name=new_gitpin.release_name,
+ tarball_url=table['nixexprs.tar.xz'].absolute_url,
+ tarball_sha256=table['nixexprs.tar.xz'].digest,
+ git_revision=new_gitpin.git_revision)
+
+ def fetch(self, v: Verification, pin: Pin) -> str:
+ assert isinstance(pin, ChannelPin)
+
+ return fetch_with_nix_prefetch_url(
+ v, pin.tarball_url, Digest16(pin.tarball_sha256))
+
+
+SearchPath = Union[AliasSearchPath,
+ SymlinkSearchPath,
+ GitSearchPath,
+ ChannelSearchPath]
+TarrableSearchPath = Union[GitSearchPath, ChannelSearchPath]