1 #------------------------------------------------------------------------------ 2 # $File: gentoo,v 1.6 2024/02/11 15:39:59 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 (a] gentoo.org> 8 # Start by doing a fast check for the most common tags. 9 0 string AUX\040 10 >0 use gentoo-manifest 11 0 string DATA\040 12 >0 use gentoo-manifest 13 0 string DIST\040 14 >0 use gentoo-manifest 15 0 string EBUILD\040 16 >0 use gentoo-manifest 17 0 string MANIFEST\040 18 >0 use gentoo-manifest 19 20 # Manifest can be PGP-signed. 21 0 string -----BEGIN\040PGP\040SIGNED\040MESSAGE----- 22 >34 search/32 \n\n 23 >>&0 string AUX\040 24 >>>&0 use gentoo-manifest 25 >>&0 string DATA\040 26 >>>&0 use gentoo-manifest 27 >>&0 string DIST\040 28 >>>&0 use gentoo-manifest 29 >>&0 string EBUILD\040 30 >>>&0 use gentoo-manifest 31 >>&0 string MANIFEST\040 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) 37 0 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 (a] gentoo.org> 44 0 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 49 0 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 (a] gentoo.org> 56 0 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 (a] gentoo.org> 66 67 # GPKG uses ustar (or ustar-compatible GNU format) that starts with 68 # a <directory>/gpkg-1 file 69 257 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