files-checker.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. $expectedFiles = [
  7. '.',
  8. '..',
  9. '.devcontainer',
  10. '.editorconfig',
  11. '.eslintignore',
  12. '.eslintrc.js',
  13. '.git',
  14. '.git-blame-ignore-revs',
  15. '.gitattributes',
  16. '.github',
  17. '.gitignore',
  18. '.gitmodules',
  19. '.htaccess',
  20. '.idea',
  21. '.jshintrc',
  22. '.mailmap',
  23. '.npmignore',
  24. '.php-cs-fixer.dist.php',
  25. '.pre-commit-config.yaml',
  26. '.reuse',
  27. '.scrutinizer.yml',
  28. '.tag',
  29. '.tx',
  30. '.user.ini',
  31. '__mocks__',
  32. '__tests__',
  33. '3rdparty',
  34. 'AUTHORS',
  35. 'CHANGELOG.md',
  36. 'CODE_OF_CONDUCT.md',
  37. 'COPYING',
  38. 'COPYING-README',
  39. 'DESIGN.md',
  40. 'Makefile',
  41. 'README.md',
  42. 'SECURITY.md',
  43. 'apps',
  44. 'autotest-checkers.sh',
  45. 'autotest-external.sh',
  46. 'autotest.sh',
  47. 'babel.config.js',
  48. 'build',
  49. 'codecov.yml',
  50. 'composer.json',
  51. 'composer.lock',
  52. 'config',
  53. 'console.php',
  54. 'contribute',
  55. 'core',
  56. 'cron.php',
  57. 'custom.d.ts',
  58. 'cypress.config.ts',
  59. 'cypress.d.ts',
  60. 'cypress',
  61. 'dist',
  62. 'index.html',
  63. 'index.php',
  64. 'lib',
  65. 'LICENSES',
  66. 'occ',
  67. 'ocs',
  68. 'ocs-provider',
  69. 'package-lock.json',
  70. 'package.json',
  71. 'psalm-ocp.xml',
  72. 'psalm.xml',
  73. 'public.php',
  74. 'remote.php',
  75. 'resources',
  76. 'robots.txt',
  77. 'status.php',
  78. 'stylelint.config.js',
  79. 'tests',
  80. 'themes',
  81. 'tsconfig.json',
  82. 'vendor-bin',
  83. 'version.php',
  84. 'vitest.config.ts',
  85. 'webpack.common.js',
  86. 'webpack.config.js',
  87. 'webpack.modules.js',
  88. ];
  89. $actualFiles = [];
  90. $files = new \DirectoryIterator(__DIR__ . '/..');
  91. foreach ($files as $file) {
  92. $actualFiles[] = $file->getFilename();
  93. }
  94. $additionalFiles = array_diff($actualFiles, $expectedFiles);
  95. $missingFiles = array_diff($expectedFiles, $actualFiles);
  96. $failed = false;
  97. if (count($additionalFiles) > 0) {
  98. echo sprintf('ERROR: There were %d additional files:', count($additionalFiles)) . PHP_EOL;
  99. echo implode(PHP_EOL, $additionalFiles) . PHP_EOL;
  100. $failed = true;
  101. }
  102. if (count($missingFiles) > 0) {
  103. echo sprintf('ERROR: There were %d missing files:', count($missingFiles)) . PHP_EOL;
  104. echo implode(PHP_EOL, $missingFiles) . PHP_EOL;
  105. $failed = true;
  106. }
  107. if ($failed) {
  108. echo 'ERROR: Please remove or add those files again or inform the release team about those now files to be included or excluded from the release tar ball.' . PHP_EOL;
  109. exit(1);
  110. }
  111. echo 'OK: all expected files are present and no additional files are there.' . PHP_EOL;
  112. exit(0);