xfgusta / pkgnote

Read packaging metadata (.note.package)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pkgnote

A utility to read an ELF file and print its packaging metadata. It looks for the note section header of type 0xCAFE1A7E (.note.packaging) and extracts the owner and value, following the specification.

Section header

SECTION: `.note.package`
note type: `0xcafe1a7e`
Owner: `FDO` (FreeDesktop.org)
Value: a single JSON object encoded as a zero-terminated UTF-8 string

Value example

{
    "type": "rpm",
    "name": "coreutils",
    "version": "9.0-5.fc36",
    "architecture": "x86_64",
    "osCpe": "cpe:/o:fedoraproject:fedora:36"
}

Run pkgnote FILE to print the JSON object or pkgnote -o FILE to print the owner.

See Package Metadata for Core Files for the overview and details.

Building from source

Requirements

  • make
  • gcc
  • libelf
  • json-c
git clone https://github.com/xfgusta/pkgnote
cd pkgnote
make

TODO

  • Add a -k option to print a specific key
  • Add man page

About

Read packaging metadata (.note.package)

License:MIT License


Languages

Language:C 91.9%Language:Makefile 8.1%