Commit Graph

1991 Commits

Author SHA1 Message Date
Mario Fetka
8719186730 modernization: SQLite WAL, subprocess.run, TODO.md
- db/sqlite.py: enable WAL journal mode per connection — concurrent
  readers no longer block writers
- Replace subprocess.call() with subprocess.run() in 8 files
  (output.py, qa.py, tools.py, client/misc.py, client/interfaces/db.py,
  portage_plugin, solo/conf.py)
- Replace os.popen() with subprocess.run() in tools.py and
  core/settings/base.py
- Add TODO.md documenting deferred logging module integration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 12:02:23 +02:00
Mario Fetka
7072c00a77 Python 3 modernization: low-hanging fruit cleanup
- hashlib: add usedforsecurity=False to all md5/sha1/sha256/sha512 calls
  (FIPS-mode compatibility, ~34 call sites across 13 files)
- join([listcomp]): convert to generator expressions (~15 sites)
- class Foo(object): -> class Foo: across all files (Python 3 style)
- collections.OrderedDict() -> {} in db/skel.py (Python 3.7+ dicts ordered)
- open() without context manager: fix 3 bare open/close in misc.py
- Exception chaining: add 'from err' to raise statements in portage_plugin
- const_is_python3() dead code removal:
  * Simplify 7 compat functions in const.py (const_is_python3,
    const_get_stringtype, const_isunicode, const_israwstring,
    const_get_buffer, const_convert_to_unicode, const_convert_to_rawstring,
    const_isstring, const_get_int) — remove Python 2 branches
  * Remove 100+ const_is_python3() if/else branches across 27 files,
    keeping only the Python 3 path
  * Remove cPickle import in dump.py, use plain pickle with fix_imports=True
  * Remove urllib2 dead imports in misc.py, fetchers.py
  * Clean up const_is_python3 from all import lines

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 11:51:29 +02:00
Mario Fetka
4e0d448aef Python 3.12+/3.13 and portage 3.0.77 compatibility fixes
- Replace deprecated Thread.isAlive() with is_alive() (Python 3.12)
- Fix invalid escape sequences in regex strings (SyntaxWarning → SyntaxError)
- Replace removed unittest aliases: assertEquals→assertEqual,
  assertNotEquals→assertNotEqual, assert_→assertTrue,
  assertRaisesRegexp→assertRaisesRegex (Python 3.12)
- Replace portage's removed clear_caches() with flush_cache()
- Fix locks.py: reset TLS state on exception in _file_lock_create
  to prevent stale shared-lock state poisoning subsequent acquisitions
- Skip os.chown() when gid is None or caller lacks permission
- Fix FastRSS attribute ordering for consistent minidom re-parse behavior
- Update test expected XML to match Python 3.8+ minidom attribute order

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 10:53:13 +02:00
Sławomir Nizio
09cb7b3496 [solo.commands.query] fix "equo query orphans" with Python 3 2020-03-13 20:18:04 +01:00
Ettore Di Giacinto
23f2e55879 Release Entropy 324 2020-02-07 16:25:39 +01:00
Geaaru
5aec1b48e5 [kernel-switcher] Refactor 2020-01-24 23:23:07 +01:00
Ettore Di Giacinto
285876cc86 Release Entropy 323 2019-12-16 23:38:39 +01:00
Sławomir Nizio
2aa2c69e2b correct exception handling / error reporting with Python 3 2019-12-13 01:32:09 +01:00
Ettore Di Giacinto
d2328561d9 Release Entropy 322 2019-11-10 15:53:52 +01:00
Ettore Di Giacinto
00afcc3c10 Release Entropy 321 2019-11-10 15:44:18 +01:00
Ettore Di Giacinto
f2cac41869 Release Entropy 320 2019-11-07 17:21:28 +01:00
Daniele Rondina
84ff779709 unused: Fix search with spm 2019-08-15 11:29:18 +02:00
Sławomir Nizio
b2c8e2c819 [solo.commands.command] simplify and improve bash completions
Note: <tab> below can mean double <tab>.

This commit fixes cases such like the following ones:

* crash (issue !73) - e.g. KeyError: u'--mtime':
    - equo security oscheck --mtime <tab>
    - equo query graph --complete <tab>
      (this was due to a typo in variable name)

* now prints options, previously it didn't:
    - equo install -a <tab>

* crashed, or (with only variable name fixed) didn't print all options:
    - equo security oscheck --mtime <tab>
      (note that it worked with more special -q instead of --mtime etc.)

* didn't print all options:
    - equo query list installed <tab>
      (now shows also --by-user)

The following behaviour is still buggy:

* last typed word (note: no space before <tab>) disappears upon completion:
    - equo security oscheck<tab>
      (not a regression)
    - equo install --deep<tab>
      (here it's an option; regression! - previously it didn't complete but
      didn't cause the word to be erased either)

These can be corrected reliably when something like ${COMP_WORDS[COMP_CWORD]}
(from complete -F) is passed to the Python side.
Without this it's not possible to distinguish between `recognized_option<tab>`
(completion of recognized_option) and `recognized_option <tab>`.
2019-07-16 08:35:32 +02:00
Daniele Rondina
cdaffff03b Improve equo generate subcommand for CI
Add option --force-non-interactive to generate
sub command to avoid use of expect tool.
2019-03-14 18:44:47 +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
Sławomir Nizio
6d4a3f09e6 makefiles: establish a layout for sitedir installs
The idea is that:
- entropy.* imports will work as before (so any 3rd party clients will
  work as always) - installed in "entropy" package,
- new "_entropy" package to hold a namespace for private modules (like
  ones that required adding special directories to sys.path).
  (Underscored name for a top level Python module is not very common...
  anyway, it was inspired by "_emerge.")

Layout:
site-packages/
    entropy (backwards compatible)
	const.py
	...
    kswitch (also toplevel to keep compatibility)
	...
    _entropy
	eit
	magneto
	matter
	rigo
	RigoDaemon
	solo

(Note that site-packages does not need to be actually Python's
site-packages directory but anything as it is controlled by an argument
to make. It is however intended to be the sitedir.)

Another idea for a layout would be one that mimics sources checkout, but
the layout there is somewhat scattered. (And some ugliness would be
needed to make them modules before implicit namespaces from Python 3.3.
Anyway, imports would be long and ugly.)

Now, the layout of installed Entropy is lean; installation to virtualenv
is also possible (though there would be a need to call scripts like
"python equo.py" as shebangs are not converted).

Follow up changes are needed to make it work.
2018-11-26 20:15:36 +01:00
Sławomir Nizio
252c260f06 use entropy_path_loader only for running from the checkout
After this commit alone it would not work when installed (unless module
paths are set in a special way). Next changes will introduce
installation to site-packages so no custom PYTHONPATH will be necessary.
2018-11-26 20:15:36 +01:00
Ettore Di Giacinto
e16a1585ec Release Entropy 319 2018-11-22 21:59:03 +01:00
Ettore Di Giacinto
450456a4ec Merge pull request #65 from Enlik/modules-reorg
Preparation for installation in Python-specific directories
2018-11-16 18:29:44 +01:00
Fabio Erculiani
c0b065fbff Release Entropy 318 2018-11-03 20:18:26 +01:00
Sławomir Nizio
33966f4f31 [*] allow setting PYTHON_SITEDIR for make
This way a proper separation between Python installs can be achieved.

With no PYTHON_SITEDIR, installation paths are exactly the same as
before this change.

In practise, passing nonstandard path will break Entropy but so it is
also with the currently available LIBDIR. This is a concern of a future
improvement (at least the PYTHON_SITEDIR path, not necessarily LIBDIR as
PYTHON_SITEDIR *will* be different if it's installed in Python specific
directories).
2018-10-28 21:44:54 +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
066ec3ac35 [client/po] Fix broken chars in German translation. See bug #5175. 2018-09-29 22:04:54 +02:00
Fabio Erculiani
8c786b7a05 [client/po] fix Italian translation for "item", see bug #5312. 2018-09-29 21:59:16 +02:00
Fabio Erculiani
a7171bdc7e Release Entropy 317 2018-09-23 22:29:48 +02:00
Fabio Erculiani
f0e6b09ee2 Release Entropy 316 2018-09-23 15:41:48 +02:00
Fabio Erculiani
fe44bb34b2 [client/po] update .po files 2018-09-23 15:39:43 +02:00
Fabio Erculiani
adb456d498 Update entropy.pot 2018-09-23 15:39:09 +02:00
Fabio Erculiani
a5890973b1 Release Entropy 315 2018-09-22 19:39:42 +02:00
Ettore Di Giacinto
d420cf5774 Release Entropy 314 2018-09-08 23:16:57 +02:00
Fabio Erculiani
12aafd8e5e Release Entropy 313 2018-08-18 09:25:08 +02:00
Sławomir Nizio
04c4495313 [solo.commands.rescue] trivial fixes
- Variable entropy_client was not available where it was used.
- Module entropy.dep was not imported but was used. It worked as
  the module was imported from another place, but it is better to
  import it explicitly.
2018-08-06 23:01:17 +02:00
Sławomir Nizio
9db87b99c3 [equo, eit] update man pages 2018-08-06 22:45:32 +02:00
Sławomir Nizio
789e06c122 [solo.commands.command, equo] support "authors" in docs
Suggested by Ettore.

My comment is that it is to have a more correct information and to give
credit where it is due.
This is not a "miscredit" towards the Creator. We know who has made this
possible!
2018-08-06 22:39:42 +02:00
Sławomir Nizio
70f1719138 [solo.commands.mark] new command 2018-07-31 08:58:31 +02:00
Sławomir Nizio
3b7181d6c9 [solo.commands.rescue] factor out _SpmUserPackages 2018-07-30 09:11:50 +02:00
Sławomir Nizio
fb1f0f2d82 [solo.commands.rescue] fix usage of a wrong variable 2018-07-30 08:52:56 +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
Ettore Di Giacinto
9e427b7c9b Release Entropy 312 2018-07-11 18:10:19 +02:00
Ettore Di Giacinto
920b2e9926 [client/po] Update translations 2018-06-03 09:24:27 +02:00
Ettore Di Giacinto
1d6fde589e Release Entropy 311 2018-05-30 22:13:29 +02:00
Sławomir Nizio
1197966644 [entropy.client] fix install_sources saving
Examples of scenarios that are fixed:
- "package was installed by user" information was lost on package p1
  when p1 was pulled as update on "equo install p2";
- update was saving all packages as installed by user.
2018-04-17 12:38:43 +02:00
Reuben D'Netto
2b532d4237 Use entropy_client.output() 2018-04-09 21:36:37 +10:00
Reuben D'Netto
2e6909f134 [solo.commands.rescue] Added a sanity check to ensure we're using the real database. 2018-04-09 20:42:46 +10:00
Reuben D'Netto
f9ff8cc305 Revert "[solo.commands.rescue] simplify "generate" code"
This reverts commit d856204a8d.
2018-04-09 20:42:46 +10: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
Fabio Erculiani
8461cdaa98 [client/po] Update translations 2017-09-10 19:08:14 +02:00
Francesco Ferro
cac8ad2b29 Release Entropy 308 2017-09-09 18:46:39 +02:00