From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SgWXd-00020q-Ly for garchives@archives.gentoo.org; Mon, 18 Jun 2012 07:38:29 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 07C4FE058A; Mon, 18 Jun 2012 07:38:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C377EE058A for ; Mon, 18 Jun 2012 07:38:11 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 355CE1B401B for ; Mon, 18 Jun 2012 07:38:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 9B753E5430 for ; Mon, 18 Jun 2012 07:38:09 +0000 (UTC) From: "Paweł Hajdan" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paweł Hajdan" Message-ID: <1340005043.31e12833015525826359340f568b2b6fad783203.phajdan.jr@gentoo> Subject: [gentoo-commits] proj/chromium-tools:master commit in: / X-VCS-Repository: proj/chromium-tools X-VCS-Files: sqlite-vacuum.py X-VCS-Directories: / X-VCS-Committer: phajdan.jr X-VCS-Committer-Name: Paweł Hajdan X-VCS-Revision: 31e12833015525826359340f568b2b6fad783203 X-VCS-Branch: master Date: Mon, 18 Jun 2012 07:38:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: cd9fb824-cb9d-4069-a9f2-3788913ce4cc X-Archives-Hash: 64c349e2c37c7e9fdd5877375011c7d4 commit: 31e12833015525826359340f568b2b6fad783203 Author: Pawel Hajdan, Jr gentoo org> AuthorDate: Mon Jun 18 07:37:23 2012 +0000 Commit: Pawe=C5=82 Hajdan gentoo org> CommitDate: Mon Jun 18 07:37:23 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/chromium-tool= s.git;a=3Dcommit;h=3D31e12833 Add sqlite-vacuum script, bug #413295. --- sqlite-vacuum.py | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/sqlite-vacuum.py b/sqlite-vacuum.py new file mode 100755 index 0000000..03b610a --- /dev/null +++ b/sqlite-vacuum.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +import os.path + +import magic +import sqlite3 + +home =3D os.path.expanduser('~') + +try: + m =3D magic.open(magic.MAGIC_NONE) + m.load() + + for root, dirs, files in os.walk(os.path.join(home, '.config', 'chromiu= m')): + for f in files: + path =3D os.path.join(root, f) + magic_type =3D m.file(path) + if magic_type and 'SQLite' in magic_type: + try: + c =3D sqlite3.connect(path) + c.execute('VACUUM') + c.execute('REINDEX') + finally: + c.close() +finally: + m.close()