unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27250: [PATCH] gnu: crawl: Update to 0.20.0.
@ 2017-06-05 13:31 nee
  2017-06-05 14:14 ` Arun Isaac
       [not found] ` <4577ad88.AEUAK6w8Z7kAAAAAAAAAAAO0_XAAAAACwQwAAAAAAAW9WABZNWdE@mailjet.com>
  0 siblings, 2 replies; 13+ messages in thread
From: nee @ 2017-06-05 13:31 UTC (permalink / raw)
  To: 27250

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

Hello, this updates crawl to 0.20.0 which came out about a week ago.
crawl-tiles indirectly updated through inheritance.

I also wrote a patch to make crawl upgrade cached strings in the SAVEDIR
by release version in addition to mtime. Without this patch crawl will
not detect that there is a new version installed and will not upgrade
files in ~/.crawl/saves/db/, because guix sets all the timestamps on the
installed files to 1970.

I will attempt to get this patch into crawl master.

Announcement for this release:
https://crawl.develz.org/wordpress/crawl-0-20-scarf-our-wanderful-fried-frogs
Changelog for this release:
https://github.com/crawl/crawl/blob/stone_soup-0.20/crawl-ref/docs/changelog.txt

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-crawl-Update-to-0.20.0.patch --]
[-- Type: text/x-patch; name="0001-gnu-crawl-Update-to-0.20.0.patch", Size: 6061 bytes --]

From 3aa8588481fb11a3abaa07d754f768b95433aede Mon Sep 17 00:00:00 2001
From: nee <nee.git@cock.li>
Date: Sun, 4 Jun 2017 17:19:41 +0200
Subject: [PATCH] gnu: crawl: Update to 0.20.0.

* gnu/packages/games.scm (crawl)[source]: Add a patch to fix savegame
  upgrades. Update to 0.20.0.
* gnu/packages/patches/crawl-upgrade-saves.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add patch.
---
 gnu/local.mk                                   |   1 +
 gnu/packages/games.scm                         |   5 +-
 gnu/packages/patches/crawl-upgrade-saves.patch | 117 +++++++++++++++++++++++++
 3 files changed, 121 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/crawl-upgrade-saves.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index e7d5ee2f4..b8a85494d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -550,6 +550,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/cpufrequtils-fix-aclocal.patch		\
   %D%/packages/patches/cracklib-CVE-2016-6318.patch		\
   %D%/packages/patches/cracklib-fix-buffer-overflow.patch	\
+  %D%/packages/patches/crawl-upgrade-saves.patch		\
   %D%/packages/patches/crda-optional-gcrypt.patch		\
   %D%/packages/patches/crossmap-allow-system-pysam.patch	\
   %D%/packages/patches/csound-header-ordering.patch		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index c1993485b..c2c24f3c8 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3955,7 +3955,7 @@ fish.  The whole game is accompanied by quiet, comforting music.")
 (define-public crawl
   (package
     (name "crawl")
-    (version "0.19.5")
+    (version "0.20.0")
     (source
      (origin
        (method url-fetch)
@@ -3969,7 +3969,8 @@ fish.  The whole game is accompanied by quiet, comforting music.")
                             version "-nodeps.tar.xz")))
        (sha256
         (base32
-         "00yl2lb2shglxlxzpyk99zvglfx4amjybqwnzdcasvbiggb4cj18"))))
+         "0127dgldij2h4m7cf32yy9ndv4vcz03g4km71lmxrsi5mw7ljgpd"))
+       (patches (search-patches "crawl-upgrade-saves.patch"))))
     (build-system gnu-build-system)
     (inputs
      `(("lua51" ,lua-5.1)
diff --git a/gnu/packages/patches/crawl-upgrade-saves.patch b/gnu/packages/patches/crawl-upgrade-saves.patch
new file mode 100644
index 000000000..c6b6b53bc
--- /dev/null
+++ b/gnu/packages/patches/crawl-upgrade-saves.patch
@@ -0,0 +1,117 @@
+Store the crawl version in the textdatabases in SAVEDIR and
+upgrade the databases when the crawl version changes.
+
+By default crawl checks for a mtime difference on files in DATADIR to see if an
+upgrade is required, but guix nulls all file dates,
+and crawl would never upgrade saves.
+
+*** a/source/database.cc	2016-05-31 09:56:08.000000000 +0200
+--- b/source/database.cc	2017-06-05 02:25:44.080149014 +0200
+***************
+*** 25,30 ****
+--- 25,31 ----
+  #include "syscalls.h"
+  #include "threads.h"
+  #include "unicode.h"
++ #include "version.h"
+  
+  // TextDB handles dependency checking the db vs text files, creating the
+  // db, loading, and destroying the DB.
+***************
+*** 55,60 ****
+--- 56,62 ----
+      vector<string> _input_files;
+      DBM* _db;
+      string timestamp;
++     string version;
+      TextDB *_parent;
+      const char* lang() { return _parent ? Options.lang_name : 0; }
+  public:
+***************
+*** 165,171 ****
+  
+  TextDB::TextDB(const char* db_name, const char* dir, ...)
+      : _db_name(db_name), _directory(dir),
+!       _db(nullptr), timestamp(""), _parent(0), translation(0)
+  {
+      va_list args;
+      va_start(args, dir);
+--- 167,173 ----
+  
+  TextDB::TextDB(const char* db_name, const char* dir, ...)
+      : _db_name(db_name), _directory(dir),
+!       _db(nullptr), timestamp(""), version(""),  _parent(0), translation(0)
+  {
+      va_list args;
+      va_start(args, dir);
+***************
+*** 187,193 ****
+      : _db_name(parent->_db_name),
+        _directory(parent->_directory + Options.lang_name + "/"),
+        _input_files(parent->_input_files), // FIXME: pointless copy
+!       _db(nullptr), timestamp(""), _parent(parent), translation(nullptr)
+  {
+  }
+  
+--- 189,195 ----
+      : _db_name(parent->_db_name),
+        _directory(parent->_directory + Options.lang_name + "/"),
+        _input_files(parent->_input_files), // FIXME: pointless copy
+!       _db(nullptr), timestamp(""), version(""), _parent(parent), translation(nullptr)
+  {
+  }
+  
+***************
+*** 202,207 ****
+--- 204,212 ----
+          return false;
+  
+      timestamp = _query_database(*this, "TIMESTAMP", false, false, true);
++     version = _query_database(*this, "VERSION", false, false, true);
++     if (version.empty())
++         return false;
+      if (timestamp.empty())
+          return false;
+  
+***************
+*** 245,250 ****
+--- 250,258 ----
+      string ts;
+      bool no_files = true;
+  
++     if (string(Version::Long) != version)
++         return true;
++ 
+      for (const string &file : _input_files)
+      {
+          string full_input_path = _directory + file;
+***************
+*** 261,267 ****
+          ts += buf;
+      }
+  
+!     if (no_files && timestamp.empty())
+      {
+          // No point in empty databases, although for simplicity keep ones
+          // for disappeared translations for now.
+--- 269,275 ----
+          ts += buf;
+      }
+  
+!     if (no_files && timestamp.empty() && version.empty())
+      {
+          // No point in empty databases, although for simplicity keep ones
+          // for disappeared translations for now.
+***************
+*** 321,327 ****
+--- 329,338 ----
+              _store_text_db(full_input_path, _db);
+          }
+      }
++ 
++     string current_version = string(Version::Long);
+      _add_entry(_db, "TIMESTAMP", ts);
++     _add_entry(_db, "VERSION", current_version);
+  
+      dbm_close(_db);
+      _db = 0;
-- 
2.13.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-06-12  9:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-05 13:31 bug#27250: [PATCH] gnu: crawl: Update to 0.20.0 nee
2017-06-05 14:14 ` Arun Isaac
2017-06-05 15:54   ` Leo Famulari
2017-06-06  8:27     ` Arun Isaac
     [not found]     ` <51e0342f.AEUAK9NcTPcAAAAAAAAAAAO0_XAAAAACwQwAAAAAAAW9WABZNmdv@mailjet.com>
2017-06-06 17:56       ` nee
2017-06-07 18:24         ` Arun Isaac
2017-06-07 19:20           ` Leo Famulari
2017-06-08 15:16             ` Arun Isaac
     [not found]             ` <cu78tl25x2y.fsf@systemreboot.net>
2017-06-10 11:39               ` Arun Isaac
     [not found]               ` <5e315f5d.AEAALOqVmtgAAAAAAAAAAAO0_XAAAAACwQwAAAAAAAW9WABZO9qA@mailjet.com>
2017-06-10 19:10                 ` nee
2017-06-12  9:36                   ` Arun Isaac
     [not found]         ` <cu7shjbbqqo.fsf@systemreboot.net>
2017-06-07 19:26           ` Arun Isaac
     [not found] ` <4577ad88.AEUAK6w8Z7kAAAAAAAAAAAO0_XAAAAACwQwAAAAAAAW9WABZNWdE@mailjet.com>
2017-06-05 17:41   ` nee

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).