Closed pjljvandelaar closed 8 months ago
It took me a time to make the wincmd equivalent of the powershell example. Maybe you can return it as part of the help text (or put it somewhere in the documentation) to help others:
for /F "usebackq delims=" %x in (`alr printenv --wincmd`) DO %x
Also this trick has the same limitations as I described earlier in this issue!
Thanks for the detailed report and research! We took some measures to make some warnings that can happen during alr printenv
go to stderr, but these ones escaped. It's probably too fragile to try to achieve this anyway; maybe we can add to the help that the safe way to invoke printenv is with -q
, or force it ourselves.
Hello @pjljvandelaar
Looks like alr printenv --powershell | Invoke-Expression
didn't work because Alire is outputting more message.
I would recommend running alr printenv --powershell
first to see if there anything to update on the Alire side.
And then do alr printenv --powershell | Invoke-Expression
@Fabien-Chouteau You describe a workaround that is similar to what I am currently using. First alr build
to make sure everything is fine. And only then use alr printenv
.
My workaround might indeed be slower, since building does problably more than just printing the environment values.
maybe we can add to the help that the safe way to invoke printenv is with
-q
, or force it ourselves.
Even with -q, some additional lines are present:
$ alr -q printenv
checking build system type... x86_64-apple-darwin21.5.0
checking host system type... x86_64-apple-darwin21.5.0
checking target system type... x86_64-apple-darwin21.5.0
checking whether gnat can build shared libs... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
configure: creating ./config.status
config.status: creating xmlada_shared.gpr
config.status: creating Makefile
config.status: creating tests/dom/default.gpr
export ALIRE="True"
...
Thus I use: % eval $(alr -q printenv --unix|grep export)
I just encountered the same problem on linux. What do you think about omitting all messages except the environment when using --unix
, --wincmd
or --powershell
as these are likely used in an environment that tries to parse the output and therefor breaks if anything other than environment declarations are printed?
If you have some minimal example that produces output to stdout after the fix in #1327 and with -q
that would be very useful.
@Blady-Com, is that output caused by some post-fetch
action or the like?
I tried to build a version after #1327 but I'm always running into the following problem:
clic-config-info.ads:1:20: error: file "toml.ads" not found
clic-config-info.ads:1:20: error: "CLIC.CONFIG.INFO (body)" depends on "CLIC.CONFIG.INFO (spec)"
clic-config-info.ads:1:20: error: "CLIC.CONFIG.INFO (spec)" depends on "CLIC.CONFIG (spec)"
clic-config-info.ads:1:20: error: "CLIC.CONFIG (spec)" depends on "TOML (spec)"
clic-config-load.adb:2:06: error: file "toml-file_io.ads" not found
clic-config-load.ads:3:20: error: file "toml.ads" not found
clic-config-load.ads:3:20: error: "CLIC.CONFIG.LOAD (body)" depends on "CLIC.CONFIG.LOAD (spec)"
clic-config-load.ads:3:20: error: "CLIC.CONFIG.LOAD (spec)" depends on "CLIC.CONFIG (spec)"
clic-config-load.ads:3:20: error: "CLIC.CONFIG (spec)" depends on "TOML (spec)"
Steps to reproduce:
$ git clone https://github.com/alire-project/alire.git
$ git submodule update --init --recursive
$ alr build
$ alr version
APPLICATION
alr version: 1.2.2
libalire version: 1.2.2
compilation date: 2023-01-12 20:53:49
compiler version: Community 2021 (20210519-103)
CONFIGURATION
config folder: /home/.../.config/alire
force flag: FALSE
non-interactive flag: FALSE
community index branch: stable-1.2.1
compatible index versions: ^1.1 & <=1.2.1
indexes folder: /home/.../.config/alire/indexes
indexes metadata: OK
index #1: (community) git+https://github.com/alire-project/alire-index#stable-1.2.1
toolchain assistant: disabled
tool #1 gnat: gnat_native=12.2.1
tool #2 gprbuild: gprbuild=22.0.1
WORKSPACE
root status: VALID
root release: alr=1.3.0-dev
root load error: none
root folder: /tmp/alire
current folder: /tmp/alire
SYSTEM
distribution: UBUNTU
host-arch: X86_64
os: LINUX
target: NATIVE
toolchain: USER
word-size: BITS_64
I tried to build a version after #1327 but I'm always running into the following problem:
Let's try to stay on topic, but see here: https://github.com/alire-project/alire/issues/1326
I tried alr -q printenv
with an alire built from 0a19027cd31b1c999bf544c9285a7def2aa308ad and it didn't produce any unwanted output for me, even if it was downloading dependencies and setting up the toolchain. So at least for me it seems the problem is fixed in that version.
@Blady-Com, is that output caused by some
post-fetch
action or the like?
Yes that's right, try for instance templates_parser crate.
Alright, I can reproduce with templates_parser
. That's definitely something concrete to fix.
Dear Alire Developers,
alr help printenv
yieldsAlthough the last example is really helpful. It doesn't always work flawless
This happens when alire is executed for the first time on a project / directory and other output to report progress is also provided.
Hopes this helps to make alire even better!
Pierre