From 6de07a3ee17052f95c38bfb7f22be87ecccb3796 Mon Sep 17 00:00:00 2001 From: bartus Date: Mon, 21 Sep 2020 17:53:55 +0200 Subject: [PATCH] Add git-lfs protocol. Allow makepkg to handle Git repository with lfs extension by introducing new protocol 'git-lfs' to use in PKGBUILD source array. Implementation of {download,extract}_git-lfs wraps {download,extract}_git. !Requires adding 'git-lfs::git-lfs' to VCSCLIENTS array in makepkg.conf. Signed-off-by: bartus --- doc/PKGBUILD.5.asciidoc | 5 ++- scripts/libmakepkg/source/git-lfs.sh.in | 43 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 scripts/libmakepkg/source/git-lfs.sh.in diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..45127f8d 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -472,7 +472,7 @@ control system (VCS) is enabled by specifying the source in the form: source=('directory::url#fragment?query') -Currently makepkg supports the Bazaar, Git, Subversion, and Mercurial version +Currently makepkg supports the Bazaar, Git, Git-lfs, Subversion, and Mercurial version control systems. For other version control systems, manual cloning of upstream repositories must be done in the `prepare()` function. @@ -502,6 +502,9 @@ The source URL is divided into four components: *git*;; branch, commit, tag + *git-lfs*;; + branch, commit, tag + *hg*;; branch, revision, tag diff --git a/scripts/libmakepkg/source/git-lfs.sh.in b/scripts/libmakepkg/source/git-lfs.sh.in new file mode 100644 index 00000000..d4b0f89c --- /dev/null +++ b/scripts/libmakepkg/source/git-lfs.sh.in @@ -0,0 +1,43 @@ +#!/bin/bash +# +# git-lfs.sh - function for handling the download and "extraction" of Git Large File Storage sources +# +# Copyright (c) 2015-2020 Pacman Development Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +[[ -n "$LIBMAKEPKG_SOURCE_GIT_SH" ]] && return +LIBMAKEPKG_SOURCE_GIT_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" +source "$LIBRARY/source/git.sh" + +download_git-lfs() { + local url="${1/git-lfs+/git+}" dir + dir="$SRCDEST/$(get_filename "$url")" + download_git "$url" + git -C "$dir" lfs install + git -C "$dir" lfs fetch +} + +extract_git-lfs() { + local url=${1/git-lfs+/git+} + extract_git "$url" +} + -- 2.28.0