files-checker.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. '.gitattributes',
  15. '.github',
  16. '.gitignore',
  17. '.gitmodules',
  18. '.htaccess',
  19. '.idea',
  20. '.jshintrc',
  21. '.mailmap',
  22. '.npmignore',
  23. '.php-cs-fixer.dist.php',
  24. '.pre-commit-config.yaml',
  25. '.reuse',
  26. '.scrutinizer.yml',
  27. '.tag',
  28. '.tx',
  29. '.user.ini',
  30. '__mocks__',
  31. '__tests__',
  32. '3rdparty',
  33. 'AUTHORS',
  34. 'CHANGELOG.md',
  35. 'CODE_OF_CONDUCT.md',
  36. 'COPYING',
  37. 'COPYING-README',
  38. 'DESIGN.md',
  39. 'Makefile',
  40. 'README.md',
  41. 'SECURITY.md',
  42. 'apps',
  43. 'autotest-checkers.sh',
  44. 'autotest-external.sh',
  45. 'autotest.sh',
  46. 'babel.config.js',
  47. 'build',
  48. 'codecov.yml',
  49. 'composer.json',
  50. 'composer.lock',
  51. 'config',
  52. 'console.php',
  53. 'contribute',
  54. 'core',
  55. 'cron.php',
  56. 'custom.d.ts',
  57. 'cypress.config.ts',
  58. 'cypress.d.ts',
  59. 'cypress',
  60. 'dist',
  61. 'index.html',
  62. 'index.php',
  63. 'jest.config.ts',
  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. 'tests',
  79. 'themes',
  80. 'tsconfig.json',
  81. 'vendor-bin',
  82. 'version.php',
  83. 'webpack.common.js',
  84. 'webpack.config.js',
  85. 'webpack.modules.js',
  86. ];
  87. $actualFiles = [];
  88. $files = new \DirectoryIterator(__DIR__ . '/..');
  89. foreach ($files as $file) {
  90. $actualFiles[] = $file->getFilename();
  91. }
  92. $additionalFiles = array_diff($actualFiles, $expectedFiles);
  93. $missingFiles = array_diff($expectedFiles, $actualFiles);
  94. $failed = false;
  95. if (count($additionalFiles) > 0) {
  96. echo sprintf('ERROR: There were %d additional files:', count($additionalFiles)) . PHP_EOL;
  97. echo implode(PHP_EOL, $additionalFiles) . PHP_EOL;
  98. $failed = true;
  99. }
  100. if (count($missingFiles) > 0) {
  101. echo sprintf('ERROR: There were %d missing files:', count($missingFiles)) . PHP_EOL;
  102. echo implode(PHP_EOL, $missingFiles) . PHP_EOL;
  103. $failed = true;
  104. }
  105. if ($failed) {
  106. 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;
  107. exit(1);
  108. }
  109. echo 'OK: all expected files are present and no additional files are there.' . PHP_EOL;
  110. exit(0);