diff --git a/CMakeLists.txt b/CMakeLists.txt index e8ac627aea..80ae30da80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,28 +39,23 @@ include(AutoRevision) # Set some variables from AutoRevision for use here and later list(LENGTH FC21_REV_TAG_LIST FC21_REV_TAG_LIST_LENGTH) -# When we tag a stable release we only get 2 of the 4 components populated -# So we manually set some of the variables we need for the full version. -if(${FC21_REV_TAG_LIST_LENGTH} EQUAL 2) +# When we tag a stable release we only get 3 of the 4 components populated, +# so we manually set some of the variables we need for the full version. +if (${FC21_REV_TAG_LIST_LENGTH} EQUAL 3) list(GET FC21_REV_TAG_LIST 0 FC21_MAJOR_VERSION) list(GET FC21_REV_TAG_LIST 1 FC21_MINOR_VERSION) - set(FC21_LABEL_VERSION "Stable") - set(FC21_EMER_VERSION "0") - set(FC21_PATCH_VERSION "0") + list(GET FC21_REV_TAG_LIST 2 FC21_PATCH_VERSION) + set(FC21_VERSION_LABEL "stable") set(IS_STABLE_VERSION true) - set(FREECIV21_VERSION "${FC21_MAJOR_VERSION}.${FC21_MINOR_VERSION}") + set(FREECIV21_VERSION "${FC21_MAJOR_VERSION}.${FC21_MINOR_VERSION}.${FC21_PATCH_VERSION}") else() + message(STATUS "${FC21_REV_TAG_LIST}") list(GET FC21_REV_TAG_LIST 0 FC21_MAJOR_VERSION) list(GET FC21_REV_TAG_LIST 1 FC21_MINOR_VERSION) - list(GET FC21_REV_TAG_LIST 2 FC21_LABEL_VERSION) - if (${FC21_REV_TAG_LIST_LENGTH} GREATER 3) - list(GET FC21_REV_TAG_LIST 3 FC21_EMER_VERSION) - else() - set(FC21_EMER_VERSION 0) - endif() - set(FC21_PATCH_VERSION ${FC21_REV_HEAD_HASH_D}) + list(GET FC21_REV_TAG_LIST 2 FC21_VERSION_LABEL) + list(GET FC21_REV_TAG_LIST 3 FC21_PATCH_VERSION) set(IS_STABLE_VERSION false) - set(FREECIV21_VERSION "${FC21_MAJOR_VERSION}.${FC21_MINOR_VERSION}.${FC21_PATCH_VERSION}") + set(FREECIV21_VERSION "${FC21_MAJOR_VERSION}.${FC21_MINOR_VERSION}") endif() # Set project diff --git a/client/packhand.cpp b/client/packhand.cpp index 5e483a2d03..04438c3f22 100644 --- a/client/packhand.cpp +++ b/client/packhand.cpp @@ -353,7 +353,7 @@ void handle_server_join_reply(bool you_can_join, const char *message, } client_info._obsolete = 5; // Old value for gui_type(GUI_QT) - client_info.emerg_version = EMERGENCY_VERSION; + client_info._obsolete2 = 0; qstrncpy(client_info.distribution, FREECIV_DISTRIBUTOR, sizeof(client_info.distribution)); send_packet_client_info(&client.conn, &client_info); diff --git a/client/page_main.cpp b/client/page_main.cpp index 3c80657d6a..12251a7f48 100644 --- a/client/page_main.cpp +++ b/client/page_main.cpp @@ -18,8 +18,6 @@ page_main::page_main(QWidget *parent, fc_client *gui) : QWidget(parent) { - QString msgbuf; - QString beta; ui.setupUi(this); ui.btut->setText(_("Tutorial")); ui.bstart->setText(_("Start new game")); @@ -46,9 +44,8 @@ page_main::page_main(QWidget *parent, fc_client *gui) : QWidget(parent) connect(ui.bload, &QPushButton::clicked, [gui]() { gui->switch_page(PAGE_LOAD); }); - // TRANS: "version 2.6.0" - msgbuf = QString(_("%1%2")).arg(word_version()).arg(freeciv21_version()); - ui.lversion->setText(QString(msgbuf) + beta); + // TRANS: "Version 2.6.0" + ui.lversion->setText(QString(_("Version %1")).arg(freeciv21_version())); setLayout(ui.gridLayout); } diff --git a/client/servers.cpp b/client/servers.cpp index 663d62e6a5..780c682a86 100644 --- a/client/servers.cpp +++ b/client/servers.cpp @@ -268,7 +268,7 @@ static struct server_list *parse_metaserver_data(QIODevice *f) "version_comments." FOLLOWTAG); if (latest_ver != nullptr) { - const char *my_comparable = fc_comparable_version(); + const char *my_comparable = freeciv21_version(); char vertext[2048]; qDebug("Metaserver says latest '" FOLLOWTAG diff --git a/common/networking/packets.def b/common/networking/packets.def index 214c214f30..d61cd62b4f 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -665,7 +665,8 @@ end PACKET_SERVER_INFO = 29; sc, dsend STRING version_label[48]; - UINT32 major_version, minor_version, patch_version, emerg_version; + UINT32 major_version, minor_version, patch_version; + UINT32 _obsolete; # Since 3.1 end /************** City packets **********************/ @@ -1291,7 +1292,7 @@ end PACKET_CLIENT_INFO = 119; cs, handle-per-conn UINT8 _obsolete; - UINT32 emerg_version; + UINT32 _obsolete2; # Since 3.1 STRING distribution[MAX_LEN_NAME]; end diff --git a/docs/Contributing/release.rst b/docs/Contributing/release.rst index a736aefecd..8b42266ee2 100644 --- a/docs/Contributing/release.rst +++ b/docs/Contributing/release.rst @@ -41,15 +41,16 @@ These are the general steps to prepare and finalize a release: `branches page `_. #. From the same page, create a new ``stable`` branch from ``master``. #. Update ``cmake/AutoRevision.txt`` with the hash of the last commit in ``master`` and - ``v[major version].[minor version]-dev`` with the version of the :strong:`next stable release`, then + ``v[major version].[minor version]-dev.0`` with the version of the :strong:`next stable release`, then open a PR for this change to ``master``. This way, development builds from ``master`` will immediately use the version number of the next stable. #. If the release is a :strong:`release candidate` for a :strong:`stable release`, the release manager will make sure that the :guilabel:`Target` branch in the release draft is set to ``stable``. #. The release manager will add a tag to the release notes page and then click :guilabel:`Publish Release`. - The format of the tag is ``v[major version].[minor version]-[pre-release name].[number]``. For example: - ``v3.0-beta.6``. :strong:`The format is very important` to the build configuration process. + The format of the tag is ``v[major version].[minor version]-[pre-release name].[number]`` for pre-releases + and ``v[major version].[minor version].[patch version]`` for stable versions. For example: + ``v3.0-beta.6`` or ``v3.1.0``. :strong:`The format is very important` to the build configuration process. #. After a few minutes the continuous integration (CI) will open a PR titled ``Release Update of AutoRevision.txt``. The release manager will open the PR, click on the :guilabel:`Close pull request` button, and then click :guilabel:`Open pull request` button. This is a diff --git a/server/connecthand.cpp b/server/connecthand.cpp index e6e5bfbc27..9b7daef6ac 100644 --- a/server/connecthand.cpp +++ b/server/connecthand.cpp @@ -399,7 +399,7 @@ bool handle_login_request(struct connection *pconn, info.major_version = MAJOR_VERSION; info.minor_version = MINOR_VERSION; info.patch_version = PATCH_VERSION; - info.emerg_version = EMERGENCY_VERSION; + info._obsolete = 0; sz_strlcpy(info.version_label, VERSION_LABEL); send_packet_server_info(pconn, &info); } diff --git a/server/savegame/savegame3.cpp b/server/savegame/savegame3.cpp index c315d65afe..e5b7396b00 100644 --- a/server/savegame/savegame3.cpp +++ b/server/savegame/savegame3.cpp @@ -1574,8 +1574,7 @@ static void sg_save_savefile(struct savedata *saving) secfile_insert_str(saving->file, saving->save_reason, "savefile.reason"); // Save as accurate freeciv revision information as possible - secfile_insert_str(saving->file, freeciv_datafile_version(), - "savefile.revision"); + secfile_insert_str(saving->file, freeciv21_version(), "savefile.revision"); /* Save rulesetdir at this point as this ruleset is required by this * savefile. */ @@ -2376,7 +2375,6 @@ static void sg_save_scenario(struct savedata *saving) game_version = MAJOR_VERSION * 1000000 + MINOR_VERSION * 10000 + PATCH_VERSION * 100; - game_version += EMERGENCY_VERSION; secfile_insert_int(saving->file, game_version, "scenario.game_version"); if (!saving->scenario || !game.scenario.is_scenario) { diff --git a/tools/civmanual.cpp b/tools/civmanual.cpp index 8bf358986f..13af8e3364 100644 --- a/tools/civmanual.cpp +++ b/tools/civmanual.cpp @@ -188,7 +188,7 @@ static bool manual_command(struct tag_types *tag_info) fprintf(doc, "%s", tag_info->header); fprintf(doc, "\n\n", - freeciv_datafile_version()); + freeciv21_version()); switch (manuals) { case MANUAL_SETTINGS: diff --git a/tools/fcmp/mpcli.cpp b/tools/fcmp/mpcli.cpp index 66aa2ae017..69d05ad263 100644 --- a/tools/fcmp/mpcli.cpp +++ b/tools/fcmp/mpcli.cpp @@ -91,10 +91,7 @@ int main(int argc, char *argv[]) load_install_info_lists(&fcmp); qInfo(_("Freeciv21 modpack installer (command line version)")); - - qInfo("%s%s", word_version(), freeciv21_version()); - - qInfo("%s", ""); + qInfo(_("Version %s"), freeciv21_version()); if (fcmp.autoinstall.isEmpty()) { if (auto msg = diff --git a/tools/fcmp/mpgui_qt.cpp b/tools/fcmp/mpgui_qt.cpp index 18b2c3d2cf..7a6bae2e1a 100644 --- a/tools/fcmp/mpgui_qt.cpp +++ b/tools/fcmp/mpgui_qt.cpp @@ -171,13 +171,9 @@ void mpgui::setup(QWidget *central, struct fcmp_params *params) new QPushButton(QString::fromUtf8(_("Install modpack"))); QStringList headers; QLabel *URL_label; - QLabel *version_label; - char verbuf[2048]; - fc_snprintf(verbuf, sizeof(verbuf), "%s%s", word_version(), - freeciv21_version()); - - version_label = new QLabel(QString::fromUtf8(verbuf)); + auto version_label = + new QLabel(QString(_("Version %1")).arg(freeciv21_version())); version_label->setAlignment(Qt::AlignHCenter); version_label->setParent(central); version_label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); diff --git a/tools/ruledit/ruledit_qt.cpp b/tools/ruledit/ruledit_qt.cpp index 5eed6e98b2..86b23b0dec 100644 --- a/tools/ruledit/ruledit_qt.cpp +++ b/tools/ruledit/ruledit_qt.cpp @@ -83,8 +83,6 @@ ruledit_gui::ruledit_gui(ruledit_main *main) : QObject(main) QWidget *edit_widget = new QWidget(); QPushButton *ruleset_accept; QLabel *rs_label; - QLabel *version_label; - char verbuf[2048]; data.nationlist = nullptr; data.nationlist_saved = nullptr; @@ -92,13 +90,12 @@ ruledit_gui::ruledit_gui(ruledit_main *main) : QObject(main) auto *central = new QWidget; main->setCentralWidget(central); - fc_snprintf(verbuf, sizeof(verbuf), "%s%s", word_version(), - freeciv21_version()); - main_layout = new QStackedLayout(); preload_layout->setSizeConstraint(QLayout::SetMaximumSize); - version_label = new QLabel(verbuf); + + auto version_label = + new QLabel(QString(_("Version %1")).arg(freeciv21_version())); version_label->setAlignment(Qt::AlignHCenter); version_label->setParent(central); preload_layout->addWidget(version_label); diff --git a/tools/ruleutil/rulesave.cpp b/tools/ruleutil/rulesave.cpp index 52fdfaaa07..5d8b53b329 100644 --- a/tools/ruleutil/rulesave.cpp +++ b/tools/ruleutil/rulesave.cpp @@ -64,7 +64,7 @@ static struct section_file *create_ruleset_file(const char *rsname, } secfile_insert_str(sfile, buf, "datafile.description"); - secfile_insert_str(sfile, freeciv_datafile_version(), "datafile.ruledit"); + secfile_insert_str(sfile, freeciv21_version(), "datafile.ruledit"); secfile_insert_str(sfile, RULESET_CAPABILITIES, "datafile.options"); secfile_insert_int(sfile, FORMAT_VERSION, "datafile.format_version"); diff --git a/utility/fc_version.h.in b/utility/fc_version.h.in index 04673e0ce7..734bad4149 100644 --- a/utility/fc_version.h.in +++ b/utility/fc_version.h.in @@ -3,17 +3,13 @@ #define MAJOR_VERSION @FC21_MAJOR_VERSION@ #define MINOR_VERSION @FC21_MINOR_VERSION@ #define PATCH_VERSION @FC21_PATCH_VERSION@ -#define EMERGENCY_VERSION @FC21_EMER_VERSION@ -#ifndef VERSION_LABEL -#define VERSION_LABEL "-@FC21_LABEL_VERSION@" -#endif +#define VERSION_LABEL "-@FC21_VERSION_LABEL@" + #cmakedefine01 IS_STABLE_VERSION -#ifndef VERSION_STRING -# if IS_STABLE_VERSION -# define VERSION_STRING "@FC21_MAJOR_VERSION@.@FC21_MINOR_VERSION@" -# else // IS_STABLE_VERSION -# define VERSION_STRING "@FC21_MAJOR_VERSION@.@FC21_MINOR_VERSION@.@FC21_PATCH_VERSION@.@FC21_EMER_VERSION@-@FC21_LABEL_VERSION@" -# endif +#if IS_STABLE_VERSION +# define VERSION_STRING "@FC21_MAJOR_VERSION@.@FC21_MINOR_VERSION@.@FC21_PATCH_VERSION@" +#else // IS_STABLE_VERSION +# define VERSION_STRING "@FC21_MAJOR_VERSION@.@FC21_MINOR_VERSION@-@FC21_VERSION_LABEL@.@FC21_PATCH_VERSION@" #endif #define NETWORK_CAPSTRING \ diff --git a/utility/version.cpp b/utility/version.cpp index e815e6414d..f72c3d3c9c 100644 --- a/utility/version.cpp +++ b/utility/version.cpp @@ -40,30 +40,3 @@ const char *freeciv_name_version() return msgbuf; } - -/** - Return string describing version type. - */ -const char *word_version() { return _("version "); } - -/** - Returns version string that can be used to compare two freeciv builds. - This does not handle git revisions, as there's no way to compare - which of the two commits is "higher". - */ -const char *fc_comparable_version() { return freeciv21_version(); } - -/** - Return version string in a format suitable to be written to created - datafiles as human readable information. - */ -const char *freeciv_datafile_version() -{ - static char buf[500] = {'\0'}; - - if (buf[0] == '\0') { - fc_snprintf(buf, sizeof(buf), "%s", freeciv21_version()); - } - - return buf; -} diff --git a/utility/version.h b/utility/version.h index b34df2157e..17db52af7e 100644 --- a/utility/version.h +++ b/utility/version.h @@ -15,6 +15,3 @@ // version informational strings const char *freeciv21_version(); const char *freeciv_name_version(); -const char *word_version(); -const char *fc_comparable_version(); -const char *freeciv_datafile_version();