[PATCH 0/1] avoid user prompts when mk-build-deps is called

1,243 views
Skip to first unread message

Cedric_H...@mentor.com

unread,
Jan 25, 2018, 3:37:24 PM1/25/18
to isar-...@googlegroups.com, Cedric Hombourger
From: Cedric Hombourger <Cedric_H...@mentor.com>

commit 498b128 caused build dependencies to be installed via mk-build-deps.

The tool may ask the user to confirm their installation but would fail when
called from bitbake (no stdin). Override the default install command to add
the -y switch (assume yes).

Cedric Hombourger (1):
build.sh: eliminate potential prompts from mk-build-deps/apt-get

meta/recipes-devtools/buildchroot/files/build.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

--
2.11.0

Cedric_H...@mentor.com

unread,
Jan 25, 2018, 3:37:33 PM1/25/18
to isar-...@googlegroups.com, Cedric Hombourger
From: Cedric Hombourger <Cedric_H...@mentor.com>

commit 498b128 caused build dependencies to be installed via mk-build-deps.

The tool may ask the user to confirm installation of the dependencies but
would fail when called from bitbake (no stdin). Override the default install
command to add the -y switch to the apt-get command it uses.

Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/recipes-devtools/buildchroot/files/build.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh
index 975252e..760ebc8 100644
--- a/meta/recipes-devtools/buildchroot/files/build.sh
+++ b/meta/recipes-devtools/buildchroot/files/build.sh
@@ -6,8 +6,11 @@
# Go to build directory
cd $1

+# Install command to be used by mk-build-deps (use -y for non-interactive)
+install_cmd="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
+
# Install all build deps
-mk-build-deps -i -r debian/control
+mk-build-deps -t "${install_cmd}" -i -r debian/control

# If autotools files have been created, update their timestamp to
# prevent them from being regenerated
--
2.11.0

Jan Kiszka

unread,
Jan 26, 2018, 2:42:24 AM1/26/18
to Cedric_H...@mentor.com, isar-...@googlegroups.com
On 2018-01-25 21:36, Cedric_H...@mentor.com wrote:
> From: Cedric Hombourger <Cedric_H...@mentor.com>
>
> commit 498b128 caused build dependencies to be installed via mk-build-deps.
>
> The tool may ask the user to confirm installation of the dependencies but
> would fail when called from bitbake (no stdin). Override the default install
> command to add the -y switch to the apt-get command it uses.
>
> Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
> ---
> meta/recipes-devtools/buildchroot/files/build.sh | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh
> index 975252e..760ebc8 100644
> --- a/meta/recipes-devtools/buildchroot/files/build.sh
> +++ b/meta/recipes-devtools/buildchroot/files/build.sh
> @@ -6,8 +6,11 @@
> # Go to build directory
> cd $1
>
> +# Install command to be used by mk-build-deps (use -y for non-interactive)
> +install_cmd="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"

This sneaks in --no-install-recommends, which has a value, but it should
be separated out or at least mentioned.

Also, Debug::pkgProblemResolver=yes is worth mentioning, even when it
doesn't change the outcome of the installation.

Jan

> +
> # Install all build deps
> -mk-build-deps -i -r debian/control
> +mk-build-deps -t "${install_cmd}" -i -r debian/control
>
> # If autotools files have been created, update their timestamp to
> # prevent them from being regenerated
>

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

Hombourger, Cedric

unread,
Jan 26, 2018, 2:47:06 AM1/26/18
to Jan Kiszka, isar-...@googlegroups.com
Hi Jan,

If I am not mistaken these args were already passed before according to mk-build-deps (1); more specifically:

-t, --tool
When installing the generated package use the specified tool. (default: apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends)

I have carried them over to make sure we only add -y.

Cedric


-----Original Message-----
From: Jan Kiszka [mailto:jan.k...@siemens.com]
Sent: Friday, January 26, 2018 8:42 AM
To: Hombourger, Cedric <Cedric_H...@mentor.com>; isar-...@googlegroups.com
Subject: Re: [PATCH 1/1] build.sh: eliminate user prompts from mk-build-deps

On 2018-01-25 21:36, Cedric_H...@mentor.com wrote:
> From: Cedric Hombourger <Cedric_H...@mentor.com>
>
> commit 498b128 caused build dependencies to be installed via mk-build-deps.
>
> The tool may ask the user to confirm installation of the dependencies
> but would fail when called from bitbake (no stdin). Override the
> default install command to add the -y switch to the apt-get command it uses.
>
> Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
> ---
> meta/recipes-devtools/buildchroot/files/build.sh | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/buildchroot/files/build.sh
> b/meta/recipes-devtools/buildchroot/files/build.sh
> index 975252e..760ebc8 100644
> --- a/meta/recipes-devtools/buildchroot/files/build.sh
> +++ b/meta/recipes-devtools/buildchroot/files/build.sh
> @@ -6,8 +6,11 @@
> # Go to build directory
> cd $1
>
> +# Install command to be used by mk-build-deps (use -y for
> +non-interactive) install_cmd="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"

Jan Kiszka

unread,
Jan 26, 2018, 2:48:50 AM1/26/18
to Hombourger, Cedric, isar-...@googlegroups.com
On 2018-01-26 08:47, Hombourger, Cedric wrote:
> Hi Jan,
>
> If I am not mistaken these args were already passed before according to mk-build-deps (1); more specifically:
>
> -t, --tool
> When installing the generated package use the specified tool. (default: apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends)
>
> I have carried them over to make sure we only add -y.

Ah, sorry, then it's fine.

Jan

Henning Schild

unread,
Jan 29, 2018, 5:24:51 AM1/29/18
to Cedric_H...@mentor.com, isar-...@googlegroups.com
Am Thu, 25 Jan 2018 21:36:55 +0100
schrieb <Cedric_H...@mentor.com>:

> From: Cedric Hombourger <Cedric_H...@mentor.com>
>
> commit 498b128 caused build dependencies to be installed via
> mk-build-deps.
>
> The tool may ask the user to confirm installation of the dependencies
> but would fail when called from bitbake (no stdin). Override the
> default install command to add the -y switch to the apt-get command
> it uses.
>
> Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
> ---
> meta/recipes-devtools/buildchroot/files/build.sh | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/buildchroot/files/build.sh
> b/meta/recipes-devtools/buildchroot/files/build.sh index
> 975252e..760ebc8 100644 ---
> a/meta/recipes-devtools/buildchroot/files/build.sh +++
> b/meta/recipes-devtools/buildchroot/files/build.sh @@ -6,8 +6,11 @@
> # Go to build directory
> cd $1

Looks good to me.

> +# Install command to be used by mk-build-deps (use -y for
> non-interactive) +install_cmd="apt-get -o
> Debug::pkgProblemResolver=yes --no-install-recommends -y" +

The comment could indicate that everything before the "-y" is the
default. i.e.
# append "-y" to the default tool of mk-build-deps

That is where Jan was wondering and without having read the manpage it
is not clear.

> # Install all build deps
> -mk-build-deps -i -r debian/control
> +mk-build-deps -t "${install_cmd}" -i -r debian/control

Or we could drop the "-i" and explicitely call apt-get. But in the end
we would still have to carry the default tool options.
So i guess there is no point in doing that.

Henning

Alexander Smirnov

unread,
Jan 29, 2018, 8:50:01 AM1/29/18
to Cedric_H...@mentor.com, isar-...@googlegroups.com
Hello Cedric,

On 01/25/2018 11:36 PM, Cedric_H...@mentor.com wrote:
> From: Cedric Hombourger <Cedric_H...@mentor.com>
>
> commit 498b128 caused build dependencies to be installed via mk-build-deps.
> > The tool may ask the user to confirm their installation but would
fail when

Do you know in which circumstances this could happen?

Alex

Henning Schild

unread,
Jan 29, 2018, 10:59:39 AM1/29/18
to Alexander Smirnov, Cedric_H...@mentor.com, isar-...@googlegroups.com
Am Mon, 29 Jan 2018 16:49:51 +0300
schrieb Alexander Smirnov <asmi...@ilbers.de>:

> Hello Cedric,
>
> On 01/25/2018 11:36 PM, Cedric_H...@mentor.com wrote:
> > From: Cedric Hombourger <Cedric_H...@mentor.com>
> >
> > commit 498b128 caused build dependencies to be installed via
> > mk-build-deps.
> > > The tool may ask the user to confirm their installation but
> > > would
> fail when
>
> Do you know in which circumstances this could happen?

Basically whenever apt-get decides to become interactive and wants to
ask for confirmation. My patch removed an "apt-get ... -y" while the
"-y" should have stayed.

Henning

Alexander Smirnov

unread,
Jan 29, 2018, 11:15:01 AM1/29/18
to Henning Schild, isar-...@googlegroups.com
On 01/29/2018 06:59 PM, Henning Schild wrote:
> Am Mon, 29 Jan 2018 16:49:51 +0300
> schrieb Alexander Smirnov <asmi...@ilbers.de>:
>
>> Hello Cedric,
>>
>> On 01/25/2018 11:36 PM, Cedric_H...@mentor.com wrote:
>>> From: Cedric Hombourger <Cedric_H...@mentor.com>
>>>
>>> commit 498b128 caused build dependencies to be installed via
>>> mk-build-deps.
>>>> The tool may ask the user to confirm their installation but
>>>> would
>> fail when
>>
>> Do you know in which circumstances this could happen?
>
> Basically whenever apt-get decides to become interactive and wants to

I do understand what this patch does. My question is exactly when
"whenever" really happens. I've noticed such behavior several times for
different Debian tools, but it would be nice eventually to understand
this kind of magic.

BTW: for me it's not the point to block this patch.

Alex

Cedric_H...@mentor.com

unread,
Jan 29, 2018, 11:31:23 AM1/29/18
to isar-...@googlegroups.com, Cedric Hombourger
From: Cedric Hombourger <Cedric_H...@mentor.com>

commit 498b128 caused build dependencies to be installed via mk-build-deps.

The tool may ask the user to confirm installation of the dependencies but
would fail when called from bitbake (no stdin). Override the default install
command to add the -y switch to the apt-get command it uses.

Signed-off-by: Cedric Hombourger <Cedric_H...@mentor.com>
---
meta/recipes-devtools/buildchroot/files/build.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh
index 975252e..77e0fdd 100644
--- a/meta/recipes-devtools/buildchroot/files/build.sh
+++ b/meta/recipes-devtools/buildchroot/files/build.sh
@@ -6,8 +6,14 @@
# Go to build directory
cd $1

+# Install command to be used by mk-build-deps
+# Notes:
+# 1) everything before the -y switch is unchanged from the defaults
+# 2) we add -y to go non-interactive
+install_cmd="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
+
# Install all build deps
-mk-build-deps -i -r debian/control
+mk-build-deps -t "${install_cmd}" -i -r debian/control

# If autotools files have been created, update their timestamp to
# prevent them from being regenerated
--
2.11.0

Henning Schild

unread,
Jan 29, 2018, 1:17:31 PM1/29/18
to Cedric_H...@mentor.com, isar-...@googlegroups.com
Thanks!

Henning

Am Mon, 29 Jan 2018 17:31:05 +0100
schrieb <Cedric_H...@mentor.com>:

Henning Schild

unread,
Jan 30, 2018, 3:51:37 PM1/30/18
to Alexander Smirnov, Cedric_H...@mentor.com, isar-...@googlegroups.com
498b128 is still in next and could be fixed before hitting master. I am
all for keeping history, even if it contains mistakes so we just not
squash them.
Alex make sure to update the comment, should the hash change.

Henning

Am Mon, 29 Jan 2018 19:17:46 +0100
schrieb "[ext] Henning Schild" <henning...@siemens.com>:

chomb...@gmail.com

unread,
Feb 3, 2018, 4:49:30 AM2/3/18
to isar-users
Hi Alex,

A simple test case to demonstrate the issue consists in adding libpci-dev as a build dependency to example-hello
I have forked and modified hello for this purpose and modifed the recipe as follows:

diff --git a/meta-isar/recipes-app/example-hello/example-hello.bb b/meta-isar/recipes-app/example-hello/example-hello.bb
index 602a11e..af87428 100644
--- a/meta-isar/recipes-app/example-hello/example-hello.bb
+++ b/meta-isar/recipes-app/example-hello/example-hello.bb
@@ -10,8 +10,8 @@ LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260
 
 PV = "0.2+7bf716d2"
 
-SRC_URI = "git://github.com/ilbers/hello.git;protocol=https"
-SRCREV = "7bf716d22dbdb5a83edf0fe6134c0500f1a8b1f0"
+SRC_URI = "git://github.com/chombourger/hello.git;protocol=https"
+SRCREV = "3f05efe8cd471ce0313b5de6ea992c4a46e0e647"
 
 SRC_DIR = "git"
 
If I bitbake example-hello, do_build will fail. The log will show:

The following NEW packages will be installed:
  libpci-dev libpci3 zlib1g-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 317 kB of archives.
After this operation, 703 kB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.

We get an "Abort" because we do not have a stdin when building from bitbake.

Hope this helps

Cedric

Alexander Smirnov

unread,
Feb 3, 2018, 12:37:47 PM2/3/18
to chomb...@gmail.com, isar-users
Hi,

chomb...@gmail.com 3 февраля 2018 г. 12:49:41 написал:
Sure, thank you for the explanation!

BTW: applied to next.

>
> Cedric
>
> On Monday, January 29, 2018 at 5:15:01 PM UTC+1, Alexander Smirnov wrote:
>>
>> On 01/29/2018 06:59 PM, Henning Schild wrote:
>> > Am Mon, 29 Jan 2018 16:49:51 +0300
>> > schrieb Alexander Smirnov <asmi...@ilbers.de <javascript:>>:
>> >
>> >> Hello Cedric,
>> >>
>> >> On 01/25/2018 11:36 PM, Cedric_H...@mentor.com <javascript:> wrote:
>> >>> From: Cedric Hombourger <Cedric_H...@mentor.com <javascript:>>
>> >>>
>> >>> commit 498b128 caused build dependencies to be installed via
>> >>> mk-build-deps.
>> >>>> The tool may ask the user to confirm their installation but
>> >>>> would
>> >> fail when
>> >>
>> >> Do you know in which circumstances this could happen?
>> >
>> > Basically whenever apt-get decides to become interactive and wants to
>>
>> I do understand what this patch does. My question is exactly when
>> "whenever" really happens. I've noticed such behavior several times for
>> different Debian tools, but it would be nice eventually to understand
>> this kind of magic.
>>
>> BTW: for me it's not the point to block this patch.
>>
>> Alex
>>
>> > ask for confirmation. My patch removed an "apt-get ... -y" while the
>> > "-y" should have stayed.
>> >
>> > Henning
>> >
>> >> Alex
>> >>
>> >>> called from bitbake (no stdin). Override the default install
>> >>> command to add the -y switch (assume yes).
>> >>>
>> >>> Cedric Hombourger (1):
>> >>> build.sh: eliminate potential prompts from mk-build-deps/apt-get
>> >>>
>> >>> meta/recipes-devtools/buildchroot/files/build.sh | 5 ++++-
>> >>> 1 file changed, 4 insertions(+), 1 deletion(-)
>> >>>
>> >>
>> >
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to isar-users+...@googlegroups.com.
> To post to this group, send email to isar-...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-users/d7821b41-5b3e-4b7a-b5cb-08938945ac8a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
-


chomb...@gmail.com

unread,
Feb 4, 2018, 3:08:49 AM2/4/18
to isar-users
You're welcome and thank you!
(BTW: it does not look like you have pushed your updated "next" branch to GitHub -- no rush though)

Cedric
Reply all
Reply to author
Forward
0 new messages