xref: /freebsd/contrib/file/magic/Magdir/gentoo (revision 0d66206fff44f864ea8a4b220c3a53b4caa959a0)
1#------------------------------------------------------------------------------
2# $File: gentoo,v 1.2 2022/09/12 13:13:28 christos Exp $
3# gentoo:  file(1) magic for gentoo specific formats
4#
5# Summary: Gentoo ebuild Manifest files (GLEP 74)
6# Reference: https://www.gentoo.org/glep/glep-0074.html
7# Submitted by: Michal Gorny <mgorny@gentoo.org>
8# Start by doing a fast check for the most common tags.
90	string	AUX
10>0	use	gentoo-manifest
110	string	DATA
12>0	use	gentoo-manifest
130	string	DIST
14>0	use	gentoo-manifest
150	string	EBUILD
16>0	use	gentoo-manifest
170	string	MANIFEST
18>0	use	gentoo-manifest
19
20# Manifest can be PGP-signed.
210	string	-----BEGIN\040PGP\040SIGNED\040MESSAGE-----
22>34	search/32	\n\n
23>>&0	string	AUX
24>>>&0	use	gentoo-manifest
25>>&0	string	DATA
26>>>&0	use	gentoo-manifest
27>>&0	string	DIST
28>>>&0	use	gentoo-manifest
29>>&0	string	EBUILD
30>>>&0	use	gentoo-manifest
31>>&0	string	MANIFEST
32>>>&0	use	gentoo-manifest
33
34# Use a more detailed regex to verify that we were correct.
35# <tag> <filename> <size> <hash-name> <hash-value>...
36# (<tag>'s already been matched prior to calling)
370	name	gentoo-manifest
38>&0	regex	[[:space:]]+[[:print:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[[:alnum:]]+[[:space:]]+[[:xdigit:]]{32}	Gentoo Manifest (GLEP 74)
39
40# Summary: Gentoo ebuild and eclass files
41# Reference: https://projects.gentoo.org/pms/8/pms.html
42# Submitted by: Michal Gorny <mgorny@gentoo.org>
430	search/512	EAPI=
44>0	regex		.*\n[\040\t]*EAPI=["']?	Gentoo ebuild
45>>&0	regex		[[:alnum:]+_.-]+	\b, EAPI %s
46
470	search/512	@ECLASS:\040		Gentoo eclass
48>&0	string		x			%s
49
50# Summary: Gentoo supplementary package and category metadata files
51# Reference: https://www.gentoo.org/glep/glep-0068.html
52# Submitted by: Michal Gorny <mgorny@gentoo.org>
530	string		\<?xml
54>0	search/512	\<catmetadata		Gentoo category metadata file
55>0	search/512	\<pkgmetadata		Gentoo package metadata file
56
57# Summary: Gentoo GLEP 78 binary package
58# Reference: https://www.gentoo.org/glep/glep-0078.html
59# Note: assumes the strict format
60# Submitted by: Michal Gorny <mgorny@gentoo.org>
61
62# GPKG uses ustar (or ustar-compatible GNU format) that starts with
63# a <directory>/gpkg-1 file
64257	string		ustar
65>0	search/100	/gpkg-1\0
66>>0	regex		[^/]+		Gentoo GLEP 78 (GPKG) binary package for "%s"
67!:mime	application/x-tar
68!:ext	tar
69# the logic below requires the gpkg-1 file to be empty
70>>>124	string	00000000000\0
71# determine the compression used by looking at the second member name
72>>>>512	search/100	.tar.
73>>>>>&0	string		gz\0		using gzip compression
74>>>>>&0	string		bz2\0		using bzip2 compression
75>>>>>&0	string		lz\0		using lzip compression
76>>>>>&0	string		lz4\0		using lz4 compression
77>>>>>&0	string		lzo\0		using lzo compression
78>>>>>&0	string		xz\0		using xz compression
79>>>>>&0	string		zst\0		using zstd compression
80>>>>(636.o+1024)	search/611	.sig\0	\b, signed
81