Commit Graph

500 Commits

Author SHA1 Message Date
Fabio Erculiani 4bbf8d773b [entropy.client.trigger] implement support for automagic /usr/share/info/*/dir update 2012-09-06 20:01:17 +02:00
Fabio Erculiani 91a96abd45 Release Entropy 140 2012-09-03 19:25:01 +02:00
Fabio Erculiani 4a37aed84a Release Entropy 139 2012-09-02 17:21:40 +02:00
Fabio Erculiani 3d923e0727 Release Entropy 138 2012-09-01 15:24:16 +02:00
Fabio Erculiani 7ddb21276c [entropy.dump] do not use os.fdopen() in dumpobj()
It has been observed that using os.fdopen() below in multi-threaded
scenarios is causing EBADF (thus OSError). There is probably a racen
condition down in the stack or mkstemp() itself is not guaranteed against
concurrent access. For now, just consume one more file descriptor and
avoid the race completely.
2012-09-01 15:21:39 +02:00
Fabio Erculiani 32104fe63c [entropy.spm] __source_env_get_var: fix typo in tmp file prefix string 2012-08-27 11:47:00 +02:00
Fabio Erculiani 84b13ffb95 Release Entropy 137 2012-08-27 11:37:50 +02:00
Fabio Erculiani 0b9acb24a4 [entropy.spm] __source_env_get_var: avoid deadlocking due to stdout buffer full
Using subprocess.PIPE and Popen.wait() causes the child process to
block in case of write (stdout) buffer full. Rewrite the whole
function to use simple a simple fd via mkstemp(). This way, even
if the env variable is very long, the process won't hang.

This issue has been observed in dev-texlive/texlive-latexextra-2012's
SRC_URI, which is more than 131k chars long!
2012-08-27 11:32:42 +02:00
Fabio Erculiani 6744795912 Release Entropy 136 2012-08-24 16:16:15 +02:00
Fabio Erculiani 3be15f077b [entropy.server.db] when download is complete, unlock all the mirrors
Unlocking just the working one causes the others to be left in
locked status until a manual unlock is issued.
2012-08-23 11:29:27 +02:00
Fabio Erculiani d530ae4cb3 [entropy.spm] look for modinfo inside /usr/bin
After more than 10 years people still change paths like this.
:-/
2012-08-23 09:29:21 +02:00
Fabio Erculiani b2c88b0c20 Release Entropy 135 2012-08-22 17:43:41 +02:00
Fabio Erculiani 385c50b548 [entropy.services] fix string format arguments 2012-08-22 17:43:11 +02:00
Fabio Erculiani ab76d2254d [entropy.client.interfaces.db] fix undefined reference to TIMEOUT_FETCH_ERROR 2012-08-22 17:42:58 +02:00
Fabio Erculiani 541f518ec3 [entropy.misc] fix undefined reference to class object 2012-08-22 17:42:05 +02:00
Fabio Erculiani c64441dcfc [entropy.spm] PortagePlugin: explicitly save err object 2012-08-22 17:41:27 +02:00
Fabio Erculiani 4da0c49b07 [entropy.db.sql] move methods used by _addPackage() into class 2012-08-22 17:41:01 +02:00
Fabio Erculiani 04ce12e276 Release Entropy 134 2012-08-22 13:19:34 +02:00
Fabio Erculiani aae376f369 [entropy.client.package] filter out splitdebug paths if splitdebug is disabled
If splitdebug was previously enabled for a package, and its
files were installed, when splitdebug is turned off Package kept
printing collision messages about /usr/lib/debug files.
This happened because packages contain /usr/lib/debug paths in
their content metadata (even those with separate splitdebug tarballs)
and this wasn't cleared out before installed packages repository
metadata update. Thus, during the cleanup step, these paths popped out
generating invalid warnings.
2012-08-22 13:09:54 +02:00
Fabio Erculiani 657478b4ee [entropy.spm] ensure that Portage vdb cache is always invalidated
It happened that assign_uid_to_installed_package() did not explicitly
invalidate the Portage vdb cache and, while this is used inside
add_installed_package(), which did invalidate the vdb cache on its own
already, it is also called directly by entropy.client.interfaces.package
code.
Moreover, root= value wasn't properly handled throughout the execution
of add_installed_package(), which may have caused cache invalidation
issues described above.
2012-08-22 12:07:56 +02:00
Fabio Erculiani fc8ed7329d [entropy.*] don't use magic constants for UrlFetcher errors 2012-08-21 10:46:56 +02:00
Fabio Erculiani af7ed0d04c [entropy.fetchers] UrlFetcher: expose generic error codes via class property 2012-08-21 10:38:08 +02:00
Fabio Erculiani b68e9104b5 [entropy.fetchers] MultipleUrlFetcher: join() threads explicitly
This avoids a potentially infinite loop if one of the threads dies
unexpectedly.
2012-08-21 09:31:15 +02:00
Fabio Erculiani 796e71e9ac [repo] migrate shebangs to /usr/bin/python 2012-08-18 16:53:32 +02:00
Fabio Erculiani 1f84203788 [entropy.spm] PortagePlugin: Python 3.x, use f.buffer.write() with bytes() 2012-08-17 22:42:36 +02:00
Fabio Erculiani ff133b432a [entropy.services.client] restore Python 3.x compatibility 2012-08-17 22:30:45 +02:00
Fabio Erculiani 333e82ea10 [entropy.spm] PortagePlugin: keep keyslot as unicode, Python 3.x compatibility 2012-08-17 22:30:03 +02:00
Fabio Erculiani e90cb74c27 [entropy.spm] PortagePlugin: expose __next__() unconditionally 2012-08-17 21:41:08 +02:00
Fabio Erculiani 206fe49203 [entropy.db.sql] add __next__() to iterators, make Python3 happy 2012-08-17 21:40:55 +02:00
Fabio Erculiani 61eeaed14e [entropy.client.package] add __next__() to iterators, make Python3 happy 2012-08-17 21:40:35 +02:00
Fabio Erculiani a37d7ca195 [entropy.db.sqlite] move _addPackage() to entropy.db.sql 2012-08-16 21:35:45 +02:00
Fabio Erculiani 5a49098515 [entropy.db] move _getLiveCacheKey and __hash__ to entropy.db.sql 2012-08-16 21:30:51 +02:00
Fabio Erculiani a0394ba9a5 [entropy.db.sql] introduce _UPDATE_OR_REPLACE and move remaining SQL to entropy.db.sql 2012-08-16 21:20:46 +02:00
Fabio Erculiani 1b10177640 [entropy.db.sql] major cursor and connection pooling rework
The original idea was to avoid doing cursor and connection resources
cleanup (left by old and dead threads) synchronously every time
_connection() and/or _cursor() is accessed. This strategy also had
a huge drawback: with no activity on the object, resources were
left hanging there forever.

This commit introduces a better strategy for transparent and automatic
cleanup of resources belonging to terminated threads: every time a new
thread_id arrives at _cursor() or _connection(), a new daemon thread
starts and synchronizes with the caller through a simple Thread.join()
(because it's a daemon thread, we can join() daemon threads as well,
even if this is not really compliant with the specs, but it seems to work
just fine in Python).
When the caller thread is joined, it is possible to start the resources
cleanup procedure, carefully taking into account that thread_ids are
recycled and thus there might be clashing with newly created threads.

This helped a design issue to emerge from the sand (like a zombie
at the seaside): it is impossible to cleanup resources left by the
MainThread because this thread never ends living, and if it dies,
everything dies, obviously. So, the first implementation of this new
strategy was NOT touching the MainThread resources but then, the old
behaviour was to kill them as well on EntropyRepository.close().
So, the final version of this patch kept the old buggy behaviour of
touching MainThread stuff (nein, nein, nein, nein would Hitler say).
However, a new keyword argument "safe" has been added to the close()
method so it is possible to start migrating code to the dark side of the
power.

This means nothing really changed for API consumers yet, just entropy.db.sql
code being more efficient (no weird for loops and synchronous crap)
and actually faster (multi-threading ftw).
2012-08-15 20:59:45 +02:00
Fabio Erculiani f1c60ec30b [entropy.db.mysql] implement support for RestartTransaction through _proxy_call() 2012-08-14 19:27:20 +02:00
Fabio Erculiani 9a699e7ae8 [entropy.db.exceptions] introduce RestartTransaction exception
Exception raised in case the whole transaction has
been aborted by the database and caller is kindly
required to restart it from the beginning.
2012-08-14 19:27:20 +02:00
Fabio Erculiani 366396bfe7 Release Entropy 133 2012-08-14 17:51:29 +02:00
Fabio Erculiani 8d00d5beec [entropy.db.sql] make custom iterators work across multiple iterations 2012-08-14 10:26:22 +02:00
Fabio Erculiani a6286b0e21 [entropy.client.package] add one more note about the universal newline mode 2012-08-14 10:13:14 +02:00
Fabio Erculiani 56616e4520 [entropy.db.mysql] add some missing docstrings 2012-08-14 09:41:29 +02:00
Fabio Erculiani 427949d481 [entropy.client.package] make FileContent*Reader iterator work multiple times
As explained in the code comments, this is mandatory for scenarios
in where the iterator has to run multiple times because transactions
can be rolled back and replayed indefinitely.
2012-08-14 09:39:44 +02:00
Fabio Erculiani 8c0c0dc10a [entropy.db.sql] _insertLicenses: tolerate unique constraint violations
The licensename column is declared as UNIQUE, multiple threads inserting
rows can cause unique constraint violations. Considering the nature of
the data, using "INSERT OR REPLACE" can be considered safe and actually
wanted.
2012-08-12 22:11:49 +02:00
Fabio Erculiani e05b649f98 [entropy.db] remove do_cleanup argument from removePackage() 2012-08-12 16:15:23 +02:00
Fabio Erculiani 9d665e050c [entropy.db] remove do_commit argument from methods 2012-08-12 16:00:02 +02:00
Fabio Erculiani 6f54ac4459 [entropy.client.package] use Universal Newline mode when opening content files
This fixes the readline() truncation issue, as explained in the comments
2012-08-12 15:45:28 +02:00
Fabio Erculiani f9ee58b48f [entropy.db.sql] add SQLConnectionWrapper.rawstring() and docstrings 2012-08-12 12:51:58 +02:00
Fabio Erculiani a8e2bbd3ba [entropy.db.sql] do not catch any exception in commit() 2012-08-12 12:08:23 +02:00
Fabio Erculiani 70c6823b90 [entropy.client.package] fix non-deterministic bug with Python File.readline()
This issue caused a load of issues with the ca-certificates.

Example of partial readline():
0|obj|/usr/share/ca-certificates/mozilla/NetLock_Arany_=Class_Gold=_F\xc3\x85
and the next call:
\xc2\x91tan\xc3\x83\xc2\xbas\xc3\x83\xc2\xadtv\xc3\x83\xc2\xa1ny.crt\n

Trying to workaround it by reading ahead if line does not end with \n
2012-08-12 11:53:50 +02:00
Fabio Erculiani c5e80d4153 [entropy.db.sql] define a common API for Cursor and Connection wrappers 2012-08-12 11:39:36 +02:00
Fabio Erculiani beb21f1660 [entropy.db] move other standard SQL code to entropy.db.sql 2012-08-12 10:29:41 +02:00