-
Notifications
You must be signed in to change notification settings - Fork 594
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
base: master
Are you sure you want to change the base?
Conversation
Thu Feb 6 11:43:42 UTC 2025 Failures:Executing:
Restoring:
|
aef6aa8
to
38c2d57
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #15023 +/- ##
=========================================
Coverage ? 78.21%
=========================================
Files ? 1168
Lines ? 154412
Branches ? 0
=========================================
Hits ? 120779
Misses ? 26192
Partials ? 7441
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
38c2d57
to
045943a
Compare
Signed-off-by: Zeyad Gouda <[email protected]>
Signed-off-by: Zeyad Gouda <[email protected]>
Signed-off-by: Zeyad Gouda <[email protected]>
045943a
to
a74f848
Compare
cmd/snap-gpio-helper/main.go
Outdated
"github.com/jessevdk/go-flags" | ||
"github.com/snapcore/snapd/snapdtool" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"github.com/jessevdk/go-flags" | |
"github.com/snapcore/snapd/snapdtool" | |
"github.com/jessevdk/go-flags" | |
"github.com/snapcore/snapd/snapdtool" |
packaging/ubuntu-14.04/snapd.install
Outdated
@@ -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 |
There was a problem hiding this comment.
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
Signed-off-by: Zeyad Gouda <[email protected]>
Signed-off-by: Zeyad Gouda <[email protected]>
|
||
import "errors" | ||
|
||
type cmdUnexportChardev struct { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"`
There was a problem hiding this comment.
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.
cmd/snap-gpio-helper/cmd_export.go
Outdated
) | ||
|
||
type cmdExportChardev struct { | ||
ChipLabels []string `long:"chip-label" description:"source chip label(s) to match" required:"yes"` |
There was a problem hiding this comment.
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:
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"` |
There was a problem hiding this comment.
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.
cmd/snap-gpio-helper/cmd_export.go
Outdated
|
||
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"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines []uint `long:"line" description:"gpio line(s) to export" required:"yes"` | |
Lines []uint `long:"lines" description:"gpio line(s) to export" required:"yes"` |
…-separated Signed-off-by: Zeyad Gouda <[email protected]>
cmd/snap-gpio-helper/cmd_export.go
Outdated
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"` |
There was a problem hiding this comment.
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
cmd/snap-gpio-helper/cmd_export.go
Outdated
|
||
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"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"` |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
Signed-off-by: Zeyad Gouda <[email protected]>
There was a problem hiding this 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
right this needs to be checked |
No description provided.