mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
RS version is now parametrizable at compile time
Avoid the need of dirty patching to set the version at build time In case RS version is not passed as argument attempt to determine it using git describe, if unavailable use hardcoded default
This commit is contained in:
parent
5495f43c51
commit
92f90178c4
12 changed files with 126 additions and 103 deletions
|
@ -515,7 +515,6 @@ HEADERS += util/folderiterator.h \
|
|||
util/rsstring.h \
|
||||
util/rsstd.h \
|
||||
util/rsthreads.h \
|
||||
util/rsversioninfo.h \
|
||||
util/rswin.h \
|
||||
util/rsrandom.h \
|
||||
util/rsmemcache.h \
|
||||
|
@ -666,7 +665,6 @@ SOURCES += util/folderiterator.cc \
|
|||
util/rsprint.cc \
|
||||
util/rsstring.cc \
|
||||
util/rsthreads.cc \
|
||||
util/rsversioninfo.cc \
|
||||
util/rsrandom.cc \
|
||||
util/rstickevent.cc \
|
||||
util/rsrecogn.cc \
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include <rsserver/p3face.h>
|
||||
#include <util/rsdir.h>
|
||||
#include <util/rsversioninfo.h>
|
||||
#include <retroshare/rsversion.h>
|
||||
#include <util/folderiterator.h>
|
||||
#include <ft/ftserver.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
|
@ -351,7 +351,6 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name,bool first_time)
|
|||
|
||||
std::cerr << " -> plugin revision number: " << pinfo.svn_revision << std::endl;
|
||||
std::cerr << " plugin API number : " << std::hex << pinfo.API_version << std::dec << std::endl;
|
||||
std::cerr << " retroshare svn number: " << RsUtil::retroshareRevision() << std::endl;
|
||||
|
||||
// Check that the plugin provides a svn revision number and a API number
|
||||
//
|
||||
|
|
|
@ -205,7 +205,7 @@ class RsPlugin
|
|||
//
|
||||
// All these items appear in the config->plugins tab, as a description of the plugin.
|
||||
//
|
||||
uint32_t getSvnRevision() const { return RS_REVISION_NUMBER ; } // This is read from libretroshare/retroshare/rsversion.h
|
||||
uint32_t getSvnRevision() const { return 0; } // This is read from libretroshare/retroshare/rsversion.h
|
||||
|
||||
virtual std::string getShortPluginDescription() const = 0 ;
|
||||
virtual std::string getPluginName() const = 0 ;
|
||||
|
|
|
@ -19,14 +19,63 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#define RS_MAJOR_VERSION 0
|
||||
#define RS_MINOR_VERSION 6
|
||||
#define RS_BUILD_NUMBER 4
|
||||
#define RS_BUILD_NUMBER_ADD "" // <-- do we need this?
|
||||
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:
|
||||
// git log --pretty="%H" | head -1 | cut -c1-8
|
||||
//
|
||||
// Do not forget the 0x, since the RS_REVISION_NUMBER should be an integer.
|
||||
//
|
||||
#define RS_REVISION_STRING "01234567"
|
||||
#define RS_REVISION_NUMBER 0x01234567
|
||||
#pragma once
|
||||
|
||||
|
||||
/**
|
||||
* @def RS_MINI_VERSION
|
||||
* First number of RetroShare versioning scheme
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_MAJOR_VERSION
|
||||
# define RS_MAJOR_VERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def RS_MINI_VERSION
|
||||
* Second number of RetroShare versioning scheme
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_MINOR_VERSION
|
||||
# define RS_MINOR_VERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def RS_MINI_VERSION
|
||||
* Third number of RetroShare versioning scheme
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_MINI_VERSION
|
||||
# define RS_MINI_VERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def RS_EXTRA_VERSION
|
||||
* An extra string to append to the version to make it more descriptive.
|
||||
* Customize it trough qmake command line @see retroshare.pri
|
||||
*/
|
||||
#ifndef RS_EXTRA_VERSION
|
||||
# define RS_EXTRA_VERSION "unknown"
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Use this macro to check in your code if version of RetroShare is at least the
|
||||
* specified.
|
||||
*/
|
||||
#define RS_VERSION_AT_LEAST(A,B,C) (RS_MAJOR_VERSION > (A) || \
|
||||
(RS_MAJOR_VERSION == (A) && \
|
||||
(RS_MINOR_VERSION > (B) || \
|
||||
(RS_MINOR_VERSION == (B) && RS_MINI_VERSION >= (C)))))
|
||||
|
||||
|
||||
#define __RS_PRIVATE_STRINGIFY2(X) #X
|
||||
#define __RS_PRIVATE_STRINGIFY(X) __RS_PRIVATE_STRINGIFY2(X)
|
||||
|
||||
/**
|
||||
* Human readable string describing RetroShare version
|
||||
*/
|
||||
constexpr auto RS_HUMAN_READABLE_VERSION =
|
||||
__RS_PRIVATE_STRINGIFY(RS_MAJOR_VERSION) "." \
|
||||
__RS_PRIVATE_STRINGIFY(RS_MINOR_VERSION) "." \
|
||||
__RS_PRIVATE_STRINGIFY(RS_MINI_VERSION) RS_EXTRA_VERSION;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*******************************************************************************/
|
||||
#include "services/p3discovery2.h"
|
||||
#include "pqi/p3peermgr.h"
|
||||
#include "util/rsversioninfo.h"
|
||||
#include "retroshare/rsversion.h"
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
@ -349,7 +349,7 @@ void p3discovery2::sendOwnContactInfo(const SSLID &sslid)
|
|||
* revert an hardcoded policy. */
|
||||
//populateContactInfo(detail, pkt, true);
|
||||
|
||||
pkt->version = RsUtil::retroshareVersion();
|
||||
pkt->version = RS_HUMAN_READABLE_VERSION;
|
||||
pkt->PeerId(sslid);
|
||||
|
||||
#ifdef P3DISC_DEBUG
|
||||
|
@ -408,7 +408,7 @@ void p3discovery2::recvOwnContactInfo(const SSLID &fromId, const RsDiscContactIt
|
|||
sendPGPList(fromId);
|
||||
|
||||
// Update mDiscStatus.
|
||||
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mDiscMtx);
|
||||
|
||||
PGPID pgpId = getPGPId(fromId);
|
||||
std::map<PGPID, DiscPgpInfo>::iterator it = mFriendList.find(pgpId);
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* libretroshare/src/util: rsversioninfo.cc *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2013-2013 by Alexandrut *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include "rsversioninfo.h"
|
||||
#include "retroshare/rsversion.h"
|
||||
#include "rsstring.h"
|
||||
|
||||
std::string RsUtil::retroshareVersion()
|
||||
{
|
||||
std::string version;
|
||||
rs_sprintf(version, "%d.%d.%d%s Revision %08x", RS_MAJOR_VERSION, RS_MINOR_VERSION, RS_BUILD_NUMBER, RS_BUILD_NUMBER_ADD, RS_REVISION_NUMBER);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
uint32_t RsUtil::retroshareRevision()
|
||||
{
|
||||
return RS_REVISION_NUMBER;
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* libretroshare/src/util: rsversioninfo.h *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright 2013-2013 by Alexandrut *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
|
||||
namespace RsUtil {
|
||||
|
||||
uint32_t retroshareRevision();
|
||||
std::string retroshareVersion();
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue