diff options
author | nee <nee.git@cock.li> | 2017-06-10 20:27:58 +0200 |
---|---|---|
committer | Arun Isaac <arunisaac@systemreboot.net> | 2017-06-12 15:02:23 +0530 |
commit | 1243aaac732abc9b02f7dd3788b45e5f8f7b8cf7 (patch) | |
tree | 7e0e4b4af18111753d5387ce5d182a5ae20f2d94 | |
parent | af5faef90f810ca8508f210ec0dab152e812e610 (diff) | |
download | patches-1243aaac732abc9b02f7dd3788b45e5f8f7b8cf7.tar patches-1243aaac732abc9b02f7dd3788b45e5f8f7b8cf7.tar.gz |
gnu: crawl: Fix savegame upgrades.
* gnu/packages/patches/crawl-upgrade-saves.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add patch.
* gnu/packages/games.scm (crawl)[source]: Apply patch.
Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/games.scm | 6 | ||||
-rw-r--r-- | gnu/packages/patches/crawl-upgrade-saves.patch | 83 |
3 files changed, 89 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index c2a7ba761b..892d1ee26e 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 a76ab1ddc2..9bbf5d0220 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -4049,7 +4049,8 @@ fish. The whole game is accompanied by quiet, comforting music.") version "-nodeps.tar.xz"))) (sha256 (base32 - "0127dgldij2h4m7cf32yy9ndv4vcz03g4km71lmxrsi5mw7ljgpd")))) + "0127dgldij2h4m7cf32yy9ndv4vcz03g4km71lmxrsi5mw7ljgpd")) + (patches (search-patches "crawl-upgrade-saves.patch")))) (build-system gnu-build-system) (inputs `(("lua51" ,lua-5.1) @@ -4101,6 +4102,9 @@ fabulous Orb of Zot.") license:zlib license:asl2.0)))) +;; The linter here claims that patch file names should start with the package +;; name. But, in this case, the patches are inherited from crawl with the +;; "crawl-" prefix instead of "crawl-tiles-". (define-public crawl-tiles (package (inherit crawl) diff --git a/gnu/packages/patches/crawl-upgrade-saves.patch b/gnu/packages/patches/crawl-upgrade-saves.patch new file mode 100644 index 0000000000..301942dc30 --- /dev/null +++ b/gnu/packages/patches/crawl-upgrade-saves.patch @@ -0,0 +1,83 @@ +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 ++++ a/source/database.cc 2017-06-05 03:00:19.270632107 +0200 +@@ -25,6 +25,7 @@ + #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,6 +56,7 @@ + vector<string> _input_files; + DBM* _db; + string timestamp; ++ string version; + TextDB *_parent; + const char* lang() { return _parent ? Options.lang_name : 0; } + public: +@@ -165,7 +167,7 @@ + + TextDB::TextDB(const char* db_name, const char* dir, ...) + : _db_name(db_name), _directory(dir), +- _db(nullptr), timestamp(""), _parent(0), translation(0) ++ _db(nullptr), timestamp(""), version(""), _parent(0), translation(0) + { + va_list args; + va_start(args, dir); +@@ -187,7 +189,7 @@ + : _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) ++ _db(nullptr), timestamp(""), version(""), _parent(parent), translation(nullptr) + { + } + +@@ -202,6 +204,9 @@ + 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,6 +250,9 @@ + 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,7 +269,7 @@ + ts += buf; + } + +- if (no_files && timestamp.empty()) ++ if (no_files && timestamp.empty() && version.empty()) + { + // No point in empty databases, although for simplicity keep ones + // for disappeared translations for now. +@@ -321,7 +329,10 @@ + _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; |