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 <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-10-30 23:17:59 +01:00
parent 80e22280fe
commit f107a20bf8
4 changed files with 38 additions and 12 deletions

View File

@ -20,7 +20,6 @@ Changes in version 1.12.6
Do not use the operator '|&'. Use instead '2>&1 |' which is compatible at Do not use the operator '|&'. Use instead '2>&1 |' which is compatible at
least with bash 3.2. least with bash 3.2.
+ update
* lib/libnetwork.lib - Davide Madrisan: * lib/libnetwork.lib - Davide Madrisan:
Clone the entire git repository when the option '--preserve-dot-git' is Clone the entire git repository when the option '--preserve-dot-git' is
selected by user. 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 Update some requirements of the autospec subpackages in order to always use
the real package names instead of their aliases ('Provides' tag). the real package names instead of their aliases ('Provides' tag).
+ update
* lib/libnetwork.lib - Davide Madrisan: * lib/libnetwork.lib - Davide Madrisan:
New helper function: 'git.download()'. New helper function: 'git.download()'.
@ -60,6 +58,12 @@ Changes in version 1.12.6
* pck-update - Davide Madrisan: * pck-update - Davide Madrisan:
Action 3,5: support source files update from a git repository. 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 Changes in version 1.12.5

View File

@ -856,13 +856,14 @@ 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:p:u: \ -o d:v:p:u: \
--long destdir:,proxy:,proxy-user: \ --long destdir:,pck-version:,proxy:,proxy-user: \
-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
eval set -- "$ARGS" eval set -- "$ARGS"
while :; do while :; do
@ -871,6 +872,10 @@ function git.download() {
destdir="$2"; shift destdir="$2"; shift
notify.debug "$FUNCNAME: destdir = \"$destdir\"" notify.debug "$FUNCNAME: destdir = \"$destdir\""
;; ;;
-v|--pck-version)
pck_version="$2"; shift
notify.debug "$FUNCNAME: pck_version = \"$pck_version\""
;;
-p|--proxy) -p|--proxy)
proxy="$2"; shift proxy="$2"; shift
notify.debug "$FUNCNAME: proxy = \"$proxy\"" notify.debug "$FUNCNAME: proxy = \"$proxy\""
@ -904,6 +909,7 @@ function git.download() {
notify.debug "$FUNCNAME: git_branch = \"$git_branch\"" notify.debug "$FUNCNAME: git_branch = \"$git_branch\""
git.create_tarball \ git.create_tarball \
--pck-version "$pck_version" \
--destdir "$destdir" \ --destdir "$destdir" \
--preserve-dot-git "0" --git-branch "$git_branch" \ --preserve-dot-git "0" --git-branch "$git_branch" \
"${token_dirname%/*}" "${token_dirname%/*}"
@ -921,13 +927,12 @@ function git.download() {
# return value: # return value:
# 0 # 0
# #
# set: pck_version, spec_source, spec_source_comment, pck_tarball # set: spec_source, spec_source_comment, pck_tarball
function git.create_tarball() { function git.create_tarball() {
local ARGS local ARGS
ARGS=`LC_ALL=C getopt \ ARGS=`LC_ALL=C getopt -o d:v:p:u: \
-o d:p:u: \ --long destdir:,pck-version:,git-branch:,preserve-dot-git:,proxy:,proxy-user:\
--long destdir:,git-branch:,preserve-dot-git:,proxy:,proxy-user: \
-n "$FUNCNAME" -- "$@"` -n "$FUNCNAME" -- "$@"`
[ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error"
@ -938,6 +943,7 @@ function git.create_tarball() {
local proxy proxy_user local proxy proxy_user
local git_branch local git_branch
local preserve_dot_git=0 local preserve_dot_git=0
local pck_version
eval set -- "$ARGS" eval set -- "$ARGS"
while :; do while :; do
@ -946,6 +952,10 @@ function git.create_tarball() {
destdir="$2"; shift destdir="$2"; shift
notify.debug "$FUNCNAME: destdir = \"$destdir\"" notify.debug "$FUNCNAME: destdir = \"$destdir\""
;; ;;
-v|--pck-version)
pck_version="$2"; shift
notify.debug "$FUNCNAME: pck_version = \"$pck_version\""
;;
--git-branch) --git-branch)
git_branch="$2"; shift git_branch="$2"; shift
notify.debug "$FUNCNAME: git_branch = \"$git_branch\"" notify.debug "$FUNCNAME: git_branch = \"$git_branch\""
@ -977,6 +987,10 @@ function git.create_tarball() {
[ "$destdir" ] || notify.error $"\ [ "$destdir" ] || notify.error $"\
(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--destdir)" (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 || which git &>/dev/null ||
notify.error $"utility not found"": \`git'" notify.error $"utility not found"": \`git'"
@ -1010,7 +1024,6 @@ function git.create_tarball() {
rm -f $pck_tarball/.gitmodules rm -f $pck_tarball/.gitmodules
fi fi
pck_version="$(date "+%Y%m%dgit")"
mv $pck_tarball ${pck_tarball}-${pck_version} mv $pck_tarball ${pck_tarball}-${pck_version}
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 && tar -cvf ${pck_tarball}.tar $pck_tarball/ >/dev/null &&
bzip2 ${pck_tarball}.tar && bzip2 ${pck_tarball}.tar &&
mv ${pck_tarball}.tar.bz2 $destdir/ mv ${pck_tarball}.tar.bz2 $destdir/
[ $? -eq 0 ] || if [ $? -eq 0 ]; then
{ popd &>/dev/null notify.note "\
...${NOTE}"$"done""${NORM}: \`${NOTE}${pck_tarball}.tar.bz2${NORM}'"
else
popd &>/dev/null
rm -fr $tmpgitdir rm -fr $tmpgitdir
notify.error $"\ 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" spec_source="${pck_tarball}.tar.bz2"
notify.debug "$FUNCNAME: spec_source = $spec_source" notify.debug "$FUNCNAME: spec_source = $spec_source"

View File

@ -1125,6 +1125,7 @@ rpmvars.solve "$fullURL_new" "$SRPM_SPECFILE_WITH_PATH")
case "$fullURL_new" in case "$fullURL_new" in
git://*|http://*.git|https://*.git) git://*|http://*.git|https://*.git)
git.download \ git.download \
--pck-version "$pck_newver" \
--destdir="$source_dir" "$fullURL_new" --destdir="$source_dir" "$fullURL_new"
;; ;;
*) curl.download --options "$curl_options" $sdflag \ *) curl.download --options "$curl_options" $sdflag \
@ -1956,6 +1957,7 @@ rpmvars.solve "$fullURL" "$SRPM_SPECFILE_WITH_PATH")
case "$fullURL" in case "$fullURL" in
git://*|http://*.git|https://*.git) git://*|http://*.git|https://*.git)
git.download \ git.download \
--pck-version "$pck_rpmversion" \
--destdir="$source_dir" "$fullURL" --destdir="$source_dir" "$fullURL"
;; ;;
*) curl.download --options "$curl_options" $sdflag \ *) curl.download --options "$curl_options" $sdflag \

View File

@ -99,3 +99,6 @@ msgstr "si è verificato un errore durante la creazione di"
msgid "creating the compressed source tarball" msgid "creating the compressed source tarball"
msgstr "creazione del file sorgente compresso" msgstr "creazione del file sorgente compresso"
msgid "done"
msgstr "fatto"