最終更新:2017-06-22 (木) 15:29:23 (2499d)  

apt-get source
Top / apt-get source

https://www.debian.org/doc/manuals/apt-howto/ch-sourcehandling.ja.html

       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 for the architecture as defined by the
           --host-architecture option. 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.

Ubuntu 16.04.2

  • $ apt-get source linux-image-$(uname -r)
    Reading package lists... Done
    Picking 'linux-hwe' as source package instead of 'linux-image-4.8.0-54-generic'
    NOTICE: 'linux-hwe' packaging is maintained in the 'Git' version control system at:
    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial -b hwe
    Please use:
    git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial -b hwe
    to retrieve the latest (possibly unreleased) updates to the package.
    Need to get 154 MB of source archives.
    Get:1 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux-hwe 4.8.0-56.61~16.04.1 (dsc) [8,543 B]
    Get:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux-hwe 4.8.0-56.61~16.04.1 (tar) [140 MB]
    Get:3 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux-hwe 4.8.0-56.61~16.04.1 (diff) [14.1 MB]                                                                       
    Fetched 154 MB in 46s (3,298 kB/s)                                                                                                                                                 
    gpgv: Signature made 2017年06月14日 20時45分02秒 JST using RSA key ID CBEECEA3
    gpgv: Can't check signature: public key not found
    dpkg-source: warning: failed to verify signature on ./linux-hwe_4.8.0-56.61~16.04.1.dsc
    dpkg-source: info: extracting linux-hwe in linux-hwe-4.8.0
    dpkg-source: info: unpacking linux-hwe_4.8.0.orig.tar.gz
    dpkg-source: info: applying linux-hwe_4.8.0-56.61~16.04.1.diff.gz
    dpkg-source: info: upstream files that have been modified: 

メモ

  • ソースをカレントディレクトリにダウンロード
  • .orig.tar.gz
  • .dsc - dpkg-source がソースパッケージを packagename-version のディレクトリに展開するために 使われる
  • .diff.gz

ビルド

  • ダウンロードしたパッケージを自動的にビルドするには、次の例のよう に -b をコマンドラインに付加します:
    $ apt-get -b source packagename

メモ

  • ダウンロードされた各ソースパッケージには、.deb パッケージを 作るために必要なファイルが含まれている debian?/ ディレクトリが あります。

Ubuntu 16.04

関連