[epoch:]software_version[-debian_version]
dpkg --compare-versions '0:1.2' eq '1.2' && echo yes
dpkg --compare-versions '1.2-0' eq '1.2' && echo yes
dpkg --compare-versions '1.2~rc1-1' lt '1.2-1' && echo yes
PackagingBasics 寫了一些 Ubuntu 這邊的版號命名方式值得參考~
如果 Software Version 為 1.2 但是還沒有 Debian 官方的 Package 則 Ubuntu 這邊應該要使用 1.2-0ubuntu1
如果也沒有 Ubuntu 官方的 Package 那麼在 PPA 上就應該使用 1.2-0ubuntu0foo1 其中的 foo 命名依照 PPA 而定
一般來說空字串比任何字元都要小除了 tilde '~' 之外,'~' 是在 etch 之後才有的規則
於是上游的 alpha/beta/rc 例如 1.2 rc1 release 就可以直接使用 1.2~rc1-1 不然就要使用 1.2-0+1.2rc1+1, 1.2-0+1.2rc1+2 或是 1.1.999-1+1.2rc1, 1.1.999-2+1.2rc1 這樣很醜
1.2 出來後就使用 1.2-1 打包 Debian Package
Non-maintainer upload
native
2.0 -> 2.0+nmu1
upstream
2.0-1 -> 2.0-1+nmu1
Ubuntu
native
2.0 -> 2.0ubuntu1
upstream
2.0-1 -> 2.0-1ubuntu1
Customization
native
2.0 -> 2.0ubuntu0custom1
2.0 -> 2.0custom1
2.0 -> 2.0+custom1 (override Ubuntu)
2.0 -> 2.0+oem1 (override Debian)
upstream
2.0-1 -> 2.0-1ubuntu0custom1
2.0-1 -> 2.0-1custom1
2.0-1 -> 2.0-1+custom1 (override Ubuntu)
2.0-1 -> 2.0-1+oem1 (override Debian)
http://lintian.debian.org/tags/source-nmu-has-incorrect-version-number.html
$ dpkg --compare-versions 0~git202411270842.3c1cdd3-0 eq 0~git202411270842.3c1cdd3; echo $?
0
這邊 debian_version 使用上有點陷阱,其實 0~git202411270842.3c1cdd3-0~ 會比 0~git202411270842.3c1cdd3 要小
$ dpkg --compare-versions 0~git202411270842.3c1cdd3-0~ lt 0~git202411270842.3c1cdd3; echo $?
0
但是在 debian/control 裡面的相依使用 ${shlibs:Depends} 會代入 (>= 0~git202411270842.3c1cdd3)