[Share Experiences] 新版deb .zstd安装包无法安装的处理脚本来了
Tofloor
poster avatar
神末shenmo
Moderator
Spark-App
2022-04-27 07:05
Author

当你遇到这样的报错时,可能会很迷惑

dpkg-deb: error: archive 'linux-headers-5.14.15-051415_5.14.15-051415.202110270548_all.deb' **uses unknown compression for member 'control.tar.zst', giving up**

(摘自:https://bbs.deepin.org/post/227527)

这是因为,从21.10开始,ubuntu的默认打包格式从.xz变成了.zstd,而debian要到11才能支持

最近一些ubuntu用户向星火商店投稿的时候出现了兼容性问题:打出来的包在deepin上无法解包


dpkg-deb: 错误: 归档 /var/cache/apt/archives/com.github.ccc-app-manager_0.0.3_amd64.deb 对成员 control.tar.zst 使用了未知的压缩,放弃操作
dpkg: 处理归档 /var/cache/apt/archives/com.github.ccc-app-manager_0.0.3_amd64.deb (--unpack)时出错:
dpkg-deb --control 子进程返回错误状态 2
在处理时有错误发生:
/var/cache/apt/archives/com.github.ccc-app-manager_0.0.3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

出现了这样的错误

我紧急写了个脚本,可以验证这个软件包是否为.zstd包,如果是,就自动重新打包

脚本地址:https://gitee.com/deepin-community-store/repo_auto_update_script/blob/master/repack-zstd

用法:repack-zstd [-h|--help] [-i|--in] [-o|out] [-t|-tmpdir] [-s|--scan] path
-h|--help     显示这个帮助
-i|--in       输入的文件路径
-o|--out      输出的文件路径,默认为运行目录
-t|--tmpdir   设置解包路径,默认为运行目录
-s|--scan     进入扫描模式,扫描这个路径下的所有deb包。在此模式下,输出文件路径将变为输入文件所在目录

如果没有设置参数,将按照 [输入路径] [输出路径] [解包路径] 的顺序读取
例子 Examples:
repack-zstd -i ./spark-store_3.0.3-13_amd64.deb -o ./ -t ./
repack-zstd ./spark-store_3.0.3-13_amd64.deb ./ ./
repack-zstd ./spark-store_3.0.3-13_amd64.deb
repack-zstd --scan ./

原理:用 file检查是否是.zstd格式包,如果是,则解包到指定目录


用法:详见上

-i来指定要检测的deb位置,-o来指定输出位置(就是重新打包为.xz后的包的位置), -t来指定解包位置(放置解包文件的位置,用后会删除)

如果不指定参数,会按照 deb位置 输出位置,解包位置的顺序读取

如果没有检测到输出位置和解包位置,则把当前工作目录作为输出和解包位置

扫描:会扫描指定目录下所有的deb包。在此模式下,输出目录会被更改到和deb输入目录一致,也就是拆完了放回去。默认的解包目录是当前目录,如果坛友有需求改成可以指定,欢迎pr


行为:

如果发现是.zstd包,则会把原包解包到 tmpdir/unpack-dir,然后打包到 output位置

如果发现不是.zstd包,则会把原包移动到output位置


用例:星火商店的仓库混入了一些 .zstd格式的软件包,但是又不能一个一个安装测试

下载 repack-zstd,执行 ./repack-zstd --scan 仓库目录,脚本自动寻找所有的.deb文件并在扫描过程中找到了 .zstd格式软件包,实施了重新打包


备注:这个脚本不附带zstd的解压功能,如果你使用的操作系统不支持.zstd包(Debian <11/Ubuntu <18.04),则无法正常解包运行。由于.zstd包的资料过少,暂时无法在脚本内提供其他解包方法。你可以用ubuntu的docker镜像来解包(诶等等我附带一个镜像是不是就完美了?


博客原文

Reply Favorite View the author
All Replies
jjcui8595
Moderator
2022-04-27 07:27
#1

感谢,收藏!

Reply View the author
SamLukeYes
deepin
2022-04-27 18:07
#2

让 deepin 来合 patchblush

Reply View the author
jjcui8595
Moderator
2022-04-27 19:07
#3

在ubuntuKylin下成功重新打包com.github.ccc-app-manager/com.github.ccc-app-manager_0.0.3_amd64.deb,并在deepin下安装。安装后,apt update或通过星火应用商店检查,已经没有更新,但应用管理器的版本号怎么还是0.0.2 ?

Reply View the author
myml
Super Moderator
Developer
2022-04-27 19:21
#4

deepin支持起来tail 老早就期待zstd了

Reply View the author
神末shenmo
Moderator
Spark-App
2022-04-27 21:31
#5
jjcui8595

在ubuntuKylin下成功重新打包com.github.ccc-app-manager/com.github.ccc-app-manager_0.0.3_amd64.deb,并在deepin下安装。安装后,apt update或通过星火应用商店检查,已经没有更新,但应用管理器的版本号怎么还是0.0.2 ?

这个是要在代码里指定的

https://gitee.com/shenmo7192/ccc-app-manager/blob/main/main.cpp

没改过来

Reply View the author
神末shenmo
Moderator
Spark-App
2022-04-27 21:31
#6
myml

deepin支持起来tail 老早就期待zstd了

啥时候UOS能支持了咱这才能放开sad

Reply View the author
jjcui8595
Moderator
2022-04-27 21:38
#7
神末shenmo

这个是要在代码里指定的

https://gitee.com/shenmo7192/ccc-app-manager/blob/main/main.cpp

没改过来

明白了,多谢

Reply View the author
心平气和
deepin
2022-04-28 00:01
#8

请期待 23吧

Reply View the author
lizipeng0013
deepin
2022-04-30 23:24
#9

使用这种压缩格式有什么好处吗?

截图_20220430152017.png

软件的数据打包压缩反而更大了一点

Reply View the author
神末shenmo
Moderator
Spark-App
2022-05-01 01:49
#10
lizipeng0013

使用这种压缩格式有什么好处吗?

截图_20220430152017.png

软件的数据打包压缩反而更大了一点

据说解压速度更快

Debian 11/ Ubuntu 21.10开始变成默认了

Reply View the author
Deepin Fans
deepin
2023-04-09 04:06
#11

脚本怎么不给下载了呀?末末...

Reply View the author
神末shenmo
Moderator
Spark-App
2023-04-09 05:31
#12
Deepin Fans

脚本怎么不给下载了呀?末末...

位置换了

话说,这个脚本deepin没法用.....手动拆zstd才行

Reply View the author