#pragma once #include #include #include "types.hh" class sqlite3; class sqlite3_stmt; namespace nix { /* RAII wrapper to close a SQLite database automatically. */ struct SQLite { sqlite3 * db; SQLite() { db = 0; } ~SQLite(); operator sqlite3 * () { return db; } }; /* RAII wrapper to create and destroy SQLite prepared statements. */ struct SQLiteStmt { sqlite3 * db = 0; sqlite3_stmt * stmt = 0; SQLiteStmt() { } void create(sqlite3 * db, const std::string & s); ~SQLiteStmt(); operator sqlite3_stmt * () { return stmt; } /* Helper for binding / executing statements. */ class Use { friend struct SQLiteStmt; private: SQLiteStmt & stmt; unsigned int curArg = 1; Use(SQLiteStmt & stmt); public: ~Use(); /* Bind the next parameter. */ Use & operator () (const std::string & value, bool notNull = true); Use & operator () (int64_t value, bool notNull = true); Use & bind(); // null int step(); /* Execute a statement that does not return rows. */ void exec(); /* For statements that return 0 or more rows. Returns true iff a row is available. */ bool next(); std::string getStr(int col); int64_t getInt(int col); }; Use use() { return Use(*this); } }; /* RAII helper that ensures transactions are aborted unless explicitly committed. */ struct SQLiteTxn { bool active = false; sqlite3 * db; SQLiteTxn(sqlite3 * db); void commit(); ~SQLiteTxn(); }; MakeError(SQLiteError, Error); MakeError(SQLiteBusy, SQLiteError); [[noreturn]] void throwSQLiteError(sqlite3 * db, const format & f); /* Convenience function for retrying a SQLite transaction when the database is busy. */ template T retrySQLite(std::function fun) { while (true) { try { return fun(); } catch (SQLiteBusy & e) { } } } } h'/>
AgeCommit message (Expand)Author
2020-11-01installer: parted: Internationalize the partition handling code....* gnu/installer/parted.scm (user-partition-description): Use 'format' and 'G_' for i18n. Ludovic Courtès
2020-10-30installer: Use UUIDs in the 'swap-devices' field....Note: This change requires an updated 'guix' package that contains Linux-swap support in (gnu build file-systems). * gnu/installer/parted.scm (user-partitions->configuration): Use UUIDs in the 'swap-devices' field. * gnu/installer/newt/final.scm (run-final-page)[wait-for-clients]: New procedure. Use it. * gnu/installer/tests.scm (choose-partitioning): Wait for 'starting-final-step' message and move configuration file dialog handling to... (conclude-installation): ... here. Send over PORT the reply corresponding to 'starting-final-step'. * gnu/tests/install.scm (gui-test-program): When ENCRYPTED? is false, invoke 'swaplabel' in the marionette. (installation-target-os-for-gui-tests): When ENCRYPTED? is false, except a fixed UUID. Ludovic Courtès
2020-10-19installer: Create bios_grub partition when it is needed....* gnu/installer/parted.scm (auto-partition!): Only check for ESP on EFI installations. Miguel Ángel Arruga Vivas
2020-09-21installer: Fix docstring typoes....* gnu/installer/connman.scm (connman-state, run-locale-page) (start-swapping, stop-swapping, run-installer-steps): Fix typo in docstring. Tobias Geerinckx-Rice
2020-08-06installer: Remove logical devices....If a device contains an active logical volume, BLKRRPART will report that the device is busy. This will cause this device to be filtered by "non-install-devices" procedure, which is not desired. Make sure to deactivate all logical volumes before device probing. Fixes <https://issues.guix.gnu.org/42683>. * gnu/installer.scm (installer-program): Add lvm2-static to the inputs. * gnu/installer/parted.scm (remove-logical-devices): New procedure, (init-parted): call it. Mathieu Othacehe
2020-07-26installer: Add NTFS support....This adds support for creating and editing NTFS partitions. It is however not possible yet to create root NTFS partitions, as overlaying on top of a fuse partition does not seem supported. * gnu/installer.scm (installer-program): Add "ntfs-3g" to the inputs. * gnu/installer/parted.scm (user-fs-type-name, user-fs-type->mount-type, partition-filesystem-user-type, create-ntfs-file-system, format-user-partitions): Add NTFS support. * gnu/installer/newt/partition.scm (run-fs-type-page): Add NTFS support. Mathieu Othacehe