gentoo 3.0 KB

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