Skip to content

Fix build-bundle command - #3032

Closed
mwleeds wants to merge 4 commits into
flatpak:masterfrom
mwleeds:fix-build-bundle
Closed

mwleeds wants to merge 4 commits into
flatpak:masterfrom
mwleeds:fix-build-bundle

Conversation

@mwleeds

@mwleeds mwleeds commented Jul 30, 2019

Copy link
Copy Markdown
Contributor

No description provided.

mwleeds added 3 commits July 25, 2019 08:21
Use the correct NONE flag, although both are 0 so this change won't make
any functional difference.
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).
Unfortunately in commit 253fcc6 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

Also, add a unit test that fails without this patch.

Fixes flatpak#3026

@wjt wjt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't exactly follow the ref-resolution logic but I do have one question about an assertion.

Comment thread app/flatpak-builtins-build-bundle.c Outdated
}
}

g_assert (*out_rev == NULL);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be a g_return_val_if_fail at the top of the function? It is not under this function's (direct) control.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right. Pushed a fixup

@alexlarsson

Copy link
Copy Markdown
Member

@rh-atomic-bot r+

@rh-atomic-bot

Copy link
Copy Markdown

📌 Commit 5a22e08 has been approved by alexlarsson

@rh-atomic-bot

Copy link
Copy Markdown

⌛ Testing commit 5a22e08 with merge 5e65174...

rh-atomic-bot pushed a commit that referenced this pull request Aug 15, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: #3032
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Aug 15, 2019
Unfortunately in commit 253fcc6 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

Also, add a unit test that fails without this patch.

Fixes #3026

Closes: #3032
Approved by: alexlarsson
@rh-atomic-bot

Copy link
Copy Markdown

☀️ Test successful - status-papr
Approved by: alexlarsson
Pushing 5e65174 to master...

mwleeds added a commit to mwleeds/flatpak that referenced this pull request Sep 16, 2019
Use the correct NONE flag, although both are 0 so this change won't make
any functional difference.

Closes: flatpak#3032
Approved by: alexlarsson

(cherry picked from commit 9a258e8)
mwleeds added a commit to mwleeds/flatpak that referenced this pull request Sep 16, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: flatpak#3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)
mwleeds added a commit to mwleeds/flatpak that referenced this pull request Sep 16, 2019
Unfortunately in commit 253fcc6 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

Also, add a unit test that fails without this patch.

Fixes flatpak#3026

Closes: flatpak#3032
Approved by: alexlarsson

(cherry picked from commit 5e65174)
alexlarsson pushed a commit to alexlarsson/flatpak that referenced this pull request Sep 18, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: flatpak#3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)
alexlarsson pushed a commit to alexlarsson/flatpak that referenced this pull request Sep 18, 2019
Unfortunately in commit 253fcc6 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

Also, add a unit test that fails without this patch.

Fixes flatpak#3026

Closes: flatpak#3032
Approved by: alexlarsson

(cherry picked from commit 5e65174)
rh-atomic-bot pushed a commit that referenced this pull request Sep 18, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)

Closes: #3111
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 18, 2019
Unfortunately in commit 253fcc6 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

Also, add a unit test that fails without this patch.

Fixes #3026

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit 5e65174)

Closes: #3111
Approved by: alexlarsson
alexlarsson pushed a commit that referenced this pull request Sep 18, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)
alexlarsson pushed a commit that referenced this pull request Sep 18, 2019
Unfortunately in commit 253fcc6 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

Also, add a unit test that fails without this patch.

Fixes #3026

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit 5e65174)
alexlarsson pushed a commit to alexlarsson/flatpak that referenced this pull request Sep 19, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: flatpak#3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)
(cherry picked from commit 8ed03ef)
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)
(cherry picked from commit 8ed03ef)

Closes: #3115
Approved by: alexlarsson
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.

4 participants