Commit Graph

96 Commits

Author SHA1 Message Date
Sławomir Nizio
c6ab5d28e2 [entropy.core] fix DependencyRewriter with or-dependencies 2019-11-09 12:20:46 +01:00
Sławomir Nizio
545b5a7ca4 [tests] fix import path
It couldn't find and load _entropy.solo.commands.pkg.
2018-11-26 21:09:08 +01:00
Sławomir Nizio
7cf7e1f6b7 convert solo imports, with needed changes to entropy_path_loader
The module entropy_path_loader (used only for running from within the
checkout; otherwise not even installed) is made to provide the _entropy
namespace.

(Other ideas instead of this entropy_path_loader change would be to
reorganise files layout; drop support for running from the checkout as
is - and perhaps require virtualenvs; require sourcing a script that
sets PYTHONPATH. However, as implemented, it is not intrusive, and the
good part is that it is quite isolated, not used in normal usage after
installation. Basically, it only does sys.path + provides _entropy
namespace.)
2018-11-26 20:15:36 +01:00
Fabio Erculiani
e9b211eea0 [entropy.spm] improve handling of non-ascii paths (e.g. puppet-agent).
It looks like Portage now stores unicode paths correctly in its metadata
as opposed to what it used to be. We need to make sure that we parse those
"CONTENTS" file and content metadata in general using the correct encoding.
This will allow us to store and retrieve such metadata from the sqlite3
database correctly and also match the stored paths with the filesystem
paths exactly.

This commit may need a bit more real-life testing. Backward compat
wrt old Entropy and Portage tbz2 files should be as expected.
Unit tests attached.
2018-09-23 22:06:05 +02:00
Sławomir Nizio
4463b6d425 [entropy.spm] add support for BDEPEND (from EAPI 7)
For the purpose of Entropy binary packages, they are merged with
DEPEND.
2018-08-17 23:51:40 +02:00
Sławomir Nizio
8643db23aa [entropy.tools, tests] fix test and code with Python 3; add to CI 2018-08-06 09:37:13 +02:00
Sławomir Nizio
fabb3e72da [tests] add lib/tests/run-nonpriv-wrapper
- runs as non-root
- does not require being in entropy/portage group
    - in fact, it's better (better isolation) to run as such
- thus does not modify running system

The wrapper script is ugly but very convenient.
2018-08-05 00:40:11 +02:00
Sławomir Nizio
779d40389f [tests] exit with failure also on assetion errors 2018-08-04 23:45:12 +02:00
Sławomir Nizio
85174d39fa add .travis.yml
USERNAME is needed in lib/entropy/security.py.
Added support for ETP_TESTS_NONINTERACTIVE (and skipped one test).
2018-08-04 19:05:19 +02:00
Sławomir Nizio
cbcbf7495f [entropy.core] implement "drop all USE" in the new dep. rewrite 2018-02-24 19:52:12 +01:00
Sławomir Nizio
0a56ec74b8 [entropy.core,entropy.server] implement new dep. rewrite parser
It uses a simple rules without the need to use complex regexes. It is
not as powerful as the existing approaches so both are complementary.

For example, this:
    foo/bar (.*)app-crypt/pinentry(.*)\[gtk\] \1app-crypt/pinentry-gtk2\2
expresses the intention that can be expressed simpler:
    rewrite foo/bar from-dep=app-crypt/pinentry to-dep=app-crypt/pinentry-gtk2 if-dep-has-use=gtk drop-use=gtk
2018-02-24 19:35:44 +01:00
Francesco Ferro
afbce1c169 [entropy.core] update tests for entropy tag sorting 2017-09-09 11:46:06 +02:00
Sławomir Nizio
d9843c2d1d [tests] enforce default caching policy
When ran in a chroot in environment where entropy.tools.total_memory()
would return 0, the test failed.
2016-04-14 22:38:14 +02:00
Fabio Erculiani
363c6a175f [entropy.*] migrate all retrieveNeeded uses to retrieveNeededLibraries 2014-10-20 15:04:19 +02:00
Fabio Erculiani
7b2810c054 [entropy.db] rewrite needed libraries SQL schema, keep compat. 2014-09-30 09:10:11 +01:00
Fabio Erculiani
1f6bd34749 [entropy] prefix package download URLs with the category directory
This makes possible to avoid directory hot spots on repository mirrors.
This commit requires some mileage and real-world testing, but it
seems to be running good on a relatively small repository.
No backward compatibility issues have been reported.
2014-02-15 19:10:16 +01:00
Fabio Erculiani
d759bdd74b [entropy.client] move LoadersMixin back into the Client class 2014-02-14 16:13:34 +01:00
Fabio Erculiani
603c96fc05 [entropy.locks] add is_already_acquired()
This method returns whether the lock has been already acquired.
It is useful in cases where the reentrancy property is leveraged.
2013-12-26 22:52:13 +01:00
Fabio Erculiani
0df7092e05 [entropy.locks] drop "_lock", just "acquire" or "release", it's cleaner 2013-12-26 22:52:11 +01:00
Fabio Erculiani
1f2575204e [entropy.locks] make ResourceLock reentrant wrt to individual threads only 2013-12-26 22:52:11 +01:00
Fabio Erculiani
e6b129ae7e [entropy.client] move ClientSystemSettingsPlugin to a separate module
This will break the circular dependency between loaders and client modules
2013-12-12 19:24:19 +01:00
Fabio Erculiani
aa4e2441be [entropy.client] move _enabled_repos to a property, allow lazy loading 2013-12-12 18:35:17 +01:00
Fabio Erculiani
3a7269aa5c [entropy.db] EntropyBaseRepository: turn lock methods into no-op if direct mode
Now that the repository lock is reentrant, it's good to have the
methods take into account direct mode as well. In direct mode,
we explicitly don't want to deal with any kind of locking, because
we accept to manipulate stale data. In order to hide locking code
from the outside and have it transparently managed inside entropy.*
methods, we must respect requests made in direct mode.
2013-12-12 14:25:44 +01:00
Fabio Erculiani
023e8e1b72 [entropy.db] EntropyBaseRepository: make possible to permanently enable direct mode 2013-12-12 10:21:27 +01:00
Fabio Erculiani
7808ad6b92 [entropy.db.sqlite] migrate locking code to entropy.locks.ResourceLock
The new EntropySQLiteRepository uses ResourceLock, and gains support
for reentrancy, anti-deadlock safety measures (only for nested calls),
unification of memory and file repositories locking code (the semantics
was already the same).
2013-12-10 21:42:34 +01:00
Fabio Erculiani
fc597d04c5 [entropy.security] refactor System, add internal locking support, improve speed 2013-12-10 16:39:17 +01:00
Fabio Erculiani
94ab49fd0b [tests] use const_mk{s,d}temp instead of tmpfile ones, default TMPDIR to /var/tmp 2013-12-09 14:36:34 +01:00
Fabio Erculiani
6a2d45df47 [entropy.locks] set recursed to False only when the reference counter is 0 2013-12-09 14:24:37 +01:00
Fabio Erculiani
d080db0d3b [tests] locks: fix test class name 2013-12-09 14:21:05 +01:00
Fabio Erculiani
bf3a8b79f9 [entropy.locks] use TLS for reentrancy safety checks, update tests 2013-12-09 14:19:21 +01:00
Fabio Erculiani
ebf63e6060 [entropy.locks] fix shared/exclusive locking mix due to reentrancy, add tests 2013-12-08 16:15:39 +01:00
Fabio Erculiani
3545f2b619 [entropy.db] add direct access support to repository
In latency sensitive code paths, the performance penality caused
by file lock contention and memory cache invalidation is too high.
This problem happens in Rigo, which is extremely latency sensitive.
Since we don't want to crap on the user, a way to solve this is
letting API consumers skip the memory cache and read data directly
from the database store. The trade off is that data may be stale,
incomplete, or invalid, but as long as the consumer is aware of this,
that's fine.
2013-12-07 20:30:06 +01:00
Fabio Erculiani
6af6a2115e [entropy.client] move Trigger class under package.actions, make it "private" 2013-12-07 20:29:20 +01:00
Fabio Erculiani
c54c893e55 [entropy.db] implement locking infrastructure (with the same semantics) for in-memory repositories 2013-12-07 20:27:57 +01:00
Fabio Erculiani
d7f22534b2 [entropy.db] rewrite locking infrastructure, handle multithreading use case 2013-12-07 20:27:57 +01:00
Fabio Erculiani
e717f7a1b3 [entropy.db.sqlite] drop support for locking based on rwsem for memory repositories
Firstly, rwsem is semantically different from flock (but this was known) and
this may confuse the API consumer. Secondly, the locking infrastructure is
purely meant for inter-process synchronization, threads synchronization is
not a current use case.
2013-12-07 20:25:55 +01:00
Fabio Erculiani
366fc37f59 [entropy.db.sqlite] implement locking infrastructure 2013-12-07 20:24:23 +01:00
Fabio Erculiani
8852a15913 [entropy.misc] add shared(), release() context managers to FlockFile 2013-12-07 20:24:22 +01:00
Fabio Erculiani
a2e1e6ba94 [entropy.client] delay installed repository initialization as much as possible 2013-12-05 23:11:36 +01:00
Fabio Erculiani
a42711086b [tests] tools: mute output 2013-11-30 11:23:40 +01:00
Fabio Erculiani
cd6d6b9d22 [tests] use const_mkdtemp() instead of tempfile.mkdtemp() 2013-11-30 10:54:13 +01:00
Fabio Erculiani
3a05acd16a [tests] spm: use const_mkdtemp() instead of tempfile.mkdtemp 2013-11-30 08:25:30 +01:00
Fabio Erculiani
a01f0bd103 [tests] mute QA and Security test function outputs 2013-11-29 19:41:08 +01:00
Fabio Erculiani
982d99fe30 [tests] client: silence tests 2013-11-29 19:37:24 +01:00
Fabio Erculiani
464ae46d90 [tests] drop debug output 2013-11-29 19:29:12 +01:00
Fabio Erculiani
e406a4edaa [entropy.*] create new dependencies metadata "pkg_dependencies"
The old "dependencies" metadata is deprecated. It was found that
the generated metadata might get corrupted by colliding atom strings.
The new implementation avoids collisions completely and is more
efficient.
2013-11-29 19:15:44 +01:00
Fabio Erculiani
2b082167cd [entropy.tools] read_elf_real_dynamic_libraries: correctly filter out elf_file 2013-11-29 16:30:23 +01:00
Fabio Erculiani
56bc937e47 [tests] cleanup run 2013-11-28 19:55:00 +01:00
Fabio Erculiani
e7c482ac21 [entropy.db] add atom field to preserved_libs metadata 2013-11-27 12:30:09 +01:00
Fabio Erculiani
005ac42610 [tests] port code to the new PackageActionFactory API 2013-11-23 13:58:39 +01:00