Skip to content
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

Add support for rebasing EOL extensions #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

doraskayo
Copy link

@doraskayo doraskayo commented Dec 18, 2021

From the main commit message:

jobs: Consider every build ref when determining the EOL prefix
    
We assume that:
*  There is always at least one build ref being committed.
*  Committed ref names always include a ref type followed by a "/"
   character. For example, "app/" or "runtime/".
*  The main ref isn't necessarily an "app/" ref. For example, in the
   case of extension-only repos, the main ref is a "runtime/" ref.
*  The main ref being committed has the shortest ref name when
   removing its ref type. For example:
   *  When the committed ref names are "app/org.app.App" and
      "runtime/org.app.App.Plugin", the main ref is "app/org.app.App".
   *  When the committed ref names are "runtime/org.app.App.Plugin"
      and "runtime/org.app.App.Plugin.Debug", the main ref is
      "runtime/org.app.App.Plugin".
*  The main ref with its ref type removed should be considered to be
   the old prefix for the purpose of EOL rebasing.
    
This should allow rebasing EOL extensions in addition to apps.

Note that while the assumptions above are based on my impression, they are not necessarily all correct. Please review thoroughly.

It's useful to be be able to see the executed command even when it's
successful.
We assume that:
*  There is always at least one build ref being committed.
*  Committed ref names always include a ref type followed by a "/"
   character. For example, "app/" or "runtime/".
*  The main ref isn't necessarily an "app/" ref. For example, in the
   case of extension-only repos, the main ref is a "runtime/" ref.
*  The main ref being committed has the shortest ref name when
   removing its ref type. For example:
   *  When the committed ref names are "app/org.app.App" and
      "runtime/org.app.App.Plugin", the main ref is "app/org.app.App".
   *  When the committed ref names are "runtime/org.app.App.Plugin"
      and "runtime/org.app.App.Plugin.Debug", the main ref is
      "runtime/org.app.App.Plugin".
*  The main ref with its ref type removed should be considered to be
   the old prefix for the purpose of EOL rebasing.

This should allow rebasing EOL extensions in addition to apps.
@gasinvein
Copy link
Member

The main ref being committed has the shortest ref name when removing its ref type.

Technically this assumption may be incorrect. As I understand, add-extensions with bundle: true allows exporting extensions with arbitrary IDs, not necessarily prefixed with the app ID. This is unlikely to be used in practice, though.

@@ -359,6 +361,12 @@ impl CommitJobInstance {
}
}

fn get_main_build_ref_name (build_refs: &Vec<models::BuildRef>) -> &str {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a slice instead of a &Vec no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, should it? What would be the benefit of using a slice in this case?

I'm definitely not an expert in Rust, so I'm open to any reasonable suggestions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -359,6 +361,12 @@ impl CommitJobInstance {
}
}

fn get_main_build_ref_name (build_refs: &Vec<models::BuildRef>) -> &str {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A getter function shouldn't have a get prefix

Copy link
Author

@doraskayo doraskayo Dec 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really a getter function, I guess. It's more of a helper function to find the main ref. Perhaps calling it find_main_build_ref_name would make it clearer?

@doraskayo
Copy link
Author

doraskayo commented Dec 18, 2021

The main ref being committed has the shortest ref name when removing its ref type.

Technically this assumption may be incorrect. As I understand, add-extensions with bundle: true allows exporting extensions with arbitrary IDs, not necessarily prefixed with the app ID. This is unlikely to be used in practice, though.

I couldn't find documentation which actually explains this aspect. Are you familiar with any repo where this funtionality is used? If I had access to one I could take a look and adjust the PR if necessary.

@gasinvein
Copy link
Member

Are you familiar with any repo where this funtionality used?

Not with unrelated extension ID, but here is org.chromium.Chromium app exporting a custom org.chromium.Chromium.Codecs extension. Imagine the extension had some ID not starting with org.chromium., e.g. org.flathub.ChromiumCodecs.

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