gcc: download_prerequisites: add --verbose and --no-verbose
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
Commit Message
When executing the script download_prerequisites, the download speed may
be extremely slow and there is no any output, the users do not know what
happened.
Given the command wget and curl have options --verbose and --no-verbose,
add them for download_prerequisites to give a chance to see the details.
contrib/ChangeLog:
* download_prerequisites
(helptext): Document --verbose and --no-verbose.
<arg parse>: Parse --verbose and --no-verbose.
<fetch command>: Set option for wget and curl.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
contrib/download_prerequisites | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
Comments
On Tue, Dec 3, 2024 at 7:09 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> When executing the script download_prerequisites, the download speed may
> be extremely slow and there is no any output, the users do not know what
> happened.
>
> Given the command wget and curl have options --verbose and --no-verbose,
> add them for download_prerequisites to give a chance to see the details.
>
For how long have they had these options? My curl (8.10.1) doesn't
seem to be listing `--no-verbose` among its `--help all` list of
options...
> contrib/ChangeLog:
>
> * download_prerequisites
> (helptext): Document --verbose and --no-verbose.
> <arg parse>: Parse --verbose and --no-verbose.
> <fetch command>: Set option for wget and curl.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> contrib/download_prerequisites | 28 ++++++++++++++++++++++------
> 1 file changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
> index 6adc97ef896..7a42bf141b0 100755
> --- a/contrib/download_prerequisites
> +++ b/contrib/download_prerequisites
> @@ -48,13 +48,9 @@ graphite=1
> verify=1
> force=0
> only_gettext=false
> +verbose=0
> OS=$(uname)
>
> -if type wget > /dev/null ; then
> - fetch='wget'
> -else
> - fetch='curl -LO'
> -fi
> chksum_extension='sha512'
> directory='.'
>
> @@ -77,6 +73,8 @@ The following options are available:
> --sha512 use SHA512 checksum to verify package integrity (default)
> --md5 use MD5 checksum to verify package integrity
> --only-gettext inhibit downloading any package but gettext
> + --verbose make the operation more talkative
> + --no-verbose turn off verboseness, without being quiet (default)
> --help show this text and exit
> --version show version information and exit
> "
> @@ -165,6 +163,12 @@ do
> --only-gettext)
> only_gettext=true
> ;;
> + --verbose)
> + verbose=1
> + ;;
> + --no-verbose)
> + verbose=0
> + ;;
> -*)
> die "unknown option: ${arg}"
> ;;
> @@ -227,11 +231,23 @@ esac
> [ -d "${directory}" ] \
> || die "No such directory: ${directory}"
>
> +if [ ${verbose} -gt 0 ]; then
> + option="--verbose"
> +else
> + option="--no-verbose"
> +fi
> +
> +if type wget > /dev/null ; then
> + fetch="wget ${option}"
> +else
> + fetch="curl -LO ${option}"
> +fi
> +
> for ar in $(echo_archives)
> do
> if [ ${force} -gt 0 ]; then rm -f "${directory}/${ar}"; fi
> [ -e "${directory}/${ar}" ] \
> - || ( cd "${directory}" && ${fetch} --no-verbose "${base_url}${ar}" ) \
> + || ( cd "${directory}" && ${fetch} "${base_url}${ar}" ) \
> || die "Cannot download ${ar} from ${base_url}"
> done
> unset ar
> --
> 2.42.0
>
On 12/03/2024 09:12 PM, Eric Gallager wrote:
> On Tue, Dec 3, 2024 at 7:09 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>>
>> When executing the script download_prerequisites, the download speed may
>> be extremely slow and there is no any output, the users do not know what
>> happened.
>>
>> Given the command wget and curl have options --verbose and --no-verbose,
>> add them for download_prerequisites to give a chance to see the details.
>>
>
> For how long have they had these options? My curl (8.10.1) doesn't
> seem to be listing `--no-verbose` among its `--help all` list of
> options...
In the curl man page [1] or "curl --manual | grep no-verbose",
there is "--no-verbose", but there is no this option in the
output of "curl --help". I do not know the internal history.
When executing the curl command, "--no-verbose" is a valid
option but seems no effect like the option "--silent".
In the current code, "curl -LO --no-verbose" looks like
somehow unreasonable, the output is not expected. Since
wget is a frequently-used command, is it possible to
remove the curl command in download_prerequisites?
I will send v2 to do this for your review.
[1] https://curl.se/docs/manpage.html#-v
Thanks,
Tiezhu
On Wed, 2024-12-04 at 10:28 +0800, Tiezhu Yang wrote:
> On 12/03/2024 09:12 PM, Eric Gallager wrote:
> > On Tue, Dec 3, 2024 at 7:09 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> > >
> > > When executing the script download_prerequisites, the download speed may
> > > be extremely slow and there is no any output, the users do not know what
> > > happened.
> > >
> > > Given the command wget and curl have options --verbose and --no-verbose,
> > > add them for download_prerequisites to give a chance to see the details.
> > >
> >
> > For how long have they had these options? My curl (8.10.1) doesn't
> > seem to be listing `--no-verbose` among its `--help all` list of
> > options...
>
> In the curl man page [1] or "curl --manual | grep no-verbose",
> there is "--no-verbose", but there is no this option in the
> output of "curl --help". I do not know the internal history.
>
> When executing the curl command, "--no-verbose" is a valid
> option but seems no effect like the option "--silent".
>
> In the current code, "curl -LO --no-verbose" looks like
> somehow unreasonable, the output is not expected. Since
> wget is a frequently-used command, is it possible to
> remove the curl command in download_prerequisites?
Doing so may force many running CI systems to update their container
image. Don't do that.
AFAIK --no-verbose just cancels out a prior --verbose and it's not same
as --quiet. I.e. there are 3 different console output levels, --quiet,
--no-verbose (the default), and --verbose.
Try "curl --verbose example.org -Lo /dev/null", "curl example.org -Lo
/dev/null", and "curl --silent example.org -Lo /dev/null" yourself.
On 12/04/2024 10:33 AM, Xi Ruoyao wrote:
> On Wed, 2024-12-04 at 10:28 +0800, Tiezhu Yang wrote:
>> On 12/03/2024 09:12 PM, Eric Gallager wrote:
>>> On Tue, Dec 3, 2024 at 7:09 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>>>>
>>>> When executing the script download_prerequisites, the download speed may
>>>> be extremely slow and there is no any output, the users do not know what
>>>> happened.
>>>>
>>>> Given the command wget and curl have options --verbose and --no-verbose,
>>>> add them for download_prerequisites to give a chance to see the details.
>>>>
>>>
>>> For how long have they had these options? My curl (8.10.1) doesn't
>>> seem to be listing `--no-verbose` among its `--help all` list of
>>> options...
>>
>> In the curl man page [1] or "curl --manual | grep no-verbose",
>> there is "--no-verbose", but there is no this option in the
>> output of "curl --help". I do not know the internal history.
>>
>> When executing the curl command, "--no-verbose" is a valid
>> option but seems no effect like the option "--silent".
>>
>> In the current code, "curl -LO --no-verbose" looks like
>> somehow unreasonable, the output is not expected. Since
>> wget is a frequently-used command, is it possible to
>> remove the curl command in download_prerequisites?
>
> Doing so may force many running CI systems to update their container
> image. Don't do that.
>
> AFAIK --no-verbose just cancels out a prior --verbose and it's not same
> as --quiet. I.e. there are 3 different console output levels, --quiet,
> --no-verbose (the default), and --verbose.
>
> Try "curl --verbose example.org -Lo /dev/null", "curl example.org -Lo
> /dev/null", and "curl --silent example.org -Lo /dev/null" yourself.
Thanks for your explanation. I tried to run the above three commands,
the output is different.
So if I understand correctly, "--no-verbose" is a valid option for curl
and wget, there is no need to change this patch.
Cc more Global Reviewers who can approve these changes.
https://inbox.sourceware.org/gcc-patches/20241203120801.15317-1-yangtiezhu@loongson.cn/
Thanks,
Tiezhu
@@ -48,13 +48,9 @@ graphite=1
verify=1
force=0
only_gettext=false
+verbose=0
OS=$(uname)
-if type wget > /dev/null ; then
- fetch='wget'
-else
- fetch='curl -LO'
-fi
chksum_extension='sha512'
directory='.'
@@ -77,6 +73,8 @@ The following options are available:
--sha512 use SHA512 checksum to verify package integrity (default)
--md5 use MD5 checksum to verify package integrity
--only-gettext inhibit downloading any package but gettext
+ --verbose make the operation more talkative
+ --no-verbose turn off verboseness, without being quiet (default)
--help show this text and exit
--version show version information and exit
"
@@ -165,6 +163,12 @@ do
--only-gettext)
only_gettext=true
;;
+ --verbose)
+ verbose=1
+ ;;
+ --no-verbose)
+ verbose=0
+ ;;
-*)
die "unknown option: ${arg}"
;;
@@ -227,11 +231,23 @@ esac
[ -d "${directory}" ] \
|| die "No such directory: ${directory}"
+if [ ${verbose} -gt 0 ]; then
+ option="--verbose"
+else
+ option="--no-verbose"
+fi
+
+if type wget > /dev/null ; then
+ fetch="wget ${option}"
+else
+ fetch="curl -LO ${option}"
+fi
+
for ar in $(echo_archives)
do
if [ ${force} -gt 0 ]; then rm -f "${directory}/${ar}"; fi
[ -e "${directory}/${ar}" ] \
- || ( cd "${directory}" && ${fetch} --no-verbose "${base_url}${ar}" ) \
+ || ( cd "${directory}" && ${fetch} "${base_url}${ar}" ) \
|| die "Cannot download ${ar} from ${base_url}"
done
unset ar