Skip to content

Add ability to have a pin version - #162

Draft
littlejo wants to merge 1 commit into
aya-rs:mainfrom
littlejo:stable-release
Draft

Add ability to have a pin version#162
littlejo wants to merge 1 commit into
aya-rs:mainfrom
littlejo:stable-release

Conversation

@littlejo

@littlejo littlejo commented Oct 27, 2025

Copy link
Copy Markdown

What

This PR adds support for an optional pinned version (rev_version) for Aya crates
(aya, aya-build, aya-ebpf, aya-log, aya-log-ebpf) in the aya-template.

Why

Previously, the template always pointed to the main branch of the Aya repository.
As a result, cargo-generate could break when new commits in Aya changed the public API
(e.g., removal of cargo_metadata from aya-build).

With this change, users can optionally provide rev_version to pin the template
dependencies to a specific commit, making generated projects more stable and reproducible.

Example usage

cargo generate https://github.com/aya-rs/aya-template --name my-project -d rev_version=a18e283e2afd6b85511f6f180069410def79f473

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/aya-rs/aya-template/162)
<!-- Reviewable:end -->

@vadorovsky

vadorovsky commented Oct 27, 2025

Copy link
Copy Markdown
Member

I don't think this will work, even for the latest release. APIs can be incompatible across versions and we need to handle these differences. Supporting all versions, or even N > 1 versions, is too much work IMO. I would just stick to one stable version.

What I think would make sense is a parameter like release = ["stable", "git"] and guarding the API-incompatible code with {% if release == "stable" %} / {% if release == "git" %}. What do you think?

Also, we would need to test both options in CI.

@littlejo

Copy link
Copy Markdown
Author

I don't think this will work, even for the latest release. APIs can be incompatible across versions and we need to handle these differences. Supporting all versions, or even N > 1 versions, is too much work IMO. I would just stick to one stable version.

What I think would make sense is a parameter like release = ["stable", "git"] and guarding the API-incompatible code with {% if release == "stable" %} / {% if release == "git" %}. What do you think?

Yes, you're probably right

@vadorovsky

Copy link
Copy Markdown
Member

I don't think this will work, even for the latest release. APIs can be incompatible across versions and we need to handle these differences. Supporting all versions, or even N > 1 versions, is too much work IMO. I would just stick to one stable version.
What I think would make sense is a parameter like release = ["stable", "git"] and guarding the API-incompatible code with {% if release == "stable" %} / {% if release == "git" %}. What do you think?

Yes, you're probably right

Are you willing to give it a try? 🙂

@littlejo

Copy link
Copy Markdown
Author

I don't think this will work, even for the latest release. APIs can be incompatible across versions and we need to handle these differences. Supporting all versions, or even N > 1 versions, is too much work IMO. I would just stick to one stable version.
What I think would make sense is a parameter like release = ["stable", "git"] and guarding the API-incompatible code with {% if release == "stable" %} / {% if release == "git" %}. What do you think?

Yes, you're probably right

Are you willing to give it a try? 🙂

I tested on another branch:

https://github.com/littlejo/aya-template/tree/stable-release3

But i have a lot of errors:

error[E0277]: the trait bound `EbpfLogger: AsRawFd` is not satisfied
   --> testaaa/src/main.rs:46:57
    |
 46 |                 tokio::io::unix::AsyncFd::with_interest(logger, tokio::io::Interest::READABLE)?;
    |                 --------------------------------------- ^^^^^^ the trait `AsRawFd` is not implemented for `EbpfLogger`
    |                 |
    |                 required by a bound introduced by this call
    |
    = help: the following other types implement trait `AsRawFd`:
              Arc<T>
              AsyncFd<T>
              BorrowedFd<'_>
              Box<T>
              ChildStderr
              ChildStdin
              ChildStdout
              File
            and 47 others
note: required by a bound in `AsyncFd::<T>::with_interest`
   --> /root/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/io/async_fd.rs:210:9
    |
210 | impl<T: AsRawFd> AsyncFd<T> {
    |         ^^^^^^^ required by this bound in `AsyncFd::<T>::with_interest`
...
243 |     pub fn with_interest(inner: T, interest: Interest) -> io::Result<Self>
    |            ------------- required by a bound in this associated function

error[E0277]: the trait bound `EbpfLogger: AsRawFd` is not satisfied
   --> testaaa/src/main.rs:46:17
    |
 46 |                 tokio::io::unix::AsyncFd::with_interest(logger, tokio::io::Interest::READABLE)?;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsRawFd` is not implemented for `EbpfLogger`
    |
    = help: the following other types implement trait `AsRawFd`:
              Arc<T>
              AsyncFd<T>
              BorrowedFd<'_>
              Box<T>
              ChildStderr
              ChildStdin
              ChildStdout
              File
            and 47 others
note: required by a bound in `AsyncFd`
   --> /root/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/io/async_fd.rs:181:23
    |
181 | pub struct AsyncFd<T: AsRawFd> {
    |                       ^^^^^^^ required by this bound in `AsyncFd`

error[E0277]: the trait bound `EbpfLogger: AsRawFd` is not satisfied
   --> testaaa/src/main.rs:46:17
    |
 46 |                 tokio::io::unix::AsyncFd::with_interest(logger, tokio::io::Interest::READABLE)?;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsRawFd` is not implemented for `EbpfLogger`
    |
    = help: the following other types implement trait `AsRawFd`:
              Arc<T>
              AsyncFd<T>
              BorrowedFd<'_>
              Box<T>
              ChildStderr
              ChildStdin
              ChildStdout
              File
            and 47 others
note: required by a bound in `AsyncFd`
   --> /root/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.48.0/src/io/async_fd.rs:181:23
    |
181 | pub struct AsyncFd<T: AsRawFd> {
    |                       ^^^^^^^ required by this bound in `AsyncFd`

error[E0599]: the method `readable_mut` exists for struct `AsyncFd<EbpfLogger>`, but its trait bounds were not satisfied
  --> testaaa/src/main.rs:49:44
   |
49 |                     let mut guard = logger.readable_mut().await.unwrap();
   |                                            ^^^^^^^^^^^^ method cannot be called on `AsyncFd<EbpfLogger>` due to unsatisfied trait bounds
   |
  ::: /root/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/aya-log-0.2.1/src/lib.rs:97:1
   |
97 | pub struct EbpfLogger;
   | --------------------- doesn't satisfy `EbpfLogger: AsRawFd`
   |
   = note: the following trait bounds were not satisfied:
           `EbpfLogger: AsRawFd`

@tamird
tamird marked this pull request as draft April 14, 2026 17:36
@provokateurin

Copy link
Copy Markdown

@littlejo I was hitting the same build failures as you (while trying to use the latest versions from crates.io) and managed to get it building by reverting these changes: 0158e1b

I would also appreciate a lot of the template was using exact specified versions instead of git dependencies.

@provokateurin

Copy link
Copy Markdown

@tamird would you please follow up on #152 (review)? 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants