AFAIK deb 包是 ar 档案。
┌─[shirish@debian] - [~/games/example] - [10297]
└─[$] ls
libcpuid14_0.4.0_amd64.deb
┌─[shirish@debian] - [~/games/example] - [10298]
└─[$] ar x
libcpuid14_0.4.0_amd64.deb
┌─[shirish@debian] - [~/games/example] - [10299]
└─[$] ls
control.tar.gz data.tar.xz debian-binary libcpuid14_0.4.0_amd64.deb
现在有 sloccount,用于计算物理源代码行数(SLOC)以及量化如果进行商业化需要创建多少代码。
一个项目的图——
SLOC Directory SLOC-by-Language (Sorted)
23697 src_modes cpp=23697
12608 src_engine cpp=12608
9584 src_luabind cpp=9584
7269 src_common cpp=7269
5294 src_editor cpp=5294
3162 game sh=3162
1721 src_top_dir cpp=1598,objc=123
1425 top_dir sh=1425
41 txt sh=25,sed=16
0 HoA.xcodeproj (none)
0 autom4te.cache (none)
0 doc (none)
0 img (none)
0 lib (none)
0 lua (none)
0 m4 (none)
0 mus (none)
0 snd (none)
Totals grouped by language (dominant language first):
cpp: 60050 (92.67%)
sh: 4612 (7.12%)
objc: 123 (0.19%)
sed: 16 (0.02%)
Total Physical Source Lines of Code (SLOC) = 64,801
Development Effort Estimate, Person-Years (Person-Months) = 15.97 (191.59)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 1.53 (18.42)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 10.40
Total Estimated Cost to Develop = $ 2,156,763
(average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."
是否有像 sloccount 这样的工具可以读取 deb 包而无需解压缩或在内存中解压缩并给出如上所示的输出?
答案1
克洛克?可从存储库获取。
计算给定文件中源代码的物理行数(可能是压缩 tarball 或 zip 文件等档案)和/或在给定目录下递归。
“cloc 有几个我喜欢的功能。首先,cloc 可以直接处理压缩文件。在 cloc 执行其操作之前,您不需要提取存档;cloc 会自动处理解压缩。如果遇到麻烦,你可以断言你的生物优势并告诉它使用哪个减压器。” ---https://inconsolation.wordpress.com/2014/07/29/cloc-clock-your-code/