我假设通过安装的所有应用程序apt-get
都是开源的;但是对于以这种方式提供的应用程序,我可以在哪里获得这些应用程序的源代码以及更新它们?
我经常使用的一些应用程序不再积极开发,我想添加一些功能。我应该去哪里获取更新这些应用程序的权利?
在这种情况下,我指的是希兰兹包裹
答案1
使用命令apt-get source <package>
(不要使用 sudo)下载包的源代码。
从man apt-get
:
source
source causes apt-get to fetch source packages. APT will examine the
available packages to decide which source package to fetch. It will then
find and download into the current directory the newest available version of
that source package while respect the default release, set with the option
APT::Default-Release, the -t option or per package with the pkg/release
syntax, if possible.
Source packages are tracked separately from binary packages via deb-src type
lines in the sources.list(5) file. This means that you will need to add such
a line for each repository you want to get sources from. If you don't do
this you will properly get another (newer, older or none) source version
than the one you have installed or could install.
If the --compile option is specified then the package will be compiled to a
binary .deb using dpkg-buildpackage, if --download-only is specified then
the source package will not be unpacked.
A specific source version can be retrieved by postfixing the source name
with an equals and then the version to fetch, similar to the mechanism used
for the package files. This enables exact matching of the source package
name and version, implicitly enabling the APT::Get::Only-Source option.
Note that source packages are not tracked like binary packages, they exist
only in the current directory and are similar to downloading source tar
balls.
要从源代码构建包,首先安装构建依赖项:
sudo apt-get build-dep <package>
然后使用dpkg-buildpackage
创建.deb
文件。从APT 和 Dpkg 快速参考表:
dpkg-构建软件包从 Debian 源代码树构建 Debian 软件包。您必须位于源代码树的主目录中才能运行此功能。示例用法:
dpkg-buildpackage -rfakeroot -uc -b
其中
-rfakeroot
指示它使用 fakeroot 程序来模拟 root 权限(用于所有权目的),-uc
代表“不对变更日志进行加密签名”,-b
代表“仅构建二进制包”
在终端中,cd
进入包含包源的目录(例如~/code/hellanzb-0.13
)并运行以下命令:
dpkg-buildpackage -rfakeroot -uc -b
如果构建成功,则会有一个.deb
文件位于父
目录中(例如~/code/hellanzb_0.13-6.1_all.deb
)。
答案2
一般来说,您可以按照以下步骤获取已安装包的源代码:
启用源存储库。打开仪表板(左上角的按钮)并搜索
sources
。这将打开程序Software & Updates
,运行它并确保已选择“源代码”选项:打开终端并运行以下命令:
apt-get source vlc
这会将 vlc 的源下载到您当前的目录中,您可以随时查看它们。
当然,在这种情况下vlc
,你也可以直接从videolan.org网站下载:https://www.videolan.org/vlc/download-sources.html
答案3
您可以apt-get source --compile
直接使用:
sudo apt-get build-dep <package>
sudo apt-get source --compile <package>
对我有用。.deb 最终出现在您运行命令的目录中。