1
0

files-checker.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. 'jest.config.ts',
  65. 'lib',
  66. 'LICENSES',
  67. 'occ',
  68. 'ocs',
  69. 'ocs-provider',
  70. 'package-lock.json',
  71. 'package.json',
  72. 'psalm-ocp.xml',
  73. 'psalm.xml',
  74. 'public.php',
  75. 'remote.php',
  76. 'resources',
  77. 'robots.txt',
  78. 'status.php',
  79. 'tests',
  80. 'themes',
  81. 'tsconfig.json',
  82. 'vendor-bin',
  83. 'version.php',
  84. 'webpack.common.js',
  85. 'webpack.config.js',
  86. 'webpack.modules.js',
  87. ];
  88. $actualFiles = [];
  89. $files = new \DirectoryIterator(__DIR__ . '/..');
  90. foreach ($files as $file) {
  91. $actualFiles[] = $file->getFilename();
  92. }
  93. $additionalFiles = array_diff($actualFiles, $expectedFiles);
  94. $missingFiles = array_diff($expectedFiles, $actualFiles);
  95. $failed = false;
  96. if (count($additionalFiles) > 0) {
  97. echo sprintf('ERROR: There were %d additional files:', count($additionalFiles)) . PHP_EOL;
  98. echo implode(PHP_EOL, $additionalFiles) . PHP_EOL;
  99. $failed = true;
  100. }
  101. if (count($missingFiles) > 0) {
  102. echo sprintf('ERROR: There were %d missing files:', count($missingFiles)) . PHP_EOL;
  103. echo implode(PHP_EOL, $missingFiles) . PHP_EOL;
  104. $failed = true;
  105. }
  106. if ($failed) {
  107. 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;
  108. exit(1);
  109. }
  110. echo 'OK: all expected files are present and no additional files are there.' . PHP_EOL;
  111. exit(0);