Commit Graph

1467 Commits

Author SHA1 Message Date
Geaaru
4b728b998e Fix vacuum on py3.6
pysqlite has a bug on use VACUUM with py3.6 (see https://github.com/ghaering/pysqlite/issues/109)

Hereinafter, exception related to eit push --quick --force <REPO> command:

Traceback (most recent call last):
  File "/usr/lib/entropy/lib/entropy/db/sql.py", line 166, in _proxy_call
    return method(*args, **kwargs)
sqlite3.OperationalError: cannot VACUUM from within a transaction

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/eit", line 17, in <module>
    main()
  File "/usr/lib/entropy/server/eit/main.py", line 114, in main
    exit_st = func(*func_args)
  File "/usr/lib/entropy/server/eit/commands/command.py", line 237, in _call_exclusive
    return func(server)
  File "/usr/lib/entropy/server/eit/commands/push.py", line 172, in _push
    rc = self._push_repo(entropy_server, repository_id)
  File "/usr/lib/entropy/server/eit/commands/push.py", line 184, in _push_repo
    rc = self.__push_repo(entropy_server, repository_id)
  File "/usr/lib/entropy/server/eit/commands/push.py", line 309, in __push_repo
    sts = self.__sync_repo(entropy_server, repository_id)
  File "/usr/lib/entropy/server/eit/commands/push.py", line 262, in __sync_repo
    enable_download = False, force = self._force)
  File "/usr/lib/entropy/lib/entropy/server/interfaces/mirrors.py", line 1673, in sync_repository
    enable_upload, enable_download, force = force)
  File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 231, in update
    enable_upload, enable_download, force = force).update()
  File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 404, in update
    rc, fine_uris, broken_uris = self._sync()
  File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 1873, in _sync
    broken_uris = self._upload(uris)
  File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 1529, in _upload
    self._shrink_and_close(dbconn)
  File "/usr/lib/entropy/lib/entropy/server/interfaces/db.py", line 1234, in _shrink_and_close
    entropy_repository.vacuum()
  File "/usr/lib/entropy/lib/entropy/db/sqlite.py", line 703, in vacuum
    self._cursor().execute("vacuum")
  File "/usr/lib/entropy/lib/entropy/db/sqlite.py", line 58, in execute
    cur = self._proxy_call(self._cur.execute, *args, **kwargs)
  File "/usr/lib/entropy/lib/entropy/db/sql.py", line 173, in _proxy_call
    raise OperationalError(err)
entropy.db.exceptions.OperationalError: cannot VACUUM from within a transaction
2018-11-04 21:50:50 +01:00
Fabio Erculiani
c0b065fbff Release Entropy 318 2018-11-03 20:18:26 +01:00
Fabio Erculiani
abb7800e86 kswitch: allow to pass the preferred kernel virtual.
It's possible to choose between LTS and non-LTS kernels via list() now.
2018-11-03 20:14:34 +01:00
Sławomir Nizio
41ba9b6d63 [*] be strict about Python modules paths being loaded
For convenience (seemingly, and it really is convenient) equo and other
tools can be run from the checkout, and Entropy modules are loaded from
the checkout. Now there is a strict separation when system paths and
when paths from the checkout are used.

It makes it a bit more robust, secure and preditable at the cost of
a little more complexity.

A pleasant side effect of this change is that it is not required to
change directory to the tool (to use non-system one), as paths in the
checkout are relative to scripts.

Imports in lib/tests were not adjusted.
2018-10-27 13:03:58 +02:00
Fabio Erculiani
c411a93dc5 [entropy.tools] correctly parse scanelf output even when spaces are present everywhere.
This is a ";" separated data input (even though we may get directory
paths containing ";"... but none so far is expected to be legit.)

Split by ";" first and then deal with spaces in paths.
2018-09-29 22:49:34 +02:00
Fabio Erculiani
a7171bdc7e Release Entropy 317 2018-09-23 22:29:48 +02:00
Fabio Erculiani
6b097b57cb [entropy.db.sql] fix comparison between different types with Py3. 2018-09-23 22:25:00 +02: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
Fabio Erculiani
34c549feb8 [entropy.client] handle correctly encoded file paths too.
Historically, Portage + Py2 were not dealing well with file paths that
were containing non-ascii chars. The situation has apparently improved
and we are able to accept paths with the correct encoding in Entropy
(separate patch will come). We need to guard against broken paths anyway,
so let's try to check which one of the paths is the one that has the
most chance to be the right one. Also, with python3 this won't be
a problem anymore...
2018-09-23 21:01:26 +02:00
Fabio Erculiani
c753f215d6 [entropy.db.sql] use etpConst instead of hardcoded encoding strings. 2018-09-23 20:56:04 +02:00
Fabio Erculiani
f0e6b09ee2 Release Entropy 316 2018-09-23 15:41:48 +02:00
Fabio Erculiani
4040523908 [kswitch] correctly resolve external kernel modules when not using --from-running.
Due to the migration to real virtual packages (away from PROVIDE= due
to EAPI=7 constraints), we failed to resolve kernel binary packages
correctly, thus packages that require them (external kernel modules.)

This patch fixes it, by making sure that we resolve new virtuals correctly.
We expect new virtuals to list kernel packages in their RDEPEND= (runtime
dependecies.)
2018-09-23 15:37:21 +02:00
Fabio Erculiani
a5890973b1 Release Entropy 315 2018-09-22 19:39:42 +02:00
Fabio Erculiani
2d61be2c4c [kswitch] fix kernel-switcher behavior when kernels are in external repos.
See the code documentation for more info.
2018-09-22 19:34:17 +02:00
Fabio Erculiani
9a28a9d025 [kswitch] write a more reliable list comprehension. 2018-09-22 18:23:37 +02:00
Fabio Erculiani
e319701afe [kswitch] do not rely on startswith but rather exact category matching. 2018-09-22 18:21:39 +02:00
Ettore Di Giacinto
d420cf5774 Release Entropy 314 2018-09-08 23:16:57 +02:00
Sławomir Nizio
f70b673f5e [kswitch] use reverse dep. not PROVIDE
The latter method does not work nowadays, after bumping Portage
(2.3.40-r1) or related to EAPI 7.
2018-09-08 18:32:20 +02:00
Fabio Erculiani
12aafd8e5e Release Entropy 313 2018-08-18 09:25:08 +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
Ettore Di Giacinto
a762d43bdc Revert "inject: fix store of content with utf-8 chars" 2018-08-11 16:13:54 +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
Ettore Di Giacinto
686f7e3ebc Merge pull request #50 from Enlik/equo-mark
[solo.commands.mark] new command
2018-08-04 23:00:31 +02:00
Geaaru
b9580f8244 inject: fix store of content with utf-8 chars 2018-08-04 21:09:42 +02:00
Ettore Di Giacinto
36b698b74b Merge pull request #49 from Enlik/spm-by-user
[solo.commands.rescue] use world file to replicate by-user status
2018-08-04 19:55:53 +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
70f1719138 [solo.commands.mark] new command 2018-07-31 08:58:31 +02:00
Sławomir Nizio
e5db0d6b6e [solo.commands.rescue] use world file to replicate by-user status
Uses the newly introduced function in spm: get_user_selected_packages.
2018-07-30 08:49:17 +02:00
Sławomir Nizio
77a5071cf5 [entropy.spm] factor out __add_update_world_file 2018-07-30 00:11:29 +02:00
Ettore Di Giacinto
9e427b7c9b Release Entropy 312 2018-07-11 18:10:19 +02:00
Geaaru
b253340b64 Fix injection of packages with directory with spaces 2018-06-25 17:04:31 +02:00
Ettore Di Giacinto
1d6fde589e Release Entropy 311 2018-05-30 22:13:29 +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
Sławomir Nizio
9e3f45f4c3 [entropy.server] simplify data container for dep_rewrite
Previously it has a dict with complex key (with the need to pack and
unpack it in places where it was used), and data was both part of the
keys and values.
It had the small advantage of removing duplicates, but changes for them
are very low and they are harmless anyway.
2018-02-24 18:49:43 +01:00
Sławomir Nizio
7635fb6d3b [entropy.server] create a simple abstration/interface for dep. rewrite 2018-02-24 18:47:29 +01:00
Fabio Erculiani
8d0f16d9d5 Release Entropy 310 2017-10-08 22:25:58 +02:00
Fabio Erculiani
2d65d5b7bf [entropy.client] fix conflicts removal handling during upgrade.
In certain extreme situations, that are more likely if the install
state is old (e.g. 9 months +), Entropy may decide to remove packages
due to conflicts with the version being installed and shoot itself
in the foot, if this is the case of dev-lang/python :-).

So, this commit tries to avoid the scenario by filtering out package
removals for those that are being installed anyway as part of the
transaction (e.g. a system upgrade).

This should fix the very specific case, but increase uncertainty
and thus entropy in other cases where once a package that lists
conflicts is installed, it may not expect to find that package
installed. However, this case should be handled by the dependency
graph generator (and it currently does not), which would need to
reorder the execution of the queue to comply with conflicts.

Perhaps, someone in the future will improve that too, for now,
let's enjoy one more snowflake.

Current improvement:
- foo-1 and bar-2 are set to be installed
- foo-1 conflicts with <bar-2
- bar-1 is installed
- foo-1 wanted to remove bar-1 as part of foo-1 install transaction.
  (now fixed, it won't...)
- bar-2 is then installed

Better improvement:
- foo-1 and bar-2 are set to be installed
- foo-1 conflicts with <bar-2 (but bar-2 itself can be installed
  and does not conflict with foo-1)
- bar-2 is set to be installed before foo-1
- when entropy gets to foo-1 there is nothing to remove
2017-10-08 21:51:07 +02:00
Fabio Erculiani
330ffd1926 Release Entropy 309 2017-09-10 19:08:33 +02:00
Francesco Ferro
cac8ad2b29 Release Entropy 308 2017-09-09 18:46:39 +02:00
Francesco Ferro
19a7a54dda [entropy.core] Remove nested function for natural sorting 2017-09-09 11:46:06 +02:00
Francesco Ferro
afbce1c169 [entropy.core] update tests for entropy tag sorting 2017-09-09 11:46:06 +02:00
Francesco Ferro
79e1bec57f [entropy.core] fix tags natural sorting issue
This commit will add a key generator that creates an array
from the original string where each group of numbers is
converted to a number.
2017-09-09 11:46:06 +02:00
Fabio Erculiani
c726b3d694 Merge pull request #34 from geaaru/basic_python3_4
Fix issue on use basic authentication with python3.4:
2017-05-14 18:29:16 +02:00
Fabio Erculiani
b2d0ca8707 Release Entropy 307 2017-05-13 14:36:24 +02:00
Fabio Erculiani
345d31b3c5 [entropy.client] Fix accidental deletion of preserved libs when still in use.
Entropy preserved libs handling code did not check all the followed symlink
before removing them. This causes the deletion of unexpected libraries during the
removal of packages. For example, app-emulation/vmware-workstation contains
the following symlink:

(A) /opt/vmware/lib/vmware/lib/libssl.so.1.0.1/libssl.so.1.0.1 -> (B) /usr/lib64/libssl.so.1.0.1

Upon removal of vmware-workstation, A is garbage collected and deleted,
if it's a symlink, the link is followed and (B) is removed as well, without
validating the action (i.e. checking if a package is still owning (B).)

This commit fixes this. See Sabayon bug #5812.
2017-05-13 14:25:01 +02:00
Geaaru
aa32d22d63 Fix issue on use basic authentication with python3.4:
Traceback (most recent call last):
  File "/usr/lib64/python3.4/base64.py", line 519, in _input_type_check
    m = memoryview(s)
TypeError: memoryview: str object does not have the buffer interface

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/equo", line 15, in <module>
    main()
  File "/usr/lib/entropy/client/solo/main.py", line 332, in main
    exit_st = func(*func_args)
  File "/usr/lib/entropy/client/solo/commands/command.py", line 406, in _call_exclusive
    return func(client)
  File "/usr/lib/entropy/client/solo/commands/update.py", line 115, in _update
    rc = self._normal_update(entropy_client)
  File "/usr/lib/entropy/client/solo/commands/update.py", line 236, in _normal_update
    rc = repo_intf.sync()
  File "/usr/lib/entropy/lib/entropy/client/interfaces/repository.py", line 327, in sync
    rc = self._run_sync()
  File "/usr/lib/entropy/lib/entropy/client/interfaces/repository.py", line 146, in _run_sync
    self._entropy, repo, self.force, self._gpg_feature)
  File "/usr/lib/entropy/lib/entropy/client/interfaces/db.py", line 2764, in update
    return updater.update()
  File "/usr/lib/entropy/lib/entropy/client/interfaces/db.py", line 2029, in update
    selected = self._select_database_mirror()
  File "/usr/lib/entropy/lib/entropy/client/interfaces/db.py", line 428, in _select_database_mirror
    https_validate_cert = https_validate_cert)
  File "/usr/lib/entropy/lib/entropy/client/interfaces/db.py", line 1992, in _remote_revision
    fetch_rc = fetcher.download()
  File "/usr/lib/entropy/lib/entropy/fetchers.py", line 391, in download
    status = downloader()
  File "/usr/lib/entropy/lib/entropy/fetchers.py", line 600, in _urllib_download
    self.__http_basic_user, self.__http_basic_pwd)).replace('\n', '')
  File "/usr/lib64/python3.4/base64.py", line 548, in encodestring
    return encodebytes(s)
  File "/usr/lib64/python3.4/base64.py", line 536, in encodebytes
    _input_type_check(s)
  File "/usr/lib64/python3.4/base64.py", line 522, in _input_type_check
    raise TypeError(msg) from err
TypeError: expected bytes-like object, not str
2017-04-29 15:31:32 +02:00
Fabio Erculiani
c611f76a33 Release Entropy 306 2016-11-20 08:07:36 +01:00