[cyphesis-cpp] 07/08: Add patch to remove obsolete buildTime/buildDate system

Olek Wojnar olek-guest at moszumanska.debian.org
Tue Sep 6 11:40:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

olek-guest pushed a commit to branch master
in repository cyphesis-cpp.

commit bd2d368d6938911d73999ed6ca4641f43a369efd
Author: Olek Wojnar <olek-dev at wojnar.org>
Date:   Sun Sep 4 19:31:01 2016 -0400

    Add patch to remove obsolete buildTime/buildDate system
    
    The __TIME__ and __DATE__ macros were interfering with reproducible builds.
---
 debian/changelog                                   |   2 +
 ...emove-obsolete-buildTime-buildDate-system.patch | 347 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 3 files changed, 350 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 2167ce2..3598745 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ cyphesis-cpp (0.6.2-1) unstable; urgency=medium
     -- Remove two superseded patches
     -- Add remove-generated-file.patch
     -- Add update-for-wfmath-api-change.patch
+    -- Add remove-obsolete-buildTime-buildDate-system.patch
+       --- Enable reproducible builds
   * Update dependencies
   * Remove games-specific installation settings
     -- Add lintian override
diff --git a/debian/patches/remove-obsolete-buildTime-buildDate-system.patch b/debian/patches/remove-obsolete-buildTime-buildDate-system.patch
new file mode 100644
index 0000000..b60da29
--- /dev/null
+++ b/debian/patches/remove-obsolete-buildTime-buildDate-system.patch
@@ -0,0 +1,347 @@
+Description: Remove obsolete buildTime/buildDate system
+ The __TIME__ and __DATE__ macros were interfering with reproducible builds.
+ Will not be needed after Cyphesis 0.6.2
+Origin: https://github.com/worldforge/cyphesis/pull/29
+Last-Update: 2016-09-04
+
+--- a/common/const.cpp
++++ b/common/const.cpp
+@@ -30,8 +30,5 @@
+   const long rootWorldIntId = 0L;
+   // Version of the software we are running
+   const char * version = PACKAGE_VERSION;
+-  // Time this server was built
+-  // const char * buildTime = __TIME__;
+-  // const char * buildDate = __DATE__;
+ 
+ }
+--- a/common/const.h
++++ b/common/const.h
+@@ -66,12 +66,8 @@
+   extern const long rootWorldIntId;
+   /// \brief Version of the software we are running
+   extern const char * version;
+-  /// \brief Time this server was built
+-  extern const char * buildTime;
+-  /// \brief Date this server was built
+-  extern const char * buildDate;
+-  /// \brief Build number of this build, derived from ChangeLog RCS revision
+-  extern const int buildId;
++  /// \brief Identifier of this build, taken from "git rev-parse".
++  extern const char * buildId;
+ 
+   // @}
+ }
+--- a/man/cycmd.1
++++ b/man/cycmd.1
+@@ -179,7 +179,6 @@
+ .nf
+ cyphesis> stat
+ Info(
+-     builddate:  11:32:45, Sep 27 2004
+      clients:  1
+      name:  calcitration.ecs.soton.ac.uk
+      objtype:  obj
+--- a/man/cycmd.sgml
++++ b/man/cycmd.sgml
+@@ -451,7 +451,6 @@
+   <programlisting>
+ cyphesis> stat
+ Info(
+-     builddate:  11:32:45, Sep 27 2004
+      clients:  1
+      name:  calcitration.ecs.soton.ac.uk
+      objtype:  obj
+--- a/scripts/extract_revision.sh
++++ b/scripts/extract_revision.sh
+@@ -1,10 +1,7 @@
+ #!/bin/bash
+ 
+ TOPSRCDIR="$@"
+-CHANGELOG="${TOPSRCDIR}/ChangeLog"
+-CVSCHECK="${TOPSRCDIR}/CVS/Root"
+ GITCHECK="${TOPSRCDIR}/.git/config"
+-OLDBUILDCPP="${TOPSRCDIR}/server/buildid.cpp"
+ 
+ if ! test -d "${TOPSRCDIR}"
+ then
+@@ -13,37 +10,17 @@
+     exit 1
+ fi
+ 
+-# If sources are under CVS control then the RCS Id in ChangeLog is our build ID.
+-if test -f "${CVSCHECK}"
+-then
+-    if tail -n 1 "${CHANGELOG}"  | sed "s/^.* 1\.\([0-9]*\).*$/\1/"
+-    then
+-        echo Getting CVS buildid revision from ChangeLog RCS Id >&2
+-        exit 0
+-    fi
+-fi
+-
+-# If sources are under git control then the number of ChangeLog commits is our build ID.
++# If sources are under Git version control then use "git rev-parse"
+ if test -f "${GITCHECK}"
+ then
+-    if (cd "${TOPSRCDIR}" && git log ChangeLog | grep "^commit [a-f0-9]\+$" | wc -l)
+-    then
+-        echo Getting GIT buildid from number of ChangeLog commits >&2
+-        exit 0
+-    fi
+-fi
+-
+-# We don't seem to be under source control, so use the existing buildid.
+-if test -f "${OLDBUILDCPP}"
+-then
+-    if grep buildId "${OLDBUILDCPP}" | head -n 1 | sed "s/^.* = \([-0-9]*\);$/\1/"
++    if (cd "${TOPSRCDIR}" && git rev-parse HEAD)
+     then
+-        echo Using existing buildid >&2
++        echo Getting buildid from Git >&2
+         exit 0
+     fi
+ fi
+ 
+-# We could not find any useful build ID, so mark it clearly as an error.
+-echo Unknown buildid >&2
+-echo 1
++# Not in Git version control, therefore this is a released build.
++echo Released build, no SHA1 buildid. >&2
++echo Released
+ exit 0
+--- a/scripts/gen_buildid.py
++++ b/scripts/gen_buildid.py
+@@ -12,12 +12,8 @@
+ 
+ namespace consts {
+ 
+-  const char * buildTime = __TIME__;
+-  const char * buildDate = __DATE__;
+-  const int buildId = %s;
++  const char * buildId = "%s";
+ }
+ """ % sys.argv[1])
+ 
+ build_id.close()
+-
+-# tail -n 1 ChangeLog | sed "s/^.* 1\.\([0-9]*\).*$/\1/"
+--- a/server/CommMDNSPublisher.cpp
++++ b/server/CommMDNSPublisher.cpp
+@@ -321,9 +321,6 @@
+ 
+     AvahiStringList * txt;
+     txt = avahi_string_list_new(
+-      String::compose("builddate=%1",
+-                      std::string(consts::buildTime) + ", " +
+-                      std::string(consts::buildDate)).c_str(),
+       String::compose("clients=%1", m_server.getClients()).c_str(),
+       String::compose("ruleset=%1", m_server.getRuleset()).c_str(),
+       String::compose("server=%1", "cyphesis").c_str(),
+--- a/server/Makefile.am
++++ b/server/Makefile.am
+@@ -163,7 +163,7 @@
+                $(FRONTEND_LIBS)
+ 
+ buildid.cpp: $(cyphesis_SOURCES) $(LOCAL_LIBS) \
+-             $(top_srcdir)/scripts/gen_buildid.py $(top_srcdir)/ChangeLog
++             $(top_srcdir)/scripts/gen_buildid.py
+ 	$(top_srcdir)/scripts/gen_buildid.py `$(top_srcdir)/scripts/extract_revision.sh $(top_srcdir)` buildid.cpp
+ 
+ cyslave_SOURCES = \
+--- a/server/ServerRouting.cpp
++++ b/server/ServerRouting.cpp
+@@ -60,14 +60,11 @@
+ {
+     Monitors * monitors = Monitors::instance();
+     monitors->insert("server", "cyphesis");
+-    monitors->insert("builddate", String::compose("%1, %2",
+-                                                  consts::buildDate,
+-                                                  consts::buildTime));
+     monitors->watch("instance", new Variable<std::string>(::instance));
+     monitors->watch("name", new Variable<std::string>(m_svrName));
+     monitors->watch("ruleset", new Variable<std::string>(m_svrRuleset));
+     monitors->watch("version", new Variable<const char *>(consts::version));
+-    monitors->watch("buildid", new Variable<int>(consts::buildId));
++    monitors->watch("buildid", new Variable<const char *>(consts::buildId));
+     monitors->watch("clients", new Variable<int>(m_numClients));
+ 
+     m_instance = this;
+@@ -153,7 +150,6 @@
+     omap["parents"] = ListType(1, "server");
+     omap["clients"] = m_numClients;
+     omap["uptime"] = m_world.upTime();
+-    omap["builddate"] = std::string(consts::buildTime)+", "+std::string(consts::buildDate);
+     omap["buildid"] = consts::buildId;
+     omap["version"] = std::string(consts::version);
+     if (restricted_flag) {
+@@ -173,7 +169,6 @@
+     ent->setParents(std::list<std::string>(1, "server"));
+     ent->setAttr("clients", m_numClients);
+     ent->setAttr("uptime", m_world.upTime());
+-    ent->setAttr("builddate", std::string(consts::buildTime)+", "+std::string(consts::buildDate));
+     ent->setAttr("buildid", consts::buildId);
+     ent->setAttr("version", std::string(consts::version));
+     if (restricted_flag) {
+--- a/server/frontend.cpp
++++ b/server/frontend.cpp
+@@ -72,7 +72,7 @@
+     if (config_status < 0) {
+         if (config_status == CONFIG_VERSION) {
+             std::cout << argv[0] << " (cyphesis) " << consts::version
+-                      << " (Cyphesis build " << consts::buildId << ")"
++                      << " (Cyphesis build: " << consts::buildId << ")"
+                       << std::endl << std::flush;
+ 
+             return 0;
+--- a/server/server.cpp
++++ b/server/server.cpp
+@@ -114,7 +114,7 @@
+     if (config_status < 0) {
+         if (config_status == CONFIG_VERSION) {
+             std::cout << argv[0] << " (cyphesis) " << consts::version
+-                      << " (Cyphesis build " << consts::buildId << ")"
++                      << " (Cyphesis build: " << consts::buildId << ")"
+                       << std::endl << std::flush;
+ 
+             return 0;
+--- a/tests/CommMDNSPublishertest.cpp
++++ b/tests/CommMDNSPublishertest.cpp
+@@ -134,9 +134,7 @@
+ 
+ namespace consts {
+ 
+-  const char * buildTime = __TIME__;
+-  const char * buildDate = __DATE__;
+-  const int buildId = -1;
++  const char * buildId = "test_buildId";
+   const char * version = "test_version";
+ }
+ 
+--- a/tests/buildidtest.cpp
++++ b/tests/buildidtest.cpp
+@@ -36,8 +36,6 @@
+   public:
+     buildidtest()
+     {
+-        ADD_TEST(buildidtest::test_time);
+-        ADD_TEST(buildidtest::test_date);
+         ADD_TEST(buildidtest::test_id);
+     }
+ 
+@@ -49,24 +47,12 @@
+     {
+     }
+ 
+-    void test_time();
+-    void test_date();
+     void test_id();
+ };
+ 
+-void buildidtest::test_time()
+-{
+-    ASSERT_GREATER(strlen(consts::buildTime), 0u);
+-}
+-
+-void buildidtest::test_date()
+-{
+-    ASSERT_GREATER(strlen(consts::buildDate), 0u);
+-}
+-
+ void buildidtest::test_id()
+ {
+-    ASSERT_GREATER(consts::buildId, 0);
++    ASSERT_GREATER(strlen(consts::buildId), 0u);
+ }
+ 
+ int main()
+--- a/tests/consttest.cpp
++++ b/tests/consttest.cpp
+@@ -80,23 +80,5 @@
+     versions = consts::version;
+     assert(versions.size() > 0);
+ 
+-#if 0
+-// For the time being, as these are now in the server/buildid.cpp
+-// we are leaving the out
+-    const char * buildTime;
+-    buildTime = consts::buildTime;
+-    assert(buildTime != 0);
+-    std::string buildTimes;
+-    buildTimes = consts::buildTime;
+-    assert(buildTimes.size() > 0);
+-
+-    const char * buildDate;
+-    buildDate = consts::buildDate;
+-    assert(buildDate != 0);
+-    std::string buildDates;
+-    buildDates = consts::buildDate;
+-    assert(buildDates.size() > 0);
+-#endif
+-
+     return 0;
+ }
+--- a/tests/AccountConnectionintegration.cpp
++++ b/tests/AccountConnectionintegration.cpp
+@@ -284,9 +284,7 @@
+ 
+ namespace consts {
+ 
+-  const char * buildTime = __TIME__;
+-  const char * buildDate = __DATE__;
+-  const int buildId = -1;
++  const char * buildId = "test_buildId";
+   const char * version = "test_build";
+ }
+ 
+--- a/tests/Accountintegration.cpp
++++ b/tests/Accountintegration.cpp
+@@ -1610,9 +1610,7 @@
+ 
+ namespace consts {
+ 
+-  const char * buildTime = __TIME__;
+-  const char * buildDate = __DATE__;
+-  const int buildId = -1;
++  const char * buildId = "test_buildId";
+ }
+ 
+ static long idGenerator = 0;
+--- a/tests/AccountServerLobbyintegration.cpp
++++ b/tests/AccountServerLobbyintegration.cpp
+@@ -924,9 +924,7 @@
+ 
+ namespace consts {
+ 
+-  const char * buildTime = __TIME__;
+-  const char * buildDate = __DATE__;
+-  const int buildId = -1;
++  const char * buildId = "test_buildId";
+   const char * version = "test_version";
+ }
+ 
+--- a/tests/CorePropertyManagertest.cpp
++++ b/tests/CorePropertyManagertest.cpp
+@@ -2063,9 +2063,7 @@
+ 
+ namespace consts {
+ 
+-  const char * buildTime = __TIME__;
+-  const char * buildDate = __DATE__;
+-  const int buildId = -1;
++  const char * buildId = "test_buildId";
+ }
+ 
+ static long idGenerator = 0;
+--- a/tests/ServerRoutingtest.cpp
++++ b/tests/ServerRoutingtest.cpp
+@@ -558,9 +558,7 @@
+ 
+ namespace consts {
+ 
+-  const char * buildTime = __TIME__;
+-  const char * buildDate = __DATE__;
+-  const int buildId = -1;
++  const char * buildId = "test_buildId";
+   const char * version = "test_version";
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index d1471c4..4d8dd97 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ add-missing-man-pages.patch
 do-not-register-with-metaserver.patch
 explicit-integer-instantiation.patch
 update-for-wfmath-api-change.patch
+remove-obsolete-buildTime-buildDate-system.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/cyphesis-cpp.git



More information about the Pkg-games-commits mailing list