Skip to content

Commit

Permalink
add definition for RPM files (#469)
Browse files Browse the repository at this point in the history
* add .ksy for rpm

* rpm: add more tags

* RPM: extract all rpm tags from the signature and the header

* rpm: clarify that this is for RPMv3 only

* rpm: add title, clarify this is about the RPM file format version, not
the version of RPM, rewrite tags to extended enum, add docs where needed
from LSB

* rpm: snake case tag name

* rpm: add webide statements, style guide fixes (ofs_)

* rpm: doc-ref: point to specific Git revisions

* rpm: style fixes - key order, indent, 8-char hash for ~15k commits

* rpm: insert underscores between words in enum value names

* rpm: replace vague "these come from rpmrc.in" with URL to the file

* rpm: add URL to 'lib/rpmtag.h'

* rpm: rename fields to use `num_` and `len_` as per style guide

* rpm: show body type in `-webide-representation` for index records

* rpm: merge `header` and `signature` types (remove duplication)

* rpm: fill in additional `architectures`

* rpm: add `-orig-id` to `no_arch_255` enum value

* rpm: add more `architectures` + `doc-ref`s

* rpm: remove `architectures::no_arch_0` item

The evidence that `archnum = 0` is "noarch" is inconclusive -
although the specified `doc-ref`s do suggest it, the same repos
contain sample files only with `archnum = 255` for "noarch".
This also seems to be common assignment among all "noarch"
samples that I found - no trace of `archnum = 0`.

`file(1)` also only recognizes `archnum = 255` as "noarch".

* rpm: move enum comment above its definition

(for consistency with other .ksy files, e.g. `executable/elf.ksy`)

* rpm: add doc-refs to `no_arch`, add enum value `no_os`

* rpm: reorder `-webide-representation` values in `header`

* rpm: fix `int8` record type, implement `char` as alias of `int8`

* rpm: explain gaps in `header_tags` enum according to `lib/rpmtag.h`

A Python script `rpm_find_enum_gaps.py` was used to find
all gaps. It has the following contents:

```python
import yaml

with open('archive/rpm.ksy', 'r', encoding='utf-8') as f:
	yaml_doc = yaml.safe_load(f)
	tags = yaml_doc['enums']['header_tags']
	last_key = None
	for key in tags:
		if last_key is None or key - last_key == 1:
			last_key = key
			continue
		print(last_key + 1 if last_key + 1 == key - 1 else '{:d}..{:d}'.format(last_key + 1, key - 1))
		last_key = key
```

* rpm: rename tag `install{ation => }_prefixes`

for consistency with other `*install_*` values

* rpm: normalize `{pre,post}_{,un}install_*` tag names

* rpm: fix tag comment `# {=>from } lib/rpmtag.h` for consistency

* rpm: update tags according to `tags.md`

using this Python script `rpm_read_tags_md.py`:
https://gist.github.com/generalmimon/11a329038b8b6afb245e7eafd6abe95d

* rpm: implement `int64` type

* rpm: allow `major == 4`, declare `lead` as obsolete

* rpm: rename `{header => record}_types` enum

* rpm: add `payload`, find its size in `signature` tags

* rpm: add year to obsoleteness declaration of `lead`

* rpm: rename `ofs_{record => body}` because used in `pos` of body

* rpm: split `count` to `num_values` and `len_value` per meaning

* rpm: move `header` description to `doc` key, explain `tag_raw`

* rpm: rename `{boundary => signature}_padding` field

See https://github.com/rpm-software-management/rpm/blob/911448f2/doc/manual/format.md#signature:

> As of RPM 2.1, all packages carry at least SIZE and MD5 signatures,
> and **the Signature section is padded to a multiple of 8 bytes.**

* rpm: move `encoding: UTF-8` from individiual fields to `/meta`

* rpm: add `/meta/{application,xref}`, change `/meta/title`

* rpm: rename types `{=>u}int{8,16,32,64}` because they're unsigned

* rpm: normalize `size_{tag,rec}` inconsistency to `size_tag`

* rpm: restore obsolete/internal/unimplemented tags

See
* <#469 (comment)>
* <#469 (comment)>

Co-authored-by: Petr Pucil <[email protected]>
  • Loading branch information
armijnhemel and generalmimon authored Nov 5, 2021
1 parent 291325b commit edc271b
Showing 1 changed file with 1,458 additions and 0 deletions.
Loading

0 comments on commit edc271b

Please sign in to comment.