The abs tool described below has been deprecated and it along with its rsync endpoint have been dropped since mid 2017.
The asp tool now provides similar functionality. More information here.
As already mentioned you can use the ABS (Arch Build System):
Install it using pacman:
sudo pacman -S base-devel abs
First, download the ABS tree:
sudo abs
Then, get a specific package:
sudo abs [package_name]
Then copy the package, whose source you want to have, from the local abs tree (e.g. /var/abs/core/findutils) to another directory, e.g. /home/blabla/abs
Then run makepkg:
if you only want to get the sources and don't want to build the package you can run makepkg -od
otherwise run makepkg -s, which will then handle all the package's dependencies automatically
watch out becaouse makepkg will overwrite your modifications, use makepkg -e to build your local sources instead
If you want to install the package you've built, run
It is a little bit more complicated than apt-get source. But perhaps you find a tool on AUR that does the job for you, for example yaourt supports building from sources and exporting them.
发布评论
评论(3)
pacman -S asp
说你是否想要Linux命令的源代码
find
find
属于哪个包:pacman -Qo $(找到)
。结果是“/usr/bin/find 属于 findutils 4.4.2-3”。
asp 导出 findutils
现在您已经有了源代码。
pacman -S asp
say if you want the source code of the Linux command
find
find
belongs to:pacman -Qo $(which find)
. The result is"/usr/bin/find is owned by findutils 4.4.2-3".
asp export findutils
Now you have your source code.
2018 更新:
下面描述的
abs
工具已已弃用,自 2017 年中期以来,它及其 rsync 端点已被删除。asp
工具现在提供类似的功能。更多信息请参见此处。正如已经提到的,您可以使用 ABS(Arch Build System):
使用 pacman 安装它:
首先,下载 ABS 树:
然后,获取特定的包:
然后从本地ABS树中复制您想要获得其源代码的包(例如
/var/abs/core/findutils
)到另一个目录,例如/home/blabla/abs
然后运行
makepkg
:如果您只想获取源代码并且不想构建软件包,则可以运行
makepkg -od
否则运行
makepkg -s
,它将自动处理该包的所有依赖项请注意,因为 makepkg 会覆盖您的修改,请使用
makepkg -e
来构建本地源如果您想安装您构建的软件包,请运行
2018 Update:
The
abs
tool described below has been deprecated and it along with its rsync endpoint have been dropped since mid 2017.The
asp
tool now provides similar functionality. More information here.As already mentioned you can use the ABS (Arch Build System):
Install it using pacman:
First, download the ABS tree:
Then, get a specific package:
Then copy the package, whose source you want to have, from the local abs tree (e.g.
/var/abs/core/findutils
) to another directory, e.g./home/blabla/abs
Then run
makepkg
:if you only want to get the sources and don't want to build the package you can run
makepkg -od
otherwise run
makepkg -s
, which will then handle all the package's dependencies automaticallywatch out becaouse makepkg will overwrite your modifications, use
makepkg -e
to build your local sources insteadIf you want to install the package you've built, run
编辑:由于 ABS 的更改,此答案已过时。
您可以从 Arch Linux SVN 存储库(称为 ABS)获取软件包源。
首先在网上找到包:
http://www.archlinux.org/packages/?q=coreutils
然后,在包详细信息页面上,右侧使用 SVN 链接,例如:
http://repos.archlinux.org/wsvn/packages/coreutils/trunk/
在那里,你有一个可爱的“下载”按钮,在这种情况下它会导致:
http://repos.archlinux.org/wsvn/ packages/coreutils/trunk/?op=dl&isdir=1
它比 apt-get source 稍微复杂一点。但也许您在 AUR 上找到了适合您的工具,例如 yaourt 支持从源构建并导出它们。
Edit: This answer is outdated due to changes on ABS.
You get the package sources from the Arch Linux SVN repository, called ABS.
First find the package online:
http://www.archlinux.org/packages/?q=coreutils
Then, on the package details page, on the right side use the SVN links, e.g.:
http://repos.archlinux.org/wsvn/packages/coreutils/trunk/
And there, you have a sweet "Download" button, in this case it leads to:
http://repos.archlinux.org/wsvn/packages/coreutils/trunk/?op=dl&isdir=1
It is a little bit more complicated than
apt-get source
. But perhaps you find a tool on AUR that does the job for you, for example yaourt supports building from sources and exporting them.