From c9af9a553984555ff540536c5426a0f492bff296 Mon Sep 17 00:00:00 2001 From: Rafi Kamal Date: Thu, 12 Sep 2019 13:02:02 -0700 Subject: [PATCH] Fix update_version.py, so that PROTOBUF_VERSION is always a 9 digit number. --- src/google/protobuf/any.pb.h | 4 ++-- src/google/protobuf/api.pb.h | 4 ++-- src/google/protobuf/compiler/plugin.pb.h | 4 ++-- src/google/protobuf/descriptor.pb.h | 4 ++-- src/google/protobuf/duration.pb.h | 4 ++-- src/google/protobuf/empty.pb.h | 4 ++-- src/google/protobuf/field_mask.pb.h | 4 ++-- src/google/protobuf/port_def.inc | 8 ++++---- src/google/protobuf/source_context.pb.h | 4 ++-- src/google/protobuf/struct.pb.h | 4 ++-- src/google/protobuf/stubs/common.h | 8 ++++---- src/google/protobuf/timestamp.pb.h | 4 ++-- src/google/protobuf/type.pb.h | 4 ++-- src/google/protobuf/wrappers.pb.h | 4 ++-- update_version.py | 14 +++++++------- 15 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 04b7e9d128..87106efe3d 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index ed4043ea6c..336c548a3c 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 94971ff986..4eaa9038d4 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 81342ccea2..59b85ec356 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 5cc32bb763..ecb69690fe 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index fe637e4462..488db4eb08 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index ecaba1479f..f948425900 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 1ac28bf9ce..cec8526ecc 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -288,14 +288,14 @@ // Shared google3/opensource definitions. ////////////////////////////////////// -#define PROTOBUF_VERSION 30010000 -#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 30010000 -#define PROTOBUF_MIN_PROTOC_VERSION 30010000 +#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 30010000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3010000 #if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI #define PROTOBUF_RTTI 0 diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index e17c5b63b9..690530fd26 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 505e9e8ff3..3df0c97e02 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index c78a192ff8..20608784ac 100644 --- a/src/google/protobuf/stubs/common.h +++ b/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 30010000 +#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 = 30010000; +static const int kMinHeaderVersionForLibrary = 3010000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 30010000 +#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 = 30010000; +static const int kMinHeaderVersionForProtoc = 3010000; // Verifies that the headers and libraries are compatible. Use the macro // below to call this. diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 6172eb4f44..d67d5cc6a5 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 2431969e34..95a29a78ae 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 4172a8cbbe..7f1b9a9738 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -8,12 +8,12 @@ #include #include -#if PROTOBUF_VERSION < 30010000 +#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 30010000 < 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. diff --git a/update_version.py b/update_version.py index f5f28542cb..9ba1a3b64a 100755 --- a/update_version.py +++ b/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 .. @@ -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, @@ -134,7 +134,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, @@ -228,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 @@ -237,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 = .*$',