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