├── .portage_not_installed
├── bin
├── ebuild-helpers
│ ├── einfo
│ ├── ewarn
│ ├── eerror
│ ├── eqawarn
│ ├── newbin
│ ├── newconfd
│ ├── newdoc
│ ├── newenvd
│ ├── newexe
│ ├── newinitd
│ ├── newlib.a
│ ├── newman
│ ├── newsbin
│ ├── prepman
│ ├── newheader
│ ├── newlib.so
│ ├── prepalldocs
│ ├── prepallinfo
│ ├── prepallman
│ ├── prepallstrip
│ ├── prepinfo
│ ├── prepstrip
│ ├── unprivileged
│ │ ├── chgrp
│ │ └── chown
│ ├── dolib.a
│ ├── dolib.so
│ ├── die
│ ├── elog
│ ├── prepall
│ ├── dodir
│ ├── nonfatal
│ ├── doinitd
│ ├── keepdir
│ ├── doconfd
│ ├── doenvd
│ ├── dohard
│ ├── fowners
│ ├── doheader
│ ├── bsd
│ │ └── sed
│ ├── dohtml
│ ├── fperms
│ ├── doinfo
│ ├── dosed
│ ├── dodoc
│ ├── emake
│ ├── dobin
│ ├── dosbin
│ └── doexe
├── chmod-lite
├── ebuild-ipc
├── preinst-qa-check.d
│ └── 50xdg-utils
├── install-qa-check.d
│ ├── 20deprecated-directories
│ ├── 05double-D
│ ├── 60udev
│ ├── 60systemd
│ ├── 90cmake-warnings
│ ├── 60pngfix
│ ├── 20runtime-directories
│ └── 90world-writable
├── portageq-wrapper
├── ebuild-pyhelper
├── emirrordist
├── lock-helper.py
├── chmod-lite.py
└── env-update
├── doc
├── api
│ ├── .gitignore
│ ├── index.rst
│ └── Makefile
├── fragment
│ ├── version.in
│ └── meson.build
├── package.docbook
├── config.docbook
├── dependency_resolution.docbook
├── custom.xsl
└── package
│ ├── ebuild.docbook
│ └── ebuild
│ └── eapi
│ └── 0.docbook
├── lib
├── portage
│ ├── binrepo
│ │ ├── __init__.py
│ │ └── meson.build
│ ├── tests
│ │ ├── bin
│ │ │ ├── __init__.py
│ │ │ ├── __test__.py
│ │ │ ├── meson.build
│ │ │ ├── test_dobin.py
│ │ │ └── test_dodir.py
│ │ ├── dep
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ ├── test_extended_atom_dict.py
│ │ │ ├── test_soname_atom_pickle.py
│ │ │ ├── meson.build
│ │ │ ├── test_dep_getslot.py
│ │ │ ├── test_dep_getrepo.py
│ │ │ ├── test_isjustname.py
│ │ │ ├── test_dep_getcpv.py
│ │ │ └── test_get_operator.py
│ │ ├── env
│ │ │ ├── __test__.py
│ │ │ ├── config
│ │ │ │ ├── __test__.py
│ │ │ │ ├── __init__.py
│ │ │ │ ├── meson.build
│ │ │ │ ├── test_PackageMaskFile.py
│ │ │ │ ├── test_PackageUseFile.py
│ │ │ │ ├── test_PortageModulesFile.py
│ │ │ │ └── test_PackageKeywordsFile.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── dbapi
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ └── test_bintree_build_id.py
│ │ ├── ebuild
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── emaint
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── emerge
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── glsa
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── gpkg
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── lint
│ │ │ ├── __init__.py
│ │ │ ├── __test__.py
│ │ │ ├── metadata.py
│ │ │ └── meson.build
│ │ ├── locks
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── news
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── process
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ ├── test_spawn_fail_e2big.py
│ │ │ └── test_spawn_returnproc.py
│ │ ├── resolver
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ ├── soname
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ └── meson.build
│ │ │ ├── binpkg_multi_instance
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ └── meson.build
│ │ │ ├── test_onlydeps.py
│ │ │ └── test_missing_iuse_and_evaluated_atoms.py
│ │ ├── sets
│ │ │ ├── __init__.py
│ │ │ ├── __test__.py
│ │ │ ├── base
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ └── meson.build
│ │ │ ├── files
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ ├── meson.build
│ │ │ │ ├── test_static_file_set.py
│ │ │ │ └── test_config_file_set.py
│ │ │ ├── shell
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ ├── meson.build
│ │ │ │ └── test_shell.py
│ │ │ └── meson.build
│ │ ├── sync
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── unicode
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── update
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── util
│ │ │ ├── __test__.py
│ │ │ ├── dyn_libs
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ └── meson.build
│ │ │ ├── futures
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ ├── asyncio
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── __test__.py
│ │ │ │ │ ├── meson.build
│ │ │ │ │ └── test_run_until_complete.py
│ │ │ │ ├── meson.build
│ │ │ │ └── test_done_callback.py
│ │ │ ├── eventloop
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ ├── meson.build
│ │ │ │ └── test_call_soon_fifo.py
│ │ │ ├── file_copy
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __test__.py
│ │ │ │ └── meson.build
│ │ │ ├── __init__.py
│ │ │ ├── test_grabdict.py
│ │ │ ├── test_normalizedPath.py
│ │ │ ├── test_stackLists.py
│ │ │ ├── meson.build
│ │ │ ├── test_stackDictList.py
│ │ │ ├── test_uniqueArray.py
│ │ │ ├── test_stackDicts.py
│ │ │ └── test_manifest.py
│ │ ├── versions
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ └── test_cpv_sort_key.py
│ │ ├── xpak
│ │ │ ├── __test__.py
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ └── test_decodeint.py
│ │ ├── lafilefixer
│ │ │ ├── __init__.py
│ │ │ ├── __test__.py
│ │ │ └── meson.build
│ │ ├── lazyimport
│ │ │ ├── __init__.py
│ │ │ ├── __test__.py
│ │ │ └── meson.build
│ │ ├── .gnupg
│ │ │ ├── pubring.kbx
│ │ │ ├── trustdb.gpg
│ │ │ └── private-keys-v1.d
│ │ │ │ ├── 273B030399E7BEA66A9AD42216DE7CA17BA5D42E.key
│ │ │ │ └── C99796FB85B0C3DF03314A11B5850C51167D6282.key
│ │ └── meson.build
│ ├── sync
│ │ ├── modules
│ │ │ ├── __init__.py
│ │ │ ├── cvs
│ │ │ │ └── meson.build
│ │ │ ├── git
│ │ │ │ └── meson.build
│ │ │ ├── svn
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ ├── rsync
│ │ │ │ └── meson.build
│ │ │ ├── webrsync
│ │ │ │ └── meson.build
│ │ │ ├── zipfile
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ ├── mercurial
│ │ │ │ └── meson.build
│ │ │ └── meson.build
│ │ ├── meson.build
│ │ └── getaddrinfo_validate.py
│ ├── _compat_upgrade
│ │ ├── __init__.py
│ │ ├── meson.build
│ │ └── binpkg_multi_instance.py
│ ├── util
│ │ ├── futures
│ │ │ ├── executor
│ │ │ │ ├── __init__.py
│ │ │ │ └── meson.build
│ │ │ ├── _asyncio
│ │ │ │ └── meson.build
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ └── futures.py
│ │ ├── elf
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── _async
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ ├── TaskScheduler.py
│ │ │ ├── FileDigester.py
│ │ │ ├── PopenProcess.py
│ │ │ ├── AsyncTaskFuture.py
│ │ │ └── FileCopier.py
│ │ ├── _dyn_libs
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── endian
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── iterators
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ ├── _eventloop
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ └── global_event_loop.py
│ │ ├── time.py
│ │ ├── _path.py
│ │ ├── bin_entry_point.py
│ │ ├── meson.build
│ │ └── portage_lru_cache.py
│ ├── env
│ │ ├── __init__.py
│ │ ├── meson.build
│ │ └── validators.py
│ ├── xml
│ │ ├── __init__.py
│ │ └── meson.build
│ ├── cache
│ │ ├── __init__.py
│ │ ├── index
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ └── IndexStreamIterator.py
│ │ ├── meson.build
│ │ └── volatile.py
│ ├── package
│ │ ├── __init__.py
│ │ ├── ebuild
│ │ │ ├── __init__.py
│ │ │ ├── _ipc
│ │ │ │ ├── __init__.py
│ │ │ │ ├── IpcCommand.py
│ │ │ │ ├── meson.build
│ │ │ │ └── ExitCommand.py
│ │ │ ├── _config
│ │ │ │ ├── __init__.py
│ │ │ │ ├── meson.build
│ │ │ │ └── env_var_validation.py
│ │ │ ├── _parallel_manifest
│ │ │ │ ├── __init__.py
│ │ │ │ └── meson.build
│ │ │ ├── meson.build
│ │ │ └── profile_iuse.py
│ │ └── meson.build
│ ├── proxy
│ │ ├── __init__.py
│ │ └── meson.build
│ ├── _emirrordist
│ │ ├── __init__.py
│ │ └── meson.build
│ ├── dep
│ │ ├── soname
│ │ │ ├── __init__.py
│ │ │ └── meson.build
│ │ └── meson.build
│ ├── repository
│ │ ├── __init__.py
│ │ ├── storage
│ │ │ ├── __init__.py
│ │ │ ├── meson.build
│ │ │ └── inplace.py
│ │ └── meson.build
│ ├── emaint
│ │ ├── __init__.py
│ │ ├── modules
│ │ │ ├── __init__.py
│ │ │ ├── logs
│ │ │ │ └── meson.build
│ │ │ ├── move
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ ├── sync
│ │ │ │ └── meson.build
│ │ │ ├── world
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ ├── binhost
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ ├── config
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ ├── merges
│ │ │ │ └── meson.build
│ │ │ ├── resume
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ ├── revisions
│ │ │ │ ├── meson.build
│ │ │ │ └── __init__.py
│ │ │ └── meson.build
│ │ ├── meson.build
│ │ └── defaults.py
│ ├── _sets
│ │ └── meson.build
│ ├── elog
│ │ ├── meson.build
│ │ ├── filtering.py
│ │ └── mod_syslog.py
│ ├── dbapi
│ │ ├── meson.build
│ │ └── DummyTree.py
│ └── installation.py
├── meson.build
└── _emerge
│ ├── __init__.py
│ ├── resolver
│ ├── __init__.py
│ └── meson.build
│ ├── BlockerDepPriority.py
│ ├── SetArg.py
│ ├── _flush_elog_mod_echo.py
│ ├── AtomArg.py
│ ├── UninstallFailure.py
│ ├── Blocker.py
│ ├── clear_caches.py
│ ├── countdown.py
│ ├── ProgressHandler.py
│ ├── EbuildSpawnProcess.py
│ ├── PackageArg.py
│ ├── is_valid_package_atom.py
│ ├── EbuildProcess.py
│ ├── AbstractDepPriority.py
│ ├── Dependency.py
│ ├── getloadavg.py
│ ├── DependencyArg.py
│ ├── _find_deep_system_runtime_deps.py
│ ├── EbuildFetchonly.py
│ └── RootConfig.py
├── cnf
├── METADATA
├── logrotate.d
│ └── elog-save-summary
├── repos.conf
├── make.conf.example.s390.diff
├── make.conf.example.ia64.diff
├── make.conf.example.sparc-fbsd.diff
├── make.conf.example.m68k.diff
└── make.conf.example.sh.diff
├── run-pylint
├── .gitignore
├── .github
└── workflows
│ ├── pre-commit.yml
│ └── lint.yml
├── .editorconfig
├── man
├── ru
│ ├── meson.build
│ ├── fixpackages.1
│ └── env-update.1
├── fixpackages.1
├── meson.build
└── env-update.1
├── .pre-commit-config.yaml
├── testpath
├── src
└── meson.build
├── tox.ini
├── .git-blame-ignore-revs
└── .builds
├── setup-python.sh
└── lint.yml
/.portage_not_installed:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/einfo:
--------------------------------------------------------------------------------
1 | elog
--------------------------------------------------------------------------------
/bin/ebuild-helpers/ewarn:
--------------------------------------------------------------------------------
1 | elog
--------------------------------------------------------------------------------
/bin/chmod-lite:
--------------------------------------------------------------------------------
1 | ebuild-pyhelper
--------------------------------------------------------------------------------
/bin/ebuild-helpers/eerror:
--------------------------------------------------------------------------------
1 | elog
--------------------------------------------------------------------------------
/bin/ebuild-helpers/eqawarn:
--------------------------------------------------------------------------------
1 | elog
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newbin:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newconfd:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newdoc:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newenvd:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newexe:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newinitd:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newlib.a:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newman:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newsbin:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepman:
--------------------------------------------------------------------------------
1 | prepall
--------------------------------------------------------------------------------
/bin/ebuild-ipc:
--------------------------------------------------------------------------------
1 | ebuild-pyhelper
--------------------------------------------------------------------------------
/doc/api/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/lib/portage/binrepo/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/bin/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/bin/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newheader:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/newlib.so:
--------------------------------------------------------------------------------
1 | newins
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepalldocs:
--------------------------------------------------------------------------------
1 | prepall
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepallinfo:
--------------------------------------------------------------------------------
1 | prepall
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepallman:
--------------------------------------------------------------------------------
1 | prepall
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepallstrip:
--------------------------------------------------------------------------------
1 | prepall
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepinfo:
--------------------------------------------------------------------------------
1 | prepall
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepstrip:
--------------------------------------------------------------------------------
1 | prepall
--------------------------------------------------------------------------------
/lib/portage/sync/modules/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/dbapi/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/ebuild/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/emaint/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/emerge/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/glsa/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/gpkg/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/lint/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/lint/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/locks/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/news/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/process/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sync/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/unicode/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/update/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/versions/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/xpak/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/unprivileged/chgrp:
--------------------------------------------------------------------------------
1 | chown
--------------------------------------------------------------------------------
/lib/portage/_compat_upgrade/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/config/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/lafilefixer/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/lafilefixer/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/lazyimport/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/lazyimport/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/base/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/base/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/files/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/files/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/shell/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/shell/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/dyn_libs/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/dyn_libs/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/eventloop/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/eventloop/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/file_copy/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/file_copy/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/util/futures/executor/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/asyncio/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/asyncio/__test__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/meson.build:
--------------------------------------------------------------------------------
1 | subdir('portage')
2 | subdir('_emerge')
3 |
--------------------------------------------------------------------------------
/bin/preinst-qa-check.d/50xdg-utils:
--------------------------------------------------------------------------------
1 | ../postinst-qa-check.d/50xdg-utils
--------------------------------------------------------------------------------
/doc/fragment/version.in:
--------------------------------------------------------------------------------
1 | @VERSION@
2 |
--------------------------------------------------------------------------------
/cnf/METADATA:
--------------------------------------------------------------------------------
1 | Metadata-Version: 2.1
2 | Name: portage
3 | Version: @VERSION@
4 |
--------------------------------------------------------------------------------
/lib/portage/env/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright: 2007 Gentoo Foundation
2 | # License: GPL2
3 |
--------------------------------------------------------------------------------
/run-pylint:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec pylint "$@" lib/_emerge lib/portage $(grep -Rl '^#!.*python' bin)
3 |
--------------------------------------------------------------------------------
/doc/package.docbook:
--------------------------------------------------------------------------------
1 |
2 | Package Formats
3 | &package_ebuild;
4 |
5 |
--------------------------------------------------------------------------------
/doc/config.docbook:
--------------------------------------------------------------------------------
1 |
2 | Configuration
3 | &config_bashrc;
4 | &config_set;
5 |
6 |
--------------------------------------------------------------------------------
/lib/portage/tests/.gnupg/pubring.kbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gentoo/portage/HEAD/lib/portage/tests/.gnupg/pubring.kbx
--------------------------------------------------------------------------------
/lib/portage/tests/.gnupg/trustdb.gpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gentoo/portage/HEAD/lib/portage/tests/.gnupg/trustdb.gpg
--------------------------------------------------------------------------------
/lib/_emerge/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2009 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/xml/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/_emerge/resolver/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/cache/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright: 2005 Gentoo Foundation
2 | # Author(s): Brian Harring (ferringb@gentoo.org)
3 | # License: GPL2
4 |
--------------------------------------------------------------------------------
/lib/portage/package/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/proxy/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2009 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/emaint/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/util/elf/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/_emirrordist/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/cache/index/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/dep/soname/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/repository/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/dbapi/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2011 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/emerge/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2011 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/glsa/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/gpkg/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2011 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/locks/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/sync/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/unicode/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/update/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/util/_async/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/util/_dyn_libs/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/util/endian/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/util/iterators/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_ipc/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/repository/storage/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2018 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/ebuild/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 1998-2007 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/process/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 1998-2008 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/util/_eventloop/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_config/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/soname/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/soname/__test__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/doc/fragment/meson.build:
--------------------------------------------------------------------------------
1 | version_doc_fragment = configure_file(
2 | input : 'version.in',
3 | output : 'version',
4 | configuration : conf_data
5 | )
6 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_parallel_manifest/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/binpkg_multi_instance/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/binpkg_multi_instance/__test__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.py[co]
2 | __pycache__/
3 | *.class
4 | *.so
5 | /build
6 | /tags
7 | /.tox/
8 | setup.cfg
9 | .*.swp
10 | *.vim
11 | .mypy_cache
12 | dist
13 | *.egg-info/
14 | MANIFEST
15 |
--------------------------------------------------------------------------------
/lib/portage/xml/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'metadata.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/xml',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/binrepo/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'config.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/binrepo',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | """System health checks and maintenance utilities."""
5 |
--------------------------------------------------------------------------------
/lib/portage/package/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | '__init__.py',
4 | ],
5 | subdir : 'portage/package',
6 | pure : not native_extensions
7 | )
8 |
9 | subdir('ebuild')
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/__init__.py:
--------------------------------------------------------------------------------
1 | # tests/portage.dep/__init__.py -- Portage Unit Test functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/__init__.py:
--------------------------------------------------------------------------------
1 | # tests/portage/env/__init__.py -- Portage Unit Test functionality
2 | # Copyright 2007 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
--------------------------------------------------------------------------------
/lib/portage/tests/news/__init__.py:
--------------------------------------------------------------------------------
1 | # tests/portage.news/__init__.py -- Portage Unit Test functionality
2 | # Copyright 2007 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/__init__.py:
--------------------------------------------------------------------------------
1 | # tests/portage.util/__init__.py -- Portage Unit Test functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
--------------------------------------------------------------------------------
/lib/portage/tests/xpak/__init__.py:
--------------------------------------------------------------------------------
1 | # tests/portage.dep/__init__.py -- Portage Unit Test functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
--------------------------------------------------------------------------------
/lib/portage/util/endian/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'decode.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/util/endian',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/cvs/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'cvs.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/sync/modules/cvs',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/git/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'git.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/sync/modules/git',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/svn/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'svn.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/sync/modules/svn',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | """Plug-in modules for system health checks and maintenance."""
5 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/rsync/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'rsync.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/sync/modules/rsync',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/tests/.gnupg/private-keys-v1.d/273B030399E7BEA66A9AD42216DE7CA17BA5D42E.key:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gentoo/portage/HEAD/lib/portage/tests/.gnupg/private-keys-v1.d/273B030399E7BEA66A9AD42216DE7CA17BA5D42E.key
--------------------------------------------------------------------------------
/lib/portage/tests/.gnupg/private-keys-v1.d/C99796FB85B0C3DF03314A11B5850C51167D6282.key:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gentoo/portage/HEAD/lib/portage/tests/.gnupg/private-keys-v1.d/C99796FB85B0C3DF03314A11B5850C51167D6282.key
--------------------------------------------------------------------------------
/lib/portage/tests/env/config/__init__.py:
--------------------------------------------------------------------------------
1 | # tests/portage/env/config/__init__.py -- Portage Unit Test functionality
2 | # Copyright 2007 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
--------------------------------------------------------------------------------
/lib/portage/tests/versions/__init__.py:
--------------------------------------------------------------------------------
1 | # tests/portage.versions/__init__.py -- Portage Unit Test functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/logs/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'logs.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/logs',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/move/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'move.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/move',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/sync/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'sync.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/sync',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/world/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'world.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/world',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/util/futures/executor/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'fork.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/util/futures/executor',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/util/iterators/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'MultiIterGroupBy.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/util/iterators',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dolib.a:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | LIBOPTIONS='-m0644' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"
6 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dolib.so:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | LIBOPTIONS='-m0755' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"
6 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/binhost/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'binhost.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/binhost',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/config/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'config.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/config',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/merges/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'merges.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/merges',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/resume/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'resume.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/resume',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/webrsync/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'webrsync.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/sync/modules/webrsync',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/zipfile/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'zipfile.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/sync/modules/zipfile',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/util/futures/_asyncio/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'streams.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/util/futures/_asyncio',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/mercurial/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'mercurial.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/sync/modules/mercurial',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/util/futures/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2018 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | __all__ = ("asyncio",)
5 |
6 | from portage.util.futures import _asyncio as asyncio
7 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/revisions/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'revisions.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/emaint/modules/revisions',
7 | pure : not native_extensions
8 | )
9 |
--------------------------------------------------------------------------------
/lib/portage/proxy/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'lazyimport.py',
4 | 'objectproxy.py',
5 | '__init__.py',
6 | ],
7 | subdir : 'portage/proxy',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/util/elf/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'constants.py',
4 | 'header.py',
5 | '__init__.py',
6 | ],
7 | subdir : 'portage/util/elf',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/die:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2010 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 | die "$@"
7 | exit 1
8 |
--------------------------------------------------------------------------------
/lib/portage/repository/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'config.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/repository',
7 | pure : not native_extensions
8 | )
9 |
10 | subdir('storage')
11 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | '__init__.py',
4 | '__test__.py',
5 | ],
6 | subdir : 'portage/tests/env',
7 | pure : not native_extensions
8 | )
9 |
10 | subdir('config')
11 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/elog:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2009 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | ${0##*/} "$@"
8 |
--------------------------------------------------------------------------------
/doc/dependency_resolution.docbook:
--------------------------------------------------------------------------------
1 |
2 | Dependency Resolution
3 | &dependency_resolution_package_modeling;
4 | &dependency_resolution_decision_making;
5 | &dependency_resolution_task_scheduling;
6 |
7 |
--------------------------------------------------------------------------------
/lib/portage/tests/news/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_NewsItem.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/news',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/xpak/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_decodeint.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/xpak',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/glsa/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_security_set.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/glsa',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/env/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'config.py',
4 | 'loaders.py',
5 | 'validators.py',
6 | '__init__.py',
7 | ],
8 | subdir : 'portage/env',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/lib/portage/tests/emaint/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_emaint_binhost.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/emaint',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/shell/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_shell.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/sets/shell',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/unicode/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_string_format.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/unicode',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/cache/index/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'IndexStreamIterator.py',
4 | 'pkg_desc_index.py',
5 | '__init__.py',
6 | ],
7 | subdir : 'portage/cache/index',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/emaint/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'defaults.py',
4 | 'main.py',
5 | '__init__.py',
6 | ],
7 | subdir : 'portage/emaint',
8 | pure : not native_extensions
9 | )
10 |
11 | subdir('modules')
12 |
--------------------------------------------------------------------------------
/lib/portage/tests/lafilefixer/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_lafilefixer.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/lafilefixer',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/file_copy/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_copyfile.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/util/file_copy',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/eventloop/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_call_soon_fifo.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/util/eventloop',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/util/_eventloop/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'asyncio_event_loop.py',
4 | 'global_event_loop.py',
5 | '__init__.py',
6 | ],
7 | subdir : 'portage/util/_eventloop',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/dep/soname/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'SonameAtom.py',
4 | 'multilib_category.py',
5 | 'parse.py',
6 | '__init__.py',
7 | ],
8 | subdir : 'portage/dep/soname',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/lib/portage/util/_eventloop/global_event_loop.py:
--------------------------------------------------------------------------------
1 | # Copyright 2012-2021 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | __all__ = ("global_event_loop",)
5 |
6 | from portage.util.futures._asyncio import _safe_loop as global_event_loop
7 |
--------------------------------------------------------------------------------
/doc/custom.xsl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/lib/portage/tests/lazyimport/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_lazy_import_portage_baseline.py',
4 | '__init__.py',
5 | '__test__.py',
6 | ],
7 | subdir : 'portage/tests/lazyimport',
8 | pure : not native_extensions
9 | )
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | '__init__.py',
4 | '__test__.py',
5 | ],
6 | subdir : 'portage/tests/sets',
7 | pure : not native_extensions
8 | )
9 |
10 | subdir('base')
11 | subdir('files')
12 | subdir('shell')
13 |
--------------------------------------------------------------------------------
/lib/portage/tests/sync/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_sync_local.py',
4 | 'test_sync_zipfile.py',
5 | '__init__.py',
6 | '__test__.py',
7 | ],
8 | subdir : 'portage/tests/sync',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/prepall:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | die "'${0##*/}' is not allowed in ebuild scope"
8 | exit 1
9 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_ipc/IpcCommand.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 |
5 | class IpcCommand:
6 | __slots__ = ()
7 |
8 | def __call__(self, argv):
9 | raise NotImplementedError(self)
10 |
--------------------------------------------------------------------------------
/lib/portage/tests/lint/metadata.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | module_metadata = {}
5 |
6 | script_metadata = {
7 | "socks5-server.py": {
8 | "required_python": "3.3",
9 | },
10 | }
11 |
--------------------------------------------------------------------------------
/lib/portage/tests/versions/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_cpv_sort_key.py',
4 | 'test_vercmp.py',
5 | '__init__.py',
6 | '__test__.py',
7 | ],
8 | subdir : 'portage/tests/versions',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_ipc/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'ExitCommand.py',
4 | 'IpcCommand.py',
5 | 'QueryCommand.py',
6 | '__init__.py',
7 | ],
8 | subdir : 'portage/package/ebuild/_ipc',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/lib/portage/tests/locks/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_asynchronous_lock.py',
4 | 'test_lock_nonblock.py',
5 | '__init__.py',
6 | '__test__.py',
7 | ],
8 | subdir : 'portage/tests/locks',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/base/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_internal_package_set.py',
4 | 'test_variable_set.py',
5 | '__init__.py',
6 | '__test__.py',
7 | ],
8 | subdir : 'portage/tests/sets/base',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/files/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_config_file_set.py',
4 | 'test_static_file_set.py',
5 | '__init__.py',
6 | '__test__.py',
7 | ],
8 | subdir : 'portage/tests/sets/files',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/lib/portage/dep/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'dep_check.py',
4 | 'libc.py',
5 | '_dnf.py',
6 | '_slot_operator.py',
7 | '__init__.py',
8 | ],
9 | subdir : 'portage/dep',
10 | pure : not native_extensions
11 | )
12 |
13 | subdir('soname')
14 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/dyn_libs/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_installed_dynlibs.py',
4 | 'test_soname_deps.py',
5 | '__init__.py',
6 | '__test__.py',
7 | ],
8 | subdir : 'portage/tests/util/dyn_libs',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/doc/api/index.rst:
--------------------------------------------------------------------------------
1 | Portage API Documentation
2 | =========================
3 |
4 | Modules
5 | =======
6 |
7 | .. toctree::
8 | :maxdepth: 1
9 |
10 | _emerge
11 | portage
12 |
13 | Indices and tables
14 | ==================
15 |
16 | * :ref:`genindex`
17 | * :ref:`modindex`
18 | * :ref:`search`
19 |
--------------------------------------------------------------------------------
/lib/portage/tests/update/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_move_ent.py',
4 | 'test_move_slot_ent.py',
5 | 'test_update_dbentry.py',
6 | '__init__.py',
7 | '__test__.py',
8 | ],
9 | subdir : 'portage/tests/update',
10 | pure : not native_extensions
11 | )
12 |
--------------------------------------------------------------------------------
/lib/portage/repository/storage/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'hardlink_quarantine.py',
4 | 'hardlink_rcu.py',
5 | 'inplace.py',
6 | 'interface.py',
7 | '__init__.py',
8 | ],
9 | subdir : 'portage/repository/storage',
10 | pure : not native_extensions
11 | )
12 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_parallel_manifest/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'ManifestProcess.py',
4 | 'ManifestScheduler.py',
5 | 'ManifestTask.py',
6 | '__init__.py',
7 | ],
8 | subdir : 'portage/package/ebuild/_parallel_manifest',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/cnf/logrotate.d/elog-save-summary:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2011 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 | # Rotate the log created by the save_summary elog module.
4 |
5 | /var/log/portage/elog/summary.log {
6 | su portage portage
7 | missingok
8 | nocreate
9 | delaycompress
10 | }
11 |
--------------------------------------------------------------------------------
/lib/portage/_compat_upgrade/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'binpkg_compression.py',
4 | 'binpkg_format.py',
5 | 'binpkg_multi_instance.py',
6 | 'default_locations.py',
7 | '__init__.py',
8 | ],
9 | subdir : 'portage/_compat_upgrade',
10 | pure : not native_extensions
11 | )
12 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | '__init__.py',
4 | ],
5 | subdir : 'portage/sync/modules',
6 | pure : not native_extensions
7 | )
8 |
9 | subdir('cvs')
10 | subdir('git')
11 | subdir('mercurial')
12 | subdir('rsync')
13 | subdir('svn')
14 | subdir('webrsync')
15 | subdir('zipfile')
16 |
--------------------------------------------------------------------------------
/lib/portage/tests/lint/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'metadata.py',
4 | 'test_bash_syntax.py',
5 | 'test_compile_modules.py',
6 | 'test_import_modules.py',
7 | '__init__.py',
8 | '__test__.py',
9 | ],
10 | subdir : 'portage/tests/lint',
11 | pure : not native_extensions
12 | )
13 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/binpkg_multi_instance/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_build_id_profile_format.py',
4 | 'test_rebuilt_binaries.py',
5 | '__init__.py',
6 | '__test__.py',
7 | ],
8 | subdir : 'portage/tests/resolver/binpkg_multi_instance',
9 | pure : not native_extensions
10 | )
11 |
--------------------------------------------------------------------------------
/.github/workflows/pre-commit.yml:
--------------------------------------------------------------------------------
1 | name: pre-commit
2 |
3 | on:
4 | pull_request:
5 | push:
6 | branches: [master]
7 |
8 | jobs:
9 | pre-commit:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v4
13 | - uses: actions/setup-python@v5
14 | with:
15 | python-version: '3.x'
16 | - uses: pre-commit/action@v3.0.1
17 |
--------------------------------------------------------------------------------
/lib/portage/_sets/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'ProfilePackageSet.py',
4 | 'base.py',
5 | 'dbapi.py',
6 | 'files.py',
7 | 'libs.py',
8 | 'profiles.py',
9 | 'security.py',
10 | 'shell.py',
11 | '__init__.py',
12 | ],
13 | subdir : 'portage/_sets',
14 | pure : not native_extensions
15 | )
16 |
--------------------------------------------------------------------------------
/lib/portage/tests/dbapi/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_auxdb.py',
4 | 'test_bintree.py',
5 | 'test_bintree_build_id.py',
6 | 'test_fakedbapi.py',
7 | 'test_portdb_cache.py',
8 | '__init__.py',
9 | '__test__.py',
10 | ],
11 | subdir : 'portage/tests/dbapi',
12 | pure : not native_extensions
13 | )
14 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/config/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_PackageKeywordsFile.py',
4 | 'test_PackageMaskFile.py',
5 | 'test_PackageUseFile.py',
6 | 'test_PortageModulesFile.py',
7 | '__init__.py',
8 | '__test__.py',
9 | ],
10 | subdir : 'portage/tests/env/config',
11 | pure : not native_extensions
12 | )
13 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | '__init__.py',
4 | ],
5 | subdir : 'portage/emaint/modules',
6 | pure : not native_extensions
7 | )
8 |
9 | subdir('binhost')
10 | subdir('config')
11 | subdir('logs')
12 | subdir('merges')
13 | subdir('move')
14 | subdir('resume')
15 | subdir('revisions')
16 | subdir('sync')
17 | subdir('world')
18 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Copyright 2017-2020 Gentoo Authors
2 |
3 | root = true
4 |
5 | [*]
6 | charset = utf-8
7 | end_of_line = lf
8 | indent_style = tab
9 | indent_size = 4
10 | tab_width = 4
11 | insert_final_newline = true
12 | trim_trailing_whitespace = true
13 |
14 | [*.{py,yaml,yml}]
15 | indent_style = space
16 |
17 | [pylintrc]
18 | indent_style = space
19 |
20 | [*.py]
21 | profile = black
22 |
--------------------------------------------------------------------------------
/lib/_emerge/resolver/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'DbapiProvidesIndex.py',
4 | 'backtracking.py',
5 | 'circular_dependency.py',
6 | 'output.py',
7 | 'output_helpers.py',
8 | 'package_tracker.py',
9 | 'slot_collision.py',
10 | '__init__.py',
11 | ],
12 | subdir : '_emerge/resolver',
13 | pure : true
14 | )
15 |
--------------------------------------------------------------------------------
/lib/portage/sync/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'config_checks.py',
4 | 'controller.py',
5 | 'getaddrinfo_validate.py',
6 | 'old_tree_timestamp.py',
7 | 'revision_history.py',
8 | 'syncbase.py',
9 | '__init__.py',
10 | ],
11 | subdir : 'portage/sync',
12 | pure : not native_extensions
13 | )
14 |
15 | subdir('modules')
16 |
--------------------------------------------------------------------------------
/lib/portage/tests/bin/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'setup_env.py',
4 | 'test_dobin.py',
5 | 'test_dodir.py',
6 | 'test_doins.py',
7 | 'test_ver_funcs.py',
8 | 'test_filter_bash_env.py',
9 | '__init__.py',
10 | '__test__.py',
11 | ],
12 | subdir : 'portage/tests/bin',
13 | pure : not native_extensions
14 | )
15 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/test_grabdict.py:
--------------------------------------------------------------------------------
1 | # test_grabDict.py -- Portage Unit Testing Functionality
2 | # Copyright 2006-2020 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 |
7 | # from portage.util import grabdict
8 |
9 |
10 | class GrabDictTestCase(TestCase):
11 | def testGrabDictPass(self):
12 | pass
13 |
--------------------------------------------------------------------------------
/doc/package/ebuild.docbook:
--------------------------------------------------------------------------------
1 |
2 | Ebuild
3 | &package_ebuild_phases;
4 | &package_ebuild_helper_functions;
5 |
6 | EAPI
7 | &package_ebuild_eapi_0;
8 | &package_ebuild_eapi_1;
9 | &package_ebuild_eapi_2;
10 | &package_ebuild_eapi_3;
11 | &package_ebuild_eapi_4;
12 | &package_ebuild_eapi_5;
13 |
14 |
15 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_done_callback.py',
4 | 'test_done_callback_after_exit.py',
5 | 'test_iter_completed.py',
6 | 'test_retry.py',
7 | '__init__.py',
8 | '__test__.py',
9 | ],
10 | subdir : 'portage/tests/util/futures',
11 | pure : not native_extensions
12 | )
13 |
14 | subdir('asyncio')
15 |
--------------------------------------------------------------------------------
/lib/portage/_emirrordist/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'Config.py',
4 | 'ContentDB.py',
5 | 'DeletionIterator.py',
6 | 'DeletionTask.py',
7 | 'FetchIterator.py',
8 | 'FetchTask.py',
9 | 'MirrorDistTask.py',
10 | 'main.py',
11 | '__init__.py',
12 | ],
13 | subdir : 'portage/_emirrordist',
14 | pure : not native_extensions
15 | )
16 |
--------------------------------------------------------------------------------
/lib/portage/util/futures/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'extendedfutures.py',
4 | 'futures.py',
5 | 'iter_completed.py',
6 | 'retry.py',
7 | 'unix_events.py',
8 | '_sync_decorator.py',
9 | '__init__.py',
10 | ],
11 | subdir : 'portage/util/futures',
12 | pure : not native_extensions
13 | )
14 |
15 | subdir('executor')
16 | subdir('_asyncio')
17 |
--------------------------------------------------------------------------------
/lib/portage/util/_dyn_libs/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'LinkageMapELF.py',
4 | 'NeededEntry.py',
5 | 'PreservedLibsRegistry.py',
6 | 'display_preserved_libs.py',
7 | 'dyn_libs.py',
8 | 'soname_deps.py',
9 | 'soname_deps_qa.py',
10 | '__init__.py',
11 | ],
12 | subdir : 'portage/util/_dyn_libs',
13 | pure : not native_extensions
14 | )
15 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dodir:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_prefix_variables; then
8 | ED=${D}
9 | fi
10 |
11 | install -d ${DIROPTIONS} "${@/#/${ED%/}/}"
12 | ret=$?
13 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
14 | exit ${ret}
15 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/nonfatal:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_nonfatal; then
8 | die "${0##*/} not supported in this EAPI"
9 | fi
10 | if [[ $# -lt 1 ]]; then
11 | die "${0##*/}: Missing argument"
12 | fi
13 |
14 | PORTAGE_NONFATAL=1 exec "$@"
15 |
--------------------------------------------------------------------------------
/lib/portage/elog/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'filtering.py',
4 | 'messages.py',
5 | 'mod_custom.py',
6 | 'mod_echo.py',
7 | 'mod_mail.py',
8 | 'mod_mail_summary.py',
9 | 'mod_save.py',
10 | 'mod_save_summary.py',
11 | 'mod_syslog.py',
12 | '__init__.py',
13 | ],
14 | subdir : 'portage/elog',
15 | pure : not native_extensions
16 | )
17 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/asyncio/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_event_loop_in_fork.py',
4 | 'test_pipe_closed.py',
5 | 'test_run_until_complete.py',
6 | 'test_subprocess_exec.py',
7 | 'test_wakeup_fd_sigchld.py',
8 | '__init__.py',
9 | '__test__.py',
10 | ],
11 | subdir : 'portage/tests/util/futures/asyncio',
12 | pure : not native_extensions
13 | )
14 |
--------------------------------------------------------------------------------
/lib/portage/util/time.py:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import datetime
5 |
6 | __all__ = ["unix_to_iso_time"]
7 |
8 |
9 | def unix_to_iso_time(unix_ts):
10 | local_timezone = datetime.datetime.now().astimezone().tzinfo
11 | dt = datetime.datetime.fromtimestamp(
12 | int(unix_ts),
13 | local_timezone,
14 | )
15 | return dt.isoformat()
16 |
--------------------------------------------------------------------------------
/lib/_emerge/BlockerDepPriority.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2009 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from _emerge.DepPriority import DepPriority
5 |
6 |
7 | class BlockerDepPriority(DepPriority):
8 | __slots__ = ()
9 |
10 | def __int__(self):
11 | return 0
12 |
13 | def __str__(self):
14 | return "blocker"
15 |
16 |
17 | BlockerDepPriority.instance = BlockerDepPriority()
18 |
--------------------------------------------------------------------------------
/lib/portage/tests/gpkg/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_gpkg_checksum.py',
4 | 'test_gpkg_gpg.py',
5 | 'test_gpkg_metadata_update.py',
6 | 'test_gpkg_metadata_url.py',
7 | 'test_gpkg_path.py',
8 | 'test_gpkg_size.py',
9 | 'test_gpkg_stream.py',
10 | '__init__.py',
11 | '__test__.py',
12 | ],
13 | subdir : 'portage/tests/gpkg',
14 | pure : not native_extensions
15 | )
16 |
--------------------------------------------------------------------------------
/man/ru/meson.build:
--------------------------------------------------------------------------------
1 | man_pages_out = []
2 | man_pages_in = [
3 | 'color.map.5',
4 | 'dispatch-conf.1',
5 | 'ebuild.1',
6 | 'env-update.1',
7 | 'etc-update.1',
8 | 'fixpackages.1',
9 | ]
10 |
11 | foreach man_page : man_pages_in
12 | man_pages_out += configure_file(
13 | input : man_page,
14 | output : man_page,
15 | configuration : conf_data
16 | )
17 | endforeach
18 |
19 | install_man(man_pages_out, locale : 'ru')
20 |
--------------------------------------------------------------------------------
/lib/_emerge/SetArg.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from _emerge.DependencyArg import DependencyArg
5 | from portage._sets import SETPREFIX
6 |
7 |
8 | class SetArg(DependencyArg):
9 | __slots__ = ("name", "pset")
10 |
11 | def __init__(self, pset=None, **kwargs):
12 | DependencyArg.__init__(self, **kwargs)
13 | self.pset = pset
14 | self.name = self.arg[len(SETPREFIX) :]
15 |
--------------------------------------------------------------------------------
/lib/portage/tests/ebuild/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_array_fromfile_eof.py',
4 | 'test_config.py',
5 | 'test_doebuild_fd_pipes.py',
6 | 'test_doebuild_spawn.py',
7 | 'test_fetch.py',
8 | 'test_ipc_daemon.py',
9 | 'test_spawn.py',
10 | 'test_use_expand_incremental.py',
11 | '__init__.py',
12 | '__test__.py',
13 | ],
14 | subdir : 'portage/tests/ebuild',
15 | pure : not native_extensions
16 | )
17 |
--------------------------------------------------------------------------------
/lib/portage/cache/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'anydbm.py',
4 | 'cache_errors.py',
5 | 'ebuild_xattr.py',
6 | 'flat_hash.py',
7 | 'fs_template.py',
8 | 'mappings.py',
9 | 'metadata.py',
10 | 'sqlite.py',
11 | 'sql_template.py',
12 | 'template.py',
13 | 'volatile.py',
14 | '__init__.py',
15 | ],
16 | subdir : 'portage/cache',
17 | pure : not native_extensions
18 | )
19 |
20 | subdir('index')
21 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/doinitd:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if [[ $# -lt 1 ]] ; then
8 | __helpers_die "${0##*/}: at least one argument needed"
9 | exit 1
10 | fi
11 |
12 | if ! ___eapi_doinitd_respects_exeopts; then
13 | export EXEOPTIONS=-m0755
14 | export DIROPTIONS=""
15 | fi
16 |
17 | __E_EXEDESTTREE='/etc/init.d/' exec doexe "$@"
18 |
--------------------------------------------------------------------------------
/lib/portage/tests/emerge/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_actions.py',
4 | 'test_binpkg_fetch.py',
5 | 'test_config_protect.py',
6 | 'test_emerge_blocker_file_collision.py',
7 | 'test_emerge_slot_abi.py',
8 | 'test_global_updates.py',
9 | 'test_baseline.py',
10 | 'test_libc_dep_inject.py',
11 | '__init__.py',
12 | '__test__.py',
13 | ],
14 | subdir : 'portage/tests/emerge',
15 | pure : not native_extensions
16 | )
17 |
--------------------------------------------------------------------------------
/lib/portage/tests/xpak/test_decodeint.py:
--------------------------------------------------------------------------------
1 | # xpak/test_decodeint.py
2 | # Copyright 2006-2020 Gentoo Authors
3 | # Portage Unit Testing Functionality
4 |
5 | from portage.tests import TestCase
6 | from portage.xpak import decodeint, encodeint
7 |
8 |
9 | class testDecodeIntTestCase(TestCase):
10 | def testDecodeInt(self):
11 | for n in range(1000):
12 | self.assertEqual(decodeint(encodeint(n)), n)
13 |
14 | for n in (2**32 - 1,):
15 | self.assertEqual(decodeint(encodeint(n)), n)
16 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_config/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'KeywordsManager.py',
4 | 'LicenseManager.py',
5 | 'LocationsManager.py',
6 | 'MaskManager.py',
7 | 'UseManager.py',
8 | 'VirtualsManager.py',
9 | 'env_var_validation.py',
10 | 'features_set.py',
11 | 'helper.py',
12 | 'special_env_vars.py',
13 | '__init__.py',
14 | ],
15 | subdir : 'portage/package/ebuild/_config',
16 | pure : not native_extensions
17 | )
18 |
--------------------------------------------------------------------------------
/man/fixpackages.1:
--------------------------------------------------------------------------------
1 | .TH "FIXPACKAGES" "1" "Dec 2011" "Portage @VERSION@" "Portage"
2 | .SH NAME
3 | fixpackages \- Perform package move updates for all packages
4 | .SH SYNOPSIS
5 | \fBfixpackages\fR
6 | .SH DESCRIPTION
7 | The fixpackages program performs package move updates on configuration
8 | files, installed packages, and binary packages.
9 | .SH "REPORTING BUGS"
10 | Please report bugs via https://bugs.gentoo.org/
11 | .SH AUTHORS
12 | Zac Medico
13 | .SH "SEE ALSO"
14 | .BR emaint (1),
15 | .BR emerge (1)
16 |
--------------------------------------------------------------------------------
/lib/_emerge/_flush_elog_mod_echo.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.elog import mod_echo
5 |
6 |
7 | def _flush_elog_mod_echo():
8 | """
9 | Dump the mod_echo output now so that our other
10 | notifications are shown last.
11 | @rtype: bool
12 | @return: True if messages were shown, False otherwise.
13 | """
14 | messages_shown = bool(mod_echo._items)
15 | mod_echo.finalize()
16 | return messages_shown
17 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/test_normalizedPath.py:
--------------------------------------------------------------------------------
1 | # test_normalizePath.py -- Portage Unit Testing Functionality
2 | # Copyright 2006-2020 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 |
7 |
8 | class NormalizePathTestCase(TestCase):
9 | def testNormalizePath(self):
10 | from portage.util import normalize_path
11 |
12 | path = "///foo/bar/baz"
13 | good = "/foo/bar/baz"
14 | self.assertEqual(normalize_path(path), good)
15 |
--------------------------------------------------------------------------------
/lib/_emerge/AtomArg.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage._sets.base import InternalPackageSet
5 | from _emerge.DependencyArg import DependencyArg
6 |
7 |
8 | class AtomArg(DependencyArg):
9 | __slots__ = ("atom", "pset")
10 |
11 | def __init__(self, atom=None, **kwargs):
12 | DependencyArg.__init__(self, **kwargs)
13 | self.atom = atom
14 | self.pset = InternalPackageSet(initial_atoms=(self.atom,), allow_repo=True)
15 |
--------------------------------------------------------------------------------
/lib/_emerge/UninstallFailure.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2009 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import portage
5 |
6 |
7 | class UninstallFailure(portage.exception.PortageException):
8 | """
9 | An instance of this class is raised by unmerge() when
10 | an uninstallation fails.
11 | """
12 |
13 | status = 1
14 |
15 | def __init__(self, *pargs):
16 | portage.exception.PortageException.__init__(self, pargs)
17 | if pargs:
18 | self.status = pargs[0]
19 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/20deprecated-directories:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # Check for deprecated directories
4 |
5 | deprecated_dir_check() {
6 | local x f=
7 | for x in etc/app-defaults usr/man usr/info usr/X11R6 usr/doc usr/locale ; do
8 | [[ -d ${ED}/${x} ]] && f+=" ${x}\n"
9 | done
10 | if [[ -n ${f} ]] ; then
11 | eqawarn "QA Notice: This ebuild installs into the following deprecated directories:"
12 | eqawarn
13 | eqawarn "${f}"
14 | fi
15 | }
16 |
17 | deprecated_dir_check
18 | : # guarantee successful exit
19 |
20 | # vim:ft=bash
21 |
--------------------------------------------------------------------------------
/lib/_emerge/Blocker.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2011 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from _emerge.Task import Task
5 |
6 |
7 | class Blocker(Task):
8 | __hash__ = Task.__hash__
9 | __slots__ = ("root", "atom", "cp", "eapi", "priority", "satisfied")
10 |
11 | def __init__(self, **kwargs):
12 | Task.__init__(self, **kwargs)
13 | self.cp = self.atom.cp
14 | self._hash_key = ("blocks", self.root, self.atom, self.eapi)
15 | self._hash_value = hash(self._hash_key)
16 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | repos:
3 | - repo: https://github.com/psf/black
4 | rev: 24.10.0
5 | hooks:
6 | - id: black
7 | - repo: https://github.com/PyCQA/pylint
8 | rev: v3.3.1
9 | hooks:
10 | - id: pylint
11 | additional_dependencies:
12 | - 'pytest'
13 | - repo: https://github.com/ikamensh/flynt/
14 | rev: '1.0.6'
15 | hooks:
16 | - id: flynt
17 | - repo: https://github.com/asottile/pyupgrade
18 | rev: v3.21.2
19 | hooks:
20 | - id: pyupgrade
21 | args: [--py39-plus]
22 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/05double-D:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # Check for accidental install into ${D}/${D}
4 |
5 | DD_check() {
6 | if [[ -d ${D%/}${D} ]] ; then
7 | eqawarn "QA Notice: files installed in \${D}/\${D}:"
8 | local files=()
9 | while read -r -d $'\0' i ; do
10 | files+=( "${i#${D%/}${D}}" )
11 | done < <(find "${D%/}${D}" -print0)
12 | eqatag -v double-D "${files[@]/#//}"
13 | die "Aborting due to QA concerns: ${#files[@]} files installed in ${D%/}${D}"
14 | fi
15 | }
16 |
17 | DD_check
18 | : # guarantee successful exit
19 |
20 | # vim:ft=bash
21 |
--------------------------------------------------------------------------------
/lib/_emerge/clear_caches.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import gc
5 |
6 |
7 | def clear_caches(trees):
8 | for d in trees.values():
9 | d["porttree"].dbapi.melt()
10 | d["porttree"].dbapi._aux_cache.clear()
11 | d["bintree"].dbapi._clear_cache()
12 | if d["vartree"].dbapi._linkmap is None:
13 | # preserve-libs is entirely disabled
14 | pass
15 | else:
16 | d["vartree"].dbapi._linkmap._clear_cache()
17 | gc.collect()
18 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/keepdir:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_prefix_variables; then
8 | ED=${D}
9 | fi
10 |
11 | dodir "$@"
12 | ret=$?
13 |
14 | for x in "$@"; do
15 | >> "${ED%/}/${x#/}/.keep_${CATEGORY}_${PN}-${SLOT%/*}" || \
16 | { echo "!!! ${0##*/}: cannot write .keep in ${ED%/}/${x#/}" 1>&2; ret=1; }
17 | done
18 |
19 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
20 | exit ${ret}
21 |
--------------------------------------------------------------------------------
/doc/package/ebuild/eapi/0.docbook:
--------------------------------------------------------------------------------
1 |
2 | EAPI 0
3 |
4 | Phases
5 |
6 | Default src_compile Phase Function
7 |
8 | src_compile() {
9 | if [ -x ./configure ] ; then
10 | econf
11 | fi
12 | if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ] ; then
13 | emake || die "emake failed"
14 | fi
15 | }
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/60udev:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # Check udev rule installs
4 |
5 | udev_check() {
6 | set +f
7 | local x f=
8 | for x in "${ED%/}/etc/udev/rules.d/"* "${ED%/}/lib"*"/udev/rules.d/"* ; do
9 | [[ -e ${x} ]] || continue
10 | [[ ${x} == ${ED%/}/lib/udev/rules.d/* ]] && continue
11 | f+=" ${x#${ED%/}}\n"
12 | done
13 |
14 | if [[ -n ${f} ]] ; then
15 | eqawarn "QA Notice: udev rules should be installed in /lib/udev/rules.d:"
16 | eqawarn
17 | eqawarn "${f}"
18 | fi
19 | }
20 |
21 | udev_check
22 | : # guarantee successful exit
23 |
24 | # vim:ft=bash
25 |
--------------------------------------------------------------------------------
/lib/portage/util/_async/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'AsyncFunction.py',
4 | 'AsyncScheduler.py',
5 | 'AsyncTaskFuture.py',
6 | 'BuildLogger.py',
7 | 'FileCopier.py',
8 | 'FileDigester.py',
9 | 'ForkProcess.py',
10 | 'PipeLogger.py',
11 | 'PipeReaderBlockingIO.py',
12 | 'PopenProcess.py',
13 | 'SchedulerInterface.py',
14 | 'TaskScheduler.py',
15 | 'run_main_scheduler.py',
16 | '__init__.py',
17 | ],
18 | subdir : 'portage/util/_async',
19 | pure : not native_extensions
20 | )
21 |
--------------------------------------------------------------------------------
/lib/portage/tests/process/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_AsyncFunction.py',
4 | 'test_ForkProcess.py',
5 | 'test_PipeLogger.py',
6 | 'test_PopenProcessBlockingIO.py',
7 | 'test_PopenProcess.py',
8 | 'test_pickle.py',
9 | 'test_poll.py',
10 | 'test_spawn_fail_e2big.py',
11 | 'test_spawn_returnproc.py',
12 | 'test_spawn_warn_large_env.py',
13 | 'test_unshare_net.py',
14 | '__init__.py',
15 | '__test__.py',
16 | ],
17 | subdir : 'portage/tests/process',
18 | pure : not native_extensions
19 | )
20 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/doconfd:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if [[ $# -lt 1 ]] ; then
8 | __helpers_die "${0##*/}: at least one argument needed"
9 | exit 1
10 | fi
11 |
12 | export __E_INSDESTTREE='/etc/conf.d/'
13 | if ___eapi_has_DESTTREE_INSDESTTREE; then
14 | export INSDESTTREE=${__E_INSDESTTREE}
15 | fi
16 |
17 | if ! ___eapi_doconfd_respects_insopts; then
18 | export INSOPTIONS=-m0644
19 | export DIROPTIONS=""
20 | fi
21 |
22 | exec doins "$@"
23 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/doenvd:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if [[ $# -lt 1 ]] ; then
8 | __helpers_die "${0##*/}: at least one argument needed"
9 | exit 1
10 | fi
11 |
12 | export __E_INSDESTTREE='/etc/env.d/'
13 | if ___eapi_has_DESTTREE_INSDESTTREE; then
14 | export INSDESTTREE=${__E_INSDESTTREE}
15 | fi
16 |
17 | if ! ___eapi_doenvd_respects_insopts; then
18 | export INSOPTIONS=-m0644
19 | export DIROPTIONS=""
20 | fi
21 |
22 | exec doins "$@"
23 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/world/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | doc = """Check and fix problems in the world file."""
5 | __doc__ = doc
6 |
7 |
8 | module_spec = {
9 | "name": "world",
10 | "description": doc,
11 | "provides": {
12 | "module1": {
13 | "name": "world",
14 | "sourcefile": "world",
15 | "class": "WorldHandler",
16 | "description": doc,
17 | "functions": ["check", "fix"],
18 | "func_desc": {},
19 | }
20 | },
21 | }
22 |
--------------------------------------------------------------------------------
/lib/portage/util/futures/futures.py:
--------------------------------------------------------------------------------
1 | # Copyright 2016-2021 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 | #
4 | # For compatibility with python versions which do not have the
5 | # asyncio module (Python 3.3 and earlier), this module provides a
6 | # subset of the asyncio.futures.Futures interface.
7 |
8 | __all__ = (
9 | "CancelledError",
10 | "Future",
11 | "InvalidStateError",
12 | "TimeoutError",
13 | )
14 |
15 | # pylint: disable=redefined-builtin
16 | from asyncio import (
17 | CancelledError,
18 | Future,
19 | InvalidStateError,
20 | TimeoutError,
21 | )
22 |
--------------------------------------------------------------------------------
/bin/portageq-wrapper:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2009-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | # Use safe cwd, avoiding unsafe import for bug #469338.
6 | cd "${PORTAGE_PYM_PATH}" || exit 1
7 |
8 | IFS=":"
9 | set -f # in case ${PATH} contains any shell glob characters
10 |
11 | for path in "${PORTAGE_BIN_PATH:?}" ${PATH}; do
12 | [[ -x ${path}/portageq ]] || continue
13 | PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
14 | exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}/portageq" "$@"
15 | done
16 |
17 | echo "portageq: command not found" >&2
18 | exit 127
19 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/soname/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_autounmask.py',
4 | 'test_depclean.py',
5 | 'test_downgrade.py',
6 | 'test_or_choices.py',
7 | 'test_reinstall.py',
8 | 'test_skip_update.py',
9 | 'test_slot_conflict_reinstall.py',
10 | 'test_slot_conflict_update.py',
11 | 'test_soname_provided.py',
12 | 'test_unsatisfiable.py',
13 | 'test_unsatisfied.py',
14 | '__init__.py',
15 | '__test__.py',
16 | ],
17 | subdir : 'portage/tests/resolver/soname',
18 | pure : not native_extensions
19 | )
20 |
--------------------------------------------------------------------------------
/testpath:
--------------------------------------------------------------------------------
1 | #
2 | # Generic testpath to source. This sets PATH and PYTHONPATH
3 | # to use the current checkout code, before searching the main PATH, PYTHONPATH
4 | # cd ~/.../portage
5 | # source ./testpath
6 | # emerge foo
7 | # repoman manifest
8 | # ...
9 | if [[ "$SHELL" =~ "zsh" ]]; then
10 | export PATH="$(dirname $0)/bin:${PATH}"
11 | export PYTHONPATH=PYTHONPATH="$(dirname $0)/lib:${PYTHONPATH:+:}${PYTHONPATH}"
12 | else
13 | export PATH="$(dirname ${BASH_SOURCE[0]})/bin:${PATH}"
14 | export PYTHONPATH=PYTHONPATH="$(dirname $BASH_SOURCE[0])/lib:${PYTHONPATH:+:}${PYTHONPATH}"
15 | fi
16 | export PYTHONWARNINGS=d,i::ImportWarning
17 |
--------------------------------------------------------------------------------
/lib/portage/tests/bin/test_dobin.py:
--------------------------------------------------------------------------------
1 | # test_dobin.py -- Portage Unit Testing Functionality
2 | # Copyright 2007-2010 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests.bin.setup_env import BinTestCase, dobin, xexists_in_D
6 |
7 |
8 | class DoBin(BinTestCase):
9 | def testDoBin(self):
10 | self.init()
11 | try:
12 | dobin("does-not-exist", 1)
13 | xexists_in_D("does-not-exist")
14 | xexists_in_D("/bin/does-not-exist")
15 | xexists_in_D("/usr/bin/does-not-exist")
16 | finally:
17 | self.cleanup()
18 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dohard:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_dohard; then
8 | die "'${0##*/}' has been banned for EAPI '${EAPI}'"
9 | exit 1
10 | fi
11 |
12 | if [[ $# -ne 2 ]] ; then
13 | echo "${0}: two arguments needed" 1>&2
14 | exit 1
15 | fi
16 |
17 | if ! ___eapi_has_prefix_variables; then
18 | ED=${D}
19 | fi
20 |
21 | destdir=${2%/*}
22 | [[ ! -d ${ED%/}/${destdir#/} ]] && dodir "${destdir}"
23 |
24 | exec ln -f "${ED%/}/${1#/}" "${ED%/}/${2#/}"
25 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/binhost/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | doc = """Scan and generate metadata indexes for binary packages."""
5 | __doc__ = doc
6 |
7 |
8 | module_spec = {
9 | "name": "binhost",
10 | "description": doc,
11 | "provides": {
12 | "module1": {
13 | "name": "binhost",
14 | "sourcefile": "binhost",
15 | "class": "BinhostHandler",
16 | "description": doc,
17 | "functions": ["check", "fix"],
18 | "func_desc": {},
19 | }
20 | },
21 | }
22 |
--------------------------------------------------------------------------------
/lib/portage/dbapi/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'DummyTree.py',
4 | 'IndexedPortdb.py',
5 | 'IndexedVardb.py',
6 | 'bintree.py',
7 | 'cpv_expand.py',
8 | 'dep_expand.py',
9 | 'porttree.py',
10 | 'vartree.py',
11 | 'virtual.py',
12 | '_ContentsCaseSensitivityManager.py',
13 | '_MergeProcess.py',
14 | '_SyncfsProcess.py',
15 | '_VdbMetadataDelta.py',
16 | '_expand_new_virt.py',
17 | '_similar_name_search.py',
18 | '__init__.py',
19 | ],
20 | subdir : 'portage/dbapi',
21 | pure : not native_extensions
22 | )
23 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'config.py',
4 | 'deprecated_profile_check.py',
5 | 'digestcheck.py',
6 | 'digestgen.py',
7 | 'doebuild.py',
8 | 'fetch.py',
9 | 'getmaskingreason.py',
10 | 'getmaskingstatus.py',
11 | 'prepare_build_dirs.py',
12 | 'profile_iuse.py',
13 | '_metadata_invalid.py',
14 | '_spawn_nofetch.py',
15 | '__init__.py',
16 | ],
17 | subdir : 'portage/package/ebuild',
18 | pure : not native_extensions
19 | )
20 |
21 | subdir('_config')
22 | subdir('_ipc')
23 | subdir('_parallel_manifest')
24 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/config/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | doc = """Check and clean the config tracker list for uninstalled packages."""
5 | __doc__ = doc
6 |
7 |
8 | module_spec = {
9 | "name": "config",
10 | "description": doc,
11 | "provides": {
12 | "module1": {
13 | "name": "cleanconfmem",
14 | "sourcefile": "config",
15 | "class": "CleanConfig",
16 | "description": doc,
17 | "functions": ["check", "fix"],
18 | "func_desc": {},
19 | }
20 | },
21 | }
22 |
--------------------------------------------------------------------------------
/lib/portage/tests/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'conftest.py',
4 | '__init__.py',
5 | ],
6 | subdir : 'portage/tests',
7 | pure : not native_extensions
8 | )
9 |
10 | subdir('bin')
11 | subdir('dbapi')
12 | subdir('dep')
13 | subdir('ebuild')
14 | subdir('emerge')
15 | subdir('env')
16 | subdir('glsa')
17 | subdir('gpkg')
18 | subdir('lafilefixer')
19 | subdir('lazyimport')
20 | subdir('lint')
21 | subdir('locks')
22 | subdir('news')
23 | subdir('process')
24 | subdir('resolver')
25 | subdir('sets')
26 | subdir('sync')
27 | subdir('unicode')
28 | subdir('update')
29 | subdir('util')
30 | subdir('versions')
31 | subdir('xpak')
32 |
--------------------------------------------------------------------------------
/lib/portage/tests/versions/test_cpv_sort_key.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.tests import TestCase
5 | from portage.versions import cpv_sort_key
6 |
7 |
8 | class CpvSortKeyTestCase(TestCase):
9 | def testCpvSortKey(self):
10 | tests = [
11 | (
12 | ("a/b-2_alpha", "a", "b", "a/b-2", "a/a-1", "a/b-1"),
13 | ("a", "a/a-1", "a/b-1", "a/b-2_alpha", "a/b-2", "b"),
14 | ),
15 | ]
16 |
17 | for test in tests:
18 | self.assertEqual(tuple(sorted(test[0], key=cpv_sort_key())), test[1])
19 |
--------------------------------------------------------------------------------
/lib/portage/tests/bin/test_dodir.py:
--------------------------------------------------------------------------------
1 | # test_dodir.py -- Portage Unit Testing Functionality
2 | # Copyright 2007-2010 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests.bin.setup_env import BinTestCase, dodir, exists_in_D
6 |
7 |
8 | class DoDir(BinTestCase):
9 | def testDoDir(self):
10 | self.init()
11 | try:
12 | dodir("usr /usr")
13 | exists_in_D("/usr")
14 | dodir("boot")
15 | exists_in_D("/boot")
16 | dodir("/var/lib/moocow")
17 | exists_in_D("/var/lib/moocow")
18 | finally:
19 | self.cleanup()
20 |
--------------------------------------------------------------------------------
/lib/portage/env/validators.py:
--------------------------------------------------------------------------------
1 | # validators.py Portage File Loader Code
2 | # Copyright 2007-2020 Gentoo Authors
3 |
4 | from portage.dep import isvalidatom
5 |
6 | ValidAtomValidator = isvalidatom
7 |
8 |
9 | def PackagesFileValidator(atom):
10 | """This function mutates atoms that begin with - or *
11 | It then checks to see if that atom is valid, and if
12 | so returns True, else it returns False.
13 |
14 | Args:
15 | atom: a string representing an atom such as sys-apps/portage-2.1
16 | """
17 | if atom.startswith("*") or atom.startswith("-"):
18 | atom = atom[1:]
19 | if not isvalidatom(atom):
20 | return False
21 | return True
22 |
--------------------------------------------------------------------------------
/lib/portage/installation.py:
--------------------------------------------------------------------------------
1 | # portage: Installation
2 | # Copyright 2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from enum import Enum
6 |
7 | TYPES = Enum(
8 | "InstallationType",
9 | [
10 | "SOURCE", # Portage is not installed, but running from its source tree.
11 | "MODULE", # Portage is installed solely as a Python module.
12 | "SYSTEM", # Portage is fully installed to the system, possibly prefixed.
13 | ],
14 | )
15 |
16 | if "@INSTALL_TYPE@" == "MODULE":
17 | TYPE = TYPES.MODULE
18 | elif "@INSTALL_TYPE@" == "SYSTEM":
19 | TYPE = TYPES.SYSTEM
20 | else:
21 | TYPE = TYPES.SOURCE
22 |
--------------------------------------------------------------------------------
/lib/_emerge/countdown.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2020 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import sys
5 | import time
6 |
7 | from portage.output import colorize
8 |
9 |
10 | def countdown(secs=5, doing="Starting"):
11 | if secs:
12 | print(
13 | f">>> Waiting {secs} seconds before starting...\n"
14 | ">>> (Control-C to abort)...\n"
15 | f"{doing} in:",
16 | end="",
17 | )
18 | for sec in range(secs, 0, -1):
19 | sys.stdout.write(colorize("UNMERGE_WARN", f" {sec}"))
20 | sys.stdout.flush()
21 | time.sleep(1)
22 | print()
23 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/resume/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | doc = """Check and fix problems in the resume and/or resume_backup files."""
5 | __doc__ = doc
6 |
7 |
8 | module_spec = {
9 | "name": "resume",
10 | "description": doc,
11 | "provides": {
12 | "module1": {
13 | "name": "cleanresume",
14 | "sourcefile": "resume",
15 | "class": "CleanResume",
16 | "description": "Discard emerge --resume merge lists",
17 | "functions": ["check", "fix"],
18 | "func_desc": {},
19 | }
20 | },
21 | }
22 |
--------------------------------------------------------------------------------
/man/ru/fixpackages.1:
--------------------------------------------------------------------------------
1 | .TH "FIXPACKAGES" "1" "Dec 2011" "Portage @VERSION@" "Portage"
2 | .SH "НАЗВАНИЕ"
3 | fixpackages \- выполняет переносы пакетов при обновлениях
4 | для всех пакетов
5 | .SH "СИНТАКСИС"
6 | \fBfixpackages\fR
7 | .SH "ОПИСАНИЕ"
8 | Программа fixpackages выполняет переносы пакетов при обновлениях
9 | для конфигурационных файлов, установленных пакетов и двоичных
10 | пакетов.
11 | .SH "БАГТРЕКЕР"
12 | Об обнаруженных ошибках сообщайте на https://bugs.gentoo.org/
13 | .SH "АВТОРЫ"
14 | Zac Medico
15 | .SH "СМОТРИ ТАКЖЕ"
16 | .BR emaint (1),
17 | .BR emerge (1)
18 |
19 | .SH "ПЕРЕВОД"
20 | .nf
21 | Переводчик: Романов Владимир
22 | .fi
23 |
--------------------------------------------------------------------------------
/src/meson.build:
--------------------------------------------------------------------------------
1 | # We create symlinks to the native extensions in the source tree for the tests
2 | # and for development. Meson does not allow you to build in-place and Python
3 | # cannot create a single namespace from two identically-named paths.
4 |
5 | whirlpool_ext = py.extension_module(
6 | '_whirlpool',
7 | 'portage_util__whirlpool.c',
8 | dependencies : py.dependency(),
9 | subdir : 'portage' / 'util',
10 | install : true
11 | )
12 |
13 | run_command(
14 | [
15 | 'ln', '-srnf',
16 | whirlpool_ext.full_path(),
17 | meson.project_source_root() / 'lib' / 'portage' / 'util/'
18 | ],
19 | capture : false,
20 | check : true
21 | )
22 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | [tox]
2 | envlist = py{39,310,311,312,313}-{pylint,test},pypy3-test
3 | skipsdist = True
4 |
5 | [gh-actions]
6 | python =
7 | 3.9: py39
8 | 3.10: py310
9 | 3.11: py311
10 | 3.12: py312
11 | 3.13: py313
12 | pypy-3: pypy3
13 |
14 | [gh-actions:env]
15 | TARGET =
16 | pylint: pylint
17 | test: test
18 |
19 | [testenv]
20 | deps =
21 | setuptools
22 | pylint: pylint
23 | pylint: pytest
24 | test: pyyaml
25 | test: pytest
26 | test: pytest-xdist
27 | setenv =
28 | PYTHONPATH={toxinidir}/lib
29 | allowlist_externals =
30 | ./run-pylint
31 | commands =
32 | pylint: ./run-pylint
33 | test: pytest -vv -ra -l -o console_output_style=count -n auto --dist=worksteal {posargs}
34 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | # Run entire repository through black. Also, change tabs to spaces
2 | 3812225ace5db8c691cbe027d234a3e223972199
3 | # black 21.12b0 reformatting
4 | a5092f11f31b6a9d54a34423088a7bb8e70bc1c6
5 | # black 22.1.0 reformatting
6 | baf79da44e543cc0fd12f64a2c99b49b66727f39
7 | # Blacken previously missed Python files
8 | 9fe091668c8a1d988c02c849ac1bece6eb764d0b
9 | # bin: style tweaks
10 | cb8eda531dad92bec9293c89f93db9b581245fd3
11 | # chore(bintree): removed useless ``if True:``
12 | a83507be7ce04d3ac421f9cbe8b63816809b0f4e
13 | # */*: rerun black w/ 23.1.0
14 | 4ceb199aab8035fdf2ebd244e213ca63c29b4d5f
15 | # */*: rerun black w/ 24.1.0
16 | 3d55e159c473075c7b2f87c92293b0df6fa57563
17 |
--------------------------------------------------------------------------------
/lib/portage/elog/filtering.py:
--------------------------------------------------------------------------------
1 | # elog/messages.py - elog core functions
2 | # Copyright 2006-2010 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 |
6 | def filter_loglevels(logentries, loglevels):
7 | # remove unwanted entries from all logentries
8 | rValue = {}
9 | loglevels = [x.upper() for x in loglevels]
10 | for phase in logentries:
11 | for msgtype, msgcontent in logentries[phase]:
12 | if msgtype.upper() in loglevels or "*" in loglevels:
13 | if phase not in rValue:
14 | rValue[phase] = []
15 | rValue[phase].append((msgtype, msgcontent))
16 | return rValue
17 |
--------------------------------------------------------------------------------
/man/meson.build:
--------------------------------------------------------------------------------
1 | man_pages_out = []
2 | man_pages_in = [
3 | 'color.map.5',
4 | 'dispatch-conf.1',
5 | 'ebuild.1',
6 | 'ebuild.5',
7 | 'egencache.1',
8 | 'emaint.1',
9 | 'emerge.1',
10 | 'emirrordist.1',
11 | 'env-update.1',
12 | 'etc-update.1',
13 | 'fixpackages.1',
14 | 'glsa-check.1',
15 | 'make.conf.5',
16 | 'portage.5',
17 | 'quickpkg.1',
18 | 'xpak.5',
19 | ]
20 |
21 | foreach man_page : man_pages_in
22 | man_pages_out += configure_file(
23 | input : man_page,
24 | output : man_page,
25 | configuration : conf_data
26 | )
27 | endforeach
28 |
29 | install_man(man_pages_out)
30 |
31 | subdir('ru')
32 |
--------------------------------------------------------------------------------
/lib/portage/cache/index/IndexStreamIterator.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 |
5 | class IndexStreamIterator:
6 | def __init__(self, f, parser):
7 | self.parser = parser
8 | self._file = f
9 |
10 | def close(self):
11 | if self._file is not None:
12 | self._file.close()
13 | self._file = None
14 |
15 | def __iter__(self):
16 | try:
17 | for line in self._file:
18 | node = self.parser(line)
19 | if node is not None:
20 | yield node
21 |
22 | finally:
23 | self.close()
24 |
--------------------------------------------------------------------------------
/bin/ebuild-pyhelper:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2010-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | export __PORTAGE_HELPER_CWD=${PWD}
6 |
7 | if [[ ${0##*/} == "ebuild-pyhelper" ]]; then
8 | echo "ebuild-pyhelper: must be called via symlink" &>2
9 | exit 1
10 | fi
11 |
12 | # Use safe cwd, avoiding unsafe import for bug #469338.
13 | cd "${PORTAGE_PYM_PATH}" || exit 1
14 | for path in "${PORTAGE_BIN_PATH:?}/${0##*/}"{.py,}; do
15 | if [[ -x "${path}" ]]; then
16 | PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
17 | exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}" "$@"
18 | fi
19 | done
20 | echo "File not found: ${path}" >&2
21 | exit 127
22 |
--------------------------------------------------------------------------------
/lib/_emerge/ProgressHandler.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2009 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import time
5 |
6 |
7 | class ProgressHandler:
8 | def __init__(self):
9 | self.curval = 0
10 | self.maxval = 0
11 | self._last_update = 0
12 | self.min_latency = 0.2
13 |
14 | def onProgress(self, maxval, curval):
15 | self.maxval = maxval
16 | self.curval = curval
17 | cur_time = time.time()
18 | if cur_time - self._last_update >= self.min_latency:
19 | self._last_update = cur_time
20 | self.display()
21 |
22 | def display(self):
23 | raise NotImplementedError(self)
24 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/fowners:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2024 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_prefix_variables; then
8 | ED=${D}
9 | fi
10 |
11 | args=()
12 | got_owner=
13 | for arg; do
14 | if [[ ${arg} == -* ]]; then
15 | args+=( "${arg}" )
16 | elif [[ ! ${got_owner} ]]; then
17 | # the first non-option is the owner and must not be prefixed
18 | got_owner=1
19 | args+=( "${arg}" )
20 | else
21 | args+=( "${ED%/}/${arg#/}" )
22 | fi
23 | done
24 |
25 | chown "${args[@]}"
26 | ret=$?
27 |
28 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
29 | exit ${ret}
30 |
--------------------------------------------------------------------------------
/lib/portage/dbapi/DummyTree.py:
--------------------------------------------------------------------------------
1 | # Copyright 2015 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 |
5 | class DummyTree:
6 | """
7 | Most internal code only accesses the "dbapi" attribute of the
8 | binarytree, portagetree, and vartree classes. DummyTree is useful
9 | in cases where alternative dbapi implementations (or wrappers that
10 | modify or extend behavior of existing dbapi implementations) are
11 | needed, since it allows these implementations to be exposed through
12 | an interface which is minimally compatible with the *tree classes.
13 | """
14 |
15 | __slots__ = ("dbapi",)
16 |
17 | def __init__(self, dbapi):
18 | self.dbapi = dbapi
19 |
--------------------------------------------------------------------------------
/bin/emirrordist:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright 2013-2014 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | import signal
6 | import sys
7 |
8 | import portage
9 |
10 | portage._internal_caller = True
11 | portage._disable_legacy_globals()
12 | from portage._emirrordist.main import emirrordist_main
13 | from portage.util._eventloop.global_event_loop import global_event_loop
14 |
15 | if __name__ == "__main__":
16 |
17 | def debug_signal(_signum, _frame):
18 | import pdb
19 |
20 | pdb.set_trace()
21 |
22 | signal.signal(signal.SIGUSR1, debug_signal)
23 |
24 | try:
25 | sys.exit(emirrordist_main(sys.argv[1:]))
26 | finally:
27 | global_event_loop().close()
28 |
--------------------------------------------------------------------------------
/lib/portage/util/_async/TaskScheduler.py:
--------------------------------------------------------------------------------
1 | # Copyright 2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from .AsyncScheduler import AsyncScheduler
5 |
6 |
7 | class TaskScheduler(AsyncScheduler):
8 | """
9 | A simple way to handle scheduling of AbstractPollTask instances. Simply
10 | pass a task iterator into the constructor and call start(). Use the
11 | poll, wait, or addExitListener methods to be notified when all of the
12 | tasks have completed.
13 | """
14 |
15 | def __init__(self, task_iter, **kwargs):
16 | AsyncScheduler.__init__(self, **kwargs)
17 | self._task_iter = task_iter
18 |
19 | def _next_task(self):
20 | return next(self._task_iter)
21 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/doheader:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_doheader; then
8 | die "${0##*/} is not supported in EAPI ${EAPI}"
9 | fi
10 |
11 | if [[ $# -lt 1 ]] || [[ $1 == -r && $# -lt 2 ]] ; then
12 | __helpers_die "${0##*/}: at least one argument needed"
13 | exit 1
14 | fi
15 |
16 | export __E_INSDESTTREE='/usr/include/'
17 | if ___eapi_has_DESTTREE_INSDESTTREE; then
18 | export INSDESTTREE=${__E_INSDESTTREE}
19 | fi
20 |
21 | if ! ___eapi_doheader_respects_insopts; then
22 | export INSOPTIONS=-m0644
23 | export DIROPTIONS=""
24 | fi
25 |
26 | exec doins "$@"
27 |
--------------------------------------------------------------------------------
/cnf/repos.conf:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | main-repo = gentoo
3 |
4 | [gentoo]
5 | location = /var/db/repos/gentoo
6 | sync-type = rsync
7 | sync-uri = rsync://rsync.gentoo.org/gentoo-portage
8 | auto-sync = yes
9 | sync-rsync-verify-jobs = 1
10 | sync-rsync-verify-metamanifest = yes
11 | sync-rsync-verify-max-age = 3
12 | sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
13 | sync-openpgp-keyserver = hkps://keys.gentoo.org
14 | sync-openpgp-key-refresh-retry-count = 40
15 | sync-openpgp-key-refresh-retry-overall-timeout = 1200
16 | sync-openpgp-key-refresh-retry-delay-exp-base = 2
17 | sync-openpgp-key-refresh-retry-delay-max = 60
18 | sync-openpgp-key-refresh-retry-delay-mult = 4
19 | sync-webrsync-verify-signature = yes
20 | sync-git-verify-commit-signature = true
21 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/bsd/sed:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2007-2015 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | scriptpath=${BASH_SOURCE[0]}
6 | scriptname=${scriptpath##*/}
7 |
8 | if [[ sed == ${scriptname} && -n ${ESED} ]]; then
9 | exec ${ESED} "$@"
10 | elif type -P g${scriptname} > /dev/null ; then
11 | exec g${scriptname} "$@"
12 | else
13 | old_IFS="${IFS}"
14 | IFS=":"
15 |
16 | for path in ${PATH}; do
17 | if [[ -x ${path}/${scriptname} ]]; then
18 | [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
19 | [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
20 |
21 | exec "${path}/${scriptname}" "$@"
22 | exit 0
23 | fi
24 | done
25 |
26 | IFS="${old_IFS}"
27 | fi
28 |
29 | exit 1
30 |
--------------------------------------------------------------------------------
/cnf/make.conf.example.s390.diff:
--------------------------------------------------------------------------------
1 | --- make.conf.example
2 | +++ make.conf.example
3 | @@ -22,6 +22,13 @@
4 | # Example:
5 | #USE="X gtk gnome -alsa"
6 |
7 | +# Host Setting
8 | +# ============
9 | +#
10 | +# All s390 systems should use this host setting:
11 | +
12 | +CHOST="s390-ibm-linux-gnu"
13 | +
14 | # Host and optimization settings
15 | # ==============================
16 | #
17 | @@ -76,7 +83,7 @@
18 | # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
19 | # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
20 | #
21 | -#ACCEPT_KEYWORDS="~arch"
22 | +#ACCEPT_KEYWORDS="~s390"
23 |
24 | # ACCEPT_LICENSE is used to mask packages based on licensing restrictions.
25 | # It may contain both license and group names, where group names are
26 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dohtml:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2009-2024 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_dohtml; then
8 | die "'${0##*/}' has been banned for EAPI '${EAPI}'"
9 | exit 1
10 | fi
11 |
12 | # Use safe cwd, avoiding unsafe import for bug #469338.
13 | export __PORTAGE_HELPER_CWD=${PWD}
14 | cd "${PORTAGE_PYM_PATH}" || die
15 | PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
16 | "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/dohtml.py" "$@"
17 |
18 | ret=$?
19 | # Restore cwd for display by __helpers_die
20 | cd "${__PORTAGE_HELPER_CWD}"
21 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
22 | exit ${ret}
23 |
--------------------------------------------------------------------------------
/cnf/make.conf.example.ia64.diff:
--------------------------------------------------------------------------------
1 | --- make.conf.example
2 | +++ make.conf.example
3 | @@ -22,6 +22,13 @@
4 | # Example:
5 | #USE="X gtk gnome -alsa"
6 |
7 | +# Host Setting
8 | +# ============
9 | +#
10 | +# All Itanium systems should use this host setting:
11 | +
12 | +CHOST="ia64-unknown-linux-gnu"
13 | +
14 | # Host and optimization settings
15 | # ==============================
16 | #
17 | @@ -76,7 +83,7 @@
18 | # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
19 | # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
20 | #
21 | -#ACCEPT_KEYWORDS="~arch"
22 | +#ACCEPT_KEYWORDS="~ia64"
23 |
24 | # ACCEPT_LICENSE is used to mask packages based on licensing restrictions.
25 | # It may contain both license and group names, where group names are
26 |
--------------------------------------------------------------------------------
/lib/_emerge/EbuildSpawnProcess.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010-2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from _emerge.AbstractEbuildProcess import AbstractEbuildProcess
5 |
6 |
7 | class EbuildSpawnProcess(AbstractEbuildProcess):
8 | """
9 | Used by doebuild.spawn() to manage the spawned process.
10 | """
11 |
12 | _spawn_kwarg_names = AbstractEbuildProcess._spawn_kwarg_names + ("fakeroot_state",)
13 |
14 | __slots__ = ("fakeroot_state", "spawn_func")
15 |
16 | def _spawn(self, args, **kwargs):
17 | env = self.settings.environ()
18 |
19 | if self._dummy_pipe_fd is not None:
20 | env["PORTAGE_PIPE_FD"] = str(self._dummy_pipe_fd)
21 |
22 | return self.spawn_func(args, env=env, **kwargs)
23 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/fperms:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2024 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_prefix_variables; then
8 | ED=${D}
9 | fi
10 |
11 | args=()
12 | got_mode=
13 | for arg; do
14 | # - can either be an option or a mode string
15 | if [[ ${arg} == -* && ${arg} != -[ugorwxXst] ]]; then
16 | args+=( "${arg}" )
17 | elif [[ ! ${got_mode} ]]; then
18 | # the first non-option is the mode and must not be prefixed
19 | got_mode=1
20 | args+=( "${arg}" )
21 | else
22 | args+=( "${ED%/}/${arg#/}" )
23 | fi
24 | done
25 |
26 | chmod "${args[@]}"
27 | ret=$?
28 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
29 | exit ${ret}
30 |
--------------------------------------------------------------------------------
/lib/_emerge/PackageArg.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2011 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from _emerge.DependencyArg import DependencyArg
5 | from _emerge.Package import Package
6 | import portage
7 | from portage._sets.base import InternalPackageSet
8 | from portage.dep import _repo_separator
9 |
10 |
11 | class PackageArg(DependencyArg):
12 | def __init__(self, package=None, **kwargs):
13 | DependencyArg.__init__(self, **kwargs)
14 | self.package = package
15 | atom = "=" + package.cpv
16 | if package.repo != Package.UNKNOWN_REPO:
17 | atom += _repo_separator + package.repo
18 | self.atom = portage.dep.Atom(atom, allow_repo=True)
19 | self.pset = InternalPackageSet(initial_atoms=(self.atom,), allow_repo=True)
20 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/test_stackLists.py:
--------------------------------------------------------------------------------
1 | # test_stackLists.py -- Portage Unit Testing Functionality
2 | # Copyright 2006-2012 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 | from portage.util import stack_lists
7 |
8 |
9 | class StackListsTestCase(TestCase):
10 | def testStackLists(self):
11 | tests = [
12 | ([["a", "b", "c"], ["d", "e", "f"]], ["a", "c", "b", "e", "d", "f"], False),
13 | ([["a", "x"], ["b", "x"]], ["a", "x", "b"], False),
14 | ([["a", "b", "c"], ["-*"]], [], True),
15 | ([["a"], ["-a"]], [], True),
16 | ]
17 |
18 | for test in tests:
19 | result = stack_lists(test[0], test[2])
20 | self.assertEqual(set(result), set(test[1]))
21 |
--------------------------------------------------------------------------------
/lib/portage/sync/getaddrinfo_validate.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010-2020 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 |
5 | def getaddrinfo_validate(addrinfos):
6 | """
7 | Validate structures returned from getaddrinfo(),
8 | since they may be corrupt, especially when python
9 | has IPv6 support disabled (bug #340899).
10 | """
11 | valid_addrinfos = []
12 | for addrinfo in addrinfos:
13 | try:
14 | if len(addrinfo) != 5:
15 | continue
16 | if len(addrinfo[4]) < 2:
17 | continue
18 | if not isinstance(addrinfo[4][0], str):
19 | continue
20 | except TypeError:
21 | continue
22 |
23 | valid_addrinfos.append(addrinfo)
24 |
25 | return valid_addrinfos
26 |
--------------------------------------------------------------------------------
/lib/portage/util/_path.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import stat
5 |
6 | from portage import os
7 | from portage.exception import PermissionDenied
8 |
9 |
10 | def exists_raise_eaccess(path):
11 | try:
12 | os.stat(path)
13 | except OSError as e:
14 | if e.errno == PermissionDenied.errno:
15 | raise PermissionDenied(f"stat('{path}')")
16 | return False
17 | else:
18 | return True
19 |
20 |
21 | def isdir_raise_eaccess(path):
22 | try:
23 | st = os.stat(path)
24 | except OSError as e:
25 | if e.errno == PermissionDenied.errno:
26 | raise PermissionDenied(f"stat('{path}')")
27 | return False
28 | else:
29 | return stat.S_ISDIR(st.st_mode)
30 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/60systemd:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # QA checks for systemd units.
4 |
5 | systemd_check() {
6 | local systemddir f
7 |
8 | # Common mistakes in systemd service files.
9 | if type -P pkg-config >/dev/null && pkg-config --exists systemd; then
10 | systemddir=$(pkg-config --variable=systemdsystemunitdir systemd)
11 | else
12 | systemddir=/usr/lib/systemd/system
13 | fi
14 | if [[ -d ${ED%/}${systemddir} ]]; then
15 | f=$(grep -sH '^EnvironmentFile.*=.*/etc/conf\.d' "${ED%/}${systemddir}"/*.service)
16 | if [[ -n ${f} ]] ; then
17 | eqawarn "QA Notice: systemd units using /etc/conf.d detected:"
18 | eqawarn "${f//${D}}"
19 | eqawarn "See: https://wiki.gentoo.org/wiki/Project:Systemd/conf.d_files"
20 | fi
21 | fi
22 | }
23 |
24 | systemd_check
25 | : # guarantee successful exit
26 |
27 | # vim:ft=bash
28 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/90cmake-warnings:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # Check for CMake invalid option warnings
4 |
5 | cmake_warn_check() {
6 | if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then
7 | local cat=cat
8 | [[ ${PORTAGE_LOG_FILE} == *.gz ]] && cat=zcat
9 |
10 | local vars=()
11 | while read -r l; do
12 | vars+=( "${l}" )
13 | done < <( "${cat}" "${PORTAGE_LOG_FILE}" \
14 | | sed -n -e '/Manually-specified variables were not used by the project/,/^--/{/^ /p}' \
15 | | LC_ALL=C sort -u)
16 |
17 | if [[ ${vars} ]]; then
18 | eqawarn "QA Notice: One or more CMake variables were not used by the project:"
19 | local v
20 | for v in "${vars[@]}"; do
21 | eqawarn " ${v}"
22 | done
23 | fi
24 | fi
25 | }
26 |
27 | cmake_warn_check
28 | : # guarantee successful exit
29 |
30 | # vim:ft=bash
31 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/doinfo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if [[ -z $1 ]] ; then
8 | __helpers_die "${0##*/}: at least one argument needed"
9 | exit 1
10 | fi
11 |
12 | if ! ___eapi_has_prefix_variables; then
13 | ED=${D}
14 | fi
15 |
16 | if [[ ! -d ${ED%/}/usr/share/info ]] ; then
17 | install -d "${ED%/}/usr/share/info" || { __helpers_die "${0##*/}: failed to install ${ED%/}/usr/share/info"; exit 1; }
18 | fi
19 |
20 | install -m0644 "$@" "${ED%/}/usr/share/info"
21 | rval=$?
22 | if [ ${rval} -ne 0 ] ; then
23 | for x in "$@" ; do
24 | [ -e "${x}" ] || echo "!!! ${0##*/}: ${x} does not exist" 1>&2
25 | done
26 | __helpers_die "${0##*/} failed"
27 | fi
28 | exit ${rval}
29 |
--------------------------------------------------------------------------------
/cnf/make.conf.example.sparc-fbsd.diff:
--------------------------------------------------------------------------------
1 | --- make.conf.example
2 | +++ make.conf.example
3 | @@ -22,6 +22,13 @@
4 | # Example:
5 | #USE="X gtk gnome -alsa"
6 |
7 | +# Host Setting
8 | +# ============
9 | +#
10 | +# The version number at the end has to correspond to the version of the
11 | +# profile and of freebsd-lib package.
12 | +CHOST="sparc64-gentoo-freebsd6.2"
13 | +
14 | # Host and optimization settings
15 | # ==============================
16 | #
17 | @@ -76,7 +83,7 @@
18 | # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
19 | # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
20 | #
21 | -#ACCEPT_KEYWORDS="~arch"
22 | +ACCEPT_KEYWORDS="~sparc-fbsd"
23 |
24 | # ACCEPT_LICENSE is used to mask packages based on licensing restrictions.
25 | # It may contain both license and group names, where group names are
26 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/60pngfix:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # Check for issues with PNG files
4 |
5 | pngfix_check() {
6 | local pngfix=$(type -P pngfix)
7 |
8 | if [[ -n ${pngfix} ]] ; then
9 | local pngout=()
10 | local next
11 |
12 | while read -r -a pngout ; do
13 | local error=""
14 |
15 | case "${pngout[1]}" in
16 | CHK)
17 | error='invalid checksum'
18 | ;;
19 | TFB)
20 | error='broken IDAT window length'
21 | ;;
22 | esac
23 |
24 | if [[ -n ${error} ]] ; then
25 | if [[ -z ${next} ]] ; then
26 | eqawarn "QA Notice: broken .png files found:"
27 | next=1
28 | fi
29 | eqawarn " ${pngout[@]:7}: ${error}"
30 | fi
31 | done < <(find "${ED}" -type f -name '*.png' -print0 | ___parallel "${pngfix}")
32 | fi
33 | }
34 |
35 | pngfix_check
36 | : # guarantee successful exit
37 |
38 | # vim:ft=bash
39 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/test_extended_atom_dict.py:
--------------------------------------------------------------------------------
1 | # test_isvalidatom.py -- Portage Unit Testing Functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 | from portage.dep import ExtendedAtomDict
7 |
8 |
9 | class TestExtendedAtomDict(TestCase):
10 | def testExtendedAtomDict(self):
11 | d = ExtendedAtomDict(dict)
12 | d["*/*"] = {"test1": "x"}
13 | d["dev-libs/*"] = {"test2": "y"}
14 | d.setdefault("sys-apps/portage", {})["test3"] = "z"
15 | self.assertEqual(d.get("dev-libs/A"), {"test1": "x", "test2": "y"})
16 | self.assertEqual(d.get("sys-apps/portage"), {"test1": "x", "test3": "z"})
17 | self.assertEqual(d["dev-libs/*"], {"test2": "y"})
18 | self.assertEqual(d["sys-apps/portage"], {"test1": "x", "test3": "z"})
19 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_config/env_var_validation.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage import os
5 | from portage.process import find_binary
6 | import shlex
7 |
8 |
9 | def validate_cmd_var(v):
10 | """
11 | Validate an environment variable value to see if it
12 | contains an executable command as the first token.
13 | returns (valid, token_list) where 'valid' is boolean and 'token_list'
14 | is the (possibly empty) list of tokens split by shlex.
15 | """
16 | invalid = False
17 | v_split = shlex.split(v)
18 | if not v_split:
19 | invalid = True
20 | elif os.path.isabs(v_split[0]):
21 | invalid = not os.access(v_split[0], os.EX_OK)
22 | elif find_binary(v_split[0]) is None:
23 | invalid = True
24 | return (not invalid, v_split)
25 |
--------------------------------------------------------------------------------
/lib/portage/emaint/defaults.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | # parser option data
5 | CHECK = {
6 | "short": "-c",
7 | "long": "--check",
8 | "help": "Check for problems (a default option for most modules)",
9 | "status": "Checking %s for problems",
10 | "action": "store_true",
11 | "func": "check",
12 | }
13 |
14 | FIX = {
15 | "short": "-f",
16 | "long": "--fix",
17 | "help": "Attempt to fix problems (a default option for most modules)",
18 | "status": "Attempting to fix %s",
19 | "action": "store_true",
20 | "func": "fix",
21 | }
22 |
23 | VERSION = {
24 | "long": "--version",
25 | "help": "show program's version number and exit",
26 | "action": "store_true",
27 | }
28 |
29 | # parser options
30 | DEFAULT_OPTIONS = {"check": CHECK, "fix": FIX, "version": VERSION}
31 |
--------------------------------------------------------------------------------
/lib/_emerge/is_valid_package_atom.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import re
5 | from portage.dep import isvalidatom
6 |
7 |
8 | def insert_category_into_atom(atom, category):
9 | # Handle '*' character for "extended syntax" wildcard support.
10 | alphanum = re.search(r"[\*\w]", atom, re.ASCII)
11 | if alphanum:
12 | ret = atom[: alphanum.start()] + f"{category}/" + atom[alphanum.start() :]
13 | else:
14 | ret = None
15 | return ret
16 |
17 |
18 | def is_valid_package_atom(x, allow_repo=False, allow_build_id=True):
19 | if "/" not in x.split(":")[0]:
20 | x2 = insert_category_into_atom(x, "cat")
21 | if x2 is not None:
22 | x = x2
23 | return isvalidatom(
24 | x, allow_blockers=False, allow_repo=allow_repo, allow_build_id=allow_build_id
25 | )
26 |
--------------------------------------------------------------------------------
/.builds/setup-python.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Maintainer: Oskari Pirhonen
3 |
4 | set -ex
5 |
6 | install_versions=( "${@/#/python}" )
7 | # Fix any pypy versions
8 | install_versions=( "${install_versions[@]/#pythonpypy/pypy}" )
9 |
10 | sudo apt-get install -y --no-install-recommends \
11 | python-is-python3 \
12 | python3-dev \
13 | python3-venv \
14 | "${install_versions[@]}" \
15 | "${install_versions[@]/%/-dev}" \
16 | "${install_versions[@]/%/-venv}"
17 |
18 | for py in "$@"; do
19 | if [[ "$py" != pypy* ]]; then
20 | "python$py" -m venv ".venv-$py"
21 | else
22 | "$py" -m venv ".venv-$py"
23 | fi
24 | source ".venv-$py/bin/activate"
25 | pip install --upgrade pip
26 | deactivate
27 | done
28 |
29 | python -m venv .venv
30 | source .venv/bin/activate
31 | pip install --upgrade pip
32 | deactivate
33 |
--------------------------------------------------------------------------------
/lib/portage/util/bin_entry_point.py:
--------------------------------------------------------------------------------
1 | # Copyright 2021-2023 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | __all__ = ["bin_entry_point"]
5 |
6 | import sys
7 |
8 | from portage.const import PORTAGE_BIN_PATH
9 | from portage import os
10 |
11 |
12 | def bin_entry_point():
13 | """
14 | Adjust sys.argv[0] to point to a script in PORTAGE_BIN_PATH, and
15 | then execute the script, in order to implement entry_points when
16 | portage has been installed by pip.
17 | """
18 | script_path = os.path.join(PORTAGE_BIN_PATH, os.path.basename(sys.argv[0]))
19 | if os.access(script_path, os.X_OK):
20 | sys.argv = [
21 | sys.executable,
22 | script_path,
23 | ] + sys.argv[1:]
24 | os.execvp(sys.argv[0], sys.argv)
25 | else:
26 | print("File not found:", script_path, file=sys.stderr)
27 | return 127
28 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/test_soname_atom_pickle.py:
--------------------------------------------------------------------------------
1 | # Copyright 2020 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 |
5 | from portage.dep.soname.SonameAtom import SonameAtom
6 | from portage.tests import TestCase
7 | from portage.util.futures import asyncio
8 | from portage.util.futures.executor.fork import ForkExecutor
9 |
10 |
11 | class TestSonameAtomPickle(TestCase):
12 | _ALL_PROVIDES = frozenset([SonameAtom("x86_64", "libc.so.6")])
13 |
14 | def test_soname_atom_pickle(self):
15 | loop = asyncio._wrap_loop()
16 | with ForkExecutor(loop=loop) as executor:
17 | result = loop.run_until_complete(
18 | loop.run_in_executor(executor, self._get_all_provides)
19 | )
20 | self.assertEqual(self._ALL_PROVIDES, result)
21 |
22 | @classmethod
23 | def _get_all_provides(cls):
24 | return cls._ALL_PROVIDES
25 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/asyncio/test_run_until_complete.py:
--------------------------------------------------------------------------------
1 | # Copyright 2018-2025 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.tests import TestCase
5 | from portage.util._eventloop.global_event_loop import global_event_loop
6 |
7 |
8 | class RunUntilCompleteTestCase(TestCase):
9 | def test_add_done_callback(self):
10 | loop = global_event_loop()
11 | f1 = loop.create_future()
12 | f2 = loop.create_future()
13 | f1.add_done_callback(f2.set_result)
14 | loop.call_soon(lambda: f1.set_result(None))
15 | loop.run_until_complete(f1)
16 | self.assertEqual(f1.done(), True)
17 |
18 | # This proves that done callbacks of f1 are executed before
19 | # loop.run_until_complete(f1) returns, which is how asyncio's
20 | # default event loop behaves.
21 | self.assertEqual(f2.done(), True)
22 |
--------------------------------------------------------------------------------
/lib/_emerge/EbuildProcess.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2025 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from _emerge.AbstractEbuildProcess import AbstractEbuildProcess
5 |
6 |
7 | class EbuildProcess(AbstractEbuildProcess):
8 | __slots__ = ("actionmap",)
9 |
10 | def _spawn(self, args, **kwargs):
11 | from portage.package.ebuild.doebuild import _doebuild_spawn, _spawn_actionmap
12 |
13 | actionmap = self.actionmap
14 | if actionmap is None:
15 | actionmap = _spawn_actionmap(self.settings)
16 |
17 | if self._dummy_pipe_fd is not None:
18 | self.settings["PORTAGE_PIPE_FD"] = str(self._dummy_pipe_fd)
19 |
20 | try:
21 | return _doebuild_spawn(
22 | self.phase, self.settings, actionmap=actionmap, **kwargs
23 | )
24 | finally:
25 | self.settings.pop("PORTAGE_PIPE_FD", None)
26 |
--------------------------------------------------------------------------------
/lib/portage/cache/volatile.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2011 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import copy
5 | from portage.cache import template
6 |
7 |
8 | class database(template.database):
9 | autocommits = True
10 | serialize_eclasses = False
11 | store_eclass_paths = False
12 |
13 | def __init__(self, *args, **config):
14 | config.pop("gid", None)
15 | config.pop("perms", None)
16 | super().__init__(*args, **config)
17 | self._data = {}
18 | self._delitem = self._data.__delitem__
19 |
20 | def _setitem(self, name, values):
21 | self._data[name] = copy.deepcopy(values)
22 |
23 | def __getitem__(self, cpv):
24 | return copy.deepcopy(self._data[cpv])
25 |
26 | def __iter__(self):
27 | return iter(self._data)
28 |
29 | def __contains__(self, key):
30 | return key in self._data
31 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_atomic_ofstream.py',
4 | 'test_checksum.py',
5 | 'test_digraph.py',
6 | 'test_file_copier.py',
7 | 'test_getconfig.py',
8 | 'test_grabdict.py',
9 | 'test_install_mask.py',
10 | 'test_manifest.py',
11 | 'test_mtimedb.py',
12 | 'test_normalizedPath.py',
13 | 'test_shelve.py',
14 | 'test_socks5.py',
15 | 'test_stackDictList.py',
16 | 'test_stackDicts.py',
17 | 'test_stackLists.py',
18 | 'test_uniqueArray.py',
19 | 'test_varExpand.py',
20 | 'test_whirlpool.py',
21 | 'test_xattr.py',
22 | '__init__.py',
23 | '__test__.py',
24 | ],
25 | subdir : 'portage/tests/util',
26 | pure : not native_extensions
27 | )
28 |
29 | subdir('dyn_libs')
30 | subdir('eventloop')
31 | subdir('file_copy')
32 | subdir('futures')
33 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/shell/test_shell.py:
--------------------------------------------------------------------------------
1 | # testCommandOututSet.py -- Portage Unit Testing Functionality
2 | # Copyright 2007-2024 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.process import find_binary
6 | from portage.tests import TestCase, test_cps
7 | from portage._sets.shell import CommandOutputSet
8 |
9 |
10 | class CommandOutputSetTestCase(TestCase):
11 | """Simple Test Case for CommandOutputSet"""
12 |
13 | def setUp(self):
14 | super().setUp()
15 |
16 | def tearDown(self):
17 | pass
18 |
19 | def testCommand(self):
20 | params = set(test_cps)
21 | command = find_binary("bash")
22 | command += " -c '"
23 | for a in params:
24 | command += f' echo -e "{a}" ; '
25 | command += "'"
26 | s = CommandOutputSet(command)
27 | atoms = s.getAtoms()
28 | self.assertEqual(atoms, params)
29 |
--------------------------------------------------------------------------------
/lib/portage/util/_async/FileDigester.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013-2023 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import functools
5 |
6 | from portage.checksum import perform_multiple_checksums
7 | from portage.util._async.AsyncFunction import AsyncFunction
8 |
9 |
10 | class FileDigester(AsyncFunction):
11 | """
12 | Asynchronously generate file digests. Pass in file_path and
13 | hash_names, and after successful execution, the digests
14 | attribute will be a dict containing all of the requested
15 | digests.
16 | """
17 |
18 | __slots__ = (
19 | "file_path",
20 | "hash_names",
21 | )
22 |
23 | def _start(self):
24 | self.target = functools.partial(
25 | perform_multiple_checksums, self.file_path, hashes=self.hash_names
26 | )
27 | super()._start()
28 |
29 | @property
30 | def digests(self):
31 | return self.result
32 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/test_stackDictList.py:
--------------------------------------------------------------------------------
1 | # test_stackDictList.py -- Portage Unit Testing Functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 |
7 |
8 | class StackDictListTestCase(TestCase):
9 | def testStackDictList(self):
10 | from portage.util import stack_dictlist
11 |
12 | tests = [
13 | ({"a": "b"}, {"x": "y"}, False, {"a": ["b"], "x": ["y"]}),
14 | ({"KEYWORDS": ["alpha", "x86"]}, {"KEYWORDS": ["-*"]}, True, {}),
15 | (
16 | {"KEYWORDS": ["alpha", "x86"]},
17 | {"KEYWORDS": ["-x86"]},
18 | True,
19 | {"KEYWORDS": ["alpha"]},
20 | ),
21 | ]
22 | for test in tests:
23 | self.assertEqual(
24 | stack_dictlist([test[0], test[1]], incremental=test[2]), test[3]
25 | )
26 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'test_atom.py',
4 | 'test_check_required_use.py',
5 | 'test_extended_atom_dict.py',
6 | 'test_extract_affecting_use.py',
7 | 'test_standalone.py',
8 | 'test_best_match_to_list.py',
9 | 'test_dep_getcpv.py',
10 | 'test_dep_getrepo.py',
11 | 'test_dep_getslot.py',
12 | 'test_dep_getusedeps.py',
13 | 'test_dnf_convert.py',
14 | 'test_get_operator.py',
15 | 'test_get_required_use_flags.py',
16 | 'test_isjustname.py',
17 | 'test_isvalidatom.py',
18 | 'test_libc.py',
19 | 'test_match_from_list.py',
20 | 'test_overlap_dnf.py',
21 | 'test_paren_reduce.py',
22 | 'test_soname_atom_pickle.py',
23 | 'test_use_reduce.py',
24 | '__init__.py',
25 | '__test__.py',
26 | ],
27 | subdir : 'portage/tests/dep',
28 | pure : not native_extensions
29 | )
30 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/config/test_PackageMaskFile.py:
--------------------------------------------------------------------------------
1 | # test_PackageMaskFile.py -- Portage Unit Testing Functionality
2 | # Copyright 2007-2020 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage import os
6 | from portage.env.config import PackageMaskFile
7 | from portage.tests import TestCase, test_cps
8 | from tempfile import mkstemp
9 |
10 |
11 | class PackageMaskFileTestCase(TestCase):
12 | def testPackageMaskFile(self):
13 | self.BuildFile()
14 | try:
15 | f = PackageMaskFile(self.fname)
16 | f.load()
17 | for atom in f:
18 | self.assertTrue(atom in test_cps)
19 | finally:
20 | self.NukeFile()
21 |
22 | def BuildFile(self):
23 | fd, self.fname = mkstemp()
24 | f = os.fdopen(fd, "w")
25 | f.write("\n".join(test_cps))
26 | f.close()
27 |
28 | def NukeFile(self):
29 | os.unlink(self.fname)
30 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/eventloop/test_call_soon_fifo.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017-2020 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import functools
5 | import random
6 |
7 | from portage.tests import TestCase
8 | from portage.util._eventloop.global_event_loop import global_event_loop
9 |
10 |
11 | class CallSoonFifoTestCase(TestCase):
12 | def testCallSoonFifo(self):
13 | event_loop = global_event_loop()
14 | inputs = [random.random() for index in range(10)]
15 | outputs = []
16 | finished = event_loop.create_future()
17 |
18 | def add_output(value):
19 | outputs.append(value)
20 | if len(outputs) == len(inputs):
21 | finished.set_result(True)
22 |
23 | for value in inputs:
24 | event_loop.call_soon(functools.partial(add_output, value))
25 |
26 | event_loop.run_until_complete(finished)
27 | self.assertEqual(inputs, outputs)
28 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/_ipc/ExitCommand.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.package.ebuild._ipc.IpcCommand import IpcCommand
5 |
6 |
7 | class ExitCommand(IpcCommand):
8 | __slots__ = (
9 | "exitcode",
10 | "reply_hook",
11 | )
12 |
13 | def __init__(self):
14 | IpcCommand.__init__(self)
15 | self.reply_hook = None
16 | self.exitcode = None
17 |
18 | def __call__(self, argv):
19 | if self.exitcode is not None:
20 | # Ignore all but the first call, since if die is called
21 | # then we certainly want to honor that exitcode, even
22 | # the ebuild process manages to send a second exit
23 | # command.
24 | self.reply_hook = None
25 | else:
26 | self.exitcode = int(argv[1])
27 |
28 | # (stdout, stderr, returncode)
29 | return ("", "", 0)
30 |
--------------------------------------------------------------------------------
/lib/portage/tests/dbapi/test_bintree_build_id.py:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.tests import TestCase
5 |
6 | from portage.dbapi.bintree import binarytree
7 |
8 |
9 | class BinarytreeBuildIdTestCase(TestCase):
10 | def testBinarytreeBuildId(self):
11 | cases = {
12 | "sec-keys/openpgp-keys-bzip2-20220406.gpkg.tar": -1,
13 | "sec-keys/openpgp-keys-bzip2/openpgp-keys-bzip2-20220406-1.gpkg.tar": 1,
14 | "sec-keys/openpgp-keys-bzip2-20220406.xpak": -1,
15 | "sec-keys/openpgp-keys-bzip2/openpgp-keys-bzip2-20220406-1.xpak": 1,
16 | }
17 | for filename, expected_build_id in cases.items():
18 | build_id = binarytree._parse_build_id(filename)
19 | self.assertEqual(
20 | build_id,
21 | expected_build_id,
22 | msg=f"Failed to parse build ID from '{filename}'",
23 | )
24 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/20runtime-directories:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # Check for directories that need to be created at runtime
4 |
5 | runtime_dir_check() {
6 | # It's ok to create these directories, but not to install into them. #493154
7 | # TODO: We should add var/lib to this list.
8 | local x f=
9 | for x in var/cache var/lock var/run var/tmp run ; do
10 | if [[ ! -L ${ED}/${x} && -d ${ED}/${x} ]] ; then
11 | if [[ -z $(find "${ED}/${x}" -prune -empty) ]] ; then
12 | f+=$(cd "${ED}"; find "${x}" -printf ' %p\n')
13 | fi
14 | fi
15 | done
16 | if [[ -n ${f} ]] ; then
17 | eqawarn "QA Notice: This ebuild installs into paths that should be created at runtime."
18 | eqawarn " To fix, simply do not install into these directories. Instead, your package"
19 | eqawarn " should create dirs on the fly at runtime as needed via init scripts/etc..."
20 | eqawarn
21 | eqawarn "${f}"
22 | fi
23 | }
24 |
25 | runtime_dir_check
26 | : # guarantee successful exit
27 |
28 | # vim:ft=bash
29 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/move/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2005-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | doc = """Perform package move updates for installed and binary packages."""
5 | __doc__ = doc
6 |
7 |
8 | module_spec = {
9 | "name": "move",
10 | "description": doc,
11 | "provides": {
12 | "module1": {
13 | "name": "moveinst",
14 | "sourcefile": "move",
15 | "class": "MoveInstalled",
16 | "description": doc,
17 | "options": ["check", "fix"],
18 | "functions": ["check", "fix"],
19 | "func_desc": {},
20 | },
21 | "module2": {
22 | "name": "movebin",
23 | "sourcefile": "move",
24 | "class": "MoveBinary",
25 | "description": "Perform package move updates for binary packages",
26 | "functions": ["check", "fix"],
27 | "func_desc": {},
28 | },
29 | },
30 | }
31 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/test_uniqueArray.py:
--------------------------------------------------------------------------------
1 | # test_uniqueArray.py -- Portage Unit Testing Functionality
2 | # Copyright 2006-2011 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage import os
6 | from portage.tests import TestCase
7 | from portage.util import unique_array
8 |
9 |
10 | class UniqueArrayTestCase(TestCase):
11 | def testUniqueArrayPass(self):
12 | """
13 | test portage.util.uniqueArray()
14 | """
15 |
16 | tests = [
17 | (["a", "a", "a", os, os, [], [], []], ["a", os, []]),
18 | ([1, 1, 1, 2, 3, 4, 4], [1, 2, 3, 4]),
19 | ]
20 |
21 | for test in tests:
22 | result = unique_array(test[0])
23 | for item in test[1]:
24 | number = result.count(item)
25 | self.assertFalse(
26 | number != 1,
27 | msg=f"{result} contains {number} of {item}, should be only 1",
28 | )
29 |
--------------------------------------------------------------------------------
/lib/_emerge/AbstractDepPriority.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2023 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import copy
5 | from portage.util.SlotObject import SlotObject
6 |
7 |
8 | class AbstractDepPriority(SlotObject):
9 | __slots__ = (
10 | "buildtime",
11 | "buildtime_slot_op",
12 | "installtime",
13 | "runtime",
14 | "runtime_post",
15 | "runtime_slot_op",
16 | )
17 |
18 | def __lt__(self, other):
19 | return self.__int__() < other
20 |
21 | def __le__(self, other):
22 | return self.__int__() <= other
23 |
24 | def __eq__(self, other):
25 | return self.__int__() == other
26 |
27 | def __ne__(self, other):
28 | return self.__int__() != other
29 |
30 | def __gt__(self, other):
31 | return self.__int__() > other
32 |
33 | def __ge__(self, other):
34 | return self.__int__() >= other
35 |
36 | def copy(self):
37 | return copy.copy(self)
38 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/files/test_static_file_set.py:
--------------------------------------------------------------------------------
1 | # testStaticFileSet.py -- Portage Unit Testing Functionality
2 | # Copyright 2007-2024 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | import tempfile
6 |
7 | from portage import os
8 | from portage.tests import TestCase, test_cps
9 | from portage._sets.files import StaticFileSet
10 |
11 |
12 | class StaticFileSetTestCase(TestCase):
13 | """Simple Test Case for StaticFileSet"""
14 |
15 | def setUp(self):
16 | super().setUp()
17 | fd, self.testfile = tempfile.mkstemp(
18 | suffix=".testdata", prefix=self.__class__.__name__, text=True
19 | )
20 | f = os.fdopen(fd, "w")
21 | f.write("\n".join(test_cps))
22 | f.close()
23 |
24 | def tearDown(self):
25 | os.unlink(self.testfile)
26 |
27 | def testSampleStaticFileSet(self):
28 | s = StaticFileSet(self.testfile)
29 | s.load()
30 | self.assertEqual(set(test_cps), s.getAtoms())
31 |
--------------------------------------------------------------------------------
/lib/_emerge/Dependency.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2012 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.util.SlotObject import SlotObject
5 | from _emerge.DepPriority import DepPriority
6 |
7 |
8 | class Dependency(SlotObject):
9 | __slots__ = (
10 | "atom",
11 | "blocker",
12 | "child",
13 | "depth",
14 | "parent",
15 | "onlydeps",
16 | "priority",
17 | "root",
18 | "want_update",
19 | "collapsed_parent",
20 | "collapsed_priority",
21 | )
22 |
23 | def __init__(self, **kwargs):
24 | SlotObject.__init__(self, **kwargs)
25 | if self.priority is None:
26 | self.priority = DepPriority()
27 | if self.depth is None:
28 | self.depth = 0
29 | if self.collapsed_parent is None:
30 | self.collapsed_parent = self.parent
31 | if self.collapsed_priority is None:
32 | self.collapsed_priority = self.priority
33 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dosed:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2018 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ! ___eapi_has_dosed; then
8 | die "'${0##*/}' has been banned for EAPI '${EAPI}'"
9 | exit 1
10 | fi
11 |
12 | if [[ $# -lt 1 ]] ; then
13 | echo "!!! ${0##*/}: at least one argument needed" >&2
14 | exit 1
15 | fi
16 |
17 | if ! ___eapi_has_prefix_variables; then
18 | ED=${D}
19 | fi
20 |
21 | ret=0
22 | file_found=0
23 | mysed="s:${ED}::g"
24 |
25 | for x in "$@" ; do
26 | y=${ED%/}/${x#/}
27 | if [ -e "${y}" ] ; then
28 | if [ -f "${y}" ] ; then
29 | file_found=1
30 | sed -i -e "${mysed}" "${y}"
31 | else
32 | echo "${y} is not a regular file!" >&2
33 | false
34 | fi
35 | ((ret|=$?))
36 | else
37 | mysed="${x}"
38 | fi
39 | done
40 |
41 | if [ ${file_found} = 0 ] ; then
42 | echo "!!! ${0##*/}: ${y} does not exist" 1>&2
43 | ((ret|=1))
44 | fi
45 |
46 | exit ${ret}
47 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dodoc:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if ___eapi_dodoc_supports_-r; then
8 | __PORTAGE_HELPER='dodoc' exec doins "$@"
9 | fi
10 |
11 | if [ $# -lt 1 ] ; then
12 | __helpers_die "${0##*/}: at least one argument needed"
13 | exit 1
14 | fi
15 |
16 | if ! ___eapi_has_prefix_variables; then
17 | ED=${D}
18 | fi
19 |
20 | dir="${ED%/}/usr/share/doc/${PF}/${__E_DOCDESTTREE#/}"
21 | if [ ! -d "${dir}" ] ; then
22 | install -d "${dir}"
23 | fi
24 |
25 | ret=0
26 | for x in "$@" ; do
27 | if [ -d "${x}" ] ; then
28 | eqawarn "QA Notice: dodoc argument '${x}' is a directory"
29 | elif [ -s "${x}" ] ; then
30 | install -m0644 "${x}" "${dir}" || { ((ret|=1)); continue; }
31 | elif [ ! -e "${x}" ] ; then
32 | echo "!!! ${0##*/}: ${x} does not exist" 1>&2
33 | ((ret|=1))
34 | fi
35 | done
36 |
37 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
38 | exit ${ret}
39 |
--------------------------------------------------------------------------------
/bin/lock-helper.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright 2010-2014 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | import os
6 | import sys
7 |
8 |
9 | def main(args):
10 | sys.path.insert(0, os.environ["PORTAGE_PYM_PATH"])
11 | import portage
12 |
13 | portage._internal_caller = True
14 | portage._disable_legacy_globals()
15 |
16 | if args and isinstance(args[0], bytes):
17 | for i, x in enumerate(args):
18 | args[i] = portage._unicode_decode(x, errors="strict")
19 |
20 | # Make locks quiet since unintended locking messages displayed on
21 | # stdout would corrupt the intended output of this program.
22 | portage.locks._quiet = True
23 | lock_obj = portage.locks.lockfile(args[0], wantnewlockfile=True)
24 | sys.stdout.write("\0")
25 | sys.stdout.flush()
26 | sys.stdin.read(1)
27 | portage.locks.unlockfile(lock_obj)
28 | return portage.os.EX_OK
29 |
30 |
31 | if __name__ == "__main__":
32 | rval = main(sys.argv[1:])
33 | sys.exit(rval)
34 |
--------------------------------------------------------------------------------
/cnf/make.conf.example.m68k.diff:
--------------------------------------------------------------------------------
1 | --- make.conf.example
2 | +++ make.conf.example
3 | @@ -22,6 +22,13 @@
4 | # Example:
5 | #USE="X gtk gnome -alsa"
6 |
7 | +# Host Setting
8 | +# ============
9 | +#
10 | +# m68k-unknown-linux-gnu for all m68k CPUs.
11 | +#
12 | +CHOST="m68k-unknown-linux-gnu"
13 | +
14 | # Host and optimization settings
15 | # ==============================
16 | #
17 | @@ -41,7 +48,7 @@
18 | #
19 | # Please refer to the GCC manual for a list of possible values.
20 | #
21 | -#CFLAGS="-O2 -pipe"
22 | +#CFLAGS="-m68030 -pipe -Os"
23 | #
24 | # If you set a CFLAGS above, then this line will set your default C++ flags to
25 | # the same settings.
26 | @@ -76,7 +83,7 @@
27 | # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
28 | # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
29 | #
30 | -#ACCEPT_KEYWORDS="~arch"
31 | +#ACCEPT_KEYWORDS="~m68k"
32 |
33 | # ACCEPT_LICENSE is used to mask packages based on licensing restrictions.
34 | # It may contain both license and group names, where group names are
35 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/test_dep_getslot.py:
--------------------------------------------------------------------------------
1 | # test_dep_getslot.py -- Portage Unit Testing Functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 | from portage.dep import dep_getslot
7 |
8 |
9 | class DepGetSlot(TestCase):
10 | """A simple testcase for isvalidatom"""
11 |
12 | def testDepGetSlot(self):
13 | slot_char = ":"
14 | slots = ("a", "1.2", "1", "IloveVapier", None)
15 | cpvs = ["sys-apps/portage"]
16 | versions = ["2.1.1", "2.1-r1"]
17 | for cpv in cpvs:
18 | for version in versions:
19 | for slot in slots:
20 | mycpv = cpv
21 | if version:
22 | mycpv = "=" + mycpv + "-" + version
23 | if slot is not None:
24 | self.assertEqual(dep_getslot(mycpv + slot_char + slot), slot)
25 | else:
26 | self.assertEqual(dep_getslot(mycpv), slot)
27 |
--------------------------------------------------------------------------------
/bin/chmod-lite.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright 2015 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | import os
6 | import sys
7 |
8 | from portage.util import apply_recursive_permissions
9 |
10 | # Change back to original cwd _after_ all imports (bug #469338).
11 | os.chdir(os.environ["__PORTAGE_HELPER_CWD"])
12 |
13 |
14 | def main(files):
15 | # We can't trust that the filesystem encoding (locale dependent)
16 | # correctly matches the arguments, so use surrogateescape to
17 | # pass through the original argv bytes for Python 3.
18 | fs_encoding = sys.getfilesystemencoding()
19 | files = [x.encode(fs_encoding, "surrogateescape") for x in files]
20 |
21 | for filename in files:
22 | # Emulate 'chmod -fR a+rX,u+w,g-w,o-w' with minimal chmod calls.
23 | apply_recursive_permissions(
24 | filename, filemode=0o644, filemask=0o022, dirmode=0o755, dirmask=0o022
25 | )
26 |
27 | return os.EX_OK
28 |
29 |
30 | if __name__ == "__main__":
31 | sys.exit(main(sys.argv[1:]))
32 |
--------------------------------------------------------------------------------
/lib/_emerge/getloadavg.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage import os
5 |
6 | getloadavg = getattr(os, "getloadavg", None)
7 | if getloadavg is None:
8 |
9 | def getloadavg():
10 | """
11 | Uses /proc/loadavg to emulate os.getloadavg().
12 | Raises OSError if the load average was unobtainable.
13 | """
14 | try:
15 | with open("/proc/loadavg") as f:
16 | loadavg_str = f.readline()
17 | except OSError:
18 | # getloadavg() is only supposed to raise OSError, so convert
19 | raise OSError("unknown")
20 | loadavg_split = loadavg_str.split()
21 | if len(loadavg_split) < 3:
22 | raise OSError("unknown")
23 | loadavg_floats = []
24 | for i in range(3):
25 | try:
26 | loadavg_floats.append(float(loadavg_split[i]))
27 | except ValueError:
28 | raise OSError("unknown")
29 | return tuple(loadavg_floats)
30 |
--------------------------------------------------------------------------------
/lib/portage/elog/mod_syslog.py:
--------------------------------------------------------------------------------
1 | # elog/mod_syslog.py - elog dispatch module
2 | # Copyright 2006-2020 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | import syslog
6 | from portage.const import EBUILD_PHASES
7 |
8 | _pri = {
9 | "INFO": syslog.LOG_INFO,
10 | "WARN": syslog.LOG_WARNING,
11 | "ERROR": syslog.LOG_ERR,
12 | "LOG": syslog.LOG_NOTICE,
13 | "QA": syslog.LOG_WARNING,
14 | }
15 |
16 |
17 | def process(mysettings, key, logentries, fulltext):
18 | syslog.openlog(
19 | "portage",
20 | syslog.LOG_ERR | syslog.LOG_WARNING | syslog.LOG_INFO | syslog.LOG_NOTICE,
21 | syslog.LOG_LOCAL5,
22 | )
23 | for phase in EBUILD_PHASES:
24 | if not phase in logentries:
25 | continue
26 | for msgtype, msgcontent in logentries[phase]:
27 | if isinstance(msgcontent, str):
28 | msgcontent = [msgcontent]
29 | for line in msgcontent:
30 | line = f"{key}: {phase}: {line}"
31 | syslog.syslog(_pri[msgtype], line.rstrip("\n"))
32 | syslog.closelog()
33 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/test_dep_getrepo.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.tests import TestCase
5 | from portage.dep import dep_getrepo
6 |
7 |
8 | class DepGetRepo(TestCase):
9 | """A simple testcase for isvalidatom"""
10 |
11 | def testDepGetRepo(self):
12 | repo_char = "::"
13 | repos = ("a", "repo-name", "repo_name", "repo123", None)
14 | cpvs = ["sys-apps/portage"]
15 | versions = ["2.1.1", "2.1-r1", None]
16 | uses = ["[use]", None]
17 | for cpv in cpvs:
18 | for version in versions:
19 | for use in uses:
20 | for repo in repos:
21 | pkg = cpv
22 | if version:
23 | pkg = "=" + pkg + "-" + version
24 | if repo is not None:
25 | pkg = pkg + repo_char + repo
26 | if use:
27 | pkg = pkg + use
28 | self.assertEqual(dep_getrepo(pkg), repo)
29 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/test_isjustname.py:
--------------------------------------------------------------------------------
1 | # test_isjustname.py -- Portage Unit Testing Functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 | from portage.dep import isjustname
7 |
8 |
9 | class IsJustName(TestCase):
10 | def testIsJustName(self):
11 | cats = ("", "sys-apps/", "foo/", "virtual/")
12 | pkgs = ("portage", "paludis", "pkgcore", "notARealPkg")
13 | vers = ("", "-2.0-r3", "-1.0_pre2", "-3.1b")
14 |
15 | for pkg in pkgs:
16 | for cat in cats:
17 | for ver in vers:
18 | if len(ver):
19 | self.assertFalse(
20 | isjustname(cat + pkg + ver),
21 | msg=f"isjustname({cat + pkg + ver}) is True!",
22 | )
23 | else:
24 | self.assertTrue(
25 | isjustname(cat + pkg + ver),
26 | msg=f"isjustname({cat + pkg + ver}) is False!",
27 | )
28 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/zipfile/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: GPL-2.0-or-later
2 | # Copyright (C) 2024 Alexey Gladkov
3 |
4 | doc = """Zipfile plug-in module for portage.
5 | Performs a http download of a portage snapshot and unpacks it to the repo
6 | location."""
7 | __doc__ = doc[:]
8 |
9 |
10 | import os
11 |
12 | from portage.sync.config_checks import CheckSyncConfig
13 |
14 |
15 | module_spec = {
16 | "name": "zipfile",
17 | "description": doc,
18 | "provides": {
19 | "zipfile-module": {
20 | "name": "zipfile",
21 | "sourcefile": "zipfile",
22 | "class": "ZipFile",
23 | "description": doc,
24 | "functions": ["sync", "retrieve_head"],
25 | "func_desc": {
26 | "sync": "Performs an archived http download of the "
27 | + "repository, then unpacks it.",
28 | "retrieve_head": "Returns the checksum of the unpacked archive.",
29 | },
30 | "validate_config": CheckSyncConfig,
31 | "module_specific_options": (),
32 | },
33 | },
34 | }
35 |
--------------------------------------------------------------------------------
/lib/portage/tests/process/test_spawn_fail_e2big.py:
--------------------------------------------------------------------------------
1 | # Copyright 2023 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import platform
5 | import resource
6 |
7 | import pytest
8 |
9 | import portage.process
10 | from portage.const import BASH_BINARY
11 |
12 |
13 | @pytest.mark.skipif(platform.system() != "Linux", reason="not Linux")
14 | def test_spawnE2big(capsys, tmp_path):
15 | env = dict()
16 | # Kernel MAX_ARG_STRLEN is defined as 32 * PAGE_SIZE
17 | max_arg_strlen_bytes = 32 * resource.getpagesize()
18 | env["VERY_LARGE_ENV_VAR"] = "X" * max_arg_strlen_bytes
19 |
20 | logfile = tmp_path / "logfile"
21 | echo_output = "Should never appear"
22 | with capsys.disabled():
23 | retval = portage.process.spawn(
24 | [BASH_BINARY, "-c", "echo", echo_output], env=env, logfile=logfile
25 | )
26 |
27 | with open(logfile) as f:
28 | logfile_content = f.read()
29 | assert (
30 | f"Largest environment variable: VERY_LARGE_ENV_VAR ({max_arg_strlen_bytes + 20} bytes)"
31 | in logfile_content
32 | )
33 | assert retval == 1
34 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/emake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2025 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 | #
5 | # emake: Run make and automatically pass along flags set in the env. We support
6 | # MAKEOPTS & EXTRA_EMAKE which allows the user to customize behavior (such as
7 | # parallel builds and load limiting). The latter overrides the ebuild and thus
8 | # should be used with caution (more a debugging knob).
9 | #
10 | # With newer EAPIs, we also automatically fail the build if make itself fails.
11 |
12 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
13 |
14 | # Prevent MAKEOPTS from resetting MAKEFLAGS jobserver mode for bug 692576.
15 | [[ -n ${MAKEFLAGS} ]] && unset MAKEOPTS
16 |
17 | cmd=(
18 | ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
19 | )
20 |
21 | if [[ ${PORTAGE_QUIET} != 1 ]] ; then
22 | (
23 | for arg in "${cmd[@]}" ; do
24 | [[ ${arg} == *" "* ]] \
25 | && printf "'%s' " "${arg}" \
26 | || printf "%s " "${arg}"
27 | done
28 | printf "\n"
29 | ) >&2
30 | fi
31 |
32 | "${cmd[@]}"
33 | ret=$?
34 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
35 | exit ${ret}
36 |
--------------------------------------------------------------------------------
/man/env-update.1:
--------------------------------------------------------------------------------
1 | .TH "ENV-UPDATE" "1" "Aug 2008" "Portage @VERSION@" "Portage"
2 | .SH "NAME"
3 | env\-update \- updates environment settings automatically
4 | .SH "SYNOPSIS"
5 | \fBenv\-update\fR \fI[options]\fR
6 | .SH "DESCRIPTION"
7 | .B env\-update
8 | reads the files in \fI/etc/env.d\fR and automatically generates
9 | \fI/etc/profile.env\fR and \fI/etc/ld.so.conf\fR. Then \fBldconfig\fR(8)
10 | is run to update \fI/etc/ld.so.cache\fR. \fBenv-update\fR is run by
11 | \fBemerge\fR(1) automatically after each package merge. Also, if you
12 | make changes to \fI/etc/env.d\fR, you should run \fBenv-update\fR
13 | yourself for changes to take effect immediately. Note that this would
14 | only affect new processes. In order for the changes to affect your
15 | active shell, you will probably have to run \fIsource /etc/profile\fR
16 | first.
17 | .SH "OPTIONS"
18 | .TP
19 | .B \-\-no\-ldconfig
20 | Do not run \fBldconfig\fR (and thus skip rebuilding the \fIld.so.cache\fR,
21 | etc...).
22 | .SH "REPORTING BUGS"
23 | Please report bugs via https://bugs.gentoo.org/
24 | .SH "AUTHORS"
25 | Daniel Robbins
26 | .SH "SEE ALSO"
27 | .BR emerge (1),
28 | .BR ldconfig (8)
29 |
--------------------------------------------------------------------------------
/lib/portage/package/ebuild/profile_iuse.py:
--------------------------------------------------------------------------------
1 | # Copyright 2018 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | __all__ = ("iter_iuse_vars",)
5 |
6 |
7 | def iter_iuse_vars(env):
8 | """
9 | Iterate over (key, value) pairs of profile variables that contribute
10 | to implicit IUSE for EAPI 5 and later.
11 |
12 | @param env: Ebuild environment
13 | @type env: Mapping
14 | @rtype: iterator
15 | @return: iterator over (key, value) pairs of profile variables
16 | """
17 |
18 | for k in (
19 | "IUSE_IMPLICIT",
20 | "USE_EXPAND_IMPLICIT",
21 | "USE_EXPAND_UNPREFIXED",
22 | "USE_EXPAND",
23 | ):
24 | v = env.get(k)
25 | if v is not None:
26 | yield (k, v)
27 |
28 | use_expand_implicit = frozenset(env.get("USE_EXPAND_IMPLICIT", "").split())
29 |
30 | for v in (
31 | env.get("USE_EXPAND_UNPREFIXED", "").split() + env.get("USE_EXPAND", "").split()
32 | ):
33 | if v in use_expand_implicit:
34 | k = "USE_EXPAND_VALUES_" + v
35 | v = env.get(k)
36 | if v is not None:
37 | yield (k, v)
38 |
--------------------------------------------------------------------------------
/lib/portage/sync/modules/svn/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | doc = """SVN plug-in module for portage.
5 | Performs a svn up on repositories."""
6 | __doc__ = doc[:]
7 |
8 | from portage.localization import _
9 | from portage.sync.config_checks import CheckSyncConfig
10 | from portage.util import writemsg_level
11 |
12 |
13 | module_spec = {
14 | "name": "svn",
15 | "description": doc,
16 | "provides": {
17 | "svn-module": {
18 | "name": "svn",
19 | "sourcefile": "svn",
20 | "class": "SVNSync",
21 | "description": doc,
22 | "functions": ["sync", "new", "exists"],
23 | "func_desc": {
24 | "sync": "Performs a svn up on the repository",
25 | "new": "Creates the new repository at the specified location",
26 | "exists": "Returns a boolean of whether the specified dir "
27 | + "exists and is a valid SVN repository",
28 | },
29 | "validate_config": CheckSyncConfig,
30 | "module_specific_options": (),
31 | }
32 | },
33 | }
34 |
--------------------------------------------------------------------------------
/lib/portage/tests/sets/files/test_config_file_set.py:
--------------------------------------------------------------------------------
1 | # testConfigFileSet.py -- Portage Unit Testing Functionality
2 | # Copyright 2007-2024 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | import tempfile
6 |
7 | from portage import os
8 | from portage.tests import TestCase, test_cps
9 | from portage._sets.files import ConfigFileSet
10 |
11 |
12 | class ConfigFileSetTestCase(TestCase):
13 | """Simple Test Case for ConfigFileSet"""
14 |
15 | def setUp(self):
16 | super().setUp()
17 | fd, self.testfile = tempfile.mkstemp(
18 | suffix=".testdata", prefix=self.__class__.__name__, text=True
19 | )
20 | f = os.fdopen(fd, "w")
21 | for i in range(0, len(test_cps)):
22 | atom = test_cps[i]
23 | if i % 2 == 0:
24 | f.write(atom + " abc def\n")
25 | else:
26 | f.write(atom + "\n")
27 | f.close()
28 |
29 | def tearDown(self):
30 | os.unlink(self.testfile)
31 |
32 | def testConfigStaticFileSet(self):
33 | s = ConfigFileSet(self.testfile)
34 | s.load()
35 | self.assertEqual(set(test_cps), s.getAtoms())
36 |
--------------------------------------------------------------------------------
/lib/_emerge/DependencyArg.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2020 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 |
5 | class DependencyArg:
6 | __slots__ = ("arg", "force_reinstall", "internal", "reset_depth", "root_config")
7 |
8 | def __init__(
9 | self,
10 | arg=None,
11 | force_reinstall=False,
12 | internal=False,
13 | reset_depth=True,
14 | root_config=None,
15 | ):
16 | """
17 | Use reset_depth=False for special arguments that should not interact
18 | with depth calculations (see the emerge --deep=DEPTH option).
19 | """
20 | self.arg = arg
21 | self.force_reinstall = force_reinstall
22 | self.internal = internal
23 | self.reset_depth = reset_depth
24 | self.root_config = root_config
25 |
26 | def __eq__(self, other):
27 | if self.__class__ is not other.__class__:
28 | return False
29 | return self.arg == other.arg and self.root_config.root == other.root_config.root
30 |
31 | def __hash__(self):
32 | return hash((self.arg, self.root_config.root))
33 |
34 | def __str__(self):
35 | return f"{self.arg}"
36 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dobin:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if [[ $# -lt 1 ]] ; then
8 | __helpers_die "${0##*/}: at least one argument needed"
9 | exit 1
10 | fi
11 |
12 | if ! ___eapi_has_prefix_variables; then
13 | ED=${D}
14 | fi
15 |
16 | if ! ___eapi_has_DESTTREE_INSDESTTREE; then
17 | [[ -n ${DESTTREE} ]] &&
18 | die "${0##*/}: \${DESTTREE} has been banned for EAPI '${EAPI}'; use 'into' instead"
19 | else
20 | # backwards compatibility
21 | __E_DESTTREE=${DESTTREE}
22 | fi
23 |
24 | if [[ ! -d ${ED%/}/${__E_DESTTREE#/}/bin ]] ; then
25 | install -d "${ED%/}/${__E_DESTTREE#/}/bin" || { __helpers_die "${0##*/}: failed to install ${ED%/}/${__E_DESTTREE#/}/bin"; exit 2; }
26 | fi
27 |
28 | ret=0
29 |
30 | for x in "$@" ; do
31 | if [[ -e ${x} ]] ; then
32 | install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED%/}/${__E_DESTTREE#/}/bin"
33 | else
34 | echo "!!! ${0##*/}: ${x} does not exist" 1>&2
35 | false
36 | fi
37 | ((ret|=$?))
38 | done
39 |
40 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
41 | exit ${ret}
42 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/dosbin:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if [[ $# -lt 1 ]] ; then
8 | __helpers_die "${0##*/}: at least one argument needed"
9 | exit 1
10 | fi
11 |
12 | if ! ___eapi_has_prefix_variables; then
13 | ED=${D}
14 | fi
15 |
16 | if ! ___eapi_has_DESTTREE_INSDESTTREE; then
17 | [[ -n ${DESTTREE} ]] &&
18 | die "${0##*/}: \${DESTTREE} has been banned for EAPI '${EAPI}'; use 'into' instead"
19 | else
20 | # backwards compatibility
21 | __E_DESTTREE=${DESTTREE}
22 | fi
23 |
24 | if [[ ! -d ${ED%/}/${__E_DESTTREE#/}/sbin ]] ; then
25 | install -d "${ED%/}/${__E_DESTTREE#/}/sbin" || { __helpers_die "${0##*/}: failed to install ${ED%/}/${__E_DESTTREE#/}/sbin"; exit 2; }
26 | fi
27 |
28 | ret=0
29 |
30 | for x in "$@" ; do
31 | if [[ -e ${x} ]] ; then
32 | install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED%/}/${__E_DESTTREE#/}/sbin"
33 | else
34 | echo "!!! ${0##*/}: ${x} does not exist" 1>&2
35 | false
36 | fi
37 | ((ret|=$?))
38 | done
39 |
40 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
41 | exit ${ret}
42 |
--------------------------------------------------------------------------------
/.builds/lint.yml:
--------------------------------------------------------------------------------
1 | # Maintainer: Oskari Pirhonen
2 |
3 | image: ubuntu/jammy
4 | shell: true
5 | repositories:
6 | # For more versions than just the default python3
7 | deadsnakes: https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy main "BA6932366A755776"
8 | environment:
9 | PYTHON_VERSIONS:
10 | - '3.9'
11 | - '3.10'
12 | - '3.11'
13 | tasks:
14 | - setup-python: |
15 | portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}"
16 |
17 | - setup-black: |
18 | .venv/bin/pip install black
19 |
20 | - setup-pylint: |
21 | for py in "${PYTHON_VERSIONS[@]}"; do
22 | ".venv-$py/bin/pip" install pylint pytest
23 | done
24 |
25 | - black: |
26 | source .venv/bin/activate
27 | cd portage
28 | STRAGGLERS="$(find bin -type f -not -name '*.py' -not -name '*.sh' | \
29 | xargs grep -l '#!/usr/bin/env python' | \
30 | tr '\n' ' ')"
31 | time black --check --diff --color . $STRAGGLERS
32 | deactivate
33 |
34 | - pylint: |
35 | for py in "${PYTHON_VERSIONS[@]}"; do
36 | source ".venv-$py/bin/activate"
37 | pushd portage
38 | time ./run-pylint
39 | popd
40 | deactivate
41 | done
42 |
--------------------------------------------------------------------------------
/bin/install-qa-check.d/90world-writable:
--------------------------------------------------------------------------------
1 | # shellcheck shell=bash
2 |
3 | # Check for world-writable files
4 |
5 | world_writable_check() {
6 | # Now we look for all world writable files.
7 | local unsafe_files=$(find "${ED}" -type f -perm -2 | sed -e "s:^${D}:/:")
8 | local OLDIFS x prev_shopts=$-
9 |
10 | OLDIFS=${IFS}
11 | IFS=$'\n'
12 | set -f
13 |
14 | if [[ -n ${unsafe_files} ]] ; then
15 | eqawarn "QA Notice: world writable file(s):"
16 |
17 | eqatag -v world-writable ${unsafe_files}
18 |
19 | eqawarn "This may or may not be a security problem, most of the time it is one."
20 | eqawarn "Please double check that ${PF} really needs a world writeable bit and file bugs accordingly."
21 | eqawarn
22 | fi
23 |
24 | local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${D}:/:")
25 | if [[ -n ${unsafe_files} ]] ; then
26 | eqawarn "QA Notice: Unsafe files detected (set*id and world writable)"
27 |
28 | eqatag -v world-writable-setid ${unsafe_files}
29 |
30 | die "Unsafe files found in \${D}. Portage will not install them."
31 | fi
32 |
33 | IFS=${OLDIFS}
34 | [[ ${prev_shopts} == *f* ]] || set +f
35 | }
36 |
37 | world_writable_check
38 | : # guarantee successful exit
39 |
40 | # vim:ft=bash
41 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/config/test_PackageUseFile.py:
--------------------------------------------------------------------------------
1 | # test_PackageUseFile.py -- Portage Unit Testing Functionality
2 | # Copyright 2007 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage import os
6 | from portage.tests import TestCase
7 | from portage.env.config import PackageUseFile
8 | from tempfile import mkstemp
9 |
10 |
11 | class PackageUseFileTestCase(TestCase):
12 | cpv = "sys-apps/portage"
13 | useflags = ["cdrom", "far", "boo", "flag", "blat"]
14 |
15 | def testPackageUseFile(self):
16 | """
17 | A simple test to ensure the load works properly
18 | """
19 | self.BuildFile()
20 | try:
21 | f = PackageUseFile(self.fname)
22 | f.load()
23 | for cpv, use in f.items():
24 | self.assertEqual(cpv, self.cpv)
25 | [flag for flag in use if self.assertTrue(flag in self.useflags)]
26 | finally:
27 | self.NukeFile()
28 |
29 | def BuildFile(self):
30 | fd, self.fname = mkstemp()
31 | f = os.fdopen(fd, "w")
32 | f.write(f"{self.cpv} {' '.join(self.useflags)}")
33 | f.close()
34 |
35 | def NukeFile(self):
36 | os.unlink(self.fname)
37 |
--------------------------------------------------------------------------------
/doc/api/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for Sphinx documentation
2 | #
3 |
4 | SPHINX_APIDOC_OPTIONS = members,private-members,undoc-members,show-inheritance,ignore-module-all,inherited-members
5 | export SPHINX_APIDOC_OPTIONS
6 |
7 | # You can set these variables from the command line.
8 | SPHINXOPTS =
9 | SPHINXBUILD = sphinx-build
10 | SOURCEDIR = .
11 | BUILDDIR = build
12 | TOPDIR = ../..
13 |
14 | # Put it first so that "make" without argument is like "make help".
15 | help:
16 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
17 |
18 | clean:
19 | rm -rf $(BUILDDIR) $(SOURCEDIR)/api
20 |
21 | $(BUILDDIR)/_sources/portage.rst:
22 | mkdir -p "$(BUILDDIR)/_sources"
23 | cp -pPR "$(SOURCEDIR)/conf.py" "$(SOURCEDIR)/index.rst" "$(BUILDDIR)/_sources"
24 | sphinx-apidoc -TPef -o "$(BUILDDIR)/_sources" $(TOPDIR)/lib/_emerge
25 | sphinx-apidoc -TPef -o "$(BUILDDIR)/_sources" $(TOPDIR)/lib/portage $(TOPDIR)/lib/portage/tests
26 |
27 | .PHONY: help Makefile
28 |
29 | # Catch-all target: route all unknown targets to Sphinx using the new
30 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
31 | %: Makefile $(BUILDDIR)/_sources/portage.rst
32 | @$(SPHINXBUILD) -M $@ "$(BUILDDIR)/_sources" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
33 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/doexe:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 1999-2023 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | if [[ $# -lt 1 ]] ; then
8 | __helpers_die "${0##*/}: at least one argument needed"
9 | exit 1
10 | fi
11 |
12 | if ! ___eapi_has_prefix_variables; then
13 | ED=${D}
14 | fi
15 |
16 | if [[ ! -d ${ED%/}/${__E_EXEDESTTREE#/} ]] ; then
17 | install -d "${ED%/}/${__E_EXEDESTTREE#/}"
18 | fi
19 |
20 | # Create a temporary directory whose subsequent removal is guaranteed.
21 | tmpdir=
22 | tmpdir=$(mktemp -d -- "${T:-/tmp}/doexe.XXXXXX") || exit
23 | trap 'rm -rf -- "${tmpdir}"' EXIT
24 |
25 | ret=0
26 | for x in "$@" ; do
27 | if [ -L "${x}" ] ; then
28 | cp "${x}" "${tmpdir}"
29 | mysrc=${tmpdir}/${x##*/}
30 | elif [ -d "${x}" ] ; then
31 | __vecho "doexe: warning, skipping directory ${x}"
32 | continue
33 | else
34 | mysrc="${x}"
35 | fi
36 |
37 | if [ -e "${mysrc}" ] ; then
38 | install ${EXEOPTIONS} "${mysrc}" "${ED%/}/${__E_EXEDESTTREE#/}"
39 | else
40 | echo "!!! ${0##*/}: ${mysrc} does not exist" 1>&2
41 | false
42 | fi
43 | ((ret|=$?))
44 | done
45 |
46 | [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
47 | exit ${ret}
48 |
--------------------------------------------------------------------------------
/lib/portage/util/_async/PopenProcess.py:
--------------------------------------------------------------------------------
1 | # Copyright 2012-2024 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import portage
5 | from _emerge.SubProcess import SubProcess
6 |
7 |
8 | class PopenProcess(SubProcess):
9 | __slots__ = (
10 | "pipe_reader",
11 | "proc",
12 | )
13 |
14 | def _start(self):
15 | self._proc = portage.process.Process(self.proc.pid)
16 | self._registered = True
17 |
18 | if self.pipe_reader is None:
19 | self.scheduler.call_soon(self._async_waitpid)
20 | else:
21 | try:
22 | self.pipe_reader.scheduler = self.scheduler
23 | except AttributeError:
24 | pass
25 | self.pipe_reader.addExitListener(self._pipe_reader_exit)
26 | self.pipe_reader.start()
27 |
28 | def _pipe_reader_exit(self, pipe_reader):
29 | self._async_waitpid()
30 |
31 | def _async_waitpid_cb(self, *args, **kwargs):
32 | SubProcess._async_waitpid_cb(self, *args, **kwargs)
33 | if self.proc.returncode is None:
34 | # Suppress warning messages like this:
35 | # ResourceWarning: subprocess 1234 is still running
36 | self.proc.returncode = self.returncode
37 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/test_dep_getcpv.py:
--------------------------------------------------------------------------------
1 | # test_dep_getcpv.py -- Portage Unit Testing Functionality
2 | # Copyright 2006-2020 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 | from portage.dep import dep_getcpv
7 |
8 |
9 | class DepGetCPV(TestCase):
10 | """A simple testcase for isvalidatom"""
11 |
12 | def testDepGetCPV(self):
13 | prefix_ops = ["<", ">", "=", "~", "<=", ">=", "!=", "!<", "!>", "!~"]
14 |
15 | bad_prefix_ops = [">~", "<~", "~>", "~<"]
16 | postfix_ops = [
17 | ("=", "*"),
18 | ]
19 |
20 | cpvs = ["sys-apps/portage-2.1", "sys-apps/portage-2.1", "sys-apps/portage-2.1"]
21 | slots = [None, ":foo", ":2"]
22 | for cpv in cpvs:
23 | for slot in slots:
24 | for prefix in prefix_ops:
25 | mycpv = prefix + cpv
26 | if slot:
27 | mycpv += slot
28 | self.assertEqual(dep_getcpv(mycpv), cpv)
29 |
30 | for prefix, postfix in postfix_ops:
31 | mycpv = prefix + cpv + postfix
32 | if slot:
33 | mycpv += slot
34 | self.assertEqual(dep_getcpv(mycpv), cpv)
35 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/test_stackDicts.py:
--------------------------------------------------------------------------------
1 | # test_stackDicts.py -- Portage Unit Testing Functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 | from portage.util import stack_dicts
7 |
8 |
9 | class StackDictsTestCase(TestCase):
10 | def testStackDictsPass(self):
11 | tests = [
12 | ([{"a": "b"}, {"b": "c"}], {"a": "b", "b": "c"}, False, [], False),
13 | ([{"a": "b"}, {"a": "c"}], {"a": "b c"}, True, [], False),
14 | ([{"a": "b"}, {"a": "c"}], {"a": "b c"}, False, ["a"], False),
15 | ([{"a": "b"}, None], {"a": "b"}, False, [], True),
16 | ([None], {}, False, [], False),
17 | ([None, {}], {}, False, [], True),
18 | ]
19 | for test in tests:
20 | result = stack_dicts(test[0], test[2], test[3], test[4])
21 | self.assertEqual(result, test[1])
22 |
23 | def testStackDictsFail(self):
24 | tests = [
25 | ([None, {}], None, False, [], True),
26 | ([{"a": "b"}, {"a": "c"}], {"a": "b c"}, False, [], False),
27 | ]
28 | for test in tests:
29 | result = stack_dicts(test[0], test[2], test[3], test[4])
30 | self.assertNotEqual(result, test[1])
31 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/test_onlydeps.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.tests import TestCase
5 | from portage.tests.resolver.ResolverPlayground import (
6 | ResolverPlayground,
7 | ResolverPlaygroundTestCase,
8 | )
9 |
10 |
11 | class OnlydepsTestCase(TestCase):
12 | def testOnlydeps(self):
13 | ebuilds = {
14 | "dev-libs/A-1": {"DEPEND": "dev-libs/B"},
15 | "dev-libs/B-1": {},
16 | }
17 | installed = {
18 | "dev-libs/B-1": {},
19 | }
20 |
21 | test_cases = (
22 | ResolverPlaygroundTestCase(
23 | ["dev-libs/A", "dev-libs/B"],
24 | all_permutations=True,
25 | success=True,
26 | options={"--onlydeps": True},
27 | mergelist=["dev-libs/B-1"],
28 | ),
29 | )
30 |
31 | playground = ResolverPlayground(
32 | ebuilds=ebuilds, installed=installed, debug=False
33 | )
34 | try:
35 | for test_case in test_cases:
36 | playground.run_TestCase(test_case)
37 | self.assertEqual(test_case.test_success, True, test_case.fail_msg)
38 | finally:
39 | playground.cleanup()
40 |
--------------------------------------------------------------------------------
/lib/portage/repository/storage/inplace.py:
--------------------------------------------------------------------------------
1 | # Copyright 2018-2021 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.repository.storage.interface import (
5 | RepoStorageException,
6 | RepoStorageInterface,
7 | )
8 |
9 |
10 | class InplaceRepoStorage(RepoStorageInterface):
11 | """
12 | Legacy repo storage behavior, where updates are applied in-place.
13 | This module is not recommended, since the repository is left in an
14 | unspecified (possibly malicious) state if the update fails.
15 | """
16 |
17 | def __init__(self, repo, spawn_kwargs):
18 | self._user_location = repo.location
19 | self._update_location = None
20 |
21 | async def init_update(self):
22 | self._update_location = self._user_location
23 | return self._update_location
24 |
25 | @property
26 | def current_update(self):
27 | if self._update_location is None:
28 | raise RepoStorageException("current update does not exist")
29 | return self._update_location
30 |
31 | async def commit_update(self):
32 | self.current_update
33 | self._update_location = None
34 |
35 | async def abort_update(self):
36 | self._update_location = None
37 |
38 | async def garbage_collection(self):
39 | pass
40 |
--------------------------------------------------------------------------------
/lib/_emerge/_find_deep_system_runtime_deps.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2009 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from _emerge.DepPriority import DepPriority
5 | from _emerge.Package import Package
6 |
7 |
8 | def _find_deep_system_runtime_deps(graph):
9 | deep_system_deps = set()
10 | node_stack = []
11 | for node in graph:
12 | if not isinstance(node, Package) or node.operation == "uninstall":
13 | continue
14 | if node.root_config.sets["system"].findAtomForPackage(node):
15 | node_stack.append(node)
16 |
17 | def ignore_priority(priority):
18 | """
19 | Ignore non-runtime priorities.
20 | """
21 | if isinstance(priority, DepPriority) and (
22 | priority.runtime or priority.runtime_post
23 | ):
24 | return False
25 | return True
26 |
27 | while node_stack:
28 | node = node_stack.pop()
29 | if node in deep_system_deps:
30 | continue
31 | deep_system_deps.add(node)
32 | for child in graph.child_nodes(node, ignore_priority=ignore_priority):
33 | if not isinstance(child, Package) or child.operation == "uninstall":
34 | continue
35 | node_stack.append(child)
36 |
37 | return deep_system_deps
38 |
--------------------------------------------------------------------------------
/lib/_emerge/EbuildFetchonly.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2024 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import portage
5 | from portage import os
6 | from portage.elog.messages import eerror
7 | from portage.util.SlotObject import SlotObject
8 |
9 |
10 | class EbuildFetchonly(SlotObject):
11 | __slots__ = ("ebuild_path", "fetch_all", "pkg", "pretend", "settings")
12 |
13 | def execute(self):
14 | settings = self.settings
15 | pkg = self.pkg
16 | portdb = pkg.root_config.trees["porttree"].dbapi
17 | debug = settings.get("PORTAGE_DEBUG") == "1"
18 |
19 | rval = portage.doebuild(
20 | self.ebuild_path,
21 | "fetch",
22 | settings=settings,
23 | debug=debug,
24 | listonly=self.pretend,
25 | fetchonly=1,
26 | fetchall=self.fetch_all,
27 | mydbapi=portdb,
28 | tree="porttree",
29 | )
30 |
31 | # For pretend mode, this error message is suppressed,
32 | # and the unsuccessful return value is used to trigger
33 | # a call to the pkg_nofetch phase.
34 | if rval != os.EX_OK and not self.pretend:
35 | msg = f"Fetch failed for '{pkg.cpv}'"
36 | eerror(msg, phase="unpack", key=pkg.cpv)
37 |
38 | return rval
39 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/config/test_PortageModulesFile.py:
--------------------------------------------------------------------------------
1 | # Copyright 2006-2024 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage import os
5 | from portage.tests import TestCase
6 | from portage.env.config import PortageModulesFile
7 | from tempfile import mkstemp
8 |
9 |
10 | class PortageModulesFileTestCase(TestCase):
11 | keys = ["foo.bar", "baz", "bob", "extra_key"]
12 | invalid_keys = ["", ""]
13 | modules = ["spanky", "zmedico", "antarus", "ricer", "5", "6"]
14 |
15 | def setUp(self):
16 | super().setUp()
17 | self.items = {}
18 | for k, v in zip(self.keys + self.invalid_keys, self.modules):
19 | self.items[k] = v
20 |
21 | def testPortageModulesFile(self):
22 | self.BuildFile()
23 | f = PortageModulesFile(self.fname)
24 | f.load()
25 | for k in self.keys:
26 | self.assertEqual(f[k], self.items[k])
27 | for ik in self.invalid_keys:
28 | self.assertEqual(False, ik in f)
29 | self.NukeFile()
30 |
31 | def BuildFile(self):
32 | fd, self.fname = mkstemp()
33 | f = os.fdopen(fd, "w")
34 | for k, v in self.items.items():
35 | f.write(f"{k}={v}\n")
36 | f.close()
37 |
38 | def NukeFile(self):
39 | os.unlink(self.fname)
40 |
--------------------------------------------------------------------------------
/lib/portage/util/_async/AsyncTaskFuture.py:
--------------------------------------------------------------------------------
1 | # Copyright 2018-2023 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import os
5 | import signal
6 |
7 | from _emerge.AsynchronousTask import AsynchronousTask
8 | from portage.util.futures import asyncio
9 |
10 |
11 | class AsyncTaskFuture(AsynchronousTask):
12 | """
13 | Wraps a Future in an AsynchronousTask, which is useful for
14 | scheduling with TaskScheduler.
15 | """
16 |
17 | __slots__ = ("future",)
18 |
19 | def _start(self):
20 | self.future = asyncio.ensure_future(self.future, self.scheduler)
21 | self.future.add_done_callback(self._done_callback)
22 |
23 | def isAlive(self):
24 | """
25 | Returns True if self.future is an asyncio.Future that is not done.
26 | """
27 | return isinstance(self.future, asyncio.Future) and not self.future.done()
28 |
29 | def _cancel(self):
30 | if not self.future.done():
31 | self.future.cancel()
32 |
33 | def _done_callback(self, future):
34 | if future.cancelled():
35 | self.cancelled = True
36 | self.returncode = -signal.SIGINT
37 | elif future.exception() is None:
38 | self.returncode = os.EX_OK
39 | else:
40 | self.returncode = 1
41 | self._async_wait()
42 |
--------------------------------------------------------------------------------
/lib/portage/util/meson.build:
--------------------------------------------------------------------------------
1 | py.install_sources(
2 | [
3 | 'ExtractKernelVersion.py',
4 | 'SlotObject.py',
5 | 'backoff.py',
6 | 'bin_entry_point.py',
7 | 'changelog.py',
8 | 'compression_probe.py',
9 | 'configparser.py',
10 | 'cpuinfo.py',
11 | 'digraph.py',
12 | 'env_update.py',
13 | 'file_copy.py',
14 | 'formatter.py',
15 | 'hooks.py',
16 | 'install_mask.py',
17 | 'lafilefixer.py',
18 | 'listdir.py',
19 | 'locale.py',
20 | 'movefile.py',
21 | 'mtimedb.py',
22 | 'netlink.py',
23 | 'path.py',
24 | 'portage_lru_cache.py',
25 | 'shelve.py',
26 | 'socks5.py',
27 | 'time.py',
28 | 'whirlpool.py',
29 | 'writeable_check.py',
30 | '_compare_files.py',
31 | '_ctypes.py',
32 | '_desktop_entry.py',
33 | '_get_vm_info.py',
34 | '_info_files.py',
35 | '_path.py',
36 | '_pty.py',
37 | '_urlopen.py',
38 | '_xattr.py',
39 | '__init__.py',
40 | ],
41 | subdir : 'portage/util',
42 | pure : not native_extensions
43 | )
44 |
45 | subdir('elf')
46 | subdir('endian')
47 | subdir('futures')
48 | subdir('iterators')
49 | subdir('_async')
50 | subdir('_dyn_libs')
51 | subdir('_eventloop')
52 |
--------------------------------------------------------------------------------
/bin/env-update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright 1999-2025 Gentoo Authors
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | import errno
6 | import sys
7 |
8 | from os import path as osp
9 |
10 | makelinks = 1
11 |
12 | if osp.isfile(
13 | osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")
14 | ):
15 | sys.path.insert(
16 | 0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "lib")
17 | )
18 |
19 |
20 | def usage(status):
21 | print("Usage: env-update [--no-ldconfig]")
22 | print("")
23 | print("See the env-update(1) man page for more info")
24 | sys.exit(status)
25 |
26 |
27 | if __name__ == "__main__":
28 | if "-h" in sys.argv or "--help" in sys.argv:
29 | usage(0)
30 |
31 | if "--no-ldconfig" in sys.argv:
32 | makelinks = 0
33 | sys.argv.pop(sys.argv.index("--no-ldconfig"))
34 |
35 | if len(sys.argv) > 1:
36 | print("!!! Invalid command line options!\n")
37 | usage(1)
38 |
39 | import portage
40 |
41 | portage._internal_caller = True
42 |
43 | try:
44 | portage.env_update(makelinks)
45 | except OSError as e:
46 | if e.errno == errno.EACCES:
47 | print("env-update: Need superuser access")
48 | sys.exit(1)
49 | else:
50 | raise
51 |
--------------------------------------------------------------------------------
/lib/portage/tests/env/config/test_PackageKeywordsFile.py:
--------------------------------------------------------------------------------
1 | # test_PackageKeywordsFile.py -- Portage Unit Testing Functionality
2 | # Copyright 2006 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage import os
6 | from portage.tests import TestCase
7 | from portage.env.config import PackageKeywordsFile
8 | from tempfile import mkstemp
9 |
10 |
11 | class PackageKeywordsFileTestCase(TestCase):
12 | cpv = ["sys-apps/portage"]
13 | keywords = ["~x86", "amd64", "-mips"]
14 |
15 | def testPackageKeywordsFile(self):
16 | """
17 | A simple test to ensure the load works properly
18 | """
19 |
20 | self.BuildFile()
21 | try:
22 | f = PackageKeywordsFile(self.fname)
23 | f.load()
24 | i = 0
25 | for cpv, keyword in f.items():
26 | self.assertEqual(cpv, self.cpv[i])
27 | [k for k in keyword if self.assertTrue(k in self.keywords)]
28 | i = i + 1
29 | finally:
30 | self.NukeFile()
31 |
32 | def BuildFile(self):
33 | fd, self.fname = mkstemp()
34 | f = os.fdopen(fd, "w")
35 | for c in self.cpv:
36 | f.write(f"{c} {' '.join(self.keywords)}\n")
37 | f.close()
38 |
39 | def NukeFile(self):
40 | os.unlink(self.fname)
41 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/test_manifest.py:
--------------------------------------------------------------------------------
1 | # Copyright 2022-2024 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import shutil
5 | import tempfile
6 |
7 | from pathlib import Path
8 | from portage import Manifest
9 | from portage.tests import TestCase
10 |
11 |
12 | class ManifestTestCase(TestCase):
13 | def test_simple_addFile(self):
14 | base_tempdir = tempfile.mkdtemp()
15 | tempdir = Path(base_tempdir) / "app-portage" / "diffball"
16 | manifest = Manifest(str(tempdir), required_hashes=["SHA512", "BLAKE2B"])
17 |
18 | (tempdir / "files").mkdir(parents=True)
19 | (tempdir / "files" / "test.patch").write_text(
20 | "Fix the diffball foobar functionality.\n"
21 | )
22 |
23 | # Nothing should be in the Manifest yet
24 | with self.assertRaises(KeyError):
25 | manifest.getFileData("AUX", "test.patch", "SHA512")
26 |
27 | manifest.addFile("AUX", "files/test.patch")
28 |
29 | self.assertEqual(len(manifest.fhashdict["AUX"].keys()), 1)
30 | self.assertEqual(
31 | manifest.getFileData("AUX", "test.patch", "SHA512"),
32 | "e30d069dcf284cbcb2d5685f03ca362469026b469dec4f8655d0c9a2bf317f5d9f68f61855ea403f4959bc0b9c003ae824fb9d6ab2472a739950623523af9da9",
33 | )
34 | shutil.rmtree(base_tempdir)
35 |
--------------------------------------------------------------------------------
/bin/ebuild-helpers/unprivileged/chown:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2012-2015 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | source "${PORTAGE_BIN_PATH:?}"/isolated-functions.sh || exit
6 |
7 | scriptpath=${BASH_SOURCE[0]}
8 | scriptname=${scriptpath##*/}
9 |
10 | IFS=':'
11 |
12 | for path in ${PATH}; do
13 | [[ -x ${path}/${scriptname} ]] || continue
14 | [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
15 | [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
16 |
17 | IFS=$' \t\n'
18 | output=$("${path}/${scriptname}" "$@" 2>&1)
19 | if [[ $? -ne 0 ]] ; then
20 | # Avoid an extreme performance problem when the
21 | # output is very long (bug #470992).
22 | if [[ $(wc -l <<< "${output}") -gt 100 ]]; then
23 | output=$(head -n100 <<< "${output}")
24 | output="${output}\n ... (further messages truncated)"
25 | fi
26 |
27 | if ! ___eapi_has_prefix_variables; then
28 | EPREFIX=
29 | fi
30 |
31 | msg="${scriptname} failure ignored with unprivileged user:\n ${scriptname} $*\n ${output}"
32 | # Reverse expansion of ${D} and ${EPREFIX}, for readability.
33 | msg=${msg//${D}/'${D}'}
34 | if [[ -n ${EPREFIX} ]] ; then
35 | msg=${msg//${EPREFIX}/'${EPREFIX}'}
36 | msg=${msg//${EPREFIX#/}/'${EPREFIX}'}
37 | fi
38 | ewarn "${msg}"
39 | fi
40 | exit 0
41 | done
42 |
43 | exit 1
44 |
--------------------------------------------------------------------------------
/lib/portage/tests/process/test_spawn_returnproc.py:
--------------------------------------------------------------------------------
1 | # Copyright 2024 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import os
5 | import signal
6 |
7 | from portage.process import find_binary, spawn
8 | from portage.tests import TestCase
9 | from portage.util._eventloop.global_event_loop import global_event_loop
10 |
11 |
12 | class SpawnReturnProcTestCase(TestCase):
13 | def testSpawnReturnProcWait(self):
14 | true_binary = find_binary("true")
15 | self.assertNotEqual(true_binary, None)
16 |
17 | loop = global_event_loop()
18 |
19 | async def watch_pid():
20 | proc = spawn([true_binary], returnproc=True)
21 | self.assertEqual(await proc.wait(), os.EX_OK)
22 |
23 | # A second wait should also work.
24 | self.assertEqual(await proc.wait(), os.EX_OK)
25 |
26 | loop.run_until_complete(watch_pid())
27 |
28 | def testSpawnReturnProcTerminate(self):
29 | sleep_binary = find_binary("sleep")
30 | self.assertNotEqual(sleep_binary, None)
31 |
32 | loop = global_event_loop()
33 |
34 | async def watch_pid():
35 | proc = spawn([sleep_binary, "9999"], returnproc=True)
36 | proc.terminate()
37 | self.assertEqual(await proc.wait(), -signal.SIGTERM)
38 |
39 | loop.run_until_complete(watch_pid())
40 |
--------------------------------------------------------------------------------
/lib/_emerge/RootConfig.py:
--------------------------------------------------------------------------------
1 | # Copyright 1999-2013 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 |
5 | class RootConfig:
6 | """This is used internally by depgraph to track information about a
7 | particular $ROOT."""
8 |
9 | __slots__ = ("mtimedb", "root", "setconfig", "sets", "settings", "trees")
10 |
11 | pkg_tree_map = {"ebuild": "porttree", "binary": "bintree", "installed": "vartree"}
12 |
13 | tree_pkg_map = {}
14 | for k, v in pkg_tree_map.items():
15 | tree_pkg_map[v] = k
16 |
17 | def __init__(self, settings, trees, setconfig):
18 | self.trees = trees
19 | self.settings = settings
20 | self.root = self.settings["EROOT"]
21 | self.setconfig = setconfig
22 | if setconfig is None:
23 | self.sets = {}
24 | else:
25 | self.sets = self.setconfig.getSets()
26 |
27 | def update(self, other):
28 | """
29 | Shallow copy all attributes from another instance.
30 | """
31 | for k in self.__slots__:
32 | try:
33 | setattr(self, k, getattr(other, k))
34 | except AttributeError:
35 | # mtimedb is currently not a required attribute
36 | try:
37 | delattr(self, k)
38 | except AttributeError:
39 | pass
40 |
--------------------------------------------------------------------------------
/lib/portage/emaint/modules/revisions/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2024 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | doc = """Purge repo_revisions history file."""
5 | __doc__ = doc
6 |
7 |
8 | module_spec = {
9 | "name": "revisions",
10 | "description": doc,
11 | "provides": {
12 | "purgerevisions": {
13 | "name": "revisions",
14 | "sourcefile": "revisions",
15 | "class": "PurgeRevisions",
16 | "description": "Purge repo_revisions history",
17 | "functions": ["purgeallrepos", "purgerepos"],
18 | "func_desc": {
19 | "repo": {
20 | "long": "--purgerepos",
21 | "help": "(revisions module only): --purgerepos Purge revisions for the specified repo(s)",
22 | "status": "Purging %s",
23 | "action": "store",
24 | "func": "purgerepos",
25 | },
26 | "allrepos": {
27 | "long": "--purgeallrepos",
28 | "help": "(revisions module only): --purgeallrepos Purge revisions for all repos",
29 | "status": "Purging %s",
30 | "action": "store_true",
31 | "func": "purgeallrepos",
32 | },
33 | },
34 | },
35 | },
36 | }
37 |
--------------------------------------------------------------------------------
/lib/portage/util/_async/FileCopier.py:
--------------------------------------------------------------------------------
1 | # Copyright 2013-2023 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import os as _os
5 |
6 | from portage import _encodings, _unicode_encode
7 | from portage.util import apply_stat_permissions
8 | from portage.util.file_copy import copyfile
9 | from portage.util.futures import asyncio
10 | from portage.util.futures.executor.fork import ForkExecutor
11 | from portage.util._async.AsyncTaskFuture import AsyncTaskFuture
12 |
13 |
14 | class FileCopier(AsyncTaskFuture):
15 | """
16 | Asynchronously copy a file.
17 | """
18 |
19 | __slots__ = ("src_path", "dest_path")
20 |
21 | def _start(self):
22 | self.future = asyncio.ensure_future(
23 | self.scheduler.run_in_executor(
24 | ForkExecutor(loop=self.scheduler),
25 | self._target,
26 | self.src_path,
27 | self.dest_path,
28 | )
29 | )
30 | super()._start()
31 |
32 | @staticmethod
33 | def _target(src_path, dest_path):
34 | src_path = _unicode_encode(src_path, encoding=_encodings["fs"], errors="strict")
35 | dest_path = _unicode_encode(
36 | dest_path, encoding=_encodings["fs"], errors="strict"
37 | )
38 | copyfile(src_path, dest_path)
39 | apply_stat_permissions(dest_path, _os.stat(src_path))
40 |
--------------------------------------------------------------------------------
/.github/workflows/lint.yml:
--------------------------------------------------------------------------------
1 | name: Lint
2 |
3 | on: [ push, pull_request ]
4 |
5 | jobs:
6 | black:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v4
10 | - name: "Collect stragglers that Black misses"
11 | id: stragglers
12 | run: |
13 | echo "missed=$(
14 | find bin -type f -not -name '*.py' -not -name '*.sh' | \
15 | xargs grep -l '#!/usr/bin/env python' | tr $'\n' ' ')" >> $GITHUB_OUTPUT
16 | - uses: psf/black@24.10.0
17 | with:
18 | src: . ${{ steps.stragglers.outputs.missed }}
19 |
20 | pylint:
21 | runs-on: ubuntu-latest
22 | strategy:
23 | matrix:
24 | python-version:
25 | - '3.9'
26 | - '3.10'
27 | - '3.11'
28 | - '3.12'
29 | fail-fast: false
30 | steps:
31 | - uses: actions/checkout@v4
32 | - name: Set up Python ${{ matrix.python-version }}
33 | uses: actions/setup-python@v5
34 | with:
35 | python-version: ${{ matrix.python-version }}
36 | - name: Install python dependencies
37 | run: |
38 | set -xe
39 | python -VV
40 | python -m site
41 | python -m pip install --upgrade pip
42 | python -m pip install pylint pytest
43 | - name: Run pylint for ${{ matrix.python-version }}
44 | run: |
45 | ./run-pylint
46 |
--------------------------------------------------------------------------------
/man/ru/env-update.1:
--------------------------------------------------------------------------------
1 | .TH "ENV-UPDATE" "1" "Aug 2008" "Portage @VERSION@" "Portage"
2 | .SH "НАЗВАНИЕ"
3 | env\-update \- автоматическое обновление настроек окружения
4 | .SH "СИНТАКСИС"
5 | \fBenv\-update\fR \fI[опции]\fR
6 | .SH "ОПИСАНИЕ"
7 | .B env\-update
8 | читает файлы в каталоге \fI/etc/env.d\fR и автоматически генерирует
9 | \fI/etc/profile.env\fR и \fI/etc/ld.so.conf\fR. Затем для обновления
10 | \fI/etc/ld.so.cache\fR запускается \fBldconfig\fR(8). \fBemerge\fR(1)
11 | автоматически вызывает \fBenv-update\fR после каждой установки пакета.
12 | Если же вы вносите изменения в \fI/etc/env.d\fR, вам следует
13 | самостоятельно выполнить \fBenv-update\fR, чтобы внесенные
14 | изменения вступили в силу. Обратите внимание, что это повлияет
15 | только на последующие операции. Чтобы изменения отразились на уже
16 | запущенных процессах, вероятно, понадобится выполнить
17 | \fIsource /etc/profile\fR.
18 | .SH "ОПЦИИ"
19 | .TP
20 | .B \-\-no\-ldconfig
21 | Не запускать \fBldconfig\fR (и, тем самым, опустить пересборку
22 | кэша \fIld.so.cache\fR и т.д.).
23 | .SH "БАГТРЕКЕР"
24 | Об обнаруженных ошибках сообщайте на https://bugs.gentoo.org/
25 | .SH "АВТОРЫ"
26 | Daniel Robbins
27 | .SH "СМОТРИ ТАКЖЕ"
28 | .BR emerge (1),
29 | .BR ldconfig (8)
30 |
31 | .SH "ПЕРЕВОД"
32 | .nf
33 | Переводчик: Елена Гаврилова
34 | Правка и обновление: Романов Владимир
35 | .fi
36 |
--------------------------------------------------------------------------------
/lib/portage/_compat_upgrade/binpkg_multi_instance.py:
--------------------------------------------------------------------------------
1 | # Copyright 2021 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import portage
5 | from portage import os
6 | from portage.const import GLOBAL_CONFIG_PATH
7 |
8 | COMPAT_FEATURES = 'FEATURES="${FEATURES} -binpkg-multi-instance"'
9 |
10 |
11 | def main():
12 | """
13 | If the current installation is still has binpkg-multi-instance
14 | disabled, then patch make.globals inside ${ED} to maintain backward
15 | compatibility. This is intended to be called from the ebuild as
16 | follows:
17 |
18 | pkg_preinst() {
19 | python_setup
20 | env -u FEATURES -u PORTAGE_REPOSITORIES \
21 | PYTHONPATH="${D}$(python_get_sitedir)${PYTHONPATH:+:${PYTHONPATH}}" \
22 | "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die
23 | }
24 | """
25 | if "binpkg-multi-instance" not in portage.settings.features:
26 | portage.output.EOutput().einfo(
27 | f"Setting make.globals default {COMPAT_FEATURES} for backward compatibility"
28 | )
29 | config_path = os.path.join(
30 | os.environ["ED"], GLOBAL_CONFIG_PATH.lstrip(os.sep), "make.globals"
31 | )
32 | with open(config_path, "a") as f:
33 | f.write(f"{COMPAT_FEATURES}\n")
34 |
35 |
36 | if __name__ == "__main__":
37 | main()
38 |
--------------------------------------------------------------------------------
/lib/portage/tests/dep/test_get_operator.py:
--------------------------------------------------------------------------------
1 | # test_get_operator.py -- Portage Unit Testing Functionality
2 | # Copyright 2007 Gentoo Foundation
3 | # Distributed under the terms of the GNU General Public License v2
4 |
5 | from portage.tests import TestCase
6 | from portage.dep import get_operator
7 |
8 |
9 | class GetOperator(TestCase):
10 | def testGetOperator(self):
11 | # get_operator does not validate operators
12 | tests = [
13 | ("~", "~"),
14 | ("=", "="),
15 | (">", ">"),
16 | (">=", ">="),
17 | ("<=", "<="),
18 | ]
19 |
20 | test_cpvs = ["sys-apps/portage-2.1"]
21 | slots = [None, "1", "linux-2.5.6"]
22 | for cpv in test_cpvs:
23 | for test in tests:
24 | for slot in slots:
25 | atom = cpv[:]
26 | if slot:
27 | atom += ":" + slot
28 | result = get_operator(test[0] + atom)
29 | self.assertEqual(
30 | result,
31 | test[1],
32 | msg=f"get_operator({test[0] + atom}) != {test[1]}",
33 | )
34 |
35 | result = get_operator("sys-apps/portage")
36 | self.assertEqual(result, None)
37 |
38 | result = get_operator("=sys-apps/portage-2.1*")
39 | self.assertEqual(result, "=*")
40 |
--------------------------------------------------------------------------------
/cnf/make.conf.example.sh.diff:
--------------------------------------------------------------------------------
1 | --- make.conf.example
2 | +++ make.conf.example
3 | @@ -22,6 +22,19 @@
4 | # Example:
5 | #USE="X gtk gnome -alsa"
6 |
7 | +# Host Setting
8 | +# ============
9 | +#
10 | +# DO NOT CHANGE THIS SETTING UNLESS YOU ARE USING STAGE1!
11 | +# It's very important you select the right CHOST from the start. A wrong
12 | +# CHOST could easily lead to weird errors either in compiling or running.
13 | +#
14 | +# There are really only two choices right now:
15 | +# sh3-unknown-linux-gnu
16 | +# sh4-unknown-linux-gnu (Dreamcast / LANTank)
17 | +#
18 | +CHOST="sh4-unknown-linux-gnu"
19 | +
20 | # Host and optimization settings
21 | # ==============================
22 | #
23 | @@ -39,10 +52,15 @@
24 | # -frecord-gcc-switches, since otherwise the check could result in false
25 | # positive results.
26 | #
27 | -# Please refer to the GCC manual for a list of possible values.
28 | +# -m# optimize code for the particular type of CPU. The number should match
29 | +# your CHOST so if you are using "sh4-unknown-linux-gnu", you should have
30 | +# -m4 below.
31 | #
32 | -#CFLAGS="-O2 -pipe"
33 | +# For a full listing of supported CPU models, please refer to the GCC website:
34 | +# https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/SH-Options.html
35 | #
36 | +#CFLAGS="-m4 -O2 -pipe"
37 | +
38 | # If you set a CFLAGS above, then this line will set your default C++ flags to
39 | # the same settings.
40 | #CXXFLAGS="${CFLAGS}"
41 |
--------------------------------------------------------------------------------
/lib/portage/tests/resolver/test_missing_iuse_and_evaluated_atoms.py:
--------------------------------------------------------------------------------
1 | # Copyright 2010-2020 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.tests import TestCase
5 | from portage.tests.resolver.ResolverPlayground import (
6 | ResolverPlayground,
7 | ResolverPlaygroundTestCase,
8 | )
9 |
10 |
11 | class MissingIUSEandEvaluatedAtomsTestCase(TestCase):
12 | def testMissingIUSEandEvaluatedAtoms(self):
13 | ebuilds = {
14 | "dev-libs/A-1": {
15 | "DEPEND": "dev-libs/B[foo?]",
16 | "IUSE": "foo bar",
17 | "EAPI": 2,
18 | },
19 | "dev-libs/A-2": {
20 | "DEPEND": "dev-libs/B[foo?,bar]",
21 | "IUSE": "foo bar",
22 | "EAPI": 2,
23 | },
24 | "dev-libs/B-1": {"IUSE": "bar"},
25 | }
26 |
27 | test_cases = (
28 | ResolverPlaygroundTestCase(["=dev-libs/A-1"], success=False),
29 | ResolverPlaygroundTestCase(["=dev-libs/A-2"], success=False),
30 | )
31 |
32 | playground = ResolverPlayground(ebuilds=ebuilds, debug=False)
33 | try:
34 | for test_case in test_cases:
35 | playground.run_TestCase(test_case)
36 | self.assertEqual(test_case.test_success, True, test_case.fail_msg)
37 | finally:
38 | playground.cleanup()
39 |
--------------------------------------------------------------------------------
/lib/portage/tests/util/futures/test_done_callback.py:
--------------------------------------------------------------------------------
1 | # Copyright 2017 Gentoo Foundation
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | from portage.tests import TestCase
5 | from portage.util._eventloop.global_event_loop import global_event_loop
6 |
7 |
8 | class FutureDoneCallbackTestCase(TestCase):
9 | def testFutureDoneCallback(self):
10 | event_loop = global_event_loop()
11 |
12 | def done_callback(finished):
13 | done_callback_called.set_result(True)
14 |
15 | done_callback_called = event_loop.create_future()
16 | finished = event_loop.create_future()
17 | finished.add_done_callback(done_callback)
18 | event_loop.call_soon(finished.set_result, True)
19 | event_loop.run_until_complete(done_callback_called)
20 |
21 | def done_callback2(finished):
22 | done_callback2_called.set_result(True)
23 |
24 | done_callback_called = event_loop.create_future()
25 | done_callback2_called = event_loop.create_future()
26 | finished = event_loop.create_future()
27 | finished.add_done_callback(done_callback)
28 | finished.add_done_callback(done_callback2)
29 | finished.remove_done_callback(done_callback)
30 | event_loop.call_soon(finished.set_result, True)
31 | event_loop.run_until_complete(done_callback2_called)
32 |
33 | self.assertFalse(done_callback_called.done())
34 |
--------------------------------------------------------------------------------
/lib/portage/util/portage_lru_cache.py:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Gentoo Authors
2 | # Distributed under the terms of the GNU General Public License v2
3 |
4 | import os
5 | import portage
6 |
7 |
8 | def show_lru_cache_info():
9 | if not os.environ.get("PORTAGE_SHOW_LRU_CACHE_INFO"):
10 | return
11 |
12 | portage_lru_caches = {
13 | portage.dep._use_reduce_cached: "use_reduce_cached",
14 | portage.eapi._get_eapi_attrs: "get_eapi_attrs",
15 | portage.process._encoded_length: "encoded_length",
16 | portage.versions.catpkgsplit: "catpkgsplit",
17 | portage.versions.vercmp: "vercmp",
18 | }
19 |
20 | print("Portage @lru_cache information")
21 | for method, name in portage_lru_caches.items():
22 | cache_info = method.cache_info()
23 |
24 | hits = cache_info.hits
25 | misses = cache_info.misses
26 | maxsize = cache_info.maxsize
27 | currsize = cache_info.currsize
28 |
29 | total = hits + misses
30 | if total:
31 | hitratio = hits / total
32 | else:
33 | hitratio = 0
34 |
35 | if maxsize:
36 | utilization = currsize / maxsize
37 | else:
38 | utilization = 0
39 |
40 | pretty_cache_info = f"hit ratio: {hitratio:.2%} (total: {total}, hits: {hits}, misses: {misses}) util: {utilization:.2%} ({maxsize} / {currsize})"
41 |
42 | print(f"{name}: {pretty_cache_info}")
43 |
--------------------------------------------------------------------------------