unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob c6b6b53bc736ce9c8da0b6b7080484200508af59 3396 bytes (raw)
name: gnu/packages/patches/crawl-upgrade-saves.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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;

debug log:

solving c6b6b53bc ...
found c6b6b53bc in https://yhetil.org/guix-patches/9de7211f-6ab6-7a7d-c2a9-ad65f95bbfe4@cock.li/

applying [1/1] https://yhetil.org/guix-patches/9de7211f-6ab6-7a7d-c2a9-ad65f95bbfe4@cock.li/
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

1:23: trailing whitespace.
  
1:38: trailing whitespace.
  
1:46: trailing whitespace.
  
1:61: trailing whitespace.
  
1:69: trailing whitespace.
  
Checking patch gnu/packages/patches/crawl-upgrade-saves.patch...
Applied patch gnu/packages/patches/crawl-upgrade-saves.patch cleanly.
warning: squelched 8 whitespace errors
warning: 13 lines add whitespace errors.

index at:
100644 c6b6b53bc736ce9c8da0b6b7080484200508af59	gnu/packages/patches/crawl-upgrade-saves.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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