Browse Source

Update to 3.10.0-rc0 (#6660)

* Cherry pick changes on update_version.py #6643

* Update version to 3.10.0-rc-0

* Do not add rc0 to php packages.xml
Jie Luo 6 years ago
parent
commit
2a4657971d

+ 1 - 1
Protobuf-C++.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name     = 'Protobuf-C++'
-  s.version  = '3.9.0-rc1'
+  s.version  = '3.10.0-rc0'
   s.summary  = 'Protocol Buffers v3 runtime library for C++.'
   s.homepage = 'https://github.com/google/protobuf'
   s.license  = '3-Clause BSD License'

+ 1 - 1
Protobuf.podspec

@@ -5,7 +5,7 @@
 # dependent projects use the :git notation to refer to the library.
 Pod::Spec.new do |s|
   s.name     = 'Protobuf'
-  s.version  = '3.9.1'
+  s.version  = '3.10.0-rc0'
   s.summary  = 'Protocol Buffers v.3 runtime library for Objective-C.'
   s.homepage = 'https://github.com/protocolbuffers/protobuf'
   s.license  = '3-Clause BSD License'

+ 1 - 1
configure.ac

@@ -17,7 +17,7 @@ AC_PREREQ(2.59)
 # In the SVN trunk, the version should always be the next anticipated release
 # version with the "-pre" suffix.  (We used to use "-SNAPSHOT" but this pushed
 # the size of one file name in the dist tarfile over the 99-char limit.)
-AC_INIT([Protocol Buffers],[3.9.1],[protobuf@googlegroups.com],[protobuf])
+AC_INIT([Protocol Buffers],[3.10.0-rc-0],[protobuf@googlegroups.com],[protobuf])
 
 AM_MAINTAINER_MODE([enable])
 

+ 1 - 1
csharp/Google.Protobuf.Tools.nuspec

@@ -5,7 +5,7 @@
     <title>Google Protocol Buffers tools</title>
     <summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
     <description>See project site for more info.</description>
-    <version>3.9.1</version>
+    <version>3.10.0-rc0</version>
     <authors>Google Inc.</authors>
     <owners>protobuf-packages</owners>
     <licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>

+ 2 - 2
csharp/src/Google.Protobuf/Google.Protobuf.csproj

@@ -4,7 +4,7 @@
     <Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
     <Copyright>Copyright 2015, Google Inc.</Copyright>
     <AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
-    <VersionPrefix>3.9.1</VersionPrefix>
+    <VersionPrefix>3.10.0-rc0</VersionPrefix>
     <LangVersion>6</LangVersion>
     <Authors>Google Inc.</Authors>
     <TargetFrameworks>netstandard1.0;netstandard2.0;net45</TargetFrameworks>
@@ -28,7 +28,7 @@
 
   <!-- Needed for the net45 build to work on Unix. See https://github.com/dotnet/designs/pull/33 -->
   <ItemGroup>
-    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" PrivateAssets="All" />
+    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0-preview.2"/>
   </ItemGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'net45' or '$(TargetFramework)' == 'netstandard2.0' ">

+ 1 - 1
java/bom/pom.xml

@@ -4,7 +4,7 @@
 
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-bom</artifactId>
-  <version>3.9.1</version>
+  <version>3.10.0-rc-0</version>
   <packaging>pom</packaging>
 
   <name>Protocol Buffers [BOM]</name>

+ 1 - 1
java/core/pom.xml

@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.9.1</version>
+    <version>3.10.0-rc-0</version>
   </parent>
 
   <artifactId>protobuf-java</artifactId>

+ 1 - 1
java/lite/pom.xml

@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.9.1</version>
+    <version>3.10.0-rc-0</version>
   </parent>
 
   <artifactId>protobuf-javalite</artifactId>

+ 1 - 1
java/pom.xml

@@ -4,7 +4,7 @@
 
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-parent</artifactId>
-  <version>3.9.1</version>
+  <version>3.10.0-rc-0</version>
   <packaging>pom</packaging>
 
   <name>Protocol Buffers [Parent]</name>

+ 1 - 1
java/util/pom.xml

@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.9.1</version>
+    <version>3.10.0-rc-0</version>
   </parent>
 
   <artifactId>protobuf-java-util</artifactId>

+ 1 - 1
js/package.json

@@ -1,6 +1,6 @@
 {
   "name": "google-protobuf",
-  "version": "3.9.1",
+  "version": "3.10.0-rc.0",
   "description": "Protocol Buffers for JavaScript",
   "main": "google-protobuf.js",
   "files": [

+ 6 - 6
php/ext/google/protobuf/package.xml

@@ -10,15 +10,15 @@
   <email>protobuf-opensource@google.com</email>
   <active>yes</active>
  </lead>
- <date>2019-08-02</date>
- <time>15:59:08</time>
+ <date>2019-09-17</date>
+ <time>16:00:29</time>
  <version>
-  <release>3.9.1</release>
-  <api>3.9.1</api>
+  <release>3.10.0RC0</release>
+  <api>3.10.0</api>
  </version>
  <stability>
-  <release>stable</release>
-  <api>stable</api>
+  <release>beta</release>
+  <api>beta</api>
  </stability>
  <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
  <notes>GA release.</notes>

+ 1 - 1
php/ext/google/protobuf/protobuf.h

@@ -37,7 +37,7 @@
 #include "upb.h"
 
 #define PHP_PROTOBUF_EXTNAME "protobuf"
-#define PHP_PROTOBUF_VERSION "3.9.1"
+#define PHP_PROTOBUF_VERSION "3.10.0RC0"
 
 #define MAX_LENGTH_OF_INT64 20
 #define SIZEOF_INT64 8

+ 1 - 1
protoc-artifacts/pom.xml

@@ -8,7 +8,7 @@
   </parent>
   <groupId>com.google.protobuf</groupId>
   <artifactId>protoc</artifactId>
-  <version>3.9.1</version>
+  <version>3.10.0-rc-0</version>
   <packaging>pom</packaging>
   <name>Protobuf Compiler</name>
   <description>

+ 1 - 1
python/google/protobuf/__init__.py

@@ -30,7 +30,7 @@
 
 # Copyright 2007 Google Inc. All Rights Reserved.
 
-__version__ = '3.9.1'
+__version__ = '3.10.0rc0'
 
 if __name__ != '__main__':
   try:

+ 1 - 1
ruby/google-protobuf.gemspec

@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
   s.name        = "google-protobuf"
-  s.version     = "3.9.1"
+  s.version     = "3.10.0.rc.0"
   git_tag       = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
   s.licenses    = ["BSD-3-Clause"]
   s.summary     = "Protocol Buffers"

+ 1 - 1
src/Makefile.am

@@ -18,7 +18,7 @@ else
 PTHREAD_DEF =
 endif
 
-PROTOBUF_VERSION = 20:1:0
+PROTOBUF_VERSION = 21:0:0
 
 if GCC
 # Turn on all warnings except for sign comparison (we ignore sign comparison

+ 2 - 2
src/google/protobuf/any.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/api.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/compiler/plugin.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/descriptor.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/duration.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/empty.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/field_mask.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 4 - 4
src/google/protobuf/port_def.inc

@@ -288,14 +288,14 @@
 
 // Shared google3/opensource definitions. //////////////////////////////////////
 
-#define PROTOBUF_VERSION 3009001
-#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3009000
-#define PROTOBUF_MIN_PROTOC_VERSION 3009000
+#define PROTOBUF_VERSION 3010000
+#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3010000
+#define PROTOBUF_MIN_PROTOC_VERSION 3010000
 #define PROTOBUF_VERSION_SUFFIX ""
 
 // The minimum library version which works with the current version of the
 // headers.
-#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3009000
+#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3010000
 
 #if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI
 #define PROTOBUF_RTTI 0

+ 2 - 2
src/google/protobuf/source_context.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/struct.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 4 - 4
src/google/protobuf/stubs/common.h

@@ -81,7 +81,7 @@ namespace internal {
 
 // The current version, represented as a single integer to make comparison
 // easier:  major * 10^6 + minor * 10^3 + micro
-#define GOOGLE_PROTOBUF_VERSION 3009001
+#define GOOGLE_PROTOBUF_VERSION 3010000
 
 // A suffix string for alpha, beta or rc releases. Empty for stable releases.
 #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
@@ -89,15 +89,15 @@ namespace internal {
 // The minimum header version which works with the current version of
 // the library.  This constant should only be used by protoc's C++ code
 // generator.
-static const int kMinHeaderVersionForLibrary = 3009000;
+static const int kMinHeaderVersionForLibrary = 3010000;
 
 // The minimum protoc version which works with the current version of the
 // headers.
-#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3009000
+#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3010000
 
 // The minimum header version which works with the current version of
 // protoc.  This constant should only be used in VerifyVersion().
-static const int kMinHeaderVersionForProtoc = 3009000;
+static const int kMinHeaderVersionForProtoc = 3010000;
 
 // Verifies that the headers and libraries are compatible.  Use the macro
 // below to call this.

+ 2 - 2
src/google/protobuf/timestamp.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/type.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 2 - 2
src/google/protobuf/wrappers.pb.h

@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3009000
+#if PROTOBUF_VERSION < 3010000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3009001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3010000 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.

+ 53 - 28
update_version.py

@@ -24,7 +24,7 @@ Example:
   exit(1)
 
 NEW_VERSION = sys.argv[1]
-NEW_VERSION_INFO = NEW_VERSION.split('.')
+NEW_VERSION_INFO = [int(x) for x in NEW_VERSION.split('.')]
 if len(NEW_VERSION_INFO) != 3:
   print """
 [ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO>
@@ -34,7 +34,7 @@ Example:
 """
   exit(1)
 
-RC_VERSION = 0
+RC_VERSION = -1
 if len(sys.argv) > 2:
   RC_VERSION = int(sys.argv[2])
 
@@ -55,7 +55,7 @@ def ReplaceText(elem, text):
 
 
 def GetFullVersion(rc_suffix = '-rc-'):
-  if RC_VERSION == 0:
+  if RC_VERSION < 0:
     return NEW_VERSION
   else:
     return '%s%s%s' % (NEW_VERSION, rc_suffix, RC_VERSION)
@@ -99,7 +99,7 @@ def UpdateConfigure():
 
 
 def UpdateCpp():
-  cpp_version = '%s00%s00%s' % (
+  cpp_version = '%d%03d%03d' % (
     NEW_VERSION_INFO[0], NEW_VERSION_INFO[1], NEW_VERSION_INFO[2])
   def RewriteCommon(line):
     line = re.sub(
@@ -110,7 +110,7 @@ def UpdateCpp():
       r'^#define PROTOBUF_VERSION .*$',
       '#define PROTOBUF_VERSION %s' % cpp_version,
       line)
-    if NEW_VERSION_INFO[2] == '0':
+    if NEW_VERSION_INFO[2] == 0:
       line = re.sub(
         r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$',
         '#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version,
@@ -128,12 +128,13 @@ def UpdateCpp():
         'static const int kMinHeaderVersionForProtoc = %s;' % cpp_version,
         line)
     return line
+  
   def RewritePortDef(line):
     line = re.sub(
       r'^#define PROTOBUF_VERSION .*$',
       '#define PROTOBUF_VERSION %s' % cpp_version,
       line)
-    if NEW_VERSION_INFO[2] == '0':
+    if NEW_VERSION_INFO[2] == 0:
       line = re.sub(
         r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$',
         '#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version,
@@ -148,8 +149,31 @@ def UpdateCpp():
         line)
     return line
 
+  def RewritePbH(line):
+    line = re.sub(
+        r'^#if PROTOBUF_VERSION < .*$',
+        '#if PROTOBUF_VERSION < %s' % cpp_version,
+        line)
+    line = re.sub(
+        r'^#if .* < PROTOBUF_MIN_PROTOC_VERSION$',
+        '#if %s < PROTOBUF_MIN_PROTOC_VERSION' % cpp_version,
+        line)
+    return line
+    
   RewriteTextFile('src/google/protobuf/stubs/common.h', RewriteCommon)
   RewriteTextFile('src/google/protobuf/port_def.inc', RewritePortDef)
+  RewriteTextFile('src/google/protobuf/any.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/api.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/descriptor.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/duration.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/empty.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/field_mask.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/source_context.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/struct.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/timestamp.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/type.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/wrappers.pb.h', RewritePbH)
+  RewriteTextFile('src/google/protobuf/compiler/plugin.pb.h', RewritePbH)
 
 
 def UpdateCsharp():
@@ -204,7 +228,7 @@ def UpdateJavaScript():
 
 def UpdateMakefile():
   protobuf_version_offset = 11
-  expected_major_version = '3'
+  expected_major_version = 3
   if NEW_VERSION_INFO[0] != expected_major_version:
     print """[ERROR] Major protobuf version has changed. Please update
 update_version.py to readjust the protobuf_version_offset and
@@ -213,8 +237,8 @@ always increasing.
     """
     exit(1)
 
-  protobuf_version_info = '%s:%s:0' % (
-    int(NEW_VERSION_INFO[1]) + protobuf_version_offset, NEW_VERSION_INFO[2])
+  protobuf_version_info = '%d:%d:0' % (
+    NEW_VERSION_INFO[1] + protobuf_version_offset, NEW_VERSION_INFO[2])
   RewriteTextFile('src/Makefile.am',
     lambda line : re.sub(
       r'^PROTOBUF_VERSION = .*$',
@@ -256,31 +280,32 @@ def UpdatePhp():
     ReplaceText(Find(version, 'api'), NEW_VERSION)
     stability = Find(root, 'stability')
     ReplaceText(Find(stability, 'release'),
-        'stable' if RC_VERSION == 0 else 'beta')
-    ReplaceText(Find(stability, 'api'), 'stable' if RC_VERSION == 0 else 'beta')
+        'stable' if RC_VERSION < 0 else 'beta')
+    ReplaceText(Find(stability, 'api'), 'stable' if RC_VERSION < 0 else 'beta')
     changelog = Find(root, 'changelog')
     for old_version in changelog.getElementsByTagName('version'):
       if Find(old_version, 'release').firstChild.nodeValue == NEW_VERSION:
         print ('[WARNING] Version %s already exists in the change log.'
           % NEW_VERSION)
         return
-    changelog.appendChild(document.createTextNode(' '))
-    release = CreateNode('release', 2, [
-        CreateNode('version', 3, [
-          FindAndClone(version, 'release'),
-          FindAndClone(version, 'api')
-        ]),
-        CreateNode('stability', 3, [
-          FindAndClone(stability, 'release'),
-          FindAndClone(stability, 'api')
-        ]),
-        FindAndClone(root, 'date'),
-        FindAndClone(root, 'time'),
-        FindAndClone(root, 'license'),
-        FindAndClone(root, 'notes')
-      ])
-    changelog.appendChild(release)
-    changelog.appendChild(document.createTextNode('\n '))
+    if RC_VERSION != 0:
+      changelog.appendChild(document.createTextNode(' '))
+      release = CreateNode('release', 2, [
+          CreateNode('version', 3, [
+            FindAndClone(version, 'release'),
+            FindAndClone(version, 'api')
+          ]),
+          CreateNode('stability', 3, [
+            FindAndClone(stability, 'release'),
+            FindAndClone(stability, 'api')
+          ]),
+          FindAndClone(root, 'date'),
+          FindAndClone(root, 'time'),
+          FindAndClone(root, 'license'),
+          FindAndClone(root, 'notes')
+        ])
+      changelog.appendChild(release)
+      changelog.appendChild(document.createTextNode('\n '))
   RewriteXml('php/ext/google/protobuf/package.xml', Callback)
   RewriteTextFile('php/ext/google/protobuf/protobuf.h',
     lambda line : re.sub(