From 66e607a4caa07b301614131c00a1521d669cca4d Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Mon, 22 Jun 2020 11:00:33 +0200 Subject: [PATCH] pck-update,linnetwork.lib: preserve .git directory if protocol is http[s]+git --- VERSION | 2 +- lib/libnetwork.lib.in | 12 +++++++++--- plugins/pck-update.in | 10 +++++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 62403c9..85857a1 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -VERSION=1.16.6 +VERSION=1.16.7 RELEASE=1mamba diff --git a/lib/libnetwork.lib.in b/lib/libnetwork.lib.in index 363d349..90ae8e0 100644 --- a/lib/libnetwork.lib.in +++ b/lib/libnetwork.lib.in @@ -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*}" } diff --git a/plugins/pck-update.in b/plugins/pck-update.in index a3660e8..2e7d221 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -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"