-
Notifications
You must be signed in to change notification settings - Fork 47
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
Allow same globs in multiple slices #62
Conversation
204bf0f
to
c5bfbc5
Compare
There's no reason why the following slices shouldn't be accepted when the globs are identical: package: openjdk-8-jre-headless slices: abc: contents: /usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libnpt.so: bcd: contents: /usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libnpt.so: Drop this restriction.
for additional context: Scenario Apackage: openjdk-8-jre-headless
slices:
abc:
contents:
/usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libnpt.so:
bcd:
contents:
/usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libnpt.so: $ chisel cut --release $PWD --root scenarioA openjdk-8-jre-headless_abc openjdk-8-jre-headless_bcd
(...)
error: cannot extract from package "openjdk-8-jre-headless": when using wildcards source and target paths must match: /usr/lib/jvm/java-8-openjdk-/jre/lib//libnpt.so Scenario Bpackage: openjdk-8-jre-headless
slices:
abc:
contents:
/usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libnpt.so:
bcd:
contents:
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libnpt.so: $ chisel cut --release $PWD --root scenarioA openjdk-8-jre-headless_abc openjdk-8-jre-headless_bcd
(...)
error: cannot extract from package "openjdk-8-jre-headless": no content at /usr/lib/jvm/java-8-openjdk-am64/jre/lib/amd64/libnpt.so Scenario CIf both paths are explicit (i.e. without globs), it works. |
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.
@woky thanks for looking into this!
Just a couple of questions:
- does this change only apply to slices within the same package? I.e. that constraint should still be valid when that path is in different packages...
- can you verify that the solution also works for scenario B in Allow same globs in multiple slices #62 (comment)?
- while at it, can you please add another test to reflect that scenario?
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.
Good initiative!
I am a bit confused if this PR implies that the globs must be identical. If the globs can be the same without being identical, i.e. matches the same paths without being the identical copy of another glob char-by-char, then I am afraid the changes won't be enough.
For example, as Cris mentioned in his comment (#62 (comment)), scenario B does not work yet. But that is a glob in one slice and an explicit path in another. I had the following SDF and it failed as well (logs attached).
package: openjdk-8-jre-headless
slices:
abc:
contents:
/usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libnpt.so:
bcd:
contents:
/usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libn*t.so:
Failure log:
error: cannot extract from package "openjdk-8-jre-headless": no content at /usr/lib/jvm/java-8-openjdk-*/jre/lib/*/libnpt.so
Notice how the globs are the same in the context, but not identical. I think this is because pendingPaths
is not empty at the end. The reason is that for one explicit path in the package, only one of the globs is cleared off from the checklist. Maybe we should modify shouldExtract
to return the list of globs/paths it matches instead of just the one.
With all that being said, if the globs must be identical char-by-char instead of being same, then this PR seems OK to me. 👍
You are right @rebornplusplus. Thanks for the explanation. Converting to draft for now. |
Closing as this is not really a fix. It's going to be easier to fix with #74 merged. |
There's no reason why the following slices shouldn't be accepted when
the globs are identical:
Drop this restriction.