`source .` v.s. `source <url>`

Did you create the tags via the console or via … ?

I create tags via the Create a new release on github :sweat_smile:

With source: <url_of_the_repository>.git, the tags can be get, which means there should be no problem with my repository.

Oups ! :slightly_smiling_face:

The following line is commented in your *.yaml file, remove the comment.

craftctl set version=$(git describe --tags --abbrev=0)

That was intentionally, I use the echo $(git describe --tags --abbrev=0) to see what it get.

And as shown previous:

  • with source: .: it return fatal: No names found, cannot describe anything.
  • with source: <url>: it return v0.1.6

I can’t understand the difference here.

That’s weird.

Is your git repository public ?

That’s exactly why I ask the question.

Here it is https://github.com/gapplef/yazi

Well :wink:.

I test this now and give feedback.

I cloned your Github repository and move the file (from the root project) snap/snapcraft.yaml in the root directory, then I remove the snap directory (because it is void now).

The effect of the previous scenario gives me this, when I run the ls command in the root directory of your project.

Here is the content of the *.yaml file after some modifications :

name: yazi
adopt-info: yazi
base: core22
version: 0.1.6
summary: Blazing fast terminal file manager
description: |
    Yazi, which means "duck", is a terminal file manager written in Rust, based on non-blocking async I/O.
    It aims to provide an efficient, user-friendly, and customizable file management experience.
license: MIT

grade: stable
confinement: classic

architectures:
  - build-on: amd64
    build-for: amd64


apps:
  yazi:
    command: yazi
    environment:
      PATH: $SNAP/bin:$PATH

parts:
  yazi:
    plugin: rust
    source: .
    override-build: |
      craftctl default
      craftctl set version=$(git describe --tags --abbrev=0)
      echo $(git describe --tags --abbrev=0)
      cargo install fd-find --root $CRAFT_PART_INSTALL
      cargo install ripgrep --root $CRAFT_PART_INSTALL
      cargo install zoxide --root $CRAFT_PART_INSTALL
      git clone --depth 1 https://github.com/junegunn/fzf.git fzf
      fzf/install --bin && mv fzf/bin/fzf $CRAFT_PART_INSTALL/bin/


After, the previous scenario I just executed the command snapcraft (from the root of your project) to build your project, like this :

snapcraft

The bug with fatal: No names found, cannot describe anything. was not raised.

Build successfully :slight_smile: .

So this is a bug of snapcraft?

I mean with snap/snapcraft.yaml and source: ., the snap can be build, but the git tag info are missing unintentionally.

Indeed, the error is due to the location of the *.yaml configuration file. To avoid errors of this nature, you must put the *.yaml file at the root of your project.

Scenario 1 → projectRoot/snap/snapcraft.yaml

source: .

When you do this source: . ( scenario 1 ) The period means here, so the build will be done from here (the directory where your .yaml file is located). In this sense if the .yaml file is not directly accessible from the root directory or if the .yaml file is not in the root of the project (directly visible/accessible) you will get an error due to (missing files, dependencies … where is the root directory ??? not here (.) ).

Scenario 2 → projectRoot/snap/snapcraft.yaml

source: https://github.com/ephemeral.git

In this sense, your project will be automatically downloaded in projectRoot/snap, yes in the snap directory (such as projectRoot/snap/projectRoot`). So in this sense no problem about where is the root directory of the project, because it will be a direct neighbor with the *.yaml file.

It’s very important to specify where the root directory of the project is located with the scenario 1.


When the root directory of your project is verbatim/projectRoot and that, the *.yaml file is located in verbatim/projectRoot/snap/snapcraft.yaml, if you deal with the scenario 1, the source property will be :

source: ..

To indicate the root project is located one step back.

I think you still not understand what the problem is.

As I emphasized many times, there is nothing wrong with snap/snapcraft.yaml + source: ., please move on from it.

Actually this is the default choice of many projects on github, for example the official appcenter.

You may put the following snapcraft.yaml file under snap folder and try out yourself.

name: yazi
base: core22
version: 0.1.6
summary: Blazing fast terminal file manager
description: |
    Yazi, which means "duck", is a terminal file manager written in Rust, based on non-blocking async I/O.
    It aims to provide an efficient, user-friendly, and customizable file management experience.
license: MIT

grade: stable
confinement: classic

architectures:
  - build-on: amd64
    build-for: amd64


apps:
  yazi:
    command: yazi
    environment:
      PATH: $SNAP/bin:$PATH

parts:
  yazi:
    plugin: rust
    source: .
    override-build: |
      craftctl default
      git describe --tags --abbrev=0
      cargo install fd-find --root $CRAFT_PART_INSTALL
      cargo install ripgrep --root $CRAFT_PART_INSTALL
      cargo install zoxide --root $CRAFT_PART_INSTALL
      git clone --depth 1 https://github.com/junegunn/fzf.git fzf
      fzf/install --bin && mv fzf/bin/fzf $CRAFT_PART_INSTALL/bin/

snapcraft can handle it, the snap can be build without any problem, at least for me, with github actions. And as I have told you, source: .. doesn’t work.

The problem is I can’t get tag information as expected with the above .yaml file.

Okay, I try another scenarios.

For my part, I saw the tags information during the build.

On base the scenario (snap/snapcraft.yaml), when I do this source: .. an error is raised, be sure the path is absolutely correct. The problem are somewhere, I will check where the problems are.

Hi ! @yelf .

How to proceed in this answer, this is the only functional scenario that I found compared to your yaml config file (with the changing source section) .