aboutsummaryrefslogtreecommitdiff
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.

diff -ur a/source/database.cc b/source/database.cc
--- a/crawl-ref/source/database.cc	2018-08-09 21:49:26.000000000 -0400
+++ b/crawl-ref/source/database.cc	2018-10-07 18:06:41.022445789 -0400
@@ -24,6 +24,7 @@
 #include "stringutil.h"
 #include "syscalls.h"
 #include "unicode.h"
+#include "version.h"
 
 // TextDB handles dependency checking the db vs text files, creating the
 // db, loading, and destroying the DB.
@@ -54,6 +55,7 @@
     vector<string> _input_files;
     DBM* _db;
     string timestamp;
+    string version;
     TextDB *_parent;
     const char* lang() { return _parent ? Options.lang_name : 0; }
 public:
@@ -163,7 +165,7 @@
 
 TextDB::TextDB(const char* db_name, const char* dir, vector<string> files)
     : _db_name(db_name), _directory(dir), _input_files(files),
-      _db(nullptr), timestamp(""), _parent(0), translation(0)
+      _db(nullptr), timestamp(""), version(""),  _parent(0), translation(0)
 {
 }
 
@@ -171,7 +173,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)
 {
 }
 
@@ -186,6 +188,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;
 
@@ -229,6 +234,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;
@@ -246,7 +254,7 @@
         ts += buf;
     }
 
-    if (no_files)
+    if (no_files && version.empty())
     {
         // No point in empty databases, although for simplicity keep ones
         // for disappeared translations for now.
@@ -312,7 +320,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;
2024-04-19maint: Support `make doc-pot-update' from a tarball....* build-aux/xgettext.scm: Move setting of environment variables to shell header. (main): Use SOURCE_DATE_EPOCH as fallback for timestamp. This fixes running from a tarball. * Makefile.am (EXTRA_DIST): Add it. Change-Id: Ic487587b22495868fd2a21545a13dc9e3458299c Janneke Nieuwenhuizen 2024-04-14maint: Fix header....* build-aux/xgettext.scm: Add `Guix' parts to header. Change-Id: I4fb03b8b0588f0482bcb1a095518b6751d111031 Janneke Nieuwenhuizen 2024-04-14maint: Use xgettext.scm wrapper to create .PO files reproducibly....* build-aux/xgettext.scm: New script. * po/guix/Makevars (XGETTEXT): Set it. (XGETTEXT_OPTIONS): Add --xgettext option to `real' xgettext. * po/packages/Makevars (XGETTEXT): Set it. (XGETTEXT_OPTIONS): Add --xgettext option to `real' xgettext. Change-Id: I71b6b843970090f765f46ac346b92a346560e3f0 Janneke Nieuwenhuizen 2024-01-05build: test-driver.scm: Set mode....Emacs auto-detects the build-aux/test-driver.scm as sh-mode, due to the shebang. So override the auto-detection using a local variable forcing scheme-mode. * build-aux/test-driver.scm: Set mode to scheme. Change-Id: I07f12656dba5fb7b52447b94569307a2a605ffc1 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Tomas Volf 2023-08-21maint: Add 'etc/hurd-manifest.scm'....* build-aux/cuirass/hurd-manifest.scm: Move to... * etc/hurd-manifest.scm: ...here. * Makefile.am (EXTRA_DIST): Update accordingly. Janneke Nieuwenhuizen 2023-07-25cuirass: Update hurd-manifest with newly supported packages....* build-aux/cuirass/hurd-manifest.scm: Include full build of python-minimal and gettext-minimal (no longer without-tests). Add grub-minimal, grub, guix-without-tests and guile-3.0 (no longer delete it from guix dependencies). Janneke Nieuwenhuizen 2022-05-26cuirass: Create just as many threads as needed....* build-aux/cuirass/evaluate.scm (command-line): Change second argument to 'n-par-for-each'. Ludovic Courtès 2022-05-26cuirass: Fork inferior processes before creating threads....Works around <https://issues.guix.gnu.org/55441#12>. Start from commit bd86bbd300474204878e927f6cd3f0defa1662a5, 'open-inferior' uses 'primitive-fork' instead of 'open-pipe*'. As a result, child process could potentially hang before calling 'execl' due to undefined behavior when forking a multi-threaded process. * build-aux/cuirass/evaluate.scm <top level>: Call 'open-inferior' before 'n-par-for-each'. Ludovic Courtès 2022-05-20cuirass: Close each inferior upon completion....* build-aux/cuirass/evaluate.scm <top level>: Add 'close-inferior' call. Ludovic Courtès 2021-12-22tests: Move keys into ./tests/keys/ and add a third ed25519 key....The third key will be used in an upcoming commit. Rename public keys to .pub. * guix/tests/gnupg.scm (%ed25519-3-public-key-file): New variable. (%ed25519-3-secret-key-file): New variable. (%ed25519-2-public-key-file): Renamed from %ed25519bis-public-key-file. (%ed25519-2-secret-key-file): Renamed from %ed25519bis-secret-key-file. * tests/keys/ed25519-3.key: New file. * tests/keys/ed25519-3.sec: New file. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Attila Lendvai 2021-11-27build-self: Help users to submit useful bug reports....* build-aux/build-self.scm (build): Request the ‘COMPLETE output’. Tobias Geerinckx-Rice 2021-10-17maint: Factorize po xref translation....This ensures we use the same method in "make" as in "guix/self.scm". * Makefile.am: Build guix/build/po.scm. * build-aux/convert-xref.scm: New file. * doc/local.mk (xref_command): Use it. * guix/self.scm (translate-cross-references): Move it... * guix/build/po.scm: Parse comments and flags separately to find fuzzy flags. (translate-cross-references): ...here. (parse-tree->assoc): Ignore fuzzy entries. Julien Lepiller