From f107a20bf85fbd7d0e7a3b0728a621018a26f66d Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Tue, 30 Oct 2012 23:17:59 +0100 Subject: [PATCH] libnetwork.lib; pck-update (action 3,5): improve the functions 'git.download()' and 'git.create_tarball()' by adding the option '--pck-version' and use it when calling 'git.download' in pck-update Signed-off-by: Davide Madrisan --- ChangeLog | 8 ++++++-- lib/libnetwork.lib.in | 37 +++++++++++++++++++++++++++---------- plugins/pck-update.in | 2 ++ po/it/libnetwork.po | 3 +++ 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85b0fa6..cfc0b2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,7 +20,6 @@ Changes in version 1.12.6 Do not use the operator '|&'. Use instead '2>&1 |' which is compatible at least with bash 3.2. -+ update * lib/libnetwork.lib - Davide Madrisan: Clone the entire git repository when the option '--preserve-dot-git' is selected by user. @@ -52,7 +51,6 @@ Changes in version 1.12.6 Update some requirements of the autospec subpackages in order to always use the real package names instead of their aliases ('Provides' tag). -+ update * lib/libnetwork.lib - Davide Madrisan: New helper function: 'git.download()'. @@ -60,6 +58,12 @@ Changes in version 1.12.6 * pck-update - Davide Madrisan: Action 3,5: support source files update from a git repository. + * lib/libnetwork.lib - Davide Madrisan: + git.download(), git.create_tarball(): new option '--pck-version'. + + * pck-update - Davide Madrisan: + Action 3,5: set the package version when calling 'git.download()'. + ------------------------------------------------------------------------------- Changes in version 1.12.5 diff --git a/lib/libnetwork.lib.in b/lib/libnetwork.lib.in index 2083c05..d5562c4 100644 --- a/lib/libnetwork.lib.in +++ b/lib/libnetwork.lib.in @@ -856,13 +856,14 @@ curl $options --user \"***:***\" --quote \"DELE $deletefile\" $1" function git.download() { local ARGS ARGS=`LC_ALL=C getopt \ - -o d:p:u: \ - --long destdir:,proxy:,proxy-user: \ + -o d:v:p:u: \ + --long destdir:,pck-version:,proxy:,proxy-user: \ -n "$FUNCNAME" -- "$@"` [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" local destdir local proxy proxy_user + local pck_version eval set -- "$ARGS" while :; do @@ -871,6 +872,10 @@ function git.download() { destdir="$2"; shift notify.debug "$FUNCNAME: destdir = \"$destdir\"" ;; + -v|--pck-version) + pck_version="$2"; shift + notify.debug "$FUNCNAME: pck_version = \"$pck_version\"" + ;; -p|--proxy) proxy="$2"; shift notify.debug "$FUNCNAME: proxy = \"$proxy\"" @@ -904,6 +909,7 @@ function git.download() { notify.debug "$FUNCNAME: git_branch = \"$git_branch\"" git.create_tarball \ + --pck-version "$pck_version" \ --destdir "$destdir" \ --preserve-dot-git "0" --git-branch "$git_branch" \ "${token_dirname%/*}" @@ -921,13 +927,12 @@ function git.download() { # return value: # 0 # -# set: pck_version, spec_source, spec_source_comment, pck_tarball +# set: spec_source, spec_source_comment, pck_tarball function git.create_tarball() { local ARGS - ARGS=`LC_ALL=C getopt \ - -o d:p:u: \ - --long destdir:,git-branch:,preserve-dot-git:,proxy:,proxy-user: \ + ARGS=`LC_ALL=C getopt -o d:v:p:u: \ +--long destdir:,pck-version:,git-branch:,preserve-dot-git:,proxy:,proxy-user:\ -n "$FUNCNAME" -- "$@"` [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" @@ -938,6 +943,7 @@ function git.create_tarball() { local proxy proxy_user local git_branch local preserve_dot_git=0 + local pck_version eval set -- "$ARGS" while :; do @@ -946,6 +952,10 @@ function git.create_tarball() { destdir="$2"; shift notify.debug "$FUNCNAME: destdir = \"$destdir\"" ;; + -v|--pck-version) + pck_version="$2"; shift + notify.debug "$FUNCNAME: pck_version = \"$pck_version\"" + ;; --git-branch) git_branch="$2"; shift notify.debug "$FUNCNAME: git_branch = \"$git_branch\"" @@ -977,6 +987,10 @@ function git.create_tarball() { [ "$destdir" ] || notify.error $"\ (bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--destdir)" + [ "$pck_version" ] || + { pck_version="$(date "+%Y%m%dgit")" + notify.debug "$FUNCNAME: pck_version = \"$pck_version\""; } + which git &>/dev/null || notify.error $"utility not found"": \`git'" @@ -1010,7 +1024,6 @@ function git.create_tarball() { rm -f $pck_tarball/.gitmodules fi - pck_version="$(date "+%Y%m%dgit")" mv $pck_tarball ${pck_tarball}-${pck_version} pck_tarball="${pck_tarball}-${pck_version}" @@ -1020,11 +1033,15 @@ function git.create_tarball() { tar -cvf ${pck_tarball}.tar $pck_tarball/ >/dev/null && bzip2 ${pck_tarball}.tar && mv ${pck_tarball}.tar.bz2 $destdir/ - [ $? -eq 0 ] || - { popd &>/dev/null + if [ $? -eq 0 ]; then + notify.note "\ +...${NOTE}"$"done""${NORM}: \`${NOTE}${pck_tarball}.tar.bz2${NORM}'" + else + popd &>/dev/null rm -fr $tmpgitdir notify.error $"\ -an error occurred while creating"": ${pck_tarball}.tar.bz2"; } +an error occurred while creating"": ${pck_tarball}.tar.bz2" + fi spec_source="${pck_tarball}.tar.bz2" notify.debug "$FUNCNAME: spec_source = $spec_source" diff --git a/plugins/pck-update.in b/plugins/pck-update.in index 6d27a4e..11b5ea7 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -1125,6 +1125,7 @@ rpmvars.solve "$fullURL_new" "$SRPM_SPECFILE_WITH_PATH") case "$fullURL_new" in git://*|http://*.git|https://*.git) git.download \ + --pck-version "$pck_newver" \ --destdir="$source_dir" "$fullURL_new" ;; *) curl.download --options "$curl_options" $sdflag \ @@ -1956,6 +1957,7 @@ rpmvars.solve "$fullURL" "$SRPM_SPECFILE_WITH_PATH") case "$fullURL" in git://*|http://*.git|https://*.git) git.download \ + --pck-version "$pck_rpmversion" \ --destdir="$source_dir" "$fullURL" ;; *) curl.download --options "$curl_options" $sdflag \ diff --git a/po/it/libnetwork.po b/po/it/libnetwork.po index 2cce5a4..10e616a 100644 --- a/po/it/libnetwork.po +++ b/po/it/libnetwork.po @@ -99,3 +99,6 @@ msgstr "si รจ verificato un errore durante la creazione di" msgid "creating the compressed source tarball" msgstr "creazione del file sorgente compresso" + +msgid "done" +msgstr "fatto"