[pacman-dev] [PATCH] Add fossil scm support to makepkg
From: Ivy Foster <escondida@iff.ink> Signed-off-by: Ivy Foster <escondida@iff.ink> --- doc/PKGBUILD.5.asciidoc | 3 + scripts/libmakepkg/source/fossil.sh.in | 124 +++++++++++++++++++++++++ scripts/libmakepkg/util/source.sh.in | 5 +- 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..54bb7775 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details) + *fossil*;; + branch, checkin, ci, commit, tag (checkin, ci, and commit are synomymous) + *git*;; branch, commit, tag diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..a0fe0480 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,124 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2015-2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone $url $db; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! (fossil remote list -R $db | grep "$url"); then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R $db; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! (fossil revert && fossil clean --verily); then + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + elif [[ -d "$dir" && ! -f "$dir/.fslckout" ]]; then + error "$(gettext "%s is not a working copy of %s")" "$dir" "$db" + plainerr "$(gettext "Aborting...")" + exit 1 + elif ! fossil open "$db" --workdir "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|checkin|ci|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" "$ref" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile") case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi -- 2.29.2
On 11/4/20 10:50 PM, escondida@iff.ink wrote:
From: Ivy Foster <escondida@iff.ink>
Please extend libmakepkg/executable/vcs.sh.in to check for fossil source urls and verify that the registered VCSCLIENTS=() in etc/makepkg.conf.in is consulted to see if it is installed.
Signed-off-by: Ivy Foster <escondida@iff.ink> --- doc/PKGBUILD.5.asciidoc | 3 + scripts/libmakepkg/source/fossil.sh.in | 124 +++++++++++++++++++++++++ scripts/libmakepkg/util/source.sh.in | 5 +- 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in
diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..54bb7775 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details)
+ *fossil*;; + branch, checkin, ci, commit, tag (checkin, ci, and commit are synomymous)
We don't need the synonymity, please stick to one. I prefer commit for symmetry with git.
+ *git*;; branch, commit, tag
diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..a0fe0480 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,124 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2015-2020 Pacman Development Team <pacman-dev@archlinux.org>
This file can start in 2002, probably. :)
+# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone $url $db; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! (fossil remote list -R $db | grep "$url"); then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1
If this has multiple remotes but the current default is not the one we want, this seems like it would pass...
+ fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R $db; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! (fossil revert && fossil clean --verily); then + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi
This entire block feels terribly wrong. In git, we fetch the $SRCDEST version into the $srcdir one, since they're different git repos wired together as remotes. In fossil, it looks like this is unnecessary and should be skipped (the metadata is directly referenced and opened in $srcdir). Instead, what this is doing is trying to break incremental builds by deleting all untracked files (we do not do this for other sources, but let you use makepkg -C to nuke $srcdir for this purpose), but not modifying the potential revision at all, then declaring this to be the "updating working copy" step of the extraction.
+ cd_safe "$srcdir" + elif [[ -d "$dir" && ! -f "$dir/.fslckout" ]]; then + error "$(gettext "%s is not a working copy of %s")" "$dir" "$db" + plainerr "$(gettext "Aborting...")" + exit 1
This string is new. Shouldn't fossil detect this automatically? How does checking for the existence of the metadata file tell you which repo it is a clone of?
+ elif ! fossil open "$db" --workdir "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|checkin|ci|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" "$ref" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile")
case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi
-- Eli Schwartz Bug Wrangler and Trusted User
From: Ivy Foster <escondida@iff.ink> Signed-off-by: Ivy Foster <escondida@iff.ink> --- doc/PKGBUILD.5.asciidoc | 3 + etc/makepkg.conf.in | 1 + scripts/libmakepkg/executable/vcs.sh.in | 2 +- scripts/libmakepkg/source/fossil.sh.in | 126 ++++++++++++++++++++++++ scripts/libmakepkg/source/meson.build | 1 + scripts/libmakepkg/util/source.sh.in | 5 +- 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..1db0b6c4 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details) + *fossil*;; + branch, commit, tag + *git*;; branch, commit, tag diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9582646..b13b1d5d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -24,6 +24,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' #-- The package required by makepkg to download VCS sources # Format: 'protocol::package' VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' 'git::git' 'hg::mercurial' 'svn::subversion') diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in index 436b82db..756eeb81 100644 --- a/scripts/libmakepkg/executable/vcs.sh.in +++ b/scripts/libmakepkg/executable/vcs.sh.in @@ -77,7 +77,7 @@ executable_vcs() { local proto=$(get_protocol "$netfile") case $proto in - bzr*|git*|hg*|svn*) + bzr*|fossil*|git*|hg*|svn*) if ! type -p ${proto%%+*} > /dev/null; then local client client=$(get_vcsclient "$proto") || exit $? diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..74791878 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,126 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone $url $db; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! (fossil remote -R $db | grep "$url" >/dev/null); then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R $db; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -d "$dir" ]]; then + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! (fossil info | awk '/^repository:/ {print $2}' | grep "$db" >/dev/null); then + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + else + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif ! fossil open "$db" --workdir "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/source/meson.build b/scripts/libmakepkg/source/meson.build index 59326133..41b18c37 100644 --- a/scripts/libmakepkg/source/meson.build +++ b/scripts/libmakepkg/source/meson.build @@ -3,6 +3,7 @@ libmakepkg_module = 'source' sources = [ 'bzr.sh.in', 'file.sh.in', + 'fossil.sh.in', 'git.sh.in', 'hg.sh.in', 'local.sh.in', diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile") case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi -- 2.29.2
On 11/24/20 5:19 PM, escondida@iff.ink wrote:
From: Ivy Foster <escondida@iff.ink>
Signed-off-by: Ivy Foster <escondida@iff.ink> --- doc/PKGBUILD.5.asciidoc | 3 + etc/makepkg.conf.in | 1 + scripts/libmakepkg/executable/vcs.sh.in | 2 +- scripts/libmakepkg/source/fossil.sh.in | 126 ++++++++++++++++++++++++ scripts/libmakepkg/source/meson.build | 1 + scripts/libmakepkg/util/source.sh.in | 5 +- 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in
diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..1db0b6c4 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details)
+ *fossil*;; + branch, commit, tag + *git*;; branch, commit, tag
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9582646..b13b1d5d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -24,6 +24,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' #-- The package required by makepkg to download VCS sources # Format: 'protocol::package' VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' 'git::git' 'hg::mercurial' 'svn::subversion') diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in index 436b82db..756eeb81 100644 --- a/scripts/libmakepkg/executable/vcs.sh.in +++ b/scripts/libmakepkg/executable/vcs.sh.in @@ -77,7 +77,7 @@ executable_vcs() { local proto=$(get_protocol "$netfile")
case $proto in - bzr*|git*|hg*|svn*) + bzr*|fossil*|git*|hg*|svn*) if ! type -p ${proto%%+*} > /dev/null; then local client client=$(get_vcsclient "$proto") || exit $? diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..74791878 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,126 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone $url $db; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! (fossil remote -R $db | grep "$url" >/dev/null); then
No need to surround the pipeline with () to run it in a subshell. () is not a requirement of either "if" or "!" grep -q is preferable to grep > /dev/null, but I think you should imitate git here to do exact matching: # Make sure we are fetching the right repo if [[ "$url" != "$(git config --get remote.origin.url)" ]] ; then So, if [[ $url != "$(fossil remote -R "$db")" ]] Ensure $db is quoted (here and elsewhere), there's no reason $SRCDEST / $srcdir cannot contain whitespace.
+ error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R $db; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -d "$dir" ]]; then + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! (fossil info | awk '/^repository:/ {print $2}' | grep "$db" >/dev/null); then + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "fossil"
This seems to be a check for "<a> is not a working copy of <b>", you've moved up the check from the v1 patch and ensured it correctly checks, but the error message is no longer accurate. Similar issue to above w.r.t. grep -q, () subshell, and [[
+ plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + else + error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1
This seems to be correct now... the working copy doesn't strictly need to be updated like in git, but this line here will run whenever the working copy is not, in fact, a fossil repo at all. Which means we won't be able to update it down below since we fail early. lgtm
+ fi + elif ! fossil open "$db" --workdir "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/source/meson.build b/scripts/libmakepkg/source/meson.build index 59326133..41b18c37 100644 --- a/scripts/libmakepkg/source/meson.build +++ b/scripts/libmakepkg/source/meson.build @@ -3,6 +3,7 @@ libmakepkg_module = 'source' sources = [ 'bzr.sh.in', 'file.sh.in', + 'fossil.sh.in', 'git.sh.in', 'hg.sh.in', 'local.sh.in', diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile")
case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi
-- Eli Schwartz Bug Wrangler and Trusted User
From: Ivy Foster <escondida@iff.ink> Signed-off-by: Ivy Foster <escondida@iff.ink> --- doc/PKGBUILD.5.asciidoc | 3 + etc/makepkg.conf.in | 1 + scripts/libmakepkg/executable/vcs.sh.in | 2 +- scripts/libmakepkg/source/fossil.sh.in | 126 ++++++++++++++++++++++++ scripts/libmakepkg/source/meson.build | 1 + scripts/libmakepkg/util/source.sh.in | 5 +- 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..1db0b6c4 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details) + *fossil*;; + branch, commit, tag + *git*;; branch, commit, tag diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9582646..b13b1d5d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -24,6 +24,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' #-- The package required by makepkg to download VCS sources # Format: 'protocol::package' VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' 'git::git' 'hg::mercurial' 'svn::subversion') diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in index 436b82db..756eeb81 100644 --- a/scripts/libmakepkg/executable/vcs.sh.in +++ b/scripts/libmakepkg/executable/vcs.sh.in @@ -77,7 +77,7 @@ executable_vcs() { local proto=$(get_protocol "$netfile") case $proto in - bzr*|git*|hg*|svn*) + bzr*|fossil*|git*|hg*|svn*) if ! type -p ${proto%%+*} > /dev/null; then local client client=$(get_vcsclient "$proto") || exit $? diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..7cf41343 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,126 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone "$url" "$db"; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! fossil remote -R "$db" | grep -q "$url"; then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R "$db"; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -d "$dir" ]]; then + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! fossil info | grep '^repository' | grep -q "$db"; then + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + else + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif ! fossil open "$db" --workdir "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/source/meson.build b/scripts/libmakepkg/source/meson.build index 59326133..41b18c37 100644 --- a/scripts/libmakepkg/source/meson.build +++ b/scripts/libmakepkg/source/meson.build @@ -3,6 +3,7 @@ libmakepkg_module = 'source' sources = [ 'bzr.sh.in', 'file.sh.in', + 'fossil.sh.in', 'git.sh.in', 'hg.sh.in', 'local.sh.in', diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile") case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi -- 2.29.2
From: Ivy Foster <escondida@iff.ink> Signed-off-by: Ivy Foster <escondida@iff.ink> --- doc/PKGBUILD.5.asciidoc | 3 + etc/makepkg.conf.in | 1 + scripts/libmakepkg/executable/vcs.sh.in | 2 +- scripts/libmakepkg/source/fossil.sh.in | 126 ++++++++++++++++++++++++ scripts/libmakepkg/source/meson.build | 1 + scripts/libmakepkg/util/source.sh.in | 5 +- 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..1db0b6c4 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details) + *fossil*;; + branch, commit, tag + *git*;; branch, commit, tag diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9582646..b13b1d5d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -24,6 +24,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' #-- The package required by makepkg to download VCS sources # Format: 'protocol::package' VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' 'git::git' 'hg::mercurial' 'svn::subversion') diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in index 436b82db..756eeb81 100644 --- a/scripts/libmakepkg/executable/vcs.sh.in +++ b/scripts/libmakepkg/executable/vcs.sh.in @@ -77,7 +77,7 @@ executable_vcs() { local proto=$(get_protocol "$netfile") case $proto in - bzr*|git*|hg*|svn*) + bzr*|fossil*|git*|hg*|svn*) if ! type -p ${proto%%+*} > /dev/null; then local client client=$(get_vcsclient "$proto") || exit $? diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..71987ca9 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,126 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone "$url" "$db"; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! [[ $(fossil remote -R "$db") = "$url" ]]; then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R "$db"; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -d "$dir" ]]; then + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! [[ $(fossil info | awk '/^repository/ {print $2}') = "$db" ]]; then + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + else + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif ! fossil open "$db" --workdir "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/source/meson.build b/scripts/libmakepkg/source/meson.build index 59326133..41b18c37 100644 --- a/scripts/libmakepkg/source/meson.build +++ b/scripts/libmakepkg/source/meson.build @@ -3,6 +3,7 @@ libmakepkg_module = 'source' sources = [ 'bzr.sh.in', 'file.sh.in', + 'fossil.sh.in', 'git.sh.in', 'hg.sh.in', 'local.sh.in', diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile") case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi -- 2.29.2
From: Ivy Foster <escondida@iff.ink> Signed-off-by: Ivy Foster <escondida@iff.ink> --- This version silences the file listing when first opening a repository, as discussed on IRC. doc/PKGBUILD.5.asciidoc | 3 + etc/makepkg.conf.in | 1 + scripts/libmakepkg/executable/vcs.sh.in | 2 +- scripts/libmakepkg/source/fossil.sh.in | 126 ++++++++++++++++++++++++ scripts/libmakepkg/source/meson.build | 1 + scripts/libmakepkg/util/source.sh.in | 5 +- 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..1db0b6c4 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details) + *fossil*;; + branch, commit, tag + *git*;; branch, commit, tag diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9582646..b13b1d5d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -24,6 +24,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' #-- The package required by makepkg to download VCS sources # Format: 'protocol::package' VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' 'git::git' 'hg::mercurial' 'svn::subversion') diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in index 436b82db..756eeb81 100644 --- a/scripts/libmakepkg/executable/vcs.sh.in +++ b/scripts/libmakepkg/executable/vcs.sh.in @@ -77,7 +77,7 @@ executable_vcs() { local proto=$(get_protocol "$netfile") case $proto in - bzr*|git*|hg*|svn*) + bzr*|fossil*|git*|hg*|svn*) if ! type -p ${proto%%+*} > /dev/null; then local client client=$(get_vcsclient "$proto") || exit $? diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..5410caa1 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,126 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone "$url" "$db"; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! [[ $(fossil remote -R "$db") = "$url" ]]; then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R "$db"; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -d "$dir" ]]; then + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! [[ $(fossil info | awk '/^repository/ {print $2}') = "$db" ]]; then + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + else + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif ! fossil open "$db" --workdir "$dir" >/dev/null; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/source/meson.build b/scripts/libmakepkg/source/meson.build index 59326133..41b18c37 100644 --- a/scripts/libmakepkg/source/meson.build +++ b/scripts/libmakepkg/source/meson.build @@ -3,6 +3,7 @@ libmakepkg_module = 'source' sources = [ 'bzr.sh.in', 'file.sh.in', + 'fossil.sh.in', 'git.sh.in', 'hg.sh.in', 'local.sh.in', diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile") case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi -- 2.29.2
On 11/25/20 10:58 PM, escondida@iff.ink wrote:
From: Ivy Foster <escondida@iff.ink>
Signed-off-by: Ivy Foster <escondida@iff.ink> --- This version silences the file listing when first opening a repository, as discussed on IRC.
Thanks.
doc/PKGBUILD.5.asciidoc | 3 + etc/makepkg.conf.in | 1 + scripts/libmakepkg/executable/vcs.sh.in | 2 +- scripts/libmakepkg/source/fossil.sh.in | 126 ++++++++++++++++++++++++ scripts/libmakepkg/source/meson.build | 1 + scripts/libmakepkg/util/source.sh.in | 5 +- 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in
diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..1db0b6c4 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details)
+ *fossil*;; + branch, commit, tag + *git*;; branch, commit, tag
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9582646..b13b1d5d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -24,6 +24,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' #-- The package required by makepkg to download VCS sources # Format: 'protocol::package' VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' 'git::git' 'hg::mercurial' 'svn::subversion') diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in index 436b82db..756eeb81 100644 --- a/scripts/libmakepkg/executable/vcs.sh.in +++ b/scripts/libmakepkg/executable/vcs.sh.in @@ -77,7 +77,7 @@ executable_vcs() { local proto=$(get_protocol "$netfile")
case $proto in - bzr*|git*|hg*|svn*) + bzr*|fossil*|git*|hg*|svn*) if ! type -p ${proto%%+*} > /dev/null; then local client client=$(get_vcsclient "$proto") || exit $? diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..5410caa1 --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,126 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone "$url" "$db"; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! [[ $(fossil remote -R "$db") = "$url" ]]; then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R "$db"; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -d "$dir" ]]; then + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! [[ $(fossil info | awk '/^repository/ {print $2}') = "$db" ]]; then + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + else + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif ! fossil open "$db" --workdir "$dir" >/dev/null; then
For context: ==> Extracting sources... -> Creating working copy of ddate.fossil fossil repo... .clang-format .fossil-settings/ignore-glob LICENSE README.md ddata/slogans/README ddata/slogans/apple ddata/slogans/discordian ddata/slogans/illuminati ddata/slogans/linux ddata/slogans/miscellaneous ddata/slogans/neologisms ddata/slogans/subgenius doc/ddate.1 doc/index doc/usage doc/versions meson.build src/bob.c src/bob.h src/convert.c src/convert.h src/ddate.c src/ddate.h src/fmt.c src/fmt.h src/slogans.c src/slogans.h src/tibs.c src/tibs.h src/util.c src/util.h project-name: ddate repository: /tmp/ddate.fossil local-root: /tmp/src/ddate/ config-db: /home/eschwartz/.config/fossil.db project-code: e5b4cc294b00b37ef44b38c4d3b59b9cdff141ed checkout: d363c13c9ec6a7a60e9969afeec3eaeff0ff1f95 2020-11-05 00:19:09 UTC parent: c252584a0dff319ee89573f4dcee363c39e391c0 2020-11-05 00:17:32 UTC tags: trunk, 0.3.2, release comment: Bump version; delete Makefile and no longer necessary ddata/meta/version (user: ivy) check-ins: 144 Autosync: https://iff.ink/fossil/ddate Round-trips: 1 Artifacts sent: 0 received: 0 Pull done, sent: 315 received: 1763 ip: 198.58.102.79 ------------------------------------------------------------------------------- checkout: d363c13c9ec6a7a60e9969afeec3eaeff0ff1f95 2020-11-05 00:19:09 UTC tags: trunk, 0.3.2, release comment: Bump version; delete Makefile and no longer necessary ddata/meta/version (user: ivy) changes: None. Already up-to-date ==> Starting pkgver()... Printing every single file is excessive, and doesn't scale well. Now: -> Creating working copy of ddate.fossil fossil repo... Autosync: https://iff.ink/fossil/ddate Round-trips: 1 Artifacts sent: 0 received: 0 Pull done, sent: 314 received: 1764 ip: 198.58.102.79 ------------------------------------------------------------------------------- checkout: d363c13c9ec6a7a60e9969afeec3eaeff0ff1f95 2020-11-05 00:19:09 UTC tags: trunk, 0.3.2, release comment: Bump version; delete Makefile and no longer necessary ddata/meta/version (user: ivy) changes: None. Already up-to-date ==> Starting pkgver()...
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref"; then
Does this need to be silenced too? If I add #tag=0.3.1 to your PKGBUILD... -> Creating working copy of ddate.fossil fossil repo... Autosync: https://iff.ink/fossil/ddate Round-trips: 1 Artifacts sent: 0 received: 0 Pull done, sent: 316 received: 1763 ip: 198.58.102.79 REMOVE .fossil-settings/ignore-glob ADD .gitignore ADD Makefile UPDATE README.md ADD ddata/meta/version ADD ddata/wisdom/yearlength UPDATE doc/ddate.1 REMOVE meson.build ------------------------------------------------------------------------------- updated-to: eb8e917743ce4f3d212e67a0f3f09df0eee9b4d1 2020-05-05 05:35:21 UTC tags: trunk, 0.3.1, release comment: Implement actually printing BS dates (user: escondida@iff.ink) changes: 8 files modified. "fossil undo" is available to undo changes to the working checkout. ==> Starting pkgver()... It would be quite nice if fossil had a flag to only summarize but not print info about every single file. >/dev/null is kind of a blunt axe. Then again, idk how important this status is to begin with.
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/source/meson.build b/scripts/libmakepkg/source/meson.build index 59326133..41b18c37 100644 --- a/scripts/libmakepkg/source/meson.build +++ b/scripts/libmakepkg/source/meson.build @@ -3,6 +3,7 @@ libmakepkg_module = 'source' sources = [ 'bzr.sh.in', 'file.sh.in', + 'fossil.sh.in', 'git.sh.in', 'hg.sh.in', 'local.sh.in', diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile")
case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi -- 2.29.2
-- Eli Schwartz Bug Wrangler and Trusted User
From: Ivy Foster <escondida@iff.ink> Signed-off-by: Ivy Foster <escondida@iff.ink> --- This version also silences the file listing when changing to a different commit in an existing checkout. doc/PKGBUILD.5.asciidoc | 3 + etc/makepkg.conf.in | 1 + scripts/libmakepkg/executable/vcs.sh.in | 2 +- scripts/libmakepkg/source/fossil.sh.in | 126 ++++++++++++++++++++++++ scripts/libmakepkg/source/meson.build | 1 + scripts/libmakepkg/util/source.sh.in | 5 +- 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/source/fossil.sh.in diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc index 2e2108a0..1db0b6c4 100644 --- a/doc/PKGBUILD.5.asciidoc +++ b/doc/PKGBUILD.5.asciidoc @@ -499,6 +499,9 @@ The source URL is divided into four components: *bzr*;; revision (see `'bzr help revisionspec'` for details) + *fossil*;; + branch, commit, tag + *git*;; branch, commit, tag diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index e9582646..b13b1d5d 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -24,6 +24,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u' #-- The package required by makepkg to download VCS sources # Format: 'protocol::package' VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' 'git::git' 'hg::mercurial' 'svn::subversion') diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in index 436b82db..756eeb81 100644 --- a/scripts/libmakepkg/executable/vcs.sh.in +++ b/scripts/libmakepkg/executable/vcs.sh.in @@ -77,7 +77,7 @@ executable_vcs() { local proto=$(get_protocol "$netfile") case $proto in - bzr*|git*|hg*|svn*) + bzr*|fossil*|git*|hg*|svn*) if ! type -p ${proto%%+*} > /dev/null; then local client client=$(get_vcsclient "$proto") || exit $? diff --git a/scripts/libmakepkg/source/fossil.sh.in b/scripts/libmakepkg/source/fossil.sh.in new file mode 100644 index 00000000..91cb114b --- /dev/null +++ b/scripts/libmakepkg/source/fossil.sh.in @@ -0,0 +1,126 @@ +#!/bin/bash +# +# fossil.sh - function for handling the download and extraction of Fossil sources +# +# Copyright (c) 2020 Pacman Development Team <pacman-dev@archlinux.org> +# +# 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 <http://www.gnu.org/licenses/>. +# + +[[ -n "$LIBMAKEPKG_SOURCE_FOSSIL_SH" ]] && return +LIBMAKEPKG_SOURCE_FOSSIL_SH=1 + + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +source "$LIBRARY/util/message.sh" +source "$LIBRARY/util/pkgbuild.sh" + +download_fossil() { + # abort early if parent says not to fetch + if declare -p get_vcs > /dev/null 2>&1; then + (( get_vcs )) || return + fi + + local netfile=$1 + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + + local repo=$db + + local url=$(get_url "$netfile") + url=${url#fossil+} + url=${url%%#*} + url=${url%%\?*} + + if [[ ! -f "$db" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "fossil" + if ! fossil clone "$url" "$db"; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + # Make sure we are fetching the right repo + if ! [[ $(fossil remote -R "$db") = "$url" ]]; then + error "$(gettext "%s is not a clone of %s")" "$db" "$url" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "fossil" + if ! fossil pull -R "$db"; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "fossil" + fi + fi +} + +extract_fossil() { + local netfile=$1 tagname + + local fragment=$(get_uri_fragment "$netfile") + local repo=$(get_filename "$netfile") + + local db=$(get_filepath "$netfile") + [[ -z "$db" ]] && db="$SRCDEST/$(get_filename "$netfile")" + local dir=${db%%.fossil} + dir=${dir##*/} + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "fossil" + pushd "$srcdir" &>/dev/null + + if [[ -d "$dir" ]]; then + if [[ -f "$dir/.fslckout" ]]; then + cd_safe "$dir" + if ! [[ $(fossil info | awk '/^repository/ {print $2}') = "$db" ]]; then + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + cd_safe "$srcdir" + else + error "$(gettext "%s is not a checkout of %s repo %s")" "${srcdir}/${dir}" "fossil" "${repo}" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + elif ! fossil open "$db" --workdir "$dir" >/dev/null; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + ref=tip + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|commit|tag) + ref=${fragment##*=} + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plainerr "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! fossil update "$ref" >/dev/null; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "fossil" + plainerr "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} diff --git a/scripts/libmakepkg/source/meson.build b/scripts/libmakepkg/source/meson.build index 59326133..41b18c37 100644 --- a/scripts/libmakepkg/source/meson.build +++ b/scripts/libmakepkg/source/meson.build @@ -3,6 +3,7 @@ libmakepkg_module = 'source' sources = [ 'bzr.sh.in', 'file.sh.in', + 'fossil.sh.in', 'git.sh.in', 'hg.sh.in', 'local.sh.in', diff --git a/scripts/libmakepkg/util/source.sh.in b/scripts/libmakepkg/util/source.sh.in index be7c15c2..029bf8ed 100644 --- a/scripts/libmakepkg/util/source.sh.in +++ b/scripts/libmakepkg/util/source.sh.in @@ -65,7 +65,7 @@ get_filename() { local proto=$(get_protocol "$netfile") case $proto in - bzr|git|hg|svn) + bzr|fossil|git|hg|svn) filename=${netfile%%#*} filename=${filename%%\?*} filename=${filename%/} @@ -73,6 +73,9 @@ get_filename() { if [[ $proto = bzr ]]; then filename=${filename#*lp:} fi + if [[ $proto = fossil ]]; then + filename=$filename.fossil + fi if [[ $proto = git ]]; then filename=${filename%%.git*} fi -- 2.29.2
participants (2)
-
Eli Schwartz
-
escondida@iff.ink