-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow alire to access indexes using ssh #1207
Allow alire to access indexes using ssh #1207
Conversation
@reznikmm can you help us fix this? -> https://github.com/alire-project/clic/blob/c7aabf94e0946ae3a5b77c29cc45fd28f70e17f6/src/clic-tty.ads#L101 |
I'm surprised because I thought this was enough:
|
That character isn't a Latin-1 character, but String contains only Latin-1 subset of Unicode. That's why compiler is complaining. If you want to keep using String to handle UTF-8 values, then you can use a conversion function like y : constant String :=
Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode
("✓"); The with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Ada.Text_IO;
procedure Main is
y : constant String :=
Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode
("✓");
begin
Ada.Text_IO.Put_Line (y);
end Main;
One way of fixing output is to decode UTF-8 to with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Ada.Wide_Wide_Text_IO;
procedure Main is
y : constant String :=
Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode
("✓");
begin
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Decode (y));
end Main; If this is too intrusive to you, then you could revert
(Values are described in GNAT RM). with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Ada.Text_IO;
procedure Main is
y : constant String :=
Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode
("✓");
begin
Ada.Text_IO.Put_Line (y);
end Main;
I hope my explanation help. |
Is it time to start to separate stream elements and text strings and to migrate to VSS? ;) |
Yup, at the bare minimum we need clean type separation. Oh well, let's not derail this PR any more. I'm sorry, @rowan-walshe, it seems your PR will have to wait for a little while until this is fixed. |
So I've run into a few more issues that aren't fixed by this change so far. Currently it appears that Alire is setup to work assuming everything is public (i.e. the index, and the things that crates in an index can link out to like git commits or tarballs). Obviously downloading a tarball that is not publicly accessible is hard to handle, as how would Alire know how to authenticate with the download service. Fortunately with git this is not an issue as Alire just uses the system's git, and therefore, assuming the user has the relevant ssh key stuff setup, Alire theoretically shouldn't have do anything different to what it currently does when calling out to git. However, as Alire assumes that git repositories are publicly accessible, there are a number of defensive checks scattered around to help out in cases where a git@ URL is provided instead of a http URL. In some cases (all?) it will also try to convert a git@ URL to a public http URL. Theoretically if these checks were removed, it should allow users to setup and run private indexes that contain private crates. I understand that for public indexes, like the community index, you would still want all crates to be publicly accessible, and CI checks could be added to make sure this is the case (if there isn't already something similar). I didn't want dig deeper into making changes if people had objections to this, or think it should be done in a different way. Maybe this question/suggestion is too big for this PR. Let me know if I should raise a ticket for it to be discussed |
Right, publish was implemented with the idea that the crate destination is the community index. Some checks have been already relaxed with |
Has this feature been abandoned or implemented elsewhere? We also would like to use a private index with ssh keys. I'm happy to contribute back to finish this if there is anything left to get it merged! |
Not implemented yet, simply because of lack of time. If you want to help with it, you're certainly welcome. From looking at the patch, it looks like this does the bare minimum to allow adding an index with |
Should I create a new pull request or can @rowan-walshe maybe give me permissions to contribute to this branch? Thanks! |
It's OK if you pick up were Rowan left and open a new PR from your own fork. |
@dalybrown Feel free to pick this up where I left off (not that I'd done much). Note that on playing around with Alire more, I found that while undocumented, it is possible to use Alire with indexes accessed using ssh already. For example, normally you might add an index like:
It is possible to add the same index using ssh:
Note that this is not a direct copy of the field from GitHub. GitHub gives you:
Then you need to add |
Sounds good. I have my own fork of it and am now using it internally with ssh. Once we've used it a bit more and are confident it works are required I'll update this pull request. |
Merged via #1571 |
Currently to add a remote index alire expects the URL that starts
git+
. SSH urls will normally startgit@
instead. By changing a few checks, alire is able to access an index via ssh.This is useful for if you want to host a non public index, but don't want to enter a username and password to be able to access the index (which is not best practice security wise).