gentoo 2.8 KB

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