diff --git a/ChangeLog b/ChangeLog index eebcd85..3bc48ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Changes in version 1.10.0 +Wed Apr 18 2012 Davide Madrisan + ++ improvement + * spec-create - Davide Madrisan: + Add code to create specfiles directly from git repositories. + Example: + autospec -s git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git \ + -o mcelog.spec + +-------------------------------------------------------------------------------- + Changes in version 1.9.4 Tue Apr 17 2012 Davide Madrisan diff --git a/NEWS b/NEWS index 525aeda..5c305b4 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +List of user visible changes in the release 1.10.0 + +-- Improvement + + * spec-create - Davide Madrisan: + Specfile can now be created directly from a git repository. + Here an example: + autospec -s git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git \ + -o mcelog.spec + +------------------------------------------------------------------------------- + List of user visible changes in the release 1.9.4 -- Improvement diff --git a/plugins/spec-create.in b/plugins/spec-create.in index de43f3d..55faa69 100644 --- a/plugins/spec-create.in +++ b/plugins/spec-create.in @@ -467,6 +467,7 @@ function specfile.create() { # 'pck_tarball' = absolute path of '$1' local pck_tarball + local pck_name pck_version case "$2" in http://*|https://*|ftp://*) @@ -480,6 +481,48 @@ ${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ pck_tarball=$source_dir/$pck_tarball ;; + git://*) + tmpgitdir=$(mktemp -q -d -t tmpgit.XXXXXXXX) + [ $? -eq 0 ] || + notify.error $"can't create temporary files" + notify.debug "$FUNCNAME: tmpgitdir = $tmpgitdir" + + pushd $tmpgitdir &>/dev/null + + # create a tarball by cloning the git repository + notify.note "${NOTE}"$"cloning git repository"" <$2>${NORM}""..." + git clone --quiet "$2" + [ $? -eq 0 ] || + { popd &>/dev/null + rm -fr $tmpgitdir + notify.error $"cannot clone git repository"; } + + pck_tarball="$(find -mindepth 1 -maxdepth 1 -type d -printf "%f")" + + # remove git files + rm -fr $pck_tarball/.git + rm -f $pck_tarball/.gitignore + + pck_version="$(date "+%Y%m%dgit")" + mv $pck_tarball ${pck_tarball}-${pck_version} + pck_tarball="${pck_tarball}-${pck_version}" + + # create a compressed tarball + tar -cvf ${pck_tarball}.tar $pck_tarball/ >/dev/null && + bzip2 ${pck_tarball}.tar && + mv ${pck_tarball}.tar.bz2 $source_dir/ + [ $? -eq 0 ] || + { popd &>/dev/null + rm -fr $tmpgitdir + notify.error $"\ +an error occurred while creating"": ${pck_tarball}.tar.bz2"; } + + spec_source="${pck_tarball}.tar.bz2" + pck_tarball=$source_dir/${spec_source} + + popd &>/dev/null + rm -fr $tmpgitdir + ;; *://*) notify.error $"unsupported protocol"": \`${2//\:*}'" ;; @@ -495,7 +538,7 @@ ${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ notify.error $"cannot find the package $pck_tarball" # get the package name from the tarball name - local pck_name=${3:-`echo $2 | sed -n "\ + [ "$pck_name" ] || pck_name=${3:-`echo $2 | sed -n "\ s/.*\/// # remove directory name, if any s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) /-[0-9]*/{s/-[0-9].*//p;q} # - @@ -509,7 +552,7 @@ ${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ [[ "${pck_newver//[0-9\.]/}" ]] && notify.error $"invalid version number"" -- \`$pck_newver'" - local pck_version=${4:-`echo $2 | sed -n "\ + [ "$pck_version" ] || pck_version=${4:-`echo $2 | sed -n "\ /[0-9]/!q # return nothing if no number is found in the package name s,.*/,, # remove directory name, if any s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) diff --git a/po/it/spec-create.po b/po/it/spec-create.po index fb6dc4a..5d530b0 100644 --- a/po/it/spec-create.po +++ b/po/it/spec-create.po @@ -1,5 +1,5 @@ # translation of it.po to Italiana -# Copyright (C) 2004-2008 Davide Madrisan +# Copyright (C) 2004-2008,2012 Davide Madrisan # Davide Madrisan msgid "" @@ -145,6 +145,12 @@ msgstr "ignorato" msgid "cannot download" msgstr "impossibile scaricare" +msgid "cloning git repository" +msgstr "clonazione del repository git" + +msgid "cannot clone git repository" +msgstr "impossibile clonare il repository git" + msgid "unsupported protocol" msgstr "protocollo non supportato"