【yocto】srpmパッケージを生成する方法

# はじめに
- yoctoでは各ソフトをsrpmで取り出すことができる

# 方法
- local.confに以下の文を追記して、bitbakeする
~~~
INHERIT += "archiver"  
ARCHIVER_MODE[srpm] = "1"   
~~~

# 動作例
- 環境変数を設定する
~~~
takeshi@X250:~/yocto/poky$ source oe-init-build-env 

### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package tasks
~~~
- local.confにsrpmパッケージを生成するように設定しておく
~~~
takeshi@X250:~/yocto/poky/build$ cat conf/local.conf | tail -n 2
INHERIT += "archiver"  
ARCHIVER_MODE[srpm] = "1"   
~~~
- bitbakeする
~~~
takeshi@X250:~/yocto/poky/build$ bitbake core-image-minimal
WARNING: Host distribution "zorin-15" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100% |##################################################################################################################################| Time: 0:00:59
Parsing of 772 .bb files complete (0 cached, 772 parsed). 1298 targets, 41 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.44.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "zorin-15"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.0"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "my-yocto-3.0:94f6b31befda5c496f65e863a6f8152b42d7ebf0"

Initialising tasks: 100% |###############################################################################################################################| Time: 0:00:03
Sstate summary: Wanted 1037 Found 1034 Missed 3 Current 0 (99% match, 0% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
NOTE: Tasks Summary: Attempted 3127 tasks of which 2897 didn't need to be rerun and all succeeded.

Summary: There was 1 WARNING message shown.
~~~
- srpmが生成されたことを確認する
~~~
takeshi@X250:~/yocto/poky/build$ ls tmp/deploy/sources/*/*/*.src.rpm
tmp/deploy/sources/allarch-poky-linux/autoconf-archive-2019.01.06-r0/autoconf-archive-2019.01.06-r0.src.rpm
tmp/deploy/sources/allarch-poky-linux/ca-certificates-20190110-r0/ca-certificates-20190110-r0.src.rpm
tmp/deploy/sources/allarch-poky-linux/update-rc.d-0.8-r0/update-rc.d-0.8-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/acl-2.2.52-r0/acl-2.2.52-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/attr-2.4.47-r0/attr-2.4.47-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/base-files-3.0.14-r89/base-files-3.0.14-r89.src.rpm
tmp/deploy/sources/x86_64-poky-linux/base-passwd-3.5.29-r0/base-passwd-3.5.29-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/bash-5.0-r0/bash-5.0-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/bash-completion-2.9-r0/bash-completion-2.9-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/bc-1.07.1-r0/bc-1.07.1-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/btrfs-tools-5.2.2-r0/btrfs-tools-5.2.2-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/busybox-1.31.0-r0/busybox-1.31.0-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/coreutils-8.31-r0/coreutils-8.31-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/dbus-1.12.16-r0/dbus-1.12.16-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/dbus-test-1.12.16-r0/dbus-test-1.12.16-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/diffutils-3.7-r0/diffutils-3.7-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/e2fsprogs-1.45.3-r0/e2fsprogs-1.45.3-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/elfutils-0.177-r0/elfutils-0.177-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/eudev-3.2.8-r0/eudev-3.2.8-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/gdbm-1.18.1-r0/gdbm-1.18.1-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/glib-2.0-1_2.60.7-r0/glib-2.0-2.60.7-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/glibc-2.30-r0/glibc-2.30-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/gmp-6.1.2-r0/gmp-6.1.2-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/gnome-desktop-testing-2018.1-r0/gnome-desktop-testing-2018.1-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/grep-3.3-r0/grep-3.3-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/init-ifupdown-1.0-r7/init-ifupdown-1.0-r7.src.rpm
tmp/deploy/sources/x86_64-poky-linux/initscripts-1.0-r155/initscripts-1.0-r155.src.rpm
tmp/deploy/sources/x86_64-poky-linux/iproute2-5.2.0-r0/iproute2-5.2.0-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/iptables-1.8.3-r0/iptables-1.8.3-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/kmod-26-r0/kmod-26-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/libcap-2.27-r0/libcap-2.27-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/libcap-ng-0.7.9-r0/libcap-ng-0.7.9-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/libmnl-1.0.4-r0/libmnl-1.0.4-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/libnsl2-1.2.0+gitAUTOINC+37c5ffe303-r0/libnsl2-1.2.0+git0+37c5ffe303-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/libtool-2.4.6-r0/libtool-2.4.6-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/libxcrypt-4.4.8-r0/libxcrypt-4.4.8-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/linux-libc-headers-5.2-r0/linux-libc-headers-5.2-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/linux-yocto-5.2.17+gitAUTOINC+b867b78b50_255a750d28-r0/linux-yocto-5.2.17+git0+b867b78b50_255a750d28-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/lzo-2.10-r0/lzo-2.10-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/make-4.2.1-r0/make-4.2.1-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/mdadm-4.1-r0/mdadm-4.1-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/netbase-1_5.6-r0/netbase-5.6-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/opkg-utils-0.4.1-r0/opkg-utils-0.4.1-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/perl-5.30.0-r0/perl-5.30.0-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/procps-3.3.15-r0/procps-3.3.15-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/ptest-runner-2.3.2+gitAUTOINC+7015e9199c-r0/ptest-runner-2.3.2+git0+7015e9199c-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/readline-8.0-r0/readline-8.0-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/sed-4.2.2-r0/sed-4.2.2-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/shared-mime-info-1.10-r0/shared-mime-info-1.10-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/socat-1.7.3.3-r0/socat-1.7.3.3-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/sysvinit-2.88dsf-r14/sysvinit-2.88dsf-r14.src.rpm
tmp/deploy/sources/x86_64-poky-linux/sysvinit-inittab-2.88dsf-r10/sysvinit-inittab-2.88dsf-r10.src.rpm
tmp/deploy/sources/x86_64-poky-linux/util-linux-2.34-r0/util-linux-2.34-r0.src.rpm
tmp/deploy/sources/x86_64-poky-linux/v86d-0.1.10-r2/v86d-0.1.10-r2.src.rpm
tmp/deploy/sources/x86_64-poky-linux/which-2.21-r3/which-2.21-r3.src.rpm
tmp/deploy/sources/x86_64-poky-linux/xz-5.2.4-r0/xz-5.2.4-r0.src.rpm
~~~