Skip to contentSkip to conversation

README: Reflect missing --getopt in configure

PATCH In review Roman Bolshakov 4 participants 8 messages Sep 24, 2020 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 README: Reflect missing --getopt in configure

83760814f637 ("configure: Check for new-enough getopt") has replaced proposed patch and doesn't introduce --getopt option in configure. Instead, configure and run_tests.sh expect proper getopt to be available in PATH.

---
 README.macOS.md | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
README.macOS.md +6 -4
index 4ca5a57..62b00be 100644
@@ -22,10 +22,14 @@ $ brew install i686-elf-gcc
 $ brew install x86_64-elf-gcc
 ```
 
-32-bit x86 tests can be built like that:
+Make enhanced getopt available in the current shell session:
+```
+export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+```
+
+Then, 32-bit x86 tests can be built like that:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=i386 \
   --cross-prefix=i686-elf-
 $ make -j $(nproc)
@@ -34,7 +38,6 @@ $ make -j $(nproc)
 64-bit x86 tests can be built likewise:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=x86_64 \
   --cross-prefix=x86_64-elf-
 $ make -j $(nproc)
@@ -71,7 +74,6 @@ $ ct-ng -C $X_BUILD_DIR build CT_PREFIX=$X_INSTALL_DIR
 Once compiled, the cross-compiler can be used to build the tests:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=x86_64 \
   --cross-prefix=$X_INSTALL_DIR/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-
 $ make -j $(nproc)
Signature · 1 line
2.28.0
maintainer
#1 lore raw
Quoted 4 lines · Roman Bolshakov

83760814f637 ("configure: Check for new-enough getopt") has replaced proposed patch and doesn't introduce --getopt option in configure. Instead, configure and run_tests.sh expect proper getopt to be available in PATH.

Is this because getopt is "keg only"? I thought you could just add brew --prefix/bin to the path. You can also do "brew link" if there are no backwards-compatibility issues.

Paolo

Quoted 43 lines
---
 README.macOS.md | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
README.macOS.md +6 -4
index 4ca5a57..62b00be 100644
@@ -22,10 +22,14 @@ $ brew install i686-elf-gcc
 $ brew install x86_64-elf-gcc
 ```
 
-32-bit x86 tests can be built like that:
+Make enhanced getopt available in the current shell session:
+```
+export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+```
+
+Then, 32-bit x86 tests can be built like that:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=i386 \
   --cross-prefix=i686-elf-
 $ make -j $(nproc)
@@ -34,7 +38,6 @@ $ make -j $(nproc)
 64-bit x86 tests can be built likewise:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=x86_64 \
   --cross-prefix=x86_64-elf-
 $ make -j $(nproc)
@@ -71,7 +74,6 @@ $ ct-ng -C $X_BUILD_DIR build CT_PREFIX=$X_INSTALL_DIR
 Once compiled, the cross-compiler can be used to build the tests:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=x86_64 \
   --cross-prefix=$X_INSTALL_DIR/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-
 $ make -j $(nproc)
#2 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 4 lines · Roman Bolshakov

83760814f637 ("configure: Check for new-enough getopt") has replaced proposed patch and doesn't introduce --getopt option in configure. Instead, configure and run_tests.sh expect proper getopt to be available in PATH.

Is this because getopt is "keg only"? I thought you could just add brew --prefix/bin to the path. You can also do "brew link" if there are no backwards-compatibility issues.

Yes, keg-only packages do not shadow system utilities (which either come from FreeBSD or GNU but have the most recent GPL2 version, i.e. quite old), so adding brew --prefix/bin to PATH doesn't help much.

brew link doesn't help either :)

$ brew link gnu-getopt

Warning: Refusing to link macOS provided/shadowed software: gnu-getopt If you need to have gnu-getopt first in your PATH run:
echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

Thanks,
Roman

maintainer
#3 lore raw
Quoted 11 lines · Roman Bolshakov

Yes, keg-only packages do not shadow system utilities (which either come from FreeBSD or GNU but have the most recent GPL2 version, i.e. quite old), so adding brew --prefix/bin to PATH doesn't help much.

brew link doesn't help either :)

$ brew link gnu-getopt

Warning: Refusing to link macOS provided/shadowed software: gnu-getopt If you need to have gnu-getopt first in your PATH run:
echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

Oh, that's not what https://docs.brew.sh/FAQ says:

-----
What does “keg-only” mean?

It means the formula is installed only into the Cellar and is not linked into /usr/local. This means most tools will not find it. You can see why a formula was installed as keg-only, and instructions to include it in your PATH, by running brew info <formula>.

You can still link in the formula if you need to with brew link <formula>, though this can cause unexpected behaviour if you are shadowing macOS software.
-----

Apparently you need --force.

Paolo

#4 lore raw
Quoted 23 lines · Paolo Bonzini
Quoted 11 lines · Roman Bolshakov

Yes, keg-only packages do not shadow system utilities (which either come from FreeBSD or GNU but have the most recent GPL2 version, i.e. quite old), so adding brew --prefix/bin to PATH doesn't help much.

brew link doesn't help either :)

$ brew link gnu-getopt

Warning: Refusing to link macOS provided/shadowed software: gnu-getopt If you need to have gnu-getopt first in your PATH run:
echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

Oh, that's not what https://docs.brew.sh/FAQ says:

-----
What does “keg-only” mean?

It means the formula is installed only into the Cellar and is not linked into /usr/local. This means most tools will not find it. You can see why a formula was installed as keg-only, and instructions to include it in your PATH, by running brew info <formula>.

Quoted 7 lines

You can still link in the formula if you need to with brew link <formula>, though this can cause unexpected behaviour if you are shadowing macOS software.
-----

Apparently you need --force.

Unfortunately it has no effect (and I wouldn't want to do that to avoid issues with other scripts/software that implicitly depend on native utilities):

$ brew link --force gnu-getopt
Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

So if it's possible I'd still prefer to add an option to specify --getopt in configure. I can resend a patch for that.

Thanks,
Roman

maintainer
#5 lore raw
Quoted 11 lines · Roman Bolshakov

Unfortunately it has no effect (and I wouldn't want to do that to avoid issues with other scripts/software that implicitly depend on native utilities):

$ brew link --force gnu-getopt
Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

So if it's possible I'd still prefer to add an option to specify --getopt in configure. I can resend a patch for that.

No, I'm not going to accept that. It's just Apple's stupidity. I have applied your patch, rewriting the harness in another language would probably be a good idea though.

Paolo

#6 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 9 lines · Roman Bolshakov

Unfortunately it has no effect (and I wouldn't want to do that to avoid issues with other scripts/software that implicitly depend on native utilities):

$ brew link --force gnu-getopt
Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
Quoted 7 lines
Quoted 2 lines

So if it's possible I'd still prefer to add an option to specify --getopt in configure. I can resend a patch for that.

No, I'm not going to accept that. It's just Apple's stupidity. I have applied your patch, rewriting the harness in another language would probably be a good idea though.

I also feel like we've outgrown Bash, especially when we implement things like migration tests. We have had requests to keep it Bash though in order to continue running in resource constrained environments. I think we can have both. We could rewrite the harness is a different language and then compile/generate standalone tests (as we already do to some extent). The standalone tests need to be compiled/generated in such a way that they can run in resource constrained environments. Finally, with standalone tests the only test runner you need is

for t in ls tests; do
tests/$t
done

which can be written in the minimal scripting language of your choice.

Thanks,
drew

#7 lore raw
Quoted 14 lines · Andrew Jones
Quoted 13 lines · Paolo Bonzini
Quoted 11 lines · Roman Bolshakov

Unfortunately it has no effect (and I wouldn't want to do that to avoid issues with other scripts/software that implicitly depend on native utilities):

$ brew link --force gnu-getopt
Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

So if it's possible I'd still prefer to add an option to specify --getopt in configure. I can resend a patch for that.

Quoted 6 lines
Quoted 3 lines

No, I'm not going to accept that. It's just Apple's stupidity. I have applied your patch, rewriting the harness in another language would probably be a good idea though.

I also feel like we've outgrown Bash, especially when we implement things like migration tests.

Any chance that we could then use some pre-existing test runner instead of re-inventing the wheel? E.g. I think Avocado already has some basic support for running the kvm-unit-tests, IIRC.

Thomas