Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | inherit allarch |
| 2 | |
| 3 | SUMMARY = "Operating system identification" |
| 4 | DESCRIPTION = "The /etc/os-release file contains operating system identification data." |
| 5 | LICENSE = "MIT" |
| 6 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
| 7 | INHIBIT_DEFAULT_DEPS = "1" |
| 8 | |
| 9 | do_fetch[noexec] = "1" |
| 10 | do_unpack[noexec] = "1" |
| 11 | do_patch[noexec] = "1" |
| 12 | do_configure[noexec] = "1" |
| 13 | |
| 14 | # Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME |
| 15 | # HOME_URL SUPPORT_URL BUG_REPORT_URL |
| 16 | OS_RELEASE_FIELDS = "ID ID_LIKE NAME VERSION VERSION_ID PRETTY_NAME" |
| 17 | |
| 18 | ID = "${DISTRO}" |
| 19 | NAME = "${DISTRO_NAME}" |
| 20 | VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}" |
| 21 | VERSION_ID = "${DISTRO_VERSION}" |
| 22 | PRETTY_NAME = "${DISTRO_NAME} ${VERSION}" |
| 23 | BUILD_ID ?= "${DATETIME}" |
| 24 | BUILD_ID[vardepsexclude] = "DATETIME" |
| 25 | |
| 26 | python do_compile () { |
| 27 | import shutil |
| 28 | with open(d.expand('${B}/os-release'), 'w') as f: |
| 29 | for field in d.getVar('OS_RELEASE_FIELDS', True).split(): |
| 30 | value = d.getVar(field, True) |
| 31 | if value: |
| 32 | f.write('{0}={1}\n'.format(field, value)) |
| 33 | if d.getVar('RPM_SIGN_PACKAGES', True) == '1': |
| 34 | rpm_gpg_pubkey = d.getVar('RPM_GPG_PUBKEY', True) |
| 35 | os.mkdir('${B}/rpm-gpg') |
| 36 | distro_version = self.d.getVar('DISTRO_VERSION', True) or "oe.0" |
| 37 | shutil.copy2(rpm_gpg_pubkey, d.expand('${B}/rpm-gpg/RPM-GPG-KEY-%s' % distro_version)) |
| 38 | } |
| 39 | do_compile[vardeps] += "${OS_RELEASE_FIELDS}" |
| 40 | |
| 41 | do_install () { |
| 42 | install -d ${D}${sysconfdir} |
| 43 | install -m 0644 os-release ${D}${sysconfdir}/ |
| 44 | |
| 45 | if [ -d "rpm-gpg" ]; then |
| 46 | install -d "${D}${sysconfdir}/pki" |
| 47 | cp -r "rpm-gpg" "${D}${sysconfdir}/pki/" |
| 48 | fi |
| 49 | } |