public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] RFC: [PATCH]: Test for presence of distcc before preclean to avoid failure
@ 2018-01-24  0:13 M. J. Everitt
  2018-01-24  3:45 ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: M. J. Everitt @ 2018-01-24  0:13 UTC (permalink / raw
  To: gentoo-catalyst


[-- Attachment #1.1.1: Type: text/plain, Size: 612 bytes --]

It would appear that the clean_stages function manages to successfully
remove distcc before the clean_distcc and subsequent functions are
called in stage3_preclean_chroot.sh, so the final 'emerge -C distcc'
fails because the package is no longer installed. This patch tests for
the existence of distcc before attempting an Unmerge. This may not be
the cleanest/best method of doing this, and doesn't account presently
for the failure of portageq or grep, but otherwise it has been tested on
my imx6 armv7a using distcc to my x86_64 crossdev box(es). Ack to Zac
for the suggestion.
Regards,

Michael.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 001-stage3-preclean-test-for-distcc.patch --]
[-- Type: text/x-patch; name="001-stage3-preclean-test-for-distcc.patch", Size: 519 bytes --]

diff --git a/targets/stage3/stage3-preclean-chroot.sh b/targets/stage3/stage3-preclean-chroot.sh
index 027dedea..324be17d 100755
--- a/targets/stage3/stage3-preclean-chroot.sh
+++ b/targets/stage3/stage3-preclean-chroot.sh
@@ -11,7 +11,10 @@ cleanup_stages
 
 if [ -n "${clst_DISTCC}" ]
 then
-	run_merge -C sys-devel/distcc || exit 1
+	portageq match / sys-devel/distcc 2>&1 | grep -s -q distcc
+	if [ $? == 0 ]; then
+		run_merge -C sys-devel/distcc || exit 1
+	fi
 fi
 
 if [ -n "${clst_ICECREAM}" ]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [gentoo-catalyst] RFC: [PATCH]: Test for presence of distcc before preclean to avoid failure
  2018-01-24  0:13 [gentoo-catalyst] RFC: [PATCH]: Test for presence of distcc before preclean to avoid failure M. J. Everitt
@ 2018-01-24  3:45 ` Mike Frysinger
  2018-01-24  9:28   ` M. J. Everitt
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2018-01-24  3:45 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

On 24 Jan 2018 00:13, M. J. Everitt wrote:
> --- a/targets/stage3/stage3-preclean-chroot.sh
> +++ b/targets/stage3/stage3-preclean-chroot.sh
> @@ -11,7 +11,10 @@ cleanup_stages
>  
>  if [ -n "${clst_DISTCC}" ]
>  then
> -	run_merge -C sys-devel/distcc || exit 1
> +	portageq match / sys-devel/distcc 2>&1 | grep -s -q distcc

just do a -n test on the output instead

although seems like portageq should be better with its exit status

> +	if [ $? == 0 ]; then

use `[[` instead of `[` when writing bash, especially when using
bash code like "==".
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-catalyst] RFC: [PATCH]: Test for presence of distcc before preclean to avoid failure
  2018-01-24  3:45 ` Mike Frysinger
@ 2018-01-24  9:28   ` M. J. Everitt
  0 siblings, 0 replies; 3+ messages in thread
From: M. J. Everitt @ 2018-01-24  9:28 UTC (permalink / raw
  To: gentoo-catalyst


[-- Attachment #1.1: Type: text/plain, Size: 1083 bytes --]

On 24/01/18 03:45, Mike Frysinger wrote:
> On 24 Jan 2018 00:13, M. J. Everitt wrote:
>> --- a/targets/stage3/stage3-preclean-chroot.sh
>> +++ b/targets/stage3/stage3-preclean-chroot.sh
>> @@ -11,7 +11,10 @@ cleanup_stages
>>  
>>  if [ -n "${clst_DISTCC}" ]
>>  then
>> -	run_merge -C sys-devel/distcc || exit 1
>> +	portageq match / sys-devel/distcc 2>&1 | grep -s -q distcc
> just do a -n test on the output instead
>
> although seems like portageq should be better with its exit status
Thanks Mike - I did take a look at the portageq source code, but after
consulting with Zac, we decided against changing exit codes at this
time, to preserve the [minimal] existing return code behaviour. I agree,
for this purpose, it would seem much more sensible, though, to simply
have a grep-like exit code to test straight-off ... Added to FEATUREREQ ;)
>> +	if [ $? == 0 ]; then
> use `[[` instead of `[` when writing bash, especially when using
> bash code like "==".
> -mike
Ooops, I usually do double-brackets - the curse of late-night coding .. :D

Michael.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-24  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-24  0:13 [gentoo-catalyst] RFC: [PATCH]: Test for presence of distcc before preclean to avoid failure M. J. Everitt
2018-01-24  3:45 ` Mike Frysinger
2018-01-24  9:28   ` M. J. Everitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox