簡 述: 使用Linux
(uos v20
系統),安裝 了;lintian
命令之後,執行 lintian xxx.deb
發現報錯如下;而未按照預期正確輸出結果應該是帶上 E / W / I /N / O
等明顯的標記。
編程環境:
💻: uos20
📎 gcc/g++ 8.3
📎 gdb8.0
lintian:
事情的起因於 #5,後面去了解了一下想關知識;
lintian
這是一個 Debian
上面的包質量的檢測工具。對於要上傳到 Debian
倉庫的 .deb
包都是有着嚴格的文件夾規範的,否則不被允許上傳;
lintian 命令會運行很多測試腳本來檢查常見的打包錯誤。lintian 命令的輸出常帶有以下幾種標記:
E:
代表錯誤:確定違反了Debian Policy
或是一個肯定的打包錯誤。W:
代表警告:可能違反了Debian Policy
或是一個可能的打包錯誤。I:
代表信息:對於特定打包類別的信息。N:
代表註釋:幫助你調試的詳細信息。O:
代表已覆蓋:一個被lintian-overrides
文件覆蓋的信息,但由於使用--show-overrides
選項而顯示。
對於警告,你應該改進軟件包或者檢查警告是否的確無意義。如果確定沒有意義,則按照 第 5.14 節 “{*
package*.,source/}lintian-overrides
” 中的敘述使用 lintian-overrides
文件將其覆蓋。
注意,你可以用 dpkg-buildpackage 來構建軟件包,並執行 lintian,只要你使用了 debuild(1) 或 pdebuild(1).
安裝&使用lintian報錯:
我在 uos v20
版本,下載和執行如下命令後,實際發現是無法使用的
# 下載得到 dde-control-center_5.1.0101.1+r0+g98e285d4e_amd64.deb 文件
☁ softFile sudo apt download dde-control-center
# 安裝 lintian ,和使用它檢測 deb 包
☁ softFile sudo apt install lintian
☁ softFile lintian dde-control-center_5.1.0101.1+r0+g98e285d4e_amd64.deb
運行之後,wtf!!! 顯示報錯?
Could not find a profile matching "{VENDOR}/main" for vendor deepin at /usr/share/perl5/Lintian/Profile.pm line 702.
Lintian::Profile::_find_vendor_profile(Lintian::Profile=HASH(0x556a2ba4e6c0)) called at /usr/share/perl5/Lintian/Profile.pm line 136
Lintian::Profile::new("Lintian::Profile", undef, ARRAY(0x556a2a1887c0), HASH(0x556a2a354ed0)) called at /usr/bin/lintian line 215
dplint::load_profile(undef) called at /usr/share/lintian/commands/lintian.pm line 1446
main::load_profile_and_configure_tags() called at /usr/share/lintian/commands/lintian.pm line 657
main::main() called at /usr/bin/lintian line 46
eval {...} called at /usr/bin/lintian line 46
main::__ANON__("/usr/share/lintian/commands/lintian.pm") called at /usr/bin/lintian line 114
dplint::run_tool("/usr/bin/lintian", "lintian") called at /usr/bin/lintian line 290
dplint::main() called at /usr/bin/lintian line 359
一頓胡亂分析,這很明顯是 lintian
這個命令有點問題。
解決方案:
原因:
/etc/dpkg/origins
是這個裏面default
指向了deepin
所以dpkg
認爲當前是deepin
環境,都換成uos
就可以;意思就是 lintian
需要通過判斷當前系統環境 根據debian/ubuntu/kail
等環境做檢測,我們 fork 一份 debian 配置檢測。
解決方法:
- 進入
/etc/dpkg/origins
裏面,修改default
的軟鏈接 重新指向uos
; - 複製一份
debian
配置檢測,改名爲uos
; - 正常使用
lintian
命令;
# 沒有修改之前的來兩個路徑文件夾內容
xmuli@xmuli-PC:/etc/dpkg/origins$ ls -al
總用量 20
drwxr-xr-x 2 root root 4096 5月 20 13:40 .
drwxr-xr-x 4 root root 4096 5月 20 09:17 ..
-rw-r--r-- 1 root root 82 5月 20 09:17 debian
-rw-r--r-- 1 root root 87 4月 29 16:41 deepin
lrwxrwxrwx 1 root root 6 5月 20 09:17 default -> deepin
-rw-r--r-- 1 root root 84 4月 29 16:41 uos
xmuli@xmuli-PC:/usr/share/lintian/profiles$ ls -al
總用量 28
drwxr-xr-x 7 root root 4096 5月 26 12:14 .
drwxr-xr-x 11 root root 4096 5月 26 12:14 ..
drwxr-xr-x 2 root root 4096 5月 26 12:14 debian
drwxr-xr-x 2 root root 4096 5月 20 09:19 dpkg
drwxr-xr-x 2 root root 4096 5月 26 12:14 kali
drwxr-xr-x 2 root root 4096 5月 26 12:14 pureos
drwxr-xr-x 2 root root 4096 5月 26 12:14 ubuntu
# 修改軟鏈接
cd /etc/dpkg/origins
sudo ln -snf uos default # 或 sudo ln -snf /etc/dpkg/origins/uos default
# 複製一份文件配置且改名
cd /usr/share/lintian/profiles
sudo cp debian ./uos -r # 拷貝 debian 的配置,命令爲 uos
# 修改完成之後
xmuli@xmuli-PC:/etc/dpkg/origins$ ls -al
總用量 20
drwxr-xr-x 2 root root 4096 5月 26 12:06 .
drwxr-xr-x 4 root root 4096 5月 25 20:19 ..
-rw-r--r-- 1 root root 82 5月 25 20:19 debian
-rw-r--r-- 1 root root 87 4月 29 16:41 deepin
lrwxrwxrwx 1 root root 3 5月 26 12:06 default -> uos
-rw-r--r-- 1 root root 84 4月 29 16:41 uos
xmuli@xmuli-PC:/usr/share/lintian/profiles$ ls -al
總用量 32
drwxr-xr-x 8 root root 4096 5月 26 12:07 .
drwxr-xr-x 11 root root 4096 5月 26 11:05 ..
drwxr-xr-x 2 root root 4096 5月 26 11:05 debian
drwxr-xr-x 2 root root 4096 5月 25 20:21 dpkg
drwxr-xr-x 2 root root 4096 5月 26 11:05 kali
drwxr-xr-x 2 root root 4096 5月 26 11:05 pureos
drwxr-xr-x 2 root root 4096 5月 26 11:05 ubuntu
drwxr-xr-x 2 root root 4096 5月 26 12:07 uos
重新運行一開始的命令,可以看到預期的效果: