-
Notifications
You must be signed in to change notification settings - Fork 36
Feature/no more anuvu/squashfs dep #461
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
Feature/no more anuvu/squashfs dep #461
Conversation
f330865
to
4d059dd
Compare
Given the superblock.go is copied from diskfs, I wonder if I need to add something like this: diff --git a/pkg/squashfs/superblock.go b/pkg/squashfs/superblock.go
index a90ab5b..1934e23 100644
--- a/pkg/squashfs/superblock.go
+++ b/pkg/squashfs/superblock.go
@@ -1,3 +1,10 @@
+/* This file was initially copied from go-diskfs [1]. The copied portion is
+ Copyright (c) 2017 Avi Deitcher and licensed under the terms of the MIT
+ license [2].
+ [1] https://github.com/diskfs/go-diskfs/filesystem/squashfs/superblock.go
+ [2] https://opensource.org/licenses/MI
+*/
+
package squashfs
import (
|
437083b
to
6c4b972
Compare
My only thought is that it would be nice to import superblock.go instead of copying it, but I suppose you tried that and it introduces some other C deps that you have to build? |
The next trick to drop dependencies would be to just "shell out" to cryptsetup and dmsetup.
when atomfs builds, it gets a dependency (from ldd) like the following. I marked the ones that come from cryptsetup with a '-'.
So basically if we shelled out, i think we could maybe get atomfs's deps down to only those compression libraries. (note, stacker probably has others, i was just looking at atomfs now, and it |
6c4b972
to
b54b54c
Compare
All diskfs exposes is a Filesystem interface. You do a Read and get one back, but then you don't have any way to get 'size' or anything even though they're in the struct. I could propose an upstream change to expose them in a consistent manner for each of the Filesystem interface implementations; this is just lazy. |
b54b54c
to
25cd403
Compare
The superblock.go comes from https://github.com/diskfs/go-diskfs/blob/master/filesystem/squashfs/ diskfs is MIT licensed and this one Apache, so copy is fine. The project doesn't expose any of the superblock internals (even size), so we can't just go import it. The only change from diskfs's current tip is to replace fmt.Errorf with errors.Errorf. Signed-off-by: Scott Moser <smoser@brickies.net>
25cd403
to
46f2fc3
Compare
You could downcast to the right one if the individual implentations are public.
…On Tue, Apr 25, 2023, at 7:25 PM, Scott Moser wrote:
> My only thought is that it would be nice to import superblock.go instead of copying it, but I suppose you tried that and it introduces some other C deps that you have to build?
>
All diskfs exposes is a Filesystem <https://github.com/diskfs/go-diskfs/blob/e29f8c4774c504fb5166defa77214e499e6e9875/filesystem/filesystem.go#L10> interface. You do a Read <https://github.com/diskfs/go-diskfs/blob/e29f8c4774c504fb5166defa77214e499e6e9875/filesystem/squashfs/squashfs.go#L100> and get one back, but then you don't have any way to get 'size' or anything even though they're in the struct.
I could propose an upstream change to expose them in a consistent manner for each of the Filesystem interface implementations; this is just lazy.
—
Reply to this email directly, view it on GitHub <#461 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAF7VV35QERVQIWC3D24CCLXDB2QJANCNFSM6AAAAAAXLPIJY4>.
You are receiving this because you commented.Message ID: ***@***.***>
|
squashfs.Filesystem is what you get back from the Read. It has a '[superblock]' of type *superblock member that is not exposed (lower case). The superblock type has a non-exposed uint64 size. Maybe i could manage to get it through an import, but not in any way that was clean or imo preferable to this one file copy. |
oh for pete's sake. test taht failed is tests/caching.bats "can read previous version's cache". |
This test won't work because it tries to build an old (upstream/main) version of stacker. The system is missing the libsquashfs1 dependency, so this would not be expected to work. Signed-off-by: Scott Moser <smoser@brickies.net>
After removing the anuvu/squashfs import we no longer need to build or install libsquashfs1 from squashfs-tools-ng. Signed-off-by: Scott Moser <smoser@brickies.net>
46f2fc3
to
8fdbbe1
Compare
Yeah, you'd have to do reflection, and then you're at risk of some non-public API change. Another option would be to fork + go replace, but copy seems fine too. |
I think
I guess there are the following cases
It seems that mount is pretty straightforward with dmsetup or cryptsetup. creation might be a little more difficult. |
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.
lgtm
stacker was only using anuvu/squashfs import to get the size of the squashfs file (from its superblock, rather than from 'stat').
That go library used libsquashfs-tools-ng as a c-go dependency, which meant a build and runtime dependency on it.
The change here is to drop that import and instead use some native go.