ファイルからパッケージを特定して、ソースコードをダウンロードする

dpkg, apt

$ which ifconfig
/sbin/ifconfig
$ dpkg -S /sbin/ifconfig
net-tools: /sbin/ifconfig
$ apache-cache show net-tools
bash: apache-cache: command not found
$ apt-cache show net-tools
Package: net-tools
Priority: important
Section: net
Installed-Size: 708
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: net-tools Team <pkg-net-tools-maintainers@lists.alioth.debian.org>
Architecture: amd64
Version: 1.60-25ubuntu2
Replaces: ja-trans (<= 0.8-2), netbase (<< 4.00)
Depends: libc6 (>= 2.14)
Conflicts: ja-trans (<= 0.8-2)
Filename: pool/main/n/net-tools/net-tools_1.60-25ubuntu2_amd64.deb
Size: 174516
MD5sum: 80d953d0950d32c66e7284ca68ed89ee
SHA1: 62ef3b9eb5114a87b1aa29062e57c544ef6df1fb
SHA256: ef921d19b77685cec007c146616056ee679d80ee4ef834b9e2da8c01fa139eef
Description: The NET-3 networking toolkit
Description-md5: 003fb6a11fdb767fff574478588a3ca8
Multi-Arch: foreign
Homepage: http://net-tools.berlios.de/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y
Task: minimal

$ dpkg -L net-tools | head
/.
/bin
/bin/netstat
/usr
/usr/share
/usr/share/doc
/usr/share/doc/net-tools
/usr/share/doc/net-tools/README.ipv6
/usr/share/doc/net-tools/README
/usr/share/doc/net-tools/TODO
$ sudo apt-get -qqy install dpkg-dev
$ apt-get source net-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
Skipping already downloaded file 'net-tools_1.60-25ubuntu2.dsc'
Skipping already downloaded file 'net-tools_1.60.orig.tar.gz'
Skipping already downloaded file 'net-tools_1.60-25ubuntu2.diff.gz'
Need to get 0 B of source archives.
gpgv: Signature made Sun Dec  8 23:53:48 2013 JST using DSA key ID 0F932C9C
gpgv: Can't check signature: public key not found
dpkg-source: warning: failed to verify signature on ./net-tools_1.60-25ubuntu2.dsc
dpkg-source: info: extracting net-tools in net-tools-1.60
dpkg-source: info: unpacking net-tools_1.60.orig.tar.gz
dpkg-source: info: applying net-tools_1.60-25ubuntu2.diff.gz

rpm, yum

$ which ifconfig
/sbin/ifconfig
$ rpm -qf /sbin/ifconfig
net-tools-1.60-110.el6_2.x86_64
$ rpm -qi net-tools
Name        : net-tools                    Relocations: (not relocatable)
Version     : 1.60                              Vendor: CentOS
Release     : 110.el6_2                     Build Date: Thu May 10 09:17:33 2012
Install Date: Mon Jun  9 16:13:12 2014         Build Host: c6b5.bsys.dev.centos.org
Group       : System Environment/Base       Source RPM: net-tools-1.60-110.el6_2.src.rpm
Size        : 778085                           License: GPL+
Signature   : RSA/SHA1, Thu May 10 11:02:47 2012, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://net-tools.berlios.de/
Summary     : Basic networking tools
Description :
The net-tools package contains basic networking tools,
including ifconfig, netstat, route, and others.
Most of them are obsolete. For replacement check iproute package.
$ rpm -ql net-tools | head
/bin/dnsdomainname
/bin/domainname
/bin/hostname
/bin/netstat
/bin/nisdomainname
/bin/ypdomainname
/etc/ethers
/sbin/arp
/sbin/ether-wake
/sbin/ifconfig
$ yum -y install yum-utils 2>&1 >/dev/null
$ yumdownloader net-tools --source
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
No source RPM found for net-tools-1.60-110.el6_2.x86_64
Nothing to download