Skip to content
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

support squashfs* properly #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions DeComp/compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,10 @@ def _sqfs(self, infodict):
self.extension(cmdinfo["mode"])

sqfs_opts = self._sub_other_options(cmdlist.args, cmdinfo)
if not infodict['arch']:
sqfs_opts.remove("-Xbcj")
sqfs_opts.remove("%(arch)s")
if infodict['mode'] == "squashfs_xz":
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rick, why did you limit the next block to only to squashfs_xz?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the squashfs_xz definition contains "-Xbcj %(arch)s"

"squashfs_xz": [
"_sqfs", "mksquashfs",
[
"%(basedir)s/%(source)s", "%(filename)s", "-comp", "xz",
"-Xbcj", "%(arch)s", "-b", "1M", "other_options"
],
"SQUASHFS", ["squashfs", "sfs"], {"mksquashfs"},
],
"squashfs_gzip": [
"_sqfs", "mksquashfs",
[
"%(basedir)s/%(source)s", "%(filename)s", "-comp", "gzip",
"-b", "1M", "other_options"
],
"SQUASHFS", ["squashfs", "sfs"], {"mksquashfs"},
],
"squashfs_zstd": [
"_sqfs", "mksquashfs",
[
"%(basedir)s/%(source)s", "%(filename)s", "-comp", "zstd",
"-Xcompression-level", "2", "-b", "1M", "other_options"
],
"SQUASHFS", ["squashfs", "sfs"], {"mksquashfs"},
],
"squashfs_pzstd": [
"_sqfs", "mksquashfs",
[
"%(basedir)s/%(source)s", "%(filename)s", "-comp", "pzstd",
"-Xcompression-level", "2", "-b", "1M", "other_options"
],
"SQUASHFS", ["squashfs", "sfs"], {"mksquashfs"},
],

For other compression types, raises:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/DeComp/compress.py", line 135, in _compress
    return self._run(infodict)
  File "/usr/lib/python3.9/site-packages/DeComp/compress.py", line 202, in _run
    success = func(infodict)
  File "/usr/lib/python3.9/site-packages/DeComp/compress.py", line 421, in _sqfs
    sqfs_opts.remove("-Xbcj")
ValueError: list.remove(x): x not in list

if not infodict['arch']:
sqfs_opts.remove("-Xbcj")
sqfs_opts.remove("%(arch)s")
opts = ' '.join(sqfs_opts) % (cmdinfo)
args = ' '.join([cmdlist.cmd, opts])

Expand Down
12 changes: 10 additions & 2 deletions DeComp/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ class functions do.
],
"GZIP", ["tar.gz"], {"tar"},
],
"squashfs_zstd": [
"_sqfs", "mksquashfs",
[
"%(basedir)s/%(source)s", "%(filename)s", "-comp", "zstd",
"-Xcompression-level", "19", "-b", "1M", "-no-recovery", "-noappend", "other_options"
],
"SQUASHFS", ["squashfs", "sfs"], {"mksquashfs"},
],
"squashfs_xz": [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've merged a different PR that added this plus pzstd

"_sqfs", "mksquashfs",
[
Expand Down Expand Up @@ -376,8 +384,8 @@ class functions do.
"squashfs": [
"_common", "unsquashfs",
[
"other_options", "-d", "%(destination)s",
"%(basedir)s/%(source)s"
"other_options", "-f", "-d", "%(destination)s",
"%(source)s"
],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this change. You dropped %(basedir)s/ which is common to all, plus you can use the other_options variable to add the -f flag for your use case without hard coding it.. This change forces the -f flag to everyone.

"SQUASHFS", ["squashfs", "sfs"], {"unsquashfs"},
],
Expand Down