Commit graph

13 commits

Author SHA1 Message Date
Jiahao XU
14c606d72b
Simplify BinFile::link_dest
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 23:27:16 +10:00
Jiahao XU
43238e39a3
Use atomic_symlink_file in install_link
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 23:26:46 +10:00
Jiahao XU
e9c86dfad4
Rm set_permissions in BinFile::install_bin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 22:51:50 +10:00
Jiahao XU
97bfeb7bd8
Use atomic_install in install_bin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 21:27:44 +10:00
Félix Saparelli
c0eaffb05d
Refactor for rich errors, split user abort and genuine error 2022-06-01 00:29:14 +12:00
Félix Saparelli
fbf26634c9
Formatting 2022-05-31 17:37:40 +12:00
Félix Saparelli
1757dc5344
Make fetcher creating infallible (#118)
Fixes #109
2022-04-29 09:24:46 +12:00
Félix Saparelli
62ec23e6f4
Use the correct link name (#117)
On windows, but also use templating to render it correctly everywhere.

Fixes #106
Fixes #111
2022-04-29 09:24:19 +12:00
наб
f76791b9b9
Direct the symlink the right way in symlink info!(), point at actual destination 2022-03-13 16:32:58 +01:00
наб
5b4909f9eb
Link to basename instead of absolute path on unix
This renders the link (a) more likely to fit in an ext4 inode
and more importantly (b) makes the bindir impervious to being moved
around
2022-03-13 16:32:55 +01:00
Félix Saparelli
b5d6d68d6d Fix quickinstall failing when packages are not wrapped in a folder 2022-02-16 22:42:37 +13:00
Félix Saparelli
6dcb1dd1b4
Split {format} and allow use of {binary-ext} in pkg-url (#95)
This from feedback in #19:

> wrt. bin-dir and bin-path, this appears to be a typo / should all be called bin-dir

This is only a readme fix afaict, I changed all occurences of `bin-path` in there to `bin-dir`.

> wrt. format, those are actually two (unfortunately named) different concepts, the first
refers to the archive format (eg. .tgz), the second to the binary format (which needs a .exe
appended for windows).

This introduces two new substitutions:
- `binary-ext` is the old "`format` in `bin-dir`"
- `archive-format` is the old "`format` in `pkg-url`"

Contents are unchanged: `binary-ext` includes the dot, `archive-format` doesn't. That
makes it easy to upgrade and also personally I slightly prefer it that way.

The old contextual `format` is still available, "soft deprecated": it will be accepted silently
so everything will work, but all documentation will use the new syntax. In the future we
could move to a "hard deprecated" model where installing a package that uses `format`
will warn the user / tell them to report that to the maintainer. I don't think we'll ever really
be able to remove it but that should be good enough.

A cool new feature is that `binary-ext` is now usable in `pkg-url`, which will be useful for raw binary downloads:

```toml
pkg_url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-{ target }{ binary-ext }"
```

I've also added a bunch of tests to GhCrateMeta around the templating for `pkg-url`.
2022-02-16 16:18:35 +13:00
Félix Saparelli
370ae05620
QuickInstall support (#94)
See this issue: https://github.com/alsuren/cargo-quickinstall/issues/27

Quick Install is a hosted repo of built crates, essentially. The approach I've taken here is
a list of strategies:

1. First, we check the crate meta or default and build the URL to the repo. Once we have
   that, we perform a `HEAD` request to the URL to see if it's available.
2. If it's not, we build the URL to the quickinstall repo, and perform a `HEAD` to there.

As soon as we've got a hit, we use that. I've built it so it's extensible with more strategies.
This could be useful for #4.

This also adds a prompt before downloading from third-party sources, and logs a short
name for a source, which is easier to glance than a full URL, and includes a quick refactor
of the install/link machinery.
2022-02-16 14:49:07 +13:00