1#------------------------------------------------------------------------------ 2# $File: gentoo,v 1.5 2022/12/26 17:16:55 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!:mime application/vnd.gentoo.manifest 40 41# Summary: Gentoo ebuild and eclass files 42# Reference: https://projects.gentoo.org/pms/8/pms.html 43# Submitted by: Michal Gorny <mgorny@gentoo.org> 440 search/512 EAPI= 45>0 regex .*\n[\040\t]*EAPI=["']? Gentoo ebuild 46>>&0 regex [[:alnum:]+_.-]+ \b, EAPI %s 47!:mime application/vnd.gentoo.ebuild 48 490 search/512 @ECLASS:\040 Gentoo eclass 50>&0 string x %s 51!:mime application/vnd.gentoo.eclass 52 53# Summary: Gentoo supplementary package and category metadata files 54# Reference: https://www.gentoo.org/glep/glep-0068.html 55# Submitted by: Michal Gorny <mgorny@gentoo.org> 560 string \<?xml 57>0 search/512 \<catmetadata Gentoo category metadata file 58!:mime application/vnd.gentoo.catmetadata+xml 59>0 search/512 \<pkgmetadata Gentoo package metadata file 60!:mime application/vnd.gentoo.pkgmetadata+xml 61 62# Summary: Gentoo GLEP 78 binary package 63# Reference: https://www.gentoo.org/glep/glep-0078.html 64# Note: assumes the strict format 65# Submitted by: Michal Gorny <mgorny@gentoo.org> 66 67# GPKG uses ustar (or ustar-compatible GNU format) that starts with 68# a <directory>/gpkg-1 file 69257 string ustar 70>0 search/100 /gpkg-1\0 71>>0 regex [^/]+ Gentoo GLEP 78 (GPKG) binary package for "%s" 72!:mime application/vnd.gentoo.gpkg 73!:ext tar 74# the logic below requires the gpkg-1 file to be empty 75>>>124 string 00000000000\0 76# determine the compression used by looking at the second member name 77>>>>512 search/100 .tar. 78>>>>>&0 string gz\0 using gzip compression 79>>>>>&0 string bz2\0 using bzip2 compression 80>>>>>&0 string lz\0 using lzip compression 81>>>>>&0 string lz4\0 using lz4 compression 82>>>>>&0 string lzo\0 using lzo compression 83>>>>>&0 string xz\0 using xz compression 84>>>>>&0 string zst\0 using zstd compression 85>>>>(636.o+1024) search/611 .sig\0 \b, signed 86