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

cmd/snap-gpio-helper: add skeleton with re-exec support #15023

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

Conversation

ZeyadYasser
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Feb 4, 2025

Thu Feb 6 11:43:42 UTC 2025
The following results are from: https://github.com/canonical/snapd/actions/runs/13176027131

Failures:

Executing:

  • google-core:ubuntu-core-24-64:tests/core/gadget-update-pc

Restoring:

  • google-core:ubuntu-core-24-64:tests/core/gadget-update-pc
  • google-core:ubuntu-core-24-64:tests/core/
  • google-core:ubuntu-core-24-64

@ZeyadYasser ZeyadYasser force-pushed the gpiod-helper-skeleton branch from aef6aa8 to 38c2d57 Compare February 4, 2025 14:53
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@ff29f60). Learn more about missing BASE report.
Report is 75 commits behind head on master.

Files with missing lines Patch % Lines
cmd/snap-gpio-helper/main.go 0.00% 15 Missing ⚠️
cmd/snap-gpio-helper/cmd_export.go 0.00% 2 Missing ⚠️
cmd/snap-gpio-helper/cmd_unexport.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #15023   +/-   ##
=========================================
  Coverage          ?   78.21%           
=========================================
  Files             ?     1168           
  Lines             ?   154412           
  Branches          ?        0           
=========================================
  Hits              ?   120779           
  Misses            ?    26192           
  Partials          ?     7441           
Flag Coverage Δ
unittests 78.21% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ZeyadYasser ZeyadYasser marked this pull request as ready for review February 4, 2025 15:58
@ZeyadYasser ZeyadYasser closed this Feb 4, 2025
@ZeyadYasser ZeyadYasser reopened this Feb 4, 2025
@ZeyadYasser ZeyadYasser force-pushed the gpiod-helper-skeleton branch from 38c2d57 to 045943a Compare February 5, 2025 09:25
Comment on lines 26 to 27
"github.com/jessevdk/go-flags"
"github.com/snapcore/snapd/snapdtool"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"github.com/jessevdk/go-flags"
"github.com/snapcore/snapd/snapdtool"
"github.com/jessevdk/go-flags"
"github.com/snapcore/snapd/snapdtool"

@@ -24,6 +24,7 @@ usr/bin/snapd /usr/lib/snapd/
usr/lib/snapd/snap-confine
usr/lib/snapd/snap-device-helper
usr/lib/snapd/snap-discard-ns
usr/lib/snapd/snap-gpio-helper
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd drop it here, maybe just leave a comment

@ZeyadYasser ZeyadYasser requested a review from bboozzoo February 5, 2025 14:18

import "errors"

type cmdUnexportChardev struct {
Copy link
Member

Choose a reason for hiding this comment

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

Does the spec not mention "<chip-labels>" "<line>" "<gadget>" "<slot-name>" for this command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for unexporting they are not really needed, but I could add them for completeness.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the description for chip-labels and lines wouldn't make sense in the case of unexporting.

	ChipLabels string `long:"chip-labels" description:"comma-separated list of source chip label(s) to match" required:"yes"`
	Lines      uint   `long:"line" description:"comma-separated list of gpio line(s) to unexport" required:"yes"`

Copy link
Contributor

Choose a reason for hiding this comment

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

options are marked as required, so you could make them positional like for export. Also, let's add all of them, such that even if the implementation was to change we have enough context provided in the input.

)

type cmdExportChardev struct {
ChipLabels []string `long:"chip-label" description:"source chip label(s) to match" required:"yes"`
Copy link
Member

Choose a reason for hiding this comment

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

The spec mentions plurals of these:

Suggested change
ChipLabels []string `long:"chip-label" description:"source chip label(s) to match" required:"yes"`
ChipLabels []string `long:"chip-labels" description:"source chip label(s) to match" required:"yes"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it would be more readable to pass multiple --chip-label args instead of one large comma-separated entry --chip-label label-1 --chip-label label-2 vs --chip-labels label-1,label-2.

After second thought, the latter looks more compact.


type cmdExportChardev struct {
ChipLabels []string `long:"chip-label" description:"source chip label(s) to match" required:"yes"`
Lines []uint `long:"line" description:"gpio line(s) to export" required:"yes"`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Lines []uint `long:"line" description:"gpio line(s) to export" required:"yes"`
Lines []uint `long:"lines" description:"gpio line(s) to export" required:"yes"`

Comment on lines 27 to 30
ChipLabels string `long:"chip-labels" description:"comma-separated list of source chip label(s) to match" required:"yes"`
Lines uint `long:"line" description:"comma-separated list of gpio line(s) to export" required:"yes"`
Gadget string `long:"gadget" description:"gadget snap name" required:"yes"`
Slot string `long:"slot" description:"gpio-chardev slot name" required:"yes"`
Copy link
Contributor

Choose a reason for hiding this comment

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

all are required so you can make them positional


type cmdExportChardev struct {
ChipLabels string `long:"chip-labels" description:"comma-separated list of source chip label(s) to match" required:"yes"`
Lines uint `long:"line" description:"comma-separated list of gpio line(s) to export" required:"yes"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Lines uint `long:"line" description:"comma-separated list of gpio line(s) to export" required:"yes"`
Lines string `long:"line" description:"comma-separated list of gpio line(s) to export" required:"yes"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad, thanks!


import "errors"

type cmdUnexportChardev struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

options are marked as required, so you could make them positional like for export. Also, let's add all of them, such that even if the implementation was to change we have enough context provided in the input.

@ZeyadYasser ZeyadYasser requested a review from bboozzoo February 6, 2025 09:46
Copy link
Contributor

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

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

I think Debian packaging will ship gpio-helper by default. We probably need to remove it explicitly

@Meulengracht
Copy link
Member

I think Debian packaging will ship gpio-helper by default. We probably need to remove it explicitly

right this needs to be checked

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