From 2a8c459e7f45d0454d8a99d38eca99d0c49f5bd8 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 31 Oct 2013 11:19:52 -0200 Subject: notes for repackaging --- docs/debian-repackaging.rst | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/debian-repackaging.rst diff --git a/docs/debian-repackaging.rst b/docs/debian-repackaging.rst new file mode 100644 index 00000000..a7488a84 --- /dev/null +++ b/docs/debian-repackaging.rst @@ -0,0 +1,41 @@ +repackaging howto +================= + +How to repackage latest code +---------------------------- + +Enter debian branch:: + + git checkout debian + +Merge your latest and greatest:: + + git merge develop + +Bump the changelog:: + + vim debian/changelog + +dch should also get you there, adding a new entry. + +Edit the changelog so you get a new version (this is the version +that apt will report). For example, change:: + + soledad-common (0.3.4) unstable; urgency=low + +to:: + + soledad-common (0.3.4-1~testing_frobnication) unstable; urgency=low + + +Last, but not least, freeze the debian version:: + + python setup.py freeze_debianver + +It might be a good idea to edit by hand the version string +under _version too, so it's clear that you're packaging some bleeding +edge not to be confused with latest stable packages. + +And now you can happily repackage for your own deploys:: + + debuild -us -uc -- cgit v1.2.3 From 4b800e2035da2bcd643274f314d62e650d39edc5 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 7 Nov 2013 19:55:41 -0200 Subject: open db in autocommit mode --- client/changes/bug_open-db-in-autocommit-mode | 2 ++ client/src/leap/soledad/client/sqlcipher.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 client/changes/bug_open-db-in-autocommit-mode diff --git a/client/changes/bug_open-db-in-autocommit-mode b/client/changes/bug_open-db-in-autocommit-mode new file mode 100644 index 00000000..26edd5a9 --- /dev/null +++ b/client/changes/bug_open-db-in-autocommit-mode @@ -0,0 +1,2 @@ + o Open db in autocommit mode, to avoid nested transactions problems. + Closes: #4400 diff --git a/client/src/leap/soledad/client/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py index 3e01a4fb..894c6f97 100644 --- a/client/src/leap/soledad/client/sqlcipher.py +++ b/client/src/leap/soledad/client/sqlcipher.py @@ -70,6 +70,14 @@ sqlite_backend.dbapi2 = dbapi2 SQLITE_CHECK_SAME_THREAD = False +# We set isolation_level to None to setup autocommit mode. +# See: http://docs.python.org/2/library/sqlite3.html#controlling-transactions +# This avoids problems with sequential operations using the same soledad object +# trying to open new transactions +# (The error was: +# OperationalError:cannot start a transaction within a transaction.) +SQLITE_ISOLATION_LEVEL = None + def open(path, password, create=True, document_factory=None, crypto=None, raw_key=False, cipher='aes-256-cbc', kdf_iter=4000, @@ -172,6 +180,7 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): with self.k_lock: self._db_handle = dbapi2.connect( sqlcipher_file, + isolation_level=SQLITE_ISOLATION_LEVEL, check_same_thread=SQLITE_CHECK_SAME_THREAD) # set SQLCipher cryptographic parameters self._set_crypto_pragmas( @@ -436,6 +445,7 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): with cls.k_lock: db_handle = dbapi2.connect( sqlcipher_file, + isolation_level=SQLITE_ISOLATION_LEVEL, check_same_thread=SQLITE_CHECK_SAME_THREAD) cls._set_crypto_pragmas( db_handle, key, raw_key, cipher, @@ -645,6 +655,7 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): passphrase that should be hashed to obtain the encyrption key. :type raw_key: bool """ + # XXX change key param! if raw_key: cls._pragma_rekey_raw(db_handle, key) else: @@ -683,6 +694,7 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): """ if not all(c in string.hexdigits for c in key): raise NotAnHexString(key) + # XXX change passphrase param! db_handle.cursor().execute('PRAGMA rekey = "x\'%s"' % passphrase) def __del__(self): -- cgit v1.2.3 From 3b2763b738939c605c3d4480501fde4463c0f2eb Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 7 Nov 2013 20:42:23 -0200 Subject: default detected encoding to utf-8 --- client/changes/bug_4417_default-encoding-to-utf8 | 1 + client/src/leap/soledad/client/__init__.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 client/changes/bug_4417_default-encoding-to-utf8 diff --git a/client/changes/bug_4417_default-encoding-to-utf8 b/client/changes/bug_4417_default-encoding-to-utf8 new file mode 100644 index 00000000..6801b766 --- /dev/null +++ b/client/changes/bug_4417_default-encoding-to-utf8 @@ -0,0 +1 @@ + o Defaults detected encoding to utf-8 to avoid bug if detected encoding is None. Closes: #4417 diff --git a/client/src/leap/soledad/client/__init__.py b/client/src/leap/soledad/client/__init__.py index 534040ef..a159d773 100644 --- a/client/src/leap/soledad/client/__init__.py +++ b/client/src/leap/soledad/client/__init__.py @@ -847,8 +847,9 @@ class Soledad(object): elif isinstance(content, str): try: result = chardet.detect(content) - content = content.decode(result["encoding"]).encode("utf-8")\ - .decode("utf-8") + default = "utf-8" + encoding = result["encoding"] or default + content = content.decode(encoding) except UnicodeError: pass return content -- cgit v1.2.3 From 70aa832393c1e926512ff8f333ef6170aa11dab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Fri, 15 Nov 2013 10:09:04 -0300 Subject: Fold in changes --- CHANGELOG | 6 ++++++ client/changes/bug_4417_default-encoding-to-utf8 | 1 - client/changes/bug_open-db-in-autocommit-mode | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) delete mode 100644 client/changes/bug_4417_default-encoding-to-utf8 delete mode 100644 client/changes/bug_open-db-in-autocommit-mode diff --git a/CHANGELOG b/CHANGELOG index e82801a1..660d4160 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +0.4.3 Nov 15: + o Defaults detected encoding to utf-8 to avoid bug if detected + encoding is None. Closes: #4417 + o Open db in autocommit mode, to avoid nested transactions problems. + Closes: #4400 + 0.4.2 Nov 1: Client: o Support non-ascii passwords. Closes #4001. diff --git a/client/changes/bug_4417_default-encoding-to-utf8 b/client/changes/bug_4417_default-encoding-to-utf8 deleted file mode 100644 index 6801b766..00000000 --- a/client/changes/bug_4417_default-encoding-to-utf8 +++ /dev/null @@ -1 +0,0 @@ - o Defaults detected encoding to utf-8 to avoid bug if detected encoding is None. Closes: #4417 diff --git a/client/changes/bug_open-db-in-autocommit-mode b/client/changes/bug_open-db-in-autocommit-mode deleted file mode 100644 index 26edd5a9..00000000 --- a/client/changes/bug_open-db-in-autocommit-mode +++ /dev/null @@ -1,2 +0,0 @@ - o Open db in autocommit mode, to avoid nested transactions problems. - Closes: #4400 -- cgit v1.2.3