1
0

files-checker.php 2.3 KB

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