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