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