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 <9903835+tri-adam@users.noreply.github.com>
  • Loading branch information
tri-adam committed Dec 10, 2024
1 parent 03266d0 commit 9638006
Show file tree
Hide file tree
Showing 18 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.22.5

require (
github.com/klauspost/compress v1.17.9
github.com/pierrec/lz4/v4 v4.1.21
github.com/rasky/go-lzo v0.0.0-20200203143853-96a758eda86e
github.com/therootcompany/xz v1.0.1
github.com/ulikunitz/xz v0.5.12
)
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.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
github.com/pierrec/lz4/v4 v4.1.21/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.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
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 @@ -7,10 +7,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 @@ -61,8 +61,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
4 changes: 2 additions & 2 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"io"
"time"

"github.com/CalebQ42/squashfs/internal/toreader"
squashfslow "github.com/CalebQ42/squashfs/low"
"github.com/sylabs/squashfs/internal/toreader"
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 9638006

Please sign in to comment.