+class GitSearchPath(TarrableSearchPath):
+ def pin(self, v: Verification) -> GitPin:
+ if hasattr(self, 'git_revision'):
+ self.old_git_revision = self.git_revision
+ del self.git_revision
+
+ git_fetch(v, self)
+ return GitPin(release_name=git_revision_name(v, self),
+ git_revision=self.git_revision)
+
+ def fetch(self, v: Verification, section: str,
+ conf: configparser.SectionProxy) -> str:
+ if 'git_revision' not in conf or 'release_name' not in conf:
+ raise Exception(
+ 'Cannot update unpinned channel "%s" (Run "pin" before "update")' %
+ section)
+ the_pin = GitPin(
+ release_name=conf['release_name'],
+ git_revision=conf['git_revision'])
+
+ ensure_git_rev_available(v, self, the_pin)
+ return git_get_tarball(v, self, the_pin)
+
+
+class ChannelSearchPath(TarrableSearchPath):
+ def pin(self, v: Verification) -> ChannelPin:
+ if hasattr(self, 'git_revision'):
+ self.old_git_revision = self.git_revision
+ del self.git_revision
+
+ fetch(v, self)
+ new_gitpin = parse_channel(v, self)
+ fetch_resources(v, self, new_gitpin)
+ ensure_git_rev_available(v, self, new_gitpin)
+ check_channel_contents(v, self)
+ return ChannelPin(
+ release_name=self.release_name,
+ tarball_url=self.table['nixexprs.tar.xz'].absolute_url,
+ tarball_sha256=self.table['nixexprs.tar.xz'].digest,
+ git_revision=self.git_revision)
+
+ # Lint TODO: Put tarball_url and tarball_sha256 in ChannelSearchPath
+ # pylint: disable=no-self-use
+ def fetch(self, v: Verification, section: str,
+ conf: configparser.SectionProxy) -> str:
+ if 'git_repo' not in conf or 'release_name' not in conf:
+ raise Exception(
+ 'Cannot update unpinned channel "%s" (Run "pin" before "update")' %
+ section)
+
+ return fetch_with_nix_prefetch_url(
+ v, conf['tarball_url'], Digest16(
+ conf['tarball_sha256']))
+
+