New package: git-annex (#24721)
This commit is contained in:
parent
4fd8640586
commit
e0b901153b
79
var/spack/repos/builtin/packages/git-annex/package.py
Normal file
79
var/spack/repos/builtin/packages/git-annex/package.py
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import re
|
||||||
|
|
||||||
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
|
class GitAnnex(Package):
|
||||||
|
"""
|
||||||
|
git-annex allows managing files with git, without checking the file
|
||||||
|
contents into git. While that may seem paradoxical, it is useful when
|
||||||
|
dealing with files larger than git can currently easily handle, whether
|
||||||
|
due to limitations in memory, time, or disk space.
|
||||||
|
"""
|
||||||
|
|
||||||
|
homepage = "https://git-annex.branchable.com"
|
||||||
|
|
||||||
|
# git-annex is written in Haskell which is currently not supported in
|
||||||
|
# spack, thus a similar approach as in the pandoc package was chosen. The
|
||||||
|
# following installs the standalone binaries for git-annex.
|
||||||
|
|
||||||
|
# git-annex does not use download links encoding the version but updates
|
||||||
|
# the "current" standalone file and keeps track of the version via
|
||||||
|
# git-annex itself
|
||||||
|
#
|
||||||
|
# Steps to find the static link e.g. for amd64:
|
||||||
|
# - $ git clone https://downloads.kitenet.net/.git/
|
||||||
|
# - $ ls -la git-annex/linux/current/
|
||||||
|
# gives for example for amd64
|
||||||
|
# ../../../.git/annex/objects/KM/Ff/SHA256E-s51276461--a1cef631ef2cc0c977580eacaa1294d7617727df99214920ca6e8f3172bae03e.tar.gz/SHA256E-s51276461--a1cef631ef2cc0c977580eacaa1294d7617727df99214920ca6e8f3172bae03e.tar.gz
|
||||||
|
# - exchange "../../../" with "https://downloads.kitenet.net" and you have the link
|
||||||
|
# the version to the link can be found in
|
||||||
|
# git-annex/linux/current/git-annex-standalone-amd64.tar.gz.info
|
||||||
|
# Caution: the version on the webpage
|
||||||
|
# (meaning here: https://downloads.kitenet.net/git-annex/linux/current/) is
|
||||||
|
# broken and always behind
|
||||||
|
|
||||||
|
if platform.system() == "Linux" and platform.machine() == "aarch64":
|
||||||
|
version('8.20210622', sha256='869f875e280db0cc3243d9d0d33492f1c3bc182053544c1d5eb0ec463125fe76',
|
||||||
|
url="https://downloads.kitenet.net/.git/annex/objects/MJ/p3/SHA256E-s55109776--869f875e280db0cc3243d9d0d33492f1c3bc182053544c1d5eb0ec463125fe76.tar.gz/SHA256E-s55109776--869f875e280db0cc3243d9d0d33492f1c3bc182053544c1d5eb0ec463125fe76.tar.gz")
|
||||||
|
|
||||||
|
elif platform.system() == "Linux":
|
||||||
|
version('8.20210622', sha256='a1cef631ef2cc0c977580eacaa1294d7617727df99214920ca6e8f3172bae03e',
|
||||||
|
url="https://downloads.kitenet.net/.git/annex/objects/KM/Ff/SHA256E-s51276461--a1cef631ef2cc0c977580eacaa1294d7617727df99214920ca6e8f3172bae03e.tar.gz/SHA256E-s51276461--a1cef631ef2cc0c977580eacaa1294d7617727df99214920ca6e8f3172bae03e.tar.gz")
|
||||||
|
|
||||||
|
variant('standalone', default=False,
|
||||||
|
description='Install git-annex fully standalone incl. git')
|
||||||
|
|
||||||
|
depends_on('git', when='~standalone')
|
||||||
|
|
||||||
|
conflicts('platform=darwin', msg='Darwin is not supported.')
|
||||||
|
conflicts('platform=windows', msg='Windows is not supported.')
|
||||||
|
|
||||||
|
executables = ['^git-annex$']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_version(cls, exe):
|
||||||
|
output = Executable(exe)('version', output=str, error=str)
|
||||||
|
match = re.search(r'git-annex version: ([0-9.]+)', output)
|
||||||
|
if not match:
|
||||||
|
return None
|
||||||
|
version = match.group(1)
|
||||||
|
return version
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
install_tree('.', prefix.bin)
|
||||||
|
|
||||||
|
if '~standalone' in spec:
|
||||||
|
# use git provided by spack instead of the one in the package
|
||||||
|
git_files = ['git', 'git-receive-pack', 'git-shell', 'git-upload-pack']
|
||||||
|
for i in git_files:
|
||||||
|
os.remove(join_path(prefix.bin, i))
|
||||||
|
os.symlink(join_path(spec['git'].prefix.bin, i),
|
||||||
|
join_path(prefix.bin, i))
|
Loading…
Reference in New Issue
Block a user