pck-update,linnetwork.lib: preserve .git directory if protocol is http[s]+git

This commit is contained in:
Silvan Calarco 2020-06-22 11:00:33 +02:00
parent 169dcf8bb9
commit 66e607a4ca
3 changed files with 19 additions and 5 deletions

View File

@ -1,2 +1,2 @@
VERSION=1.16.6
VERSION=1.16.7
RELEASE=1mamba

View File

@ -852,6 +852,7 @@ curl $options --user \"***:***\" --quote \"DELE $deletefile\" $1"
# -d, --destdir : target directory
# -p, --proxy : proxy server
# -u, --proxy-user : proxy user
# --preserve-dot-git : do not remove .git files
# $@ : git repository
#
# return value:
@ -860,14 +861,15 @@ curl $options --user \"***:***\" --quote \"DELE $deletefile\" $1"
function git.download() {
local ARGS
ARGS=`LC_ALL=C getopt \
-o d:v:p:u: \
--long destdir:,pck-version:,proxy:,proxy-user: \
-o d:v:p:u:k \
--long destdir:,pck-version:,proxy:,proxy-user:,preserve-dot-git: \
-n "$FUNCNAME" -- "$@"`
[ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error"
local destdir
local proxy proxy_user
local pck_version
local preserve_dot_git=0
eval set -- "$ARGS"
while :; do
@ -888,6 +890,10 @@ function git.download() {
proxy_user="$2"; shift
notify.debug "$FUNCNAME: proxy_user = \"$proxy_user\""
;;
--preserve-dot-git)
preserve_dot_git="$2"; shift
notify.debug "$FUNCNAME: preserve_dot_git = \"$preserve_dot_git\""
;;
--) shift; break;;
*) notify.error $"\
(bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;;
@ -915,7 +921,7 @@ function git.download() {
git.create_tarball \
--pck-version "$pck_version" \
--destdir "$destdir" \
--preserve-dot-git "0" --git-branch "$git_branch" \
--preserve-dot-git "${preserve_dot_git}" --git-branch "$git_branch" \
"${token_dirname/\/$git_branch*}"
}

View File

@ -2052,13 +2052,21 @@ rpmvars.solve "$fullURL" "$SRPM_SPECFILE_WITH_PATH")
notify.debug "fullURL = $fullURL"
case "$fullURL" in
git://*|http://*.git/*|https://*.git/*|http+git://*|https+git://*)
git://*|http://*.git/*|https://*.git/*)
fullURL="${fullURL/+git}"
[ -e "${source_dir}/${fullURL/*\/}" -a "$force_download" != "1" ] || \
git.download \
--pck-version "$pck_rpmversion" \
--destdir="$source_dir" "$fullURL"
;;
http+git://*|https+git://*)
fullURL="${fullURL/+git}"
[ -e "${source_dir}/${fullURL/*\/}" -a "$force_download" != "1" ] || \
git.download \
--pck-version "$pck_rpmversion" \
--destdir="$source_dir" "$fullURL" \
--preserve-dot-git 1
;;
*) curl.download --options "$curl_options" $sdflag \
${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \
--exit-on-err --filenum="$totfilenum" --destdir="$source_dir" "$fullURL"