Rev 1427 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1427 | Rev 1430 | ||
---|---|---|---|
Line 98... | Line 98... | ||
98 | $out = array(); |
98 | $out = array(); |
99 | exec('cd /tmp/oidplus_git_a && git reset --hard --quiet && git checkout master --quiet && git log --reverse --quiet', $out, $ec); |
99 | exec('cd /tmp/oidplus_git_a && git reset --hard --quiet && git checkout master --quiet && git log --reverse --quiet', $out, $ec); |
100 | if ($ec != 0) { |
100 | if ($ec != 0) { |
101 | fwrite(STDERR, "GIT Log failed\n"); |
101 | fwrite(STDERR, "GIT Log failed\n"); |
102 | exit(1); |
102 | exit(1); |
103 | } else { |
103 | } |
- | 104 | ||
104 | $cont = implode("\n", $out); |
105 | $cont = implode("\n", $out); |
105 | preg_match_all('%^commit (.+)\n.+trunk@(\d+) 02e%smU', $cont, $git_commits, PREG_SET_ORDER); |
106 | preg_match_all('%^commit (.+)\n.+trunk@(\d+) 02e%smU', $cont, $git_commits, PREG_SET_ORDER); |
106 | $svn_git = []; |
107 | $svn_git = []; |
107 | foreach ($git_commits as $git_commit) { |
108 | foreach ($git_commits as $git_commit) { |
- | 109 | // ViaThinkSoft uses "Git-to-Svn" to synchronize SVN revisions to GitHub |
|
- | 110 | // We need to find the revision numbers for each commit, so we can identify |
|
- | 111 | // which commits were revision 1..1425, so we can see where version 2.0.0.<svnrev> applies |
|
- | 112 | // and when changelog.json.php applies. |
|
108 | $svn_git[$git_commit[1]] = $git_commit[2]; |
113 | $svn_git[$git_commit[1]] = $git_commit[2]; |
109 | } |
114 | } |
110 | preg_match_all('%^commit (.+)\n%smU', $cont, $git_commits, PREG_SET_ORDER); |
115 | preg_match_all('%^commit (.+)\n%smU', $cont, $git_commits, PREG_SET_ORDER); |
111 | foreach ($git_commits as $git_commit) { |
116 | foreach ($git_commits as $git_commit) { |
112 | if (isset($git_version_cache["git-to-ver"][$git_commit[1]])) continue; |
117 | if (isset($git_version_cache["git-to-ver"][$git_commit[1]])) continue; |
Line 116... | Line 121... | ||
116 | $github_project = $ary[4]; |
121 | $github_project = $ary[4]; |
117 | $v3_versionfile = 'https://raw.githubusercontent.com/'.$github_user.'/'.$github_project.'/'.$git_commit[1].'/changelog.json.php'; |
122 | $v3_versionfile = 'https://raw.githubusercontent.com/'.$github_user.'/'.$github_project.'/'.$git_commit[1].'/changelog.json.php'; |
118 | 123 | ||
119 | $svn = $svn_git[$git_commit[1]] ?? 0; |
124 | $svn = $svn_git[$git_commit[1]] ?? 0; |
120 | if (($svn >= 1) && ($svn <= 1425)) { |
125 | if (($svn >= 1) && ($svn <= 1425)) { |
- | 126 | // SVN Revision 0..1425 were named 2.0.0.<svnrev>. They did not have a changelog.json.php. Every revision was a new version. |
|
121 | $ver = "2.0.0.$svn"; |
127 | $ver = "2.0.0.$svn"; |
122 | $git_version_cache["git-to-ver"][$git_commit[1]] = $ver; |
128 | $git_version_cache["git-to-ver"][$git_commit[1]] = $ver; |
123 | if (!isset($git_version_cache["version-first-commit"][$ver])) { |
129 | if (!isset($git_version_cache["version-first-commit"][$ver])) { |
124 | $git_version_cache["version-first-commit"][$ver] = $git_commit[1]; |
130 | $git_version_cache["version-first-commit"][$ver] = $git_commit[1]; |
125 | } |
131 | } |
126 | } else if ($ver = OIDplus::getVersion($v3_versionfile)) { |
132 | } else if ($ver = OIDplus::getVersion($v3_versionfile)) { |
- | 133 | // Beginning with SVN revision 1426, versions are defined by the first revision/commit that adds a new version to changelog.json.php |
|
127 | $git_version_cache["git-to-ver"][$git_commit[1]] = $ver; |
134 | $git_version_cache["git-to-ver"][$git_commit[1]] = $ver; |
128 | if (!isset($git_version_cache["version-first-commit"][$ver])) { |
135 | if (!isset($git_version_cache["version-first-commit"][$ver])) { |
129 | $git_version_cache["version-first-commit"][$ver] = $git_commit[1]; |
136 | $git_version_cache["version-first-commit"][$ver] = $git_commit[1]; |
130 | } |
137 | } |
131 | } else { |
138 | } else { |
132 | fwrite(STDERR, "PROBLEM: " . $git_commit[1] . "\n"); |
139 | fwrite(STDERR, "PROBLEM: " . $git_commit[1] . "\n"); |
133 | } |
140 | } |
134 | } |
141 | } |
135 | } |
- | |
136 | 142 | ||
137 | file_put_contents($git_version_cache_file, json_encode($git_version_cache, JSON_PRETTY_PRINT)); |
143 | file_put_contents($git_version_cache_file, json_encode($git_version_cache, JSON_PRETTY_PRINT)); |
138 | 144 | ||
139 | // Step 2: Write change-scripts (for ZIP/TAR-GZ distribution channel) |
145 | // Step 2: Write change-scripts (for ZIP/TAR-GZ distribution channel) |
140 | // The order of $git_version_cache is very critical here! |
146 | // The order of $git_version_cache is very critical here! |