Skip to content

Commit

Permalink
feat: remove LZO support
Browse files Browse the repository at this point in the history
LZO support requires the github.com/rasky/go-lzo module, which is GPLv2
licensed and thus not suitable for inclusion in some projects.

Signed-off-by: Adam Hughes <[email protected]>
  • Loading branch information
tri-adam committed Jul 5, 2024
1 parent e9de9e6 commit 3afc631
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 53 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

[![PkgGoDev](https://pkg.go.dev/badge/github.com/CalebQ42/squashfs)](https://pkg.go.dev/github.com/CalebQ42/squashfs) [![Go Report Card](https://goreportcard.com/badge/github.com/CalebQ42/squashfs)](https://goreportcard.com/report/github.com/CalebQ42/squashfs)

This is a fork of `CalebQ42/squashfs` for the purpose of maintaing a package that removes the lzo dependency, so that it does not contain GPL code.

## Branches

* `remove-lzo` - `main` from `CalebQ42/squashfs` with LZO support removed.
* `remove-lzo-vX.Y.Z` - `vX.Y.Z` from `CalebQ42/squashfs` with LZO support removed.

## Tags

* `vX.Y.Z` - `vX.Y.Z` from `CalebQ42/squashfs` with LZO support removed.

-----

A PURE Go library to read squashfs. There is currently no plans to add archive creation support as it will almost always be better to just call `mksquashfs`. I could see some possible use cases, but probably won't spend time on it unless it's requested (open a discussion if you want this feature).

The library has two parts with this `github.com/CalebQ42/squashfs` being easy to use as it implements `io/fs` interfaces and doesn't expose unnecessary information. 95% this is the library you want. If you need lower level access to the information, use `github.com/CalebQ42/squashfs/low` where far more information is exposed.
Expand Down
2 changes: 1 addition & 1 deletion cmd/go-unsquashfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"time"

"github.com/CalebQ42/squashfs"
"github.com/sylabs/squashfs"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion extraction_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/fs"
"runtime"

"github.com/CalebQ42/squashfs/internal/routinemanager"
"github.com/sylabs/squashfs/internal/routinemanager"
)

type ExtractionOptions struct {
Expand Down
8 changes: 4 additions & 4 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"runtime"
"strconv"

"github.com/CalebQ42/squashfs/internal/routinemanager"
squashfslow "github.com/CalebQ42/squashfs/low"
"github.com/CalebQ42/squashfs/low/data"
"github.com/CalebQ42/squashfs/low/inode"
"github.com/sylabs/squashfs/internal/routinemanager"
squashfslow "github.com/sylabs/squashfs/low"
"github.com/sylabs/squashfs/low/data"
"github.com/sylabs/squashfs/low/inode"
)

// File represents a file inside a squashfs archive.
Expand Down
4 changes: 2 additions & 2 deletions file_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"io/fs"
"time"

"github.com/CalebQ42/squashfs/low/directory"
"github.com/CalebQ42/squashfs/low/inode"
"github.com/sylabs/squashfs/low/directory"
"github.com/sylabs/squashfs/low/inode"
)

type fileInfo struct {
Expand Down
4 changes: 2 additions & 2 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"slices"
"strings"

squashfslow "github.com/CalebQ42/squashfs/low"
"github.com/CalebQ42/squashfs/low/directory"
squashfslow "github.com/sylabs/squashfs/low"
"github.com/sylabs/squashfs/low/directory"
)

// FS is a fs.FS representation of a squashfs directory.
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
module github.com/CalebQ42/squashfs
module github.com/sylabs/squashfs

go 1.21.5

require (
github.com/pierrec/lz4/v4 v4.1.19
github.com/ulikunitz/xz v0.5.11
github.com/klauspost/compress v1.17.4
github.com/rasky/go-lzo v0.0.0-20200203143853-96a758eda86e
github.com/therootcompany/xz v1.0.1
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/pierrec/lz4/v4 v4.1.19 h1:tYLzDnjDXh9qIxSTKHwXwOYmm9d887Y7Y1ZkyXYHAN4=
github.com/pierrec/lz4/v4 v4.1.19/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/rasky/go-lzo v0.0.0-20200203143853-96a758eda86e h1:dCWirM5F3wMY+cmRda/B1BiPsFtmzXqV9b0hLWtVBMs=
github.com/rasky/go-lzo v0.0.0-20200203143853-96a758eda86e/go.mod h1:9leZcVcItj6m9/CfHY5Em/iBrCz7js8LcRQGTKEEv2M=
github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+xzw=
github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY=
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
Expand Down
13 changes: 0 additions & 13 deletions internal/decompress/lzo.go

This file was deleted.

2 changes: 1 addition & 1 deletion internal/metadata/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/binary"
"io"

"github.com/CalebQ42/squashfs/internal/decompress"
"github.com/sylabs/squashfs/internal/decompress"
)

type Reader struct {
Expand Down
4 changes: 2 additions & 2 deletions low/data/fullreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"runtime"
"sync"

"github.com/CalebQ42/squashfs/internal/decompress"
"github.com/CalebQ42/squashfs/internal/toreader"
"github.com/sylabs/squashfs/internal/decompress"
"github.com/sylabs/squashfs/internal/toreader"
)

type FragReaderConstructor func() (io.Reader, error)
Expand Down
2 changes: 1 addition & 1 deletion low/data/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/binary"
"io"

"github.com/CalebQ42/squashfs/internal/decompress"
"github.com/sylabs/squashfs/internal/decompress"
)

type Reader struct {
Expand Down
8 changes: 4 additions & 4 deletions low/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"slices"
"strings"

"github.com/CalebQ42/squashfs/internal/metadata"
"github.com/CalebQ42/squashfs/internal/toreader"
"github.com/CalebQ42/squashfs/low/directory"
"github.com/CalebQ42/squashfs/low/inode"
"github.com/sylabs/squashfs/internal/metadata"
"github.com/sylabs/squashfs/internal/toreader"
"github.com/sylabs/squashfs/low/directory"
"github.com/sylabs/squashfs/low/inode"
)

type Directory struct {
Expand Down
10 changes: 5 additions & 5 deletions low/file_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"errors"
"io"

"github.com/CalebQ42/squashfs/internal/metadata"
"github.com/CalebQ42/squashfs/internal/toreader"
"github.com/CalebQ42/squashfs/low/data"
"github.com/CalebQ42/squashfs/low/directory"
"github.com/CalebQ42/squashfs/low/inode"
"github.com/sylabs/squashfs/internal/metadata"
"github.com/sylabs/squashfs/internal/toreader"
"github.com/sylabs/squashfs/low/data"
"github.com/sylabs/squashfs/low/directory"
"github.com/sylabs/squashfs/low/inode"
)

type FileBase struct {
Expand Down
8 changes: 4 additions & 4 deletions low/inode.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package squashfslow

import (
"github.com/CalebQ42/squashfs/internal/metadata"
"github.com/CalebQ42/squashfs/internal/toreader"
"github.com/CalebQ42/squashfs/low/directory"
"github.com/CalebQ42/squashfs/low/inode"
"github.com/sylabs/squashfs/internal/metadata"
"github.com/sylabs/squashfs/internal/toreader"
"github.com/sylabs/squashfs/low/directory"
"github.com/sylabs/squashfs/low/inode"
)

func (r *Reader) InodeFromRef(ref uint64) (*inode.Inode, error) {
Expand Down
10 changes: 4 additions & 6 deletions low/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"io"
"math"

"github.com/CalebQ42/squashfs/internal/decompress"
"github.com/CalebQ42/squashfs/internal/metadata"
"github.com/CalebQ42/squashfs/internal/toreader"
"github.com/CalebQ42/squashfs/low/inode"
"github.com/sylabs/squashfs/internal/decompress"
"github.com/sylabs/squashfs/internal/metadata"
"github.com/sylabs/squashfs/internal/toreader"
"github.com/sylabs/squashfs/low/inode"
)

// The types of compression supported by squashfs
Expand Down Expand Up @@ -60,8 +60,6 @@ func NewReader(r io.ReaderAt) (rdr *Reader, err error) {
rdr.d = decompress.Zlib{}
case LZMACompression:
rdr.d = decompress.Lzma{}
case LZOCompression:
rdr.d = decompress.Lzo{}
case XZCompression:
rdr.d = decompress.Xz{}
case LZ4Compression:
Expand Down
2 changes: 1 addition & 1 deletion low/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"path/filepath"
"testing"

squashfslow "github.com/CalebQ42/squashfs/low"
squashfslow "github.com/sylabs/squashfs/low"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io"
"time"

squashfslow "github.com/CalebQ42/squashfs/low"
squashfslow "github.com/sylabs/squashfs/low"
)

type Reader struct {
Expand Down
2 changes: 1 addition & 1 deletion squashfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"testing"
"time"

"github.com/CalebQ42/squashfs"
"github.com/sylabs/squashfs"
)

const (
Expand Down

0 comments on commit 3afc631

Please sign in to comment.