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 RELEASE=1mamba

View File

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

View File

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