From: Michael Tremer Date: Mon, 14 Nov 2011 14:33:54 +0000 (+0100) Subject: Call sync() after transaction was done. X-Git-Tag: 0.9.18~20^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92aef53216981050a4829de5da5ba9860aaa3e33;p=pakfire.git Call sync() after transaction was done. This will make sure that all data is entirely written to disk. --- diff --git a/po/pakfire.pot b/po/pakfire.pot index 0f87a8e77..bdb8c8db5 100644 --- a/po/pakfire.pot +++ b/po/pakfire.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-25 20:58+0200\n" +"POT-Creation-Date: 2011-11-14 15:18+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -292,7 +292,7 @@ msgstr "" msgid "Give name of at least one package to check." msgstr "" -#: ../python/pakfire/cli.py:348 ../python/pakfire/transaction.py:344 +#: ../python/pakfire/cli.py:348 ../python/pakfire/transaction.py:345 msgid "Repository" msgstr "" @@ -435,7 +435,7 @@ msgstr "" msgid "Running pakfire-build in a pakfire container?" msgstr "" -#: ../python/pakfire/errors.py:85 ../python/pakfire/transaction.py:409 +#: ../python/pakfire/errors.py:85 ../python/pakfire/transaction.py:410 msgid "Transaction test was not successful" msgstr "" @@ -448,11 +448,11 @@ msgstr "" msgid "Name" msgstr "" -#: ../python/pakfire/packages/base.py:105 ../python/pakfire/transaction.py:343 +#: ../python/pakfire/packages/base.py:105 ../python/pakfire/transaction.py:344 msgid "Arch" msgstr "" -#: ../python/pakfire/packages/base.py:108 ../python/pakfire/transaction.py:343 +#: ../python/pakfire/packages/base.py:108 ../python/pakfire/transaction.py:344 msgid "Version" msgstr "" @@ -460,7 +460,7 @@ msgstr "" msgid "Release" msgstr "" -#: ../python/pakfire/packages/base.py:113 ../python/pakfire/transaction.py:344 +#: ../python/pakfire/packages/base.py:113 ../python/pakfire/transaction.py:345 msgid "Size" msgstr "" @@ -660,92 +660,92 @@ msgstr "" msgid " Solutions:" msgstr "" -#: ../python/pakfire/transaction.py:88 +#: ../python/pakfire/transaction.py:89 #, python-format msgid "file %s from %s conflicts with file from package %s" msgstr "" -#: ../python/pakfire/transaction.py:94 +#: ../python/pakfire/transaction.py:95 #, python-format msgid "file %s from %s conflicts with files from %s" msgstr "" -#: ../python/pakfire/transaction.py:103 +#: ../python/pakfire/transaction.py:104 #, python-format msgid "" "There is not enough space left on %(name)s. Need at least %(size)s to " "perform transaction." msgstr "" -#: ../python/pakfire/transaction.py:280 +#: ../python/pakfire/transaction.py:281 #, python-format msgid "Not enough space to download %s of packages." msgstr "" -#: ../python/pakfire/transaction.py:283 +#: ../python/pakfire/transaction.py:284 msgid "Downloading packages:" msgstr "" -#: ../python/pakfire/transaction.py:343 +#: ../python/pakfire/transaction.py:344 msgid "Package" msgstr "" -#: ../python/pakfire/transaction.py:348 +#: ../python/pakfire/transaction.py:349 msgid "Installing:" msgstr "" -#: ../python/pakfire/transaction.py:349 +#: ../python/pakfire/transaction.py:350 msgid "Reinstalling:" msgstr "" -#: ../python/pakfire/transaction.py:350 +#: ../python/pakfire/transaction.py:351 msgid "Updating:" msgstr "" -#: ../python/pakfire/transaction.py:351 +#: ../python/pakfire/transaction.py:352 msgid "Downgrading:" msgstr "" -#: ../python/pakfire/transaction.py:352 +#: ../python/pakfire/transaction.py:353 msgid "Removing:" msgstr "" -#: ../python/pakfire/transaction.py:358 +#: ../python/pakfire/transaction.py:359 msgid "Transaction Summary" msgstr "" -#: ../python/pakfire/transaction.py:365 +#: ../python/pakfire/transaction.py:366 msgid "package" msgstr "" -#: ../python/pakfire/transaction.py:371 +#: ../python/pakfire/transaction.py:372 #, python-format msgid "Total download size: %s" msgstr "" -#: ../python/pakfire/transaction.py:375 +#: ../python/pakfire/transaction.py:376 #, python-format msgid "Installed size: %s" msgstr "" -#: ../python/pakfire/transaction.py:378 +#: ../python/pakfire/transaction.py:379 #, python-format msgid "Freed size: %s" msgstr "" -#: ../python/pakfire/transaction.py:387 +#: ../python/pakfire/transaction.py:388 msgid "Is this okay?" msgstr "" -#: ../python/pakfire/transaction.py:390 +#: ../python/pakfire/transaction.py:391 msgid "Running Transaction Test" msgstr "" -#: ../python/pakfire/transaction.py:402 +#: ../python/pakfire/transaction.py:403 msgid "Transaction Test Succeeded" msgstr "" -#: ../python/pakfire/transaction.py:420 +#: ../python/pakfire/transaction.py:421 msgid "Running transaction" msgstr "" diff --git a/python/pakfire/transaction.py b/python/pakfire/transaction.py index 069105b09..15961421f 100644 --- a/python/pakfire/transaction.py +++ b/python/pakfire/transaction.py @@ -33,6 +33,7 @@ import util from constants import * from i18n import _ +from pakfire._pakfire import sync PKG_DUMP_FORMAT = " %-21s %-8s %-21s %-18s %6s " @@ -426,3 +427,6 @@ class Transaction(object): logging.error("Action finished with an error: %s - %s" % (action, e)) logging.info("") + + # Call sync to make sure all buffers are written to disk. + sync() diff --git a/python/src/_pakfiremodule.c b/python/src/_pakfiremodule.c index b5c22128f..ab291269b 100644 --- a/python/src/_pakfiremodule.c +++ b/python/src/_pakfiremodule.c @@ -41,6 +41,7 @@ static PyMethodDef pakfireModuleMethods[] = { {"get_capabilities", (PyCFunction)get_capabilities, METH_VARARGS, NULL}, {"set_capabilities", (PyCFunction)set_capabilities, METH_VARARGS, NULL}, {"personality", (PyCFunction)_personality, METH_VARARGS, NULL}, + {"sync", (PyCFunction)_sync, METH_NOARGS, NULL}, { NULL, NULL, 0, NULL } }; diff --git a/python/src/util.c b/python/src/util.c index d3ee3a224..ed555f549 100644 --- a/python/src/util.c +++ b/python/src/util.c @@ -21,6 +21,7 @@ #include #include +#include #include "util.h" @@ -44,6 +45,13 @@ PyObject *_personality(PyObject *self, PyObject *args) { return Py_BuildValue("i", ret); } +PyObject *_sync(PyObject *self, PyObject *args) { + /* Just sync everything to disks. */ + sync(); + + Py_RETURN_NONE; +} + PyObject *version_compare(PyObject *self, PyObject *args) { Pool *pool; const char *evr1, *evr2; diff --git a/python/src/util.h b/python/src/util.h index d0a7e0985..6ed9d1460 100644 --- a/python/src/util.h +++ b/python/src/util.h @@ -26,6 +26,7 @@ #include extern PyObject *_personality(PyObject *self, PyObject *args); +extern PyObject *_sync(PyObject *self, PyObject *args); extern PyObject *version_compare(PyObject *self, PyObject *args); #endif