aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bersenev <bay@hackerdom.ru>2014-02-17 17:55:51 +0600
committerAlexander Bersenev <bay@hackerdom.ru>2014-02-17 17:55:51 +0600
commit5a3f506c9ef1cfd78940b0509f10ef94b4434e29 (patch)
tree147c35a17a8bcd8ff467bb3063adab623da51fac /portage_with_autodep
parentfixed a deadlock (diff)
downloadautodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.tar.gz
autodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.tar.bz2
autodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.zip
updated portage to 2.2.8-r1
Diffstat (limited to 'portage_with_autodep')
-rwxr-xr-xportage_with_autodep/bin/archive-conf2
-rwxr-xr-xportage_with_autodep/bin/bashrc-functions.sh140
-rwxr-xr-xportage_with_autodep/bin/chpathtool.py182
-rwxr-xr-xportage_with_autodep/bin/dispatch-conf94
-rwxr-xr-xportage_with_autodep/bin/dohtml.py13
-rwxr-xr-xportage_with_autodep/bin/eapi.sh145
-rwxr-xr-xportage_with_autodep/bin/ebuild64
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/bsd/sed (renamed from portage_with_autodep/bin/ebuild-helpers/sed)14
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dobin11
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dodir7
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dodoc5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/doexe11
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dohard9
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/doheader19
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/doinfo11
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/doins17
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dolib7
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/doman9
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/domo12
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dosbin11
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dosed9
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/dosym18
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/ecompressdir73
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/fowners13
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/fperms7
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/keepdir20
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newbin5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newconfd5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newdoc5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newenvd5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newexe5
l---------portage_with_autodep/bin/ebuild-helpers/newheader1
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newinitd5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newins3
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newlib.a5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newlib.so5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newman5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/newsbin5
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepall11
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepalldocs8
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepallinfo7
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepallman7
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepallstrip7
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepinfo9
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/preplib9
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepman11
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/prepstrip290
l---------portage_with_autodep/bin/ebuild-helpers/unprivileged/chgrp1
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/unprivileged/chown41
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/xattr/install12
-rwxr-xr-xportage_with_autodep/bin/ebuild-ipc.py38
-rwxr-xr-xportage_with_autodep/bin/ebuild.sh1993
-rwxr-xr-xportage_with_autodep/bin/egencache181
-rwxr-xr-xportage_with_autodep/bin/emaint22
-rwxr-xr-xportage_with_autodep/bin/emerge-webrsync17
-rwxr-xr-xportage_with_autodep/bin/emirrordist13
-rwxr-xr-xportage_with_autodep/bin/etc-update769
-rwxr-xr-xportage_with_autodep/bin/fixpackages9
-rwxr-xr-xportage_with_autodep/bin/glsa-check5
-rwxr-xr-xportage_with_autodep/bin/helper-functions.sh62
-rwxr-xr-xportage_with_autodep/bin/install.py253
-rwxr-xr-x[-rw-r--r--]portage_with_autodep/bin/isolated-functions.sh175
-rwxr-xr-xportage_with_autodep/bin/lock-helper.py5
-rwxr-xr-xportage_with_autodep/bin/misc-functions.sh503
-rwxr-xr-xportage_with_autodep/bin/phase-functions.sh1001
-rwxr-xr-xportage_with_autodep/bin/phase-helpers.sh663
-rwxr-xr-xportage_with_autodep/bin/portageq257
-rwxr-xr-xportage_with_autodep/bin/quickpkg73
-rwxr-xr-xportage_with_autodep/bin/regenworld5
-rwxr-xr-xportage_with_autodep/bin/repoman838
-rwxr-xr-xportage_with_autodep/bin/save-ebuild-env.sh100
-rwxr-xr-xportage_with_autodep/bin/xattr-helper.py190
-rwxr-xr-xportage_with_autodep/bin/xpak-helper.py4
-rw-r--r--portage_with_autodep/integration_with_portage.patch920
-rw-r--r--portage_with_autodep/pym/_emerge/AbstractDepPriority.py4
-rw-r--r--portage_with_autodep/pym/_emerge/AbstractDepPriority.pyobin0 -> 1757 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/AbstractEbuildProcess.py52
-rw-r--r--portage_with_autodep/pym/_emerge/AbstractEbuildProcess.pyobin0 -> 10082 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/AbstractPollTask.py112
-rw-r--r--portage_with_autodep/pym/_emerge/AbstractPollTask.pyobin0 -> 4918 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/AsynchronousLock.py90
-rw-r--r--portage_with_autodep/pym/_emerge/AsynchronousLock.pyobin0 -> 10536 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/AsynchronousTask.py45
-rw-r--r--portage_with_autodep/pym/_emerge/AsynchronousTask.pyobin0 -> 5610 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/AtomArg.pyobin0 -> 771 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/Binpkg.py85
-rw-r--r--portage_with_autodep/pym/_emerge/Binpkg.pyobin0 -> 13229 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.py6
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.pyobin0 -> 3084 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.py3
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.pyobin0 -> 1337 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgFetcher.py3
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgFetcher.pyobin0 -> 5698 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgPrefetcher.pyobin0 -> 1932 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BinpkgVerifier.pyobin0 -> 2515 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/Blocker.pyobin0 -> 853 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BlockerCache.py21
-rw-r--r--portage_with_autodep/pym/_emerge/BlockerCache.pyobin0 -> 6840 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BlockerDB.py5
-rw-r--r--portage_with_autodep/pym/_emerge/BlockerDB.pyobin0 -> 4286 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/BlockerDepPriority.pyobin0 -> 797 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/CompositeTask.py7
-rw-r--r--portage_with_autodep/pym/_emerge/CompositeTask.pyobin0 -> 5111 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/DepPriority.pyobin0 -> 1653 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/DepPriorityNormalRange.pyobin0 -> 1866 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/DepPrioritySatisfiedRange.pyobin0 -> 2980 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/Dependency.py5
-rw-r--r--portage_with_autodep/pym/_emerge/Dependency.pyobin0 -> 1092 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/DependencyArg.pyobin0 -> 1612 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildBinpkg.py6
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildBinpkg.pyobin0 -> 2007 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildBuild.py29
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildBuild.pyobin0 -> 11947 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildBuildDir.py5
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildBuildDir.pyobin0 -> 3933 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildExecuter.py4
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildExecuter.pyobin0 -> 3424 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildFetcher.py28
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildFetcher.pyobin0 -> 9374 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildFetchonly.py6
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildFetchonly.pyobin0 -> 1552 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildIpcDaemon.py31
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildIpcDaemon.pyobin0 -> 3227 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildMerge.py4
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildMerge.pyobin0 -> 2558 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildMetadataPhase.py154
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildMetadataPhase.pyobin0 -> 5787 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildPhase.py15
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildPhase.py.rej12
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildPhase.pyobin0 -> 11191 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildProcess.pyobin0 -> 967 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EbuildSpawnProcess.pyobin0 -> 897 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/EventsAnalyser.py180
-rw-r--r--portage_with_autodep/pym/_emerge/EventsLogger.py102
-rw-r--r--portage_with_autodep/pym/_emerge/FakeVartree.py26
-rw-r--r--portage_with_autodep/pym/_emerge/FakeVartree.pyobin0 -> 9274 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/FifoIpcDaemon.py25
-rw-r--r--portage_with_autodep/pym/_emerge/FifoIpcDaemon.pyobin0 -> 2902 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/JobStatusDisplay.py21
-rw-r--r--portage_with_autodep/pym/_emerge/JobStatusDisplay.pyobin0 -> 9115 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/MergeListItem.py2
-rw-r--r--portage_with_autodep/pym/_emerge/MergeListItem.pyobin0 -> 3960 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/MetadataRegen.py79
-rw-r--r--portage_with_autodep/pym/_emerge/MetadataRegen.pyobin0 -> 5760 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/MiscFunctionsProcess.py10
-rw-r--r--portage_with_autodep/pym/_emerge/MiscFunctionsProcess.pyobin0 -> 1701 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/Package.py50
-rw-r--r--portage_with_autodep/pym/_emerge/Package.pyobin0 -> 21535 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/PackageArg.pyobin0 -> 1110 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/PackageMerge.py2
-rw-r--r--portage_with_autodep/pym/_emerge/PackageMerge.pyobin0 -> 1509 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/PackageUninstall.pyobin0 -> 4110 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/PackageVirtualDbapi.py22
-rw-r--r--portage_with_autodep/pym/_emerge/PackageVirtualDbapi.pyobin0 -> 6099 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/PipeReader.py60
-rw-r--r--portage_with_autodep/pym/_emerge/PipeReader.pyobin0 -> 3672 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/PollScheduler.py346
-rw-r--r--portage_with_autodep/pym/_emerge/PollScheduler.pyobin0 -> 8151 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/ProgressHandler.pyobin0 -> 1115 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/QueueScheduler.py79
-rw-r--r--portage_with_autodep/pym/_emerge/QueueScheduler.pyobin0 -> 3658 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/RootConfig.py2
-rw-r--r--portage_with_autodep/pym/_emerge/RootConfig.pyobin0 -> 1404 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/Scheduler.py399
-rw-r--r--portage_with_autodep/pym/_emerge/Scheduler.pyobin0 -> 55155 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/SequentialTaskQueue.py72
-rw-r--r--portage_with_autodep/pym/_emerge/SequentialTaskQueue.pyobin0 -> 3343 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/SetArg.pyobin0 -> 719 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/SpawnProcess.py107
-rw-r--r--portage_with_autodep/pym/_emerge/SpawnProcess.pyobin0 -> 6006 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/SubProcess.py65
-rw-r--r--portage_with_autodep/pym/_emerge/SubProcess.pyobin0 -> 4178 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/Task.py5
-rw-r--r--portage_with_autodep/pym/_emerge/Task.pyobin0 -> 2148 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/TaskScheduler.py7
-rw-r--r--portage_with_autodep/pym/_emerge/TaskScheduler.pyobin0 -> 1309 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/TaskSequence.pyobin0 -> 2147 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/UninstallFailure.pyobin0 -> 785 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/UnmergeDepPriority.pyobin0 -> 1345 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/UseFlagDisplay.pyobin0 -> 4148 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/__init__.pyobin0 -> 129 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/_find_deep_system_runtime_deps.pyobin0 -> 1299 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/_flush_elog_mod_echo.py2
-rw-r--r--portage_with_autodep/pym/_emerge/_flush_elog_mod_echo.pyobin0 -> 606 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/actions.py500
-rw-r--r--portage_with_autodep/pym/_emerge/actions.pyobin0 -> 80730 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/chk_updated_cfg_files.py42
-rw-r--r--portage_with_autodep/pym/_emerge/clear_caches.pyobin0 -> 719 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/countdown.pyobin0 -> 917 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/create_depgraph_params.py20
-rw-r--r--portage_with_autodep/pym/_emerge/create_depgraph_params.pyobin0 -> 1954 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/create_world_atom.py35
-rw-r--r--portage_with_autodep/pym/_emerge/create_world_atom.pyobin0 -> 2648 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/depgraph.py1140
-rw-r--r--portage_with_autodep/pym/_emerge/depgraph.pyobin0 -> 162245 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/emergelog.py9
-rw-r--r--portage_with_autodep/pym/_emerge/emergelog.pyobin0 -> 1927 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/getloadavg.pyobin0 -> 931 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/help.py798
-rw-r--r--portage_with_autodep/pym/_emerge/help.pyobin0 -> 2546 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/is_valid_package_atom.pyobin0 -> 910 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/main.py295
-rw-r--r--portage_with_autodep/pym/_emerge/main.pyobin0 -> 52644 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/post_emerge.py165
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/__init__.pyobin0 -> 138 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/backtracking.py27
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/backtracking.pyobin0 -> 7838 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/circular_dependency.py5
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/circular_dependency.pyobin0 -> 7555 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/output.py235
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/output.pyobin0 -> 28079 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/output_helpers.py142
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/output_helpers.pyobin0 -> 18016 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/slot_collision.py22
-rw-r--r--portage_with_autodep/pym/_emerge/resolver/slot_collision.pyobin0 -> 23644 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/search.py29
-rw-r--r--portage_with_autodep/pym/_emerge/search.pyobin0 -> 11825 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/show_invalid_depstring_notice.pyobin0 -> 2001 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/stdout_spinner.pyobin0 -> 3440 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/sync/__init__.pyobin0 -> 134 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/sync/getaddrinfo_validate.pyobin0 -> 847 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/sync/old_tree_timestamp.pyobin0 -> 2746 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/unmerge.py55
-rw-r--r--portage_with_autodep/pym/_emerge/unmerge.pyobin0 -> 14236 bytes
-rw-r--r--portage_with_autodep/pym/_emerge/userquery.py6
-rw-r--r--portage_with_autodep/pym/_emerge/userquery.pyobin0 -> 2254 bytes
-rw-r--r--portage_with_autodep/pym/portage/__init__.py132
-rw-r--r--portage_with_autodep/pym/portage/__init__.pyobin0 -> 22647 bytes
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/Config.py132
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/DeletionIterator.py83
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/DeletionTask.py129
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/FetchIterator.py147
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/FetchTask.py629
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/MirrorDistTask.py218
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/__init__.py (renamed from portage_with_autodep/pym/portage/tests/locks/__init__.py)2
-rw-r--r--portage_with_autodep/pym/portage/_emirrordist/main.py455
-rw-r--r--portage_with_autodep/pym/portage/_global_updates.py13
-rw-r--r--portage_with_autodep/pym/portage/_global_updates.pyobin0 -> 7542 bytes
-rw-r--r--portage_with_autodep/pym/portage/_legacy_globals.py13
-rw-r--r--portage_with_autodep/pym/portage/_legacy_globals.pyobin0 -> 1922 bytes
-rw-r--r--portage_with_autodep/pym/portage/_selinux.pyobin0 -> 4706 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/__init__.py45
-rw-r--r--portage_with_autodep/pym/portage/_sets/__init__.pyobin0 -> 9216 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/base.pyobin0 -> 10383 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/dbapi.py14
-rw-r--r--portage_with_autodep/pym/portage/_sets/dbapi.pyobin0 -> 15064 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/files.pyobin0 -> 13042 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/libs.pyobin0 -> 4053 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/profiles.pyobin0 -> 2296 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/security.py8
-rw-r--r--portage_with_autodep/pym/portage/_sets/security.pyobin0 -> 4426 bytes
-rw-r--r--portage_with_autodep/pym/portage/_sets/shell.pyobin0 -> 2072 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/__init__.pyobin0 -> 135 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/anydbm.pyobin0 -> 3755 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/cache_errors.pyobin0 -> 4629 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/ebuild_xattr.py3
-rw-r--r--portage_with_autodep/pym/portage/cache/ebuild_xattr.pyobin0 -> 6260 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/flat_hash.py9
-rw-r--r--portage_with_autodep/pym/portage/cache/flat_hash.pyobin0 -> 5468 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/flat_list.pyobin0 -> 4939 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/fs_template.pyobin0 -> 3580 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/mappings.py2
-rw-r--r--portage_with_autodep/pym/portage/cache/mappings.pyobin0 -> 18081 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/metadata.py8
-rw-r--r--portage_with_autodep/pym/portage/cache/metadata.pyobin0 -> 5048 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/metadata_overlay.py105
-rw-r--r--portage_with_autodep/pym/portage/cache/sql_template.pyobin0 -> 10542 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/sqlite.pyobin0 -> 9109 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/template.py108
-rw-r--r--portage_with_autodep/pym/portage/cache/template.pyobin0 -> 11332 bytes
-rw-r--r--portage_with_autodep/pym/portage/cache/util.py170
-rw-r--r--portage_with_autodep/pym/portage/cache/volatile.py11
-rw-r--r--portage_with_autodep/pym/portage/cache/volatile.pyobin0 -> 1633 bytes
-rw-r--r--portage_with_autodep/pym/portage/checksum.py136
-rw-r--r--portage_with_autodep/pym/portage/checksum.pyobin0 -> 10716 bytes
-rw-r--r--portage_with_autodep/pym/portage/const.py59
-rw-r--r--portage_with_autodep/pym/portage/const.py.rej12
-rw-r--r--portage_with_autodep/pym/portage/const.pyobin0 -> 4887 bytes
-rw-r--r--portage_with_autodep/pym/portage/cvstree.py10
-rw-r--r--portage_with_autodep/pym/portage/cvstree.pyobin0 -> 9826 bytes
-rw-r--r--portage_with_autodep/pym/portage/data.py208
-rw-r--r--portage_with_autodep/pym/portage/data.pyobin0 -> 5965 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/_MergeProcess.py91
-rw-r--r--portage_with_autodep/pym/portage/dbapi/_MergeProcess.pyobin0 -> 6813 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/_SyncfsProcess.py53
-rw-r--r--portage_with_autodep/pym/portage/dbapi/__init__.py122
-rw-r--r--portage_with_autodep/pym/portage/dbapi/__init__.pyobin0 -> 11096 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/_expand_new_virt.py3
-rw-r--r--portage_with_autodep/pym/portage/dbapi/_expand_new_virt.pyobin0 -> 1943 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/_similar_name_search.py57
-rw-r--r--portage_with_autodep/pym/portage/dbapi/bintree.py110
-rw-r--r--portage_with_autodep/pym/portage/dbapi/bintree.pyobin0 -> 39953 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/cpv_expand.pyobin0 -> 2373 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/dep_expand.pyobin0 -> 1500 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/porttree.py694
-rw-r--r--portage_with_autodep/pym/portage/dbapi/porttree.pyobin0 -> 33775 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/vartree.py834
-rw-r--r--portage_with_autodep/pym/portage/dbapi/vartree.pyobin0 -> 120778 bytes
-rw-r--r--portage_with_autodep/pym/portage/dbapi/virtual.py32
-rw-r--r--portage_with_autodep/pym/portage/dbapi/virtual.pyobin0 -> 5813 bytes
-rw-r--r--portage_with_autodep/pym/portage/debug.py4
-rw-r--r--portage_with_autodep/pym/portage/debug.pyobin0 -> 4434 bytes
-rw-r--r--portage_with_autodep/pym/portage/dep/__init__.py232
-rw-r--r--portage_with_autodep/pym/portage/dep/__init__.pyobin0 -> 67806 bytes
-rw-r--r--portage_with_autodep/pym/portage/dep/_slot_operator.py97
-rw-r--r--portage_with_autodep/pym/portage/dep/dep_check.py44
-rw-r--r--portage_with_autodep/pym/portage/dep/dep_check.pyobin0 -> 13211 bytes
-rw-r--r--portage_with_autodep/pym/portage/dispatch_conf.py42
-rw-r--r--portage_with_autodep/pym/portage/dispatch_conf.pyobin0 -> 7195 bytes
-rw-r--r--portage_with_autodep/pym/portage/eapi.py14
-rw-r--r--portage_with_autodep/pym/portage/eapi.pyobin0 -> 4007 bytes
-rw-r--r--portage_with_autodep/pym/portage/eclass_cache.py84
-rw-r--r--portage_with_autodep/pym/portage/eclass_cache.pyobin0 -> 5716 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/__init__.py20
-rw-r--r--portage_with_autodep/pym/portage/elog/__init__.pyobin0 -> 5346 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/filtering.pyobin0 -> 574 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/messages.py36
-rw-r--r--portage_with_autodep/pym/portage/elog/messages.pyobin0 -> 4935 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_custom.pyobin0 -> 988 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_echo.py13
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_echo.pyobin0 -> 1933 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_mail.pyobin0 -> 1464 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_mail_summary.pyobin0 -> 3107 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_save.py28
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_save.pyobin0 -> 2192 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_save_summary.py21
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_save_summary.pyobin0 -> 2342 bytes
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_syslog.py14
-rw-r--r--portage_with_autodep/pym/portage/elog/mod_syslog.pyobin0 -> 1292 bytes
-rw-r--r--portage_with_autodep/pym/portage/emaint/__init__.py5
-rw-r--r--portage_with_autodep/pym/portage/emaint/defaults.py25
-rw-r--r--portage_with_autodep/pym/portage/emaint/main.py222
-rw-r--r--portage_with_autodep/pym/portage/emaint/module.py194
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/__init__.py5
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/binhost/__init__.py20
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/binhost/binhost.py163
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/config/__init__.py20
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/config/config.py79
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/logs/__init__.py45
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/logs/logs.py103
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/move/__init__.py30
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/move/move.py180
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/resume/__init__.py20
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/resume/resume.py58
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/world/__init__.py20
-rw-r--r--portage_with_autodep/pym/portage/emaint/modules/world/world.py89
-rw-r--r--portage_with_autodep/pym/portage/emaint/progress.py61
-rw-r--r--portage_with_autodep/pym/portage/env/__init__.pyobin0 -> 133 bytes
-rw-r--r--portage_with_autodep/pym/portage/env/config.pyobin0 -> 4454 bytes
-rw-r--r--portage_with_autodep/pym/portage/env/loaders.py4
-rw-r--r--portage_with_autodep/pym/portage/env/loaders.pyobin0 -> 11328 bytes
-rw-r--r--portage_with_autodep/pym/portage/env/validators.pyobin0 -> 762 bytes
-rw-r--r--portage_with_autodep/pym/portage/exception.py4
-rw-r--r--portage_with_autodep/pym/portage/exception.pyobin0 -> 11981 bytes
-rw-r--r--portage_with_autodep/pym/portage/getbinpkg.py36
-rw-r--r--portage_with_autodep/pym/portage/getbinpkg.pyobin0 -> 24428 bytes
-rw-r--r--portage_with_autodep/pym/portage/glsa.py23
-rw-r--r--portage_with_autodep/pym/portage/glsa.pyobin0 -> 24474 bytes
-rw-r--r--portage_with_autodep/pym/portage/localization.pyobin0 -> 793 bytes
-rw-r--r--portage_with_autodep/pym/portage/locks.py246
-rw-r--r--portage_with_autodep/pym/portage/locks.pyobin0 -> 12530 bytes
-rw-r--r--portage_with_autodep/pym/portage/mail.py3
-rw-r--r--portage_with_autodep/pym/portage/mail.pyobin0 -> 4745 bytes
-rw-r--r--portage_with_autodep/pym/portage/manifest.py239
-rw-r--r--portage_with_autodep/pym/portage/manifest.pyobin0 -> 24109 bytes
-rw-r--r--portage_with_autodep/pym/portage/news.py81
-rw-r--r--portage_with_autodep/pym/portage/news.pyobin0 -> 15630 bytes
-rw-r--r--portage_with_autodep/pym/portage/output.py45
-rw-r--r--portage_with_autodep/pym/portage/output.pyobin0 -> 28175 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/__init__.pyobin0 -> 137 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/__init__.pyobin0 -> 144 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/KeywordsManager.py43
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/KeywordsManager.pyobin0 -> 8961 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/LicenseManager.py9
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/LicenseManager.pyobin0 -> 8214 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/LocationsManager.py149
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/LocationsManager.pyobin0 -> 9666 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/MaskManager.py82
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/MaskManager.pyobin0 -> 8064 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/UseManager.py30
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/UseManager.pyobin0 -> 9077 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/VirtualsManager.pyobin0 -> 6480 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/__init__.pyobin0 -> 152 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/env_var_validation.pyobin0 -> 1011 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/features_set.pyobin0 -> 5840 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/helper.py4
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/helper.pyobin0 -> 2235 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/special_env_vars.py32
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/special_env_vars.pyobin0 -> 5517 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_config/unpack_dependencies.py38
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_eapi_invalid.py54
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_eapi_invalid.pyobin0 -> 1848 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_ipc/ExitCommand.pyobin0 -> 1057 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_ipc/IpcCommand.pyobin0 -> 612 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_ipc/QueryCommand.py11
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_ipc/QueryCommand.pyobin0 -> 3629 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_ipc/__init__.pyobin0 -> 149 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_metadata_invalid.py41
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_parallel_manifest/ManifestProcess.py43
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_parallel_manifest/ManifestScheduler.py93
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_parallel_manifest/ManifestTask.py186
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_parallel_manifest/__init__.py (renamed from portage_with_autodep/pym/portage/tests/dbapi/__init__.py)2
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_spawn_nofetch.py8
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/_spawn_nofetch.pyobin0 -> 3182 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/config.py443
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/config.pyobin0 -> 65727 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/deprecated_profile_check.pyobin0 -> 1949 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/digestcheck.py57
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/digestcheck.pyobin0 -> 4457 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/digestgen.py28
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/digestgen.pyobin0 -> 5721 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/doebuild.py592
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/doebuild.pyobin0 -> 55376 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/fetch.py88
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/fetch.pyobin0 -> 24287 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/getmaskingreason.py8
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/getmaskingreason.pyobin0 -> 3654 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/getmaskingstatus.py22
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/getmaskingstatus.pyobin0 -> 5230 bytes
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/prepare_build_dirs.py48
-rw-r--r--portage_with_autodep/pym/portage/package/ebuild/prepare_build_dirs.pyobin0 -> 11519 bytes
-rw-r--r--portage_with_autodep/pym/portage/process.py66
-rw-r--r--portage_with_autodep/pym/portage/process.pyobin0 -> 12173 bytes
-rw-r--r--portage_with_autodep/pym/portage/proxy/__init__.pyobin0 -> 135 bytes
-rw-r--r--portage_with_autodep/pym/portage/proxy/lazyimport.pyobin0 -> 6140 bytes
-rw-r--r--portage_with_autodep/pym/portage/proxy/objectproxy.pyobin0 -> 5289 bytes
-rw-r--r--portage_with_autodep/pym/portage/repository/__init__.pyobin0 -> 140 bytes
-rw-r--r--portage_with_autodep/pym/portage/repository/config.py620
-rw-r--r--portage_with_autodep/pym/portage/repository/config.pyobin0 -> 24828 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/__init__.py150
-rw-r--r--portage_with_autodep/pym/portage/tests/__init__.pyobin0 -> 10394 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/setup_env.py85
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/test_dobin.py16
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/test_dodir.py16
-rw-r--r--portage_with_autodep/pym/portage/tests/dbapi/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/dbapi/test_fakedbapi.py58
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/__init__.py3
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/testAtom.py315
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/testCheckRequiredUse.py219
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/testExtendedAtomDict.py18
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/testExtractAffectingUSE.py75
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/testStandalone.py36
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_best_match_to_list.py43
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_dep_getcpv.py35
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_dep_getrepo.py29
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_dep_getslot.py28
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_dep_getusedeps.py35
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_get_operator.py33
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_get_required_use_flags.py42
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_isjustname.py24
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_isvalidatom.py146
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_match_from_list.py108
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_paren_reduce.py66
-rw-r--r--portage_with_autodep/pym/portage/tests/dep/test_use_reduce.py627
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/__init__.py2
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/test_array_fromfile_eof.py43
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/test_config.py198
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/test_doebuild_spawn.py82
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/test_ipc_daemon.py124
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/test_pty_eof.py32
-rw-r--r--portage_with_autodep/pym/portage/tests/ebuild/test_spawn.py52
-rw-r--r--portage_with_autodep/pym/portage/tests/env/__init__.py4
-rw-r--r--portage_with_autodep/pym/portage/tests/env/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/env/config/__init__.py4
-rw-r--r--portage_with_autodep/pym/portage/tests/env/config/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/env/config/test_PackageKeywordsFile.py40
-rw-r--r--portage_with_autodep/pym/portage/tests/env/config/test_PackageMaskFile.py29
-rw-r--r--portage_with_autodep/pym/portage/tests/env/config/test_PackageUseFile.py37
-rw-r--r--portage_with_autodep/pym/portage/tests/env/config/test_PortageModulesFile.py39
-rw-r--r--portage_with_autodep/pym/portage/tests/lafilefixer/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/lafilefixer/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/lafilefixer/test_lafilefixer.py145
-rw-r--r--portage_with_autodep/pym/portage/tests/lazyimport/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/lazyimport/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/lazyimport/test_lazy_import_portage_baseline.py81
-rw-r--r--portage_with_autodep/pym/portage/tests/lazyimport/test_preload_portage_submodules.py16
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/__init__.pyobin0 -> 140 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.pyobin0 -> 1944 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_compile_modules.pyobin0 -> 1855 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/lint/test_import_modules.pyobin0 -> 1725 bytes
-rw-r--r--portage_with_autodep/pym/portage/tests/locks/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/locks/test_asynchronous_lock.py124
-rw-r--r--portage_with_autodep/pym/portage/tests/locks/test_lock_nonblock.py46
-rw-r--r--portage_with_autodep/pym/portage/tests/news/__init__.py3
-rw-r--r--portage_with_autodep/pym/portage/tests/news/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/news/test_NewsItem.py95
-rw-r--r--portage_with_autodep/pym/portage/tests/process/__init__.py2
-rw-r--r--portage_with_autodep/pym/portage/tests/process/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/process/test_poll.py39
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/ResolverPlayground.py690
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_autounmask.py326
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_backtracking.py169
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_circular_dependencies.py84
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_depclean.py285
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_depth.py252
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_eapi.py115
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_merge_order.py453
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_missing_iuse_and_evaluated_atoms.py31
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_multirepo.py318
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_multislot.py40
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_old_dep_chain_display.py35
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_output.py88
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_rebuild.py138
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_required_use.py114
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_simple.py57
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_slot_collisions.py143
-rw-r--r--portage_with_autodep/pym/portage/tests/resolver/test_use_dep_defaults.py40
-rwxr-xr-xportage_with_autodep/pym/portage/tests/runTests6
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/base/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/base/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/base/testInternalPackageSet.py61
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/files/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/files/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/files/testConfigFileSet.py32
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/files/testStaticFileSet.py27
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/shell/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/shell/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/sets/shell/testShell.py28
-rw-r--r--portage_with_autodep/pym/portage/tests/unicode/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/unicode/test_string_format.py108
-rw-r--r--portage_with_autodep/pym/portage/tests/util/__init__.py4
-rw-r--r--portage_with_autodep/pym/portage/tests/util/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_digraph.py201
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_getconfig.py29
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_grabdict.py11
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_normalizedPath.py14
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_stackDictList.py17
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_stackDicts.py36
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_stackLists.py19
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_uniqueArray.py24
-rw-r--r--portage_with_autodep/pym/portage/tests/util/test_varExpand.py92
-rw-r--r--portage_with_autodep/pym/portage/tests/versions/__init__.py3
-rw-r--r--portage_with_autodep/pym/portage/tests/versions/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/versions/test_cpv_sort_key.py16
-rw-r--r--portage_with_autodep/pym/portage/tests/versions/test_vercmp.py80
-rw-r--r--portage_with_autodep/pym/portage/tests/xpak/__init__.py3
-rw-r--r--portage_with_autodep/pym/portage/tests/xpak/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/xpak/test_decodeint.py16
-rw-r--r--portage_with_autodep/pym/portage/update.py26
-rw-r--r--portage_with_autodep/pym/portage/update.pyobin0 -> 10829 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/ExtractKernelVersion.py4
-rw-r--r--portage_with_autodep/pym/portage/util/ExtractKernelVersion.pyobin0 -> 2297 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/SlotObject.py (renamed from portage_with_autodep/pym/_emerge/SlotObject.py)13
-rw-r--r--portage_with_autodep/pym/portage/util/SlotObject.pyobin0 -> 1719 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_ShelveUnicodeWrapper.py45
-rw-r--r--portage_with_autodep/pym/portage/util/__init__.py203
-rw-r--r--portage_with_autodep/pym/portage/util/__init__.pyobin0 -> 47487 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_argparse.py42
-rw-r--r--portage_with_autodep/pym/portage/util/_async/AsyncScheduler.py102
-rw-r--r--portage_with_autodep/pym/portage/util/_async/FileCopier.py17
-rw-r--r--portage_with_autodep/pym/portage/util/_async/FileDigester.py73
-rw-r--r--portage_with_autodep/pym/portage/util/_async/ForkProcess.py65
-rw-r--r--portage_with_autodep/pym/portage/util/_async/PipeLogger.py163
-rw-r--r--portage_with_autodep/pym/portage/util/_async/PipeReaderBlockingIO.py91
-rw-r--r--portage_with_autodep/pym/portage/util/_async/PopenProcess.py33
-rw-r--r--portage_with_autodep/pym/portage/util/_async/SchedulerInterface.py79
-rw-r--r--portage_with_autodep/pym/portage/util/_async/TaskScheduler.py20
-rw-r--r--portage_with_autodep/pym/portage/util/_async/__init__.py (renamed from portage_with_autodep/pym/portage/tests/resolver/__init__.py)2
-rw-r--r--portage_with_autodep/pym/portage/util/_async/run_main_scheduler.py41
-rw-r--r--portage_with_autodep/pym/portage/util/_ctypes.py47
-rw-r--r--portage_with_autodep/pym/portage/util/_desktop_entry.py75
-rw-r--r--portage_with_autodep/pym/portage/util/_desktop_entry.pyobin0 -> 2878 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_dyn_libs/LinkageMapELF.py8
-rw-r--r--portage_with_autodep/pym/portage/util/_dyn_libs/LinkageMapELF.pyobin0 -> 26399 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py109
-rw-r--r--portage_with_autodep/pym/portage/util/_dyn_libs/PreservedLibsRegistry.pyobin0 -> 8884 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_dyn_libs/__init__.pyobin0 -> 144 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_dyn_libs/display_preserved_libs.py98
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/EventLoop.py490
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/EventLoop.pyobin0 -> 13508 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/GlibEventLoop.py23
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/GlibEventLoop.pyobin0 -> 1029 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/PollConstants.py (renamed from portage_with_autodep/pym/_emerge/PollConstants.py)0
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/PollConstants.pyobin0 -> 787 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/PollSelectAdapter.py (renamed from portage_with_autodep/pym/_emerge/PollSelectAdapter.py)7
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/PollSelectAdapter.pyobin0 -> 2220 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/__init__.py (renamed from portage_with_autodep/pym/portage/tests/unicode/__init__.py)2
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/__init__.pyobin0 -> 145 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/global_event_loop.py35
-rw-r--r--portage_with_autodep/pym/portage/util/_eventloop/global_event_loop.pyobin0 -> 878 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_get_vm_info.py80
-rw-r--r--portage_with_autodep/pym/portage/util/_info_files.py138
-rw-r--r--portage_with_autodep/pym/portage/util/_path.py27
-rw-r--r--portage_with_autodep/pym/portage/util/_pty.py152
-rw-r--r--portage_with_autodep/pym/portage/util/_pty.pyobin0 -> 1936 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/_urlopen.py42
-rw-r--r--portage_with_autodep/pym/portage/util/_urlopen.pyobin0 -> 1626 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/digraph.py15
-rw-r--r--portage_with_autodep/pym/portage/util/digraph.pyobin0 -> 10678 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/env_update.py78
-rw-r--r--portage_with_autodep/pym/portage/util/env_update.pyobin0 -> 9095 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/lafilefixer.py2
-rw-r--r--portage_with_autodep/pym/portage/util/lafilefixer.pyobin0 -> 3621 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/listdir.py2
-rw-r--r--portage_with_autodep/pym/portage/util/listdir.pyobin0 -> 4088 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/movefile.py144
-rw-r--r--portage_with_autodep/pym/portage/util/movefile.pyobin0 -> 8236 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/mtimedb.py75
-rw-r--r--portage_with_autodep/pym/portage/util/mtimedb.pyobin0 -> 3770 bytes
-rw-r--r--portage_with_autodep/pym/portage/util/whirlpool.py794
-rw-r--r--portage_with_autodep/pym/portage/util/whirlpool.pyobin0 -> 38994 bytes
-rw-r--r--portage_with_autodep/pym/portage/versions.py187
-rw-r--r--portage_with_autodep/pym/portage/versions.pyobin0 -> 13125 bytes
-rw-r--r--portage_with_autodep/pym/portage/xml/__init__.pyobin0 -> 133 bytes
-rw-r--r--portage_with_autodep/pym/portage/xml/metadata.py60
-rw-r--r--portage_with_autodep/pym/portage/xml/metadata.pyobin0 -> 15298 bytes
-rw-r--r--portage_with_autodep/pym/portage/xpak.py312
-rw-r--r--portage_with_autodep/pym/portage/xpak.pyobin0 -> 16218 bytes
-rw-r--r--portage_with_autodep/pym/repoman/__init__.pyobin0 -> 129 bytes
-rw-r--r--portage_with_autodep/pym/repoman/checks.py49
-rw-r--r--portage_with_autodep/pym/repoman/checks.pyobin0 -> 31426 bytes
-rw-r--r--portage_with_autodep/pym/repoman/errors.pyobin0 -> 1948 bytes
-rw-r--r--portage_with_autodep/pym/repoman/herdbase.py8
-rw-r--r--portage_with_autodep/pym/repoman/herdbase.pyobin0 -> 3401 bytes
-rw-r--r--portage_with_autodep/pym/repoman/utilities.py384
-rw-r--r--portage_with_autodep/pym/repoman/utilities.pyobin0 -> 24780 bytes
622 files changed, 21297 insertions, 16543 deletions
diff --git a/portage_with_autodep/bin/archive-conf b/portage_with_autodep/bin/archive-conf
index 5a03b85..7978668 100755
--- a/portage_with_autodep/bin/archive-conf
+++ b/portage_with_autodep/bin/archive-conf
@@ -20,7 +20,7 @@ except ImportError:
import portage
from portage import os
-import dispatch_conf
+from portage import dispatch_conf
FIND_EXTANT_CONTENTS = "find %s -name CONTENTS"
diff --git a/portage_with_autodep/bin/bashrc-functions.sh b/portage_with_autodep/bin/bashrc-functions.sh
new file mode 100755
index 0000000..4da5585
--- /dev/null
+++ b/portage_with_autodep/bin/bashrc-functions.sh
@@ -0,0 +1,140 @@
+#!/bin/bash
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+portageq() {
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" "$@"
+}
+
+register_die_hook() {
+ local x
+ for x in $* ; do
+ has $x $EBUILD_DEATH_HOOKS || \
+ export EBUILD_DEATH_HOOKS="$EBUILD_DEATH_HOOKS $x"
+ done
+}
+
+register_success_hook() {
+ local x
+ for x in $* ; do
+ has $x $EBUILD_SUCCESS_HOOKS || \
+ export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x"
+ done
+}
+
+strip_duplicate_slashes() {
+ if [[ -n $1 ]] ; then
+ local removed=$1
+ while [[ ${removed} == *//* ]] ; do
+ removed=${removed//\/\///}
+ done
+ echo ${removed}
+ fi
+}
+
+# this is a function for removing any directory matching a passed in pattern from
+# PATH
+remove_path_entry() {
+ save_IFS
+ IFS=":"
+ stripped_path="${PATH}"
+ while [ -n "$1" ]; do
+ cur_path=""
+ for p in ${stripped_path}; do
+ if [ "${p/${1}}" == "${p}" ]; then
+ cur_path="${cur_path}:${p}"
+ fi
+ done
+ stripped_path="${cur_path#:*}"
+ shift
+ done
+ restore_IFS
+ PATH="${stripped_path}"
+}
+
+# Set given variables unless these variable have been already set (e.g. during emerge
+# invocation) to values different than values set in make.conf.
+set_unless_changed() {
+ if [[ $# -lt 1 ]]; then
+ die "${FUNCNAME}() requires at least 1 argument: VARIABLE=VALUE"
+ fi
+
+ local argument value variable
+ for argument in "$@"; do
+ if [[ ${argument} != *=* ]]; then
+ die "${FUNCNAME}(): Argument '${argument}' has incorrect syntax"
+ fi
+ variable="${argument%%=*}"
+ value="${argument#*=}"
+ if eval "[[ \${${variable}} == \$(env -u ${variable} portageq envvar ${variable}) ]]"; then
+ eval "${variable}=\"\${value}\""
+ fi
+ done
+}
+
+# Unset given variables unless these variable have been set (e.g. during emerge
+# invocation) to values different than values set in make.conf.
+unset_unless_changed() {
+ if [[ $# -lt 1 ]]; then
+ die "${FUNCNAME}() requires at least 1 argument: VARIABLE"
+ fi
+
+ local variable
+ for variable in "$@"; do
+ if eval "[[ \${${variable}} == \$(env -u ${variable} portageq envvar ${variable}) ]]"; then
+ unset ${variable}
+ fi
+ done
+}
+
+KV_major() {
+ [[ -z $1 ]] && return 1
+
+ local KV=$@
+ echo "${KV%%.*}"
+}
+
+KV_minor() {
+ [[ -z $1 ]] && return 1
+
+ local KV=$@
+ KV=${KV#*.}
+ echo "${KV%%.*}"
+}
+
+KV_micro() {
+ [[ -z $1 ]] && return 1
+
+ local KV=$@
+ KV=${KV#*.*.}
+ echo "${KV%%[^[:digit:]]*}"
+}
+
+KV_to_int() {
+ [[ -z $1 ]] && return 1
+
+ local KV_MAJOR=$(KV_major "$1")
+ local KV_MINOR=$(KV_minor "$1")
+ local KV_MICRO=$(KV_micro "$1")
+ local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+ # We make version 2.2.0 the minimum version we will handle as
+ # a sanity check ... if its less, we fail ...
+ if [[ ${KV_int} -ge 131584 ]] ; then
+ echo "${KV_int}"
+ return 0
+ fi
+
+ return 1
+}
+
+_RC_GET_KV_CACHE=""
+get_KV() {
+ [[ -z ${_RC_GET_KV_CACHE} ]] \
+ && _RC_GET_KV_CACHE=$(uname -r)
+
+ echo $(KV_to_int "${_RC_GET_KV_CACHE}")
+
+ return $?
+}
diff --git a/portage_with_autodep/bin/chpathtool.py b/portage_with_autodep/bin/chpathtool.py
new file mode 100755
index 0000000..d0d49cb
--- /dev/null
+++ b/portage_with_autodep/bin/chpathtool.py
@@ -0,0 +1,182 @@
+#!/usr/bin/python
+# Copyright 2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import io
+import optparse
+import os
+import stat
+import sys
+
+CONTENT_ENCODING = "utf_8"
+FS_ENCODING = "utf_8"
+
+try:
+ import magic
+except ImportError:
+ magic = None
+else:
+ try:
+ magic.MIME_TYPE
+ except AttributeError:
+ # magic module seems to be broken
+ magic = None
+
+class IsTextFile(object):
+
+ def __init__(self):
+ if magic is not None:
+ self._call = self._is_text_magic
+ self._m = magic.open(magic.MIME_TYPE)
+ self._m.load()
+ else:
+ self._call = self._is_text_encoding
+ self._encoding = CONTENT_ENCODING
+
+ def __call__(self, filename):
+ """
+ Returns True if the given file is a text file, and False otherwise.
+ """
+ return self._call(filename)
+
+ def _is_text_magic(self, filename):
+ mime_type = self._m.file(filename)
+ return mime_type.startswith("text/")
+
+ def _is_text_encoding(self, filename):
+ try:
+ for line in io.open(filename, mode='r', encoding=self._encoding):
+ pass
+ except UnicodeDecodeError:
+ return False
+ return True
+
+def chpath_inplace(filename, is_text_file, old, new):
+ """
+ Returns True if any modifications were made, and False otherwise.
+ """
+
+ modified = False
+ orig_stat = os.lstat(filename)
+ try:
+ f = io.open(filename, buffering=0, mode='r+b')
+ except IOError:
+ try:
+ orig_mode = stat.S_IMODE(os.lstat(filename).st_mode)
+ except OSError as e:
+ sys.stderr.write("%s: %s\n" % (e, filename))
+ return
+ temp_mode = 0o200 | orig_mode
+ os.chmod(filename, temp_mode)
+ try:
+ f = io.open(filename, buffering=0, mode='r+b')
+ finally:
+ os.chmod(filename, orig_mode)
+
+ len_old = len(old)
+ len_new = len(new)
+ matched_byte_count = 0
+ while True:
+ in_byte = f.read(1)
+
+ if not in_byte:
+ break
+
+ if in_byte == old[matched_byte_count]:
+ matched_byte_count += 1
+ if matched_byte_count == len_old:
+ modified = True
+ matched_byte_count = 0
+ end_position = f.tell()
+ start_position = end_position - len_old
+ if not is_text_file:
+ # search backwards for leading slashes written by
+ # a previous invocation of this tool
+ num_to_write = len_old
+ f.seek(start_position - 1)
+ while True:
+ if f.read(1) != b'/':
+ break
+ num_to_write += 1
+ f.seek(f.tell() - 2)
+
+ # pad with as many leading slashes as necessary
+ while num_to_write > len_new:
+ f.write(b'/')
+ num_to_write -= 1
+ f.write(new)
+ else:
+ remainder = f.read()
+ f.seek(start_position)
+ f.write(new)
+ if remainder:
+ f.write(remainder)
+ f.truncate()
+ f.seek(start_position + len_new)
+ elif matched_byte_count > 0:
+ # back up an try to start a new match after
+ # the first byte of the previous partial match
+ f.seek(f.tell() - matched_byte_count)
+ matched_byte_count = 0
+
+ f.close()
+ if modified:
+ orig_mtime = orig_stat[stat.ST_MTIME]
+ os.utime(filename, (orig_mtime, orig_mtime))
+ return modified
+
+def chpath_inplace_symlink(filename, st, old, new):
+ target = os.readlink(filename)
+ if target.startswith(old):
+ new_target = new + target[len(old):]
+ os.unlink(filename)
+ os.symlink(new_target, filename)
+ os.lchown(filename, st.st_uid, st.st_gid)
+
+def main(argv):
+
+ usage = "%s [options] <location> <old> <new>" % (os.path.basename(argv[0],))
+ parser = optparse.OptionParser(usage=usage)
+ options, args = parser.parse_args(argv[1:])
+
+ if len(args) != 3:
+ parser.error("3 args required, got %s" % (len(args),))
+
+ location, old, new = args
+
+ is_text_file = IsTextFile()
+
+ if not isinstance(location, bytes):
+ location = location.encode(FS_ENCODING)
+ if not isinstance(old, bytes):
+ old = old.encode(FS_ENCODING)
+ if not isinstance(new, bytes):
+ new = new.encode(FS_ENCODING)
+
+ st = os.lstat(location)
+
+ if stat.S_ISDIR(st.st_mode):
+ for parent, dirs, files in os.walk(location):
+ for filename in files:
+ filename = os.path.join(parent, filename)
+ try:
+ st = os.lstat(filename)
+ except OSError:
+ pass
+ else:
+ if stat.S_ISREG(st.st_mode):
+ chpath_inplace(filename,
+ is_text_file(filename), old, new)
+ elif stat.S_ISLNK(st.st_mode):
+ chpath_inplace_symlink(filename, st, old, new)
+
+ elif stat.S_ISREG(st.st_mode):
+ chpath_inplace(location,
+ is_text_file(location), old, new)
+ elif stat.S_ISLNK(st.st_mode):
+ chpath_inplace_symlink(location, st, old, new)
+
+ return os.EX_OK
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/portage_with_autodep/bin/dispatch-conf b/portage_with_autodep/bin/dispatch-conf
index 1e21a52..139a001 100755
--- a/portage_with_autodep/bin/dispatch-conf
+++ b/portage_with_autodep/bin/dispatch-conf
@@ -1,5 +1,5 @@
#!/usr/bin/python -O
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
@@ -27,13 +27,11 @@ except ImportError:
from portage import os
from portage import dispatch_conf
from portage import _unicode_decode
-from portage.dispatch_conf import diffstatusoutput_len
+from portage.dispatch_conf import diffstatusoutput
from portage.process import find_binary
FIND_EXTANT_CONFIGS = "find '%s' %s -name '._cfg????_%s' ! -name '.*~' ! -iname '.*.bak' -print"
DIFF_CONTENTS = "diff -Nu '%s' '%s'"
-DIFF_CVS_INTERP = "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep -v '# .Header:.*'"
-DIFF_WSCOMMENTS = "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep -v '^[-+]#' | grep -v '^[-+][:space:]*$'"
# We need a secure scratch dir and python does silly verbose errors on the use of tempnam
oldmask = os.umask(0o077)
@@ -62,7 +60,21 @@ def cleanup(mydir=SCRATCH_DIR):
shutil.rmtree(mydir)
atexit.register(cleanup)
-MANDATORY_OPTS = [ 'archive-dir', 'diff', 'replace-cvs', 'replace-wscomments', 'merge' ]
+MANDATORY_OPTS = [ 'archive-dir', 'diff', 'replace-cvs', 'replace-wscomments', 'merge' ]
+
+def cmd_var_is_valid(cmd):
+ """
+ Return true if the first whitespace-separated token contained
+ in cmd is an executable file, false otherwise.
+ """
+ cmd = portage.util.shlex_split(cmd)
+ if not cmd:
+ return False
+
+ if os.path.isabs(cmd[0]):
+ return os.access(cmd[0], os.EX_OK)
+
+ return find_binary(cmd[0]) is not None
class dispatch:
options = {}
@@ -71,7 +83,7 @@ class dispatch:
confs = []
count = 0
- config_root = '/'
+ config_root = portage.const.EPREFIX or os.sep
self.options = portage.dispatch_conf.read_config(MANDATORY_OPTS)
if "log-file" in self.options:
@@ -84,12 +96,30 @@ class dispatch:
else:
self.options["log-file"] = "/dev/null"
+ pager = self.options.get("pager")
+ if pager is None or not cmd_var_is_valid(pager):
+ pager = os.environ.get("PAGER")
+ if pager is None or not cmd_var_is_valid(pager):
+ pager = "cat"
+
+ pager_basename = os.path.basename(portage.util.shlex_split(pager)[0])
+ if pager_basename == "less":
+ less_opts = self.options.get("less-opts")
+ if less_opts is not None and less_opts.strip():
+ pager += " " + less_opts
+
+ if pager_basename == "cat":
+ pager = ""
+ else:
+ pager = " | " + pager
+
#
# Build list of extant configs
#
for path in config_paths:
- path = portage.normalize_path(path)
+ path = portage.normalize_path(
+ os.path.join(config_root, path.lstrip(os.sep)))
try:
mymode = os.stat(path).st_mode
except OSError:
@@ -100,7 +130,9 @@ class dispatch:
path, basename = os.path.split(path)
find_opts = "-maxdepth 1"
- confs += self.massage(os.popen(FIND_EXTANT_CONFIGS % (path, find_opts, basename)).readlines())
+ with os.popen(FIND_EXTANT_CONFIGS %
+ (path, find_opts, basename)) as proc:
+ confs += self.massage(proc.readlines())
if self.options['use-rcs'] == 'yes':
for rcs_util in ("rcs", "ci", "co", "rcsmerge"):
@@ -118,6 +150,9 @@ class dispatch:
portage.util.shlex_split(
portage.settings.get('CONFIG_PROTECT_MASK', '')))
+ def diff(file1, file2):
+ return diffstatusoutput(DIFF_CONTENTS, file1, file2)
+
#
# Remove new configs identical to current
# and
@@ -134,11 +169,11 @@ class dispatch:
else:
mrgfail = portage.dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf)
if os.path.exists(archive + '.dist'):
- unmodified = diffstatusoutput_len(DIFF_CONTENTS % (conf['current'], archive + '.dist'))[1] == 0
+ unmodified = len(diff(conf['current'], archive + '.dist')[1]) == 0
else:
unmodified = 0
if os.path.exists(mrgconf):
- if mrgfail or diffstatusoutput_len(DIFF_CONTENTS % (conf['new'], mrgconf))[1] == 0:
+ if mrgfail or len(diff(conf['new'], mrgconf)[1]) == 0:
os.unlink(mrgconf)
newconf = conf['new']
else:
@@ -149,24 +184,34 @@ class dispatch:
if newconf == mrgconf and \
self.options.get('ignore-previously-merged') != 'yes' and \
os.path.exists(archive+'.dist') and \
- diffstatusoutput_len(DIFF_CONTENTS % (archive+'.dist', conf['new']))[1] == 0:
+ len(diff(archive+'.dist', conf['new'])[1]) == 0:
# The current update is identical to the archived .dist
# version that has previously been merged.
os.unlink(mrgconf)
newconf = conf['new']
- mystatus, myoutput_len = diffstatusoutput_len(
- DIFF_CONTENTS % (conf ['current'], newconf))
+ mystatus, myoutput = diff(conf['current'], newconf)
+ myoutput_len = len(myoutput)
same_file = 0 == myoutput_len
if mystatus >> 8 == 2:
# Binary files differ
same_cvs = False
same_wsc = False
else:
- same_cvs = 0 == diffstatusoutput_len(
- DIFF_CVS_INTERP % (conf ['current'], newconf))[1]
- same_wsc = 0 == diffstatusoutput_len(
- DIFF_WSCOMMENTS % (conf ['current'], newconf))[1]
+ # Extract all the normal diff lines (ignore the headers).
+ mylines = re.findall('^[+-][^\n+-].*$', myoutput, re.MULTILINE)
+
+ # Filter out all the cvs headers
+ cvs_header = re.compile('# [$]Header:')
+ cvs_lines = list(filter(cvs_header.search, mylines))
+ same_cvs = len(mylines) == len(cvs_lines)
+
+ # Filter out comments and whitespace-only changes.
+ # Note: be nice to also ignore lines that only differ in whitespace...
+ wsc_lines = []
+ for x in ['^[-+]\s*#', '^[-+]\s*$']:
+ wsc_lines += list(filter(re.compile(x).match, mylines))
+ same_wsc = len(mylines) == len(wsc_lines)
# Do options permit?
same_cvs = same_cvs and self.options['replace-cvs'] == 'yes'
@@ -224,10 +269,12 @@ class dispatch:
clear_screen()
if show_new_diff:
cmd = self.options['diff'] % (conf['new'], mrgconf)
+ cmd += pager
spawn_shell(cmd)
show_new_diff = 0
else:
cmd = self.options['diff'] % (conf['current'], newconf)
+ cmd += pager
spawn_shell(cmd)
print()
@@ -423,6 +470,19 @@ def spawn_shell(cmd):
else:
os.system(cmd)
+def usage(argv):
+ print('dispatch-conf: sane configuration file update\n')
+ print('Usage: dispatch-conf [config dirs]\n')
+ print('See the dispatch-conf(1) man page for more details')
+ sys.exit(os.EX_OK)
+
+for x in sys.argv:
+ if x in ('-h', '--help'):
+ usage(sys.argv)
+ elif x in ('--version'):
+ print("Portage", portage.VERSION)
+ sys.exit(os.EX_OK)
+
# run
d = dispatch ()
diff --git a/portage_with_autodep/bin/dohtml.py b/portage_with_autodep/bin/dohtml.py
index 00258ec..f0a7f2c 100755
--- a/portage_with_autodep/bin/dohtml.py
+++ b/portage_with_autodep/bin/dohtml.py
@@ -56,9 +56,9 @@ def install(basename, dirname, options, prefix=""):
fullpath = dirname + "/" + fullpath
if options.DOCDESTTREE:
- destdir = options.D + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
+ destdir = options.ED + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
else:
- destdir = options.D + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
+ destdir = options.ED + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
if not os.path.exists(fullpath):
sys.stderr.write("!!! dohtml: %s does not exist\n" % fullpath)
@@ -86,13 +86,16 @@ def install(basename, dirname, options, prefix=""):
class OptionsClass:
def __init__(self):
self.PF = ""
- self.D = ""
+ self.ED = ""
self.DOCDESTTREE = ""
if "PF" in os.environ:
self.PF = os.environ["PF"]
- if "D" in os.environ:
- self.D = os.environ["D"]
+ if "force-prefix" not in os.environ.get("FEATURES", "").split() and \
+ os.environ.get("EAPI", "0") in ("0", "1", "2"):
+ self.ED = os.environ.get("D", "")
+ else:
+ self.ED = os.environ.get("ED", "")
if "_E_DOCDESTTREE_" in os.environ:
self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"]
diff --git a/portage_with_autodep/bin/eapi.sh b/portage_with_autodep/bin/eapi.sh
new file mode 100755
index 0000000..623b89f
--- /dev/null
+++ b/portage_with_autodep/bin/eapi.sh
@@ -0,0 +1,145 @@
+#!/bin/bash
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# PHASES
+
+___eapi_has_pkg_pretend() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_src_prepare() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1)$ ]]
+}
+
+___eapi_has_src_configure() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1)$ ]]
+}
+
+___eapi_default_src_test_disables_parallel_jobs() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_has_S_WORKDIR_fallback() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+# VARIABLES
+
+___eapi_has_prefix_variables() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2)$ || " ${FEATURES} " == *" force-prefix "* ]]
+}
+
+___eapi_has_HDEPEND() {
+ [[ ${1-${EAPI}} =~ ^(5-hdepend)$ ]]
+}
+
+___eapi_has_RDEPEND_DEPEND_fallback() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+# HELPERS PRESENCE
+
+___eapi_has_dohard() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_dosed() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_docompress() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_nonfatal() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_has_doheader() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_has_usex() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_has_master_repositories() {
+ [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
+}
+
+___eapi_has_repository_path() {
+ [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
+}
+
+___eapi_has_available_eclasses() {
+ [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
+}
+
+___eapi_has_eclass_path() {
+ [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
+}
+
+___eapi_has_license_path() {
+ [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
+}
+
+___eapi_has_package_manager_build_user() {
+ [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
+}
+
+___eapi_has_package_manager_build_group() {
+ [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
+}
+
+# HELPERS BEHAVIOR
+
+___eapi_best_version_and_has_version_support_--host-root() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_unpack_supports_xz() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2)$ ]]
+}
+
+___eapi_econf_passes_--disable-dependency-tracking() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_econf_passes_--disable-silent-rules() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_use_enable_and_use_with_support_empty_third_argument() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_dodoc_supports_-r() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_doins_and_newins_preserve_symlinks() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_newins_supports_reading_from_standard_input() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]]
+}
+
+___eapi_helpers_can_die() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
+}
+
+___eapi_disallows_helpers_in_global_scope() {
+ [[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
+}
+
+___eapi_unpack_is_case_sensitive() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
+}
+
+# OTHERS
+
+___eapi_enables_globstar() {
+ [[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
+}
diff --git a/portage_with_autodep/bin/ebuild b/portage_with_autodep/bin/ebuild
index f8b6d79..35cdc14 100755
--- a/portage_with_autodep/bin/ebuild
+++ b/portage_with_autodep/bin/ebuild
@@ -1,5 +1,5 @@
#!/usr/bin/python -O
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
@@ -29,6 +29,7 @@ def debug_signal(signum, frame):
signal.signal(signal.SIGUSR1, debug_signal)
import imp
+import io
import optparse
import os
@@ -46,6 +47,8 @@ parser.add_option("--color", help="enable or disable color output",
type="choice", choices=("y", "n"))
parser.add_option("--debug", help="show debug output",
action="store_true", dest="debug")
+parser.add_option("--version", help="show version and exit",
+ action="store_true", dest="version")
parser.add_option("--ignore-default-opts",
action="store_true",
help="do not use the EBUILD_DEFAULT_OPTS environment variable")
@@ -54,14 +57,6 @@ parser.add_option("--skip-manifest", help="skip all manifest checks",
opts, pargs = parser.parse_args(args=sys.argv[1:])
-if len(pargs) < 2:
- parser.error("missing required args")
-
-if "merge" in pargs:
- print("Disabling noauto in features... merge disables it. (qmerge doesn't)")
- os.environ["FEATURES"] = os.environ.get("FEATURES", "") + " -noauto"
-
-os.environ["PORTAGE_CALLER"]="ebuild"
try:
import portage
except ImportError:
@@ -79,6 +74,13 @@ from portage.const import VDB_PATH
from _emerge.Package import Package
from _emerge.RootConfig import RootConfig
+if opts.version:
+ print("Portage", portage.VERSION)
+ sys.exit(os.EX_OK)
+
+if len(pargs) < 2:
+ parser.error("missing required args")
+
if not opts.ignore_default_opts:
default_opts = portage.settings.get("EBUILD_DEFAULT_OPTS", "").split()
opts, pargs = parser.parse_args(default_opts + sys.argv[1:])
@@ -138,27 +140,24 @@ vdb_path = os.path.realpath(os.path.join(portage.settings['EROOT'], VDB_PATH))
# Make sure that portdb.findname() returns the correct ebuild.
if ebuild_portdir != vdb_path and \
ebuild_portdir not in portage.portdb.porttrees:
+ portdir_overlay = portage.settings.get("PORTDIR_OVERLAY", "")
if sys.hexversion >= 0x3000000:
os.environ["PORTDIR_OVERLAY"] = \
- os.environ.get("PORTDIR_OVERLAY","") + \
+ portdir_overlay + \
" " + _shell_quote(ebuild_portdir)
else:
os.environ["PORTDIR_OVERLAY"] = \
- os.environ.get("PORTDIR_OVERLAY","") + \
+ _unicode_encode(portdir_overlay,
+ encoding=_encodings['content'], errors='strict') + \
" " + _unicode_encode(_shell_quote(ebuild_portdir),
encoding=_encodings['content'], errors='strict')
print("Appending %s to PORTDIR_OVERLAY..." % ebuild_portdir)
imp.reload(portage)
-# Constrain eclass resolution to the master(s)
-# that are specified in layout.conf (using an
-# approach similar to repoman's).
myrepo = None
if ebuild_portdir != vdb_path:
myrepo = portage.portdb.getRepositoryName(ebuild_portdir)
- repo_info = portage.portdb._repo_info[ebuild_portdir]
- portage.portdb.porttrees = list(repo_info.eclass_db.porttrees)
if not os.path.exists(ebuild):
print("'%s' does not exist." % ebuild)
@@ -167,7 +166,12 @@ if not os.path.exists(ebuild):
ebuild_split = ebuild.split("/")
cpv = "%s/%s" % (ebuild_split[-3], pf)
-if not portage.catpkgsplit(cpv):
+with io.open(_unicode_encode(ebuild, encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'], errors='replace') as f:
+ eapi = portage._parse_eapi_ebuild_head(f)[0]
+if eapi is None:
+ eapi = "0"
+if not portage.catpkgsplit(cpv, eapi=eapi):
print("!!! %s does not follow correct package syntax." % (cpv))
sys.exit(1)
@@ -204,9 +208,10 @@ def discard_digests(myebuild, mysettings, mydbapi):
portage._doebuild_manifest_exempt_depend += 1
pkgdir = os.path.dirname(myebuild)
fetchlist_dict = portage.FetchlistDict(pkgdir, mysettings, mydbapi)
- from portage.manifest import Manifest
- mf = Manifest(pkgdir, mysettings["DISTDIR"],
- fetchlist_dict=fetchlist_dict, manifest1_compat=False)
+ mf = mysettings.repositories.get_repo_for_location(
+ os.path.dirname(os.path.dirname(pkgdir)))
+ mf = mf.load_manifest(pkgdir, mysettings["DISTDIR"],
+ fetchlist_dict=fetchlist_dict)
mf.create(requiredDistfiles=None,
assumeDistHashesSometimes=True, assumeDistHashesAlways=True)
distfiles = fetchlist_dict[cpv]
@@ -228,10 +233,8 @@ build_dir_phases = set(["setup", "unpack", "prepare", "configure", "compile",
# sourced again even if $T/environment already exists.
ebuild_changed = False
if mytree == "porttree" and build_dir_phases.intersection(pargs):
- metadata, st, emtime = \
- portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir)
- if metadata is None:
- ebuild_changed = True
+ ebuild_changed = \
+ portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir)[0] is None
tmpsettings = portage.config(clone=portage.settings)
tmpsettings["PORTAGE_VERBOSE"] = "1"
@@ -257,16 +260,20 @@ if "test" in pargs:
tmpsettings.features.discard("fail-clean")
+if "merge" in pargs and "noauto" in tmpsettings.features:
+ print("Disabling noauto in features... merge disables it. (qmerge doesn't)")
+ tmpsettings.features.discard("noauto")
+
try:
metadata = dict(zip(Package.metadata_keys,
- portage.db[portage.settings["ROOT"]][mytree].dbapi.aux_get(
+ portage.db[portage.settings['EROOT']][mytree].dbapi.aux_get(
cpv, Package.metadata_keys, myrepo=myrepo)))
except KeyError:
# aux_get failure, message should have been shown on stderr.
sys.exit(1)
root_config = RootConfig(portage.settings,
- portage.db[portage.settings["ROOT"]], None)
+ portage.db[portage.settings['EROOT']], None)
pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv,
installed=(pkg_type=="installed"),
@@ -275,7 +282,10 @@ pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv,
# Apply package.env and repo-level settings. This allows per-package
# FEATURES and other variables (possibly PORTAGE_TMPDIR) to be
-# available as soon as possible.
+# available as soon as possible. Also, note that the only way to ensure
+# that setcpv gets metadata from the correct repository is to pass in
+# a Package instance, as we do here (previously we had to modify
+# portdb.porttrees in order to accomplish this).
tmpsettings.setcpv(pkg)
def stale_env_warning():
diff --git a/portage_with_autodep/bin/ebuild-helpers/sed b/portage_with_autodep/bin/ebuild-helpers/bsd/sed
index b21e856..01b8847 100755
--- a/portage_with_autodep/bin/ebuild-helpers/sed
+++ b/portage_with_autodep/bin/ebuild-helpers/bsd/sed
@@ -1,27 +1,27 @@
#!/bin/bash
-# Copyright 2007 Gentoo Foundation
+# Copyright 2007-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
scriptpath=${BASH_SOURCE[0]}
scriptname=${scriptpath##*/}
-if [[ sed == ${scriptname} ]] && [[ -n ${ESED} ]]; then
+if [[ sed == ${scriptname} && -n ${ESED} ]]; then
exec ${ESED} "$@"
elif type -P g${scriptname} > /dev/null ; then
exec g${scriptname} "$@"
else
old_IFS="${IFS}"
IFS=":"
-
+
for path in $PATH; do
- [[ ${path}/${scriptname} == ${scriptpath} ]] && continue
if [[ -x ${path}/${scriptname} ]]; then
- exec ${path}/${scriptname} "$@"
+ [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
+ exec "${path}/${scriptname}" "$@"
exit 0
fi
done
-
+
IFS="${old_IFS}"
fi
-
+
exit 1
diff --git a/portage_with_autodep/bin/ebuild-helpers/dobin b/portage_with_autodep/bin/ebuild-helpers/dobin
index e385455..f90d893 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dobin
+++ b/portage_with_autodep/bin/ebuild-helpers/dobin
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,15 +9,18 @@ if [[ $# -lt 1 ]] ; then
exit 1
fi
-if [[ ! -d ${D}${DESTTREE}/bin ]] ; then
- install -d "${D}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/bin"; exit 2; }
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
+ install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
fi
ret=0
for x in "$@" ; do
if [[ -e ${x} ]] ; then
- install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin"
+ install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin"
else
echo "!!! ${0##*/}: $x does not exist" 1>&2
false
diff --git a/portage_with_autodep/bin/ebuild-helpers/dodir b/portage_with_autodep/bin/ebuild-helpers/dodir
index f40bee7..90a3efe 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dodir
+++ b/portage_with_autodep/bin/ebuild-helpers/dodir
@@ -1,10 +1,13 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-install -d ${DIROPTIONS} "${@/#/${D}/}"
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+install -d ${DIROPTIONS} "${@/#/${ED}/}"
ret=$?
[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
exit $ret
diff --git a/portage_with_autodep/bin/ebuild-helpers/dodoc b/portage_with_autodep/bin/ebuild-helpers/dodoc
index 65713db..1f333a6 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dodoc
+++ b/portage_with_autodep/bin/ebuild-helpers/dodoc
@@ -9,7 +9,10 @@ if [ $# -lt 1 ] ; then
exit 1
fi
-dir="${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
if [ ! -d "${dir}" ] ; then
install -d "${dir}"
fi
diff --git a/portage_with_autodep/bin/ebuild-helpers/doexe b/portage_with_autodep/bin/ebuild-helpers/doexe
index 360800e..fb228f9 100755
--- a/portage_with_autodep/bin/ebuild-helpers/doexe
+++ b/portage_with_autodep/bin/ebuild-helpers/doexe
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,8 +9,11 @@ if [[ $# -lt 1 ]] ; then
exit 1
fi
-if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then
- install -d "${D}${_E_EXEDESTTREE_}"
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
+ install -d "${ED}${_E_EXEDESTTREE_}"
fi
TMP=$T/.doexe_tmp
@@ -29,7 +32,7 @@ for x in "$@" ; do
mysrc="${x}"
fi
if [ -e "$mysrc" ] ; then
- install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_"
+ install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_"
else
echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
false
diff --git a/portage_with_autodep/bin/ebuild-helpers/dohard b/portage_with_autodep/bin/ebuild-helpers/dohard
index 2270487..b52fd7c 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dohard
+++ b/portage_with_autodep/bin/ebuild-helpers/dohard
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
if [[ $# -ne 2 ]] ; then
@@ -7,7 +7,10 @@ if [[ $# -ne 2 ]] ; then
exit 1
fi
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
destdir=${2%/*}
-[[ ! -d ${D}${destdir} ]] && dodir "${destdir}"
+[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
-exec ln -f "${D}$1" "${D}$2"
+exec ln -f "${ED}$1" "${ED}$2"
diff --git a/portage_with_autodep/bin/ebuild-helpers/doheader b/portage_with_autodep/bin/ebuild-helpers/doheader
new file mode 100755
index 0000000..3795365
--- /dev/null
+++ b/portage_with_autodep/bin/ebuild-helpers/doheader
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_doheader; then
+ die "${0##*/} is not supported in EAPI ${EAPI}"
+fi
+
+if [[ $# -lt 1 ]] || [[ $1 == -r && $# -lt 2 ]] ; then
+ __helpers_die "${0##*/}: at least one argument needed"
+ exit 1
+fi
+
+exec \
+env \
+INSDESTTREE="/usr/include/" \
+doins "$@"
diff --git a/portage_with_autodep/bin/ebuild-helpers/doinfo b/portage_with_autodep/bin/ebuild-helpers/doinfo
index 54fb8da..8fd7d45 100755
--- a/portage_with_autodep/bin/ebuild-helpers/doinfo
+++ b/portage_with_autodep/bin/ebuild-helpers/doinfo
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,11 +9,14 @@ if [[ -z $1 ]] ; then
exit 1
fi
-if [[ ! -d ${D}usr/share/info ]] ; then
- install -d "${D}usr/share/info" || { helpers_die "${0##*/}: failed to install ${D}usr/share/info"; exit 1; }
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}usr/share/info ]] ; then
+ install -d "${ED}usr/share/info" || { helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; }
fi
-install -m0644 "$@" "${D}usr/share/info"
+install -m0644 "$@" "${ED}usr/share/info"
rval=$?
if [ $rval -ne 0 ] ; then
for x in "$@" ; do
diff --git a/portage_with_autodep/bin/ebuild-helpers/doins b/portage_with_autodep/bin/ebuild-helpers/doins
index 7dec146..443bfdb 100755
--- a/portage_with_autodep/bin/ebuild-helpers/doins
+++ b/portage_with_autodep/bin/ebuild-helpers/doins
@@ -27,12 +27,15 @@ else
DOINSRECUR=n
fi
-if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
+
+if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
vecho "-------------------------------------------------------" 1>&2
- vecho "You should not use \${D} with helpers." 1>&2
+ vecho "You should not use \${D} or \${ED} with helpers." 1>&2
vecho " --> ${INSDESTTREE}" 1>&2
vecho "-------------------------------------------------------" 1>&2
- helpers_die "${0##*/} used with \${D}"
+ helpers_die "${0##*/} used with \${D} or \${ED}"
exit 1
fi
@@ -49,7 +52,7 @@ export TMP=$T/.doins_tmp
# Use separate directories to avoid potential name collisions.
mkdir -p "$TMP"/{1,2}
-[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
+[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
_doins() {
local mysrc="$1" mydir="$2" cleanup="" rval
@@ -63,8 +66,8 @@ _doins() {
# $PORTAGE_ACTUAL_DISTDIR/.
if [ $PRESERVE_SYMLINKS = y ] && \
! [[ $(readlink "$mysrc") == "$PORTAGE_ACTUAL_DISTDIR"/* ]] ; then
- rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
- cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}"
+ rm -rf "${ED}$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
+ cp -P "$mysrc" "${ED}$INSDESTTREE/$mydir/${mysrc##*/}"
return $?
else
cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $?
@@ -73,7 +76,7 @@ _doins() {
fi
fi
- install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}"
+ install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}"
rval=$?
[[ -n ${cleanup} ]] && rm -f "${cleanup}"
[ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
diff --git a/portage_with_autodep/bin/ebuild-helpers/dolib b/portage_with_autodep/bin/ebuild-helpers/dolib
index 87ade42..9af5418 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dolib
+++ b/portage_with_autodep/bin/ebuild-helpers/dolib
@@ -1,9 +1,12 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
# Setup ABI cruft
LIBDIR_VAR="LIBDIR_${ABI}"
if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
@@ -12,7 +15,7 @@ fi
unset LIBDIR_VAR
# we need this to default to lib so that things dont break
CONF_LIBDIR=${CONF_LIBDIR:-lib}
-libdir="${D}${DESTTREE}/${CONF_LIBDIR}"
+libdir="${ED}${DESTTREE}/${CONF_LIBDIR}"
if [[ $# -lt 1 ]] ; then
diff --git a/portage_with_autodep/bin/ebuild-helpers/doman b/portage_with_autodep/bin/ebuild-helpers/doman
index 4561bef..b4047ce 100755
--- a/portage_with_autodep/bin/ebuild-helpers/doman
+++ b/portage_with_autodep/bin/ebuild-helpers/doman
@@ -9,6 +9,9 @@ if [[ $# -lt 1 ]] ; then
exit 1
fi
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
i18n=""
ret=0
@@ -44,11 +47,11 @@ for x in "$@" ; do
if [[ ${mandir} == *man[0-9n] ]] ; then
if [[ -s ${x} ]] ; then
- if [[ ! -d ${D}/usr/share/man/${mandir} ]] ; then
- install -d "${D}/usr/share/man/${mandir}"
+ if [[ ! -d ${ED}/usr/share/man/${mandir} ]] ; then
+ install -d "${ED}/usr/share/man/${mandir}"
fi
- install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}"
+ install -m0644 "${x}" "${ED}/usr/share/man/${mandir}/${name}"
((ret|=$?))
elif [[ ! -e ${x} ]] ; then
echo "!!! ${0##*/}: $x does not exist" 1>&2
diff --git a/portage_with_autodep/bin/ebuild-helpers/domo b/portage_with_autodep/bin/ebuild-helpers/domo
index 4737f44..d994343 100755
--- a/portage_with_autodep/bin/ebuild-helpers/domo
+++ b/portage_with_autodep/bin/ebuild-helpers/domo
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,8 +9,12 @@ if [ ${mynum} -lt 1 ] ; then
helpers_die "${0}: at least one argument needed"
exit 1
fi
-if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then
- install -d "${D}${DESTTREE}/share/locale/"
+
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
+ install -d "${ED}${DESTTREE}/share/locale/"
fi
ret=0
@@ -18,7 +22,7 @@ ret=0
for x in "$@" ; do
if [ -e "${x}" ] ; then
mytiny="${x##*/}"
- mydir="${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES"
+ mydir="${ED}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES"
if [ ! -d "${mydir}" ] ; then
install -d "${mydir}"
fi
diff --git a/portage_with_autodep/bin/ebuild-helpers/dosbin b/portage_with_autodep/bin/ebuild-helpers/dosbin
index 87a3091..d101c8a 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dosbin
+++ b/portage_with_autodep/bin/ebuild-helpers/dosbin
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,15 +9,18 @@ if [[ $# -lt 1 ]] ; then
exit 1
fi
-if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then
- install -d "${D}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/sbin"; exit 2; }
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
+ install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
fi
ret=0
for x in "$@" ; do
if [[ -e ${x} ]] ; then
- install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin"
+ install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/sbin"
else
echo "!!! ${0##*/}: ${x} does not exist" 1>&2
false
diff --git a/portage_with_autodep/bin/ebuild-helpers/dosed b/portage_with_autodep/bin/ebuild-helpers/dosed
index afc949b..f202df7 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dosed
+++ b/portage_with_autodep/bin/ebuild-helpers/dosed
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
if [[ $# -lt 1 ]] ; then
@@ -7,12 +7,15 @@ if [[ $# -lt 1 ]] ; then
exit 1
fi
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
ret=0
file_found=0
-mysed="s:${D}::g"
+mysed="s:${ED}::g"
for x in "$@" ; do
- y=$D${x#/}
+ y=$ED${x#/}
if [ -e "${y}" ] ; then
if [ -f "${y}" ] ; then
file_found=1
diff --git a/portage_with_autodep/bin/ebuild-helpers/dosym b/portage_with_autodep/bin/ebuild-helpers/dosym
index 500dad0..2489e22 100755
--- a/portage_with_autodep/bin/ebuild-helpers/dosym
+++ b/portage_with_autodep/bin/ebuild-helpers/dosym
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -9,10 +9,22 @@ if [[ $# -ne 2 ]] ; then
exit 1
fi
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ${2} == */ ]] || \
+ [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
+ # implicit basename not allowed by PMS (bug #379899)
+ eqawarn "QA Notice: dosym target omits basename: '${2}'"
+fi
+
destdir=${2%/*}
-[[ ! -d ${D}${destdir} ]] && dodir "${destdir}"
+[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
+# when absolute, prefix with offset for Gentoo Prefix
+target="${1}"
+[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}"
+ln -snf "${target}" "${ED}${2}"
-ln -snf "$1" "${D}$2"
ret=$?
[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
exit $ret
diff --git a/portage_with_autodep/bin/ebuild-helpers/ecompressdir b/portage_with_autodep/bin/ebuild-helpers/ecompressdir
index 7a95120..a2c9e52 100755
--- a/portage_with_autodep/bin/ebuild-helpers/ecompressdir
+++ b/portage_with_autodep/bin/ebuild-helpers/ecompressdir
@@ -1,27 +1,30 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
if [[ -z $1 ]] ; then
helpers_die "${0##*/}: at least one argument needed"
exit 1
fi
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} EPREFIX= ;; esac
+
case $1 in
--ignore)
shift
for skip in "$@" ; do
- [[ -d ${D}${skip} || -f ${D}${skip} ]] \
- && >> "${D}${skip}.ecompress.skip"
+ [[ -d ${ED}${skip} || -f ${ED}${skip} ]] \
+ && >> "${ED}${skip}.ecompress.skip"
done
exit 0
;;
--queue)
shift
set -- "${@/%/.ecompress.dir}"
- set -- "${@/#/${D}}"
+ set -- "${@/#/${ED}}"
ret=0
for x in "$@" ; do
>> "$x"
@@ -32,10 +35,10 @@ case $1 in
;;
--dequeue)
[[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
- find "${D}" -name '*.ecompress.dir' -print0 \
- | sed -e 's:\.ecompress\.dir::g' -e "s:${D}:/:g" \
+ find "${ED}" -name '*.ecompress.dir' -print0 \
+ | sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \
| ${XARGS} -0 ecompressdir
- find "${D}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
+ find "${ED}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
exit 0
;;
--*)
@@ -66,6 +69,17 @@ funk_up_dir() {
while read -r -d $'\0' brokenlink ; do
[[ -e ${brokenlink} ]] && continue
olddest=$(readlink "${brokenlink}")
+ # Ignore temporarily broken symlinks due to
+ # _relocate_skip_dirs (bug #399595), and handle
+ # absolute symlinks to files that aren't merged
+ # yet (bug #405327).
+ if [[ ${olddest} == /* ]] ; then
+ [ -e "${D}${olddest}" ] && continue
+ skip_dir_dest=${T}/ecompress-skip/${olddest#${EPREFIX}}
+ else
+ skip_dir_dest=${T}/ecompress-skip/${actual_dir#${ED}}/${brokenlink%/*}/${olddest}
+ fi
+ [[ -e ${skip_dir_dest} ]] && continue
[[ ${act} == "compress" ]] \
&& newdest="${olddest}${suffix}" \
|| newdest="${olddest%${suffix}}"
@@ -95,18 +109,28 @@ _relocate_skip_dirs() {
mv "${src}.ecompress.skip" "${dst}.ecompress.skip"
done
}
-hide_skip_dirs() { _relocate_skip_dirs "${D}" "${T}"/ecompress-skip/ ; }
-restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${D}" ; }
+hide_skip_dirs() { _relocate_skip_dirs "${ED}" "${T}"/ecompress-skip/ ; }
+restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${ED}" ; }
ret=0
rm -rf "${T}"/ecompress-skip
+decompressors=(
+ ".Z" "gunzip -f"
+ ".gz" "gunzip -f"
+ ".bz2" "bunzip2 -f"
+ ".xz" "unxz -f"
+ ".lzma" "unxz -f"
+)
+
+multijob_init
+
for dir in "$@" ; do
dir=${dir#/}
- dir="${D}${dir}"
+ dir="${ED}${dir}"
if [[ ! -d ${dir} ]] ; then
- vecho "${0##*/}: /${dir#${D}} does not exist!"
+ vecho "${0##*/}: /${dir#${ED}} does not exist!"
continue
fi
cd "${dir}"
@@ -122,18 +146,31 @@ for dir in "$@" ; do
find "${dir}" -type f -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f
# not uncommon for packages to compress doc files themselves
- funk_up_dir "decompress" ".Z" "gunzip -f"
- funk_up_dir "decompress" ".gz" "gunzip -f"
- funk_up_dir "decompress" ".bz2" "bunzip2 -f"
+ for (( d = 0; d < ${#decompressors[@]}; d += 2 )) ; do
+ # It's faster to parallelize at this stage than to try to
+ # parallelize the compressors. This is because the find|xargs
+ # ends up launching less compressors overall, so the overhead
+ # of forking children ends up dominating.
+ (
+ multijob_child_init
+ funk_up_dir "decompress" "${decompressors[i]}" "${decompressors[i+1]}"
+ ) &
+ multijob_post_fork
+ : $(( ret |= $? ))
+ done
# forcibly break all hard links as some compressors whine about it
find "${dir}" -type f -links +1 -exec env file="{}" sh -c \
'cp -p "${file}" "${file}.ecompress.break" ; mv -f "${file}.ecompress.break" "${file}"' \;
+ multijob_finish
+ : $(( ret |= $? ))
+
# now lets do our work
- [[ -z ${suffix} ]] && continue
- vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}"
- funk_up_dir "compress" "${suffix}" "ecompress"
+ if [[ -n ${suffix} ]] ; then
+ vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}"
+ funk_up_dir "compress" "${suffix}" "ecompress"
+ fi
# finally, restore the skipped stuff
restore_skip_dirs
diff --git a/portage_with_autodep/bin/ebuild-helpers/fowners b/portage_with_autodep/bin/ebuild-helpers/fowners
index 4cc6bfa..a213c9e 100755
--- a/portage_with_autodep/bin/ebuild-helpers/fowners
+++ b/portage_with_autodep/bin/ebuild-helpers/fowners
@@ -1,13 +1,22 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) EPREFIX= ED=${D} ;; esac
+
# we can't prefix all arguments because
# chown takes random options
slash="/"
-chown "${@/#${slash}/${D}${slash}}"
+chown "${@/#${slash}/${ED}${slash}}"
ret=$?
+
+if [[ ${ret} != 0 && -n ${EPREFIX} && ${EUID} != 0 ]] ; then
+ ewarn "fowners failure ignored in Prefix with non-privileged user"
+ exit 0
+fi
+
[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
exit $ret
diff --git a/portage_with_autodep/bin/ebuild-helpers/fperms b/portage_with_autodep/bin/ebuild-helpers/fperms
index 0260bdc..a2f77ea 100755
--- a/portage_with_autodep/bin/ebuild-helpers/fperms
+++ b/portage_with_autodep/bin/ebuild-helpers/fperms
@@ -1,13 +1,16 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
# we can't prefix all arguments because
# chmod takes random options
slash="/"
-chmod "${@/#${slash}/${D}${slash}}"
+chmod "${@/#${slash}/${ED}${slash}}"
ret=$?
[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
exit $ret
diff --git a/portage_with_autodep/bin/ebuild-helpers/keepdir b/portage_with_autodep/bin/ebuild-helpers/keepdir
new file mode 100755
index 0000000..bec2feb
--- /dev/null
+++ b/portage_with_autodep/bin/ebuild-helpers/keepdir
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_prefix_variables; then
+ ED=${D}
+fi
+
+dodir "$@"
+ret=$?
+
+for x in "$@"; do
+ >> "${ED}${x}/.keep_${CATEGORY}_${PN}-${SLOT%/*}" || \
+ { echo "!!! ${0##*/}: cannot write .keep in ${ED}${x}" 1>&2; ret=1; }
+done
+
+[[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
+exit ${ret}
diff --git a/portage_with_autodep/bin/ebuild-helpers/newbin b/portage_with_autodep/bin/ebuild-helpers/newbin
index 30f19b0..bf98744 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newbin
+++ b/portage_with_autodep/bin/ebuild-helpers/newbin
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec dobin "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newconfd b/portage_with_autodep/bin/ebuild-helpers/newconfd
index 5752cfa..fa3710d 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newconfd
+++ b/portage_with_autodep/bin/ebuild-helpers/newconfd
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec doconfd "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newdoc b/portage_with_autodep/bin/ebuild-helpers/newdoc
index f97ce0d..df6fb1d 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newdoc
+++ b/portage_with_autodep/bin/ebuild-helpers/newdoc
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec dodoc "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newenvd b/portage_with_autodep/bin/ebuild-helpers/newenvd
index 83c556e..c54af05 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newenvd
+++ b/portage_with_autodep/bin/ebuild-helpers/newenvd
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec doenvd "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newexe b/portage_with_autodep/bin/ebuild-helpers/newexe
index 92dbe9f..9bcf64b 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newexe
+++ b/portage_with_autodep/bin/ebuild-helpers/newexe
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec doexe "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newheader b/portage_with_autodep/bin/ebuild-helpers/newheader
new file mode 120000
index 0000000..59a0db2
--- /dev/null
+++ b/portage_with_autodep/bin/ebuild-helpers/newheader
@@ -0,0 +1 @@
+newins \ No newline at end of file
diff --git a/portage_with_autodep/bin/ebuild-helpers/newinitd b/portage_with_autodep/bin/ebuild-helpers/newinitd
index fc6003a..03bbe68 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newinitd
+++ b/portage_with_autodep/bin/ebuild-helpers/newinitd
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec doinitd "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newins b/portage_with_autodep/bin/ebuild-helpers/newins
index 065477f..adf2d80 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newins
+++ b/portage_with_autodep/bin/ebuild-helpers/newins
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" || exit $?
case "$EAPI" in
0|1|2|3|3_pre2)
diff --git a/portage_with_autodep/bin/ebuild-helpers/newlib.a b/portage_with_autodep/bin/ebuild-helpers/newlib.a
index eef4104..7ff8195 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newlib.a
+++ b/portage_with_autodep/bin/ebuild-helpers/newlib.a
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec dolib.a "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newlib.so b/portage_with_autodep/bin/ebuild-helpers/newlib.so
index c8696f3..fd4c097 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newlib.so
+++ b/portage_with_autodep/bin/ebuild-helpers/newlib.so
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec dolib.so "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newman b/portage_with_autodep/bin/ebuild-helpers/newman
index ffb8a2d..889e0f9 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newman
+++ b/portage_with_autodep/bin/ebuild-helpers/newman
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec doman "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/newsbin b/portage_with_autodep/bin/ebuild-helpers/newsbin
index 82242aa..9df0af2 100755
--- a/portage_with_autodep/bin/ebuild-helpers/newsbin
+++ b/portage_with_autodep/bin/ebuild-helpers/newsbin
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -14,6 +14,9 @@ if [ ! -e "$1" ] ; then
exit 1
fi
+(($#>2)) && \
+ eqawarn "QA Notice: ${0##*/} called with more than 2 arguments: ${@:3}"
+
rm -rf "${T}/${2}" && \
cp -f "${1}" "${T}/${2}" && \
exec dosbin "${T}/${2}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepall b/portage_with_autodep/bin/ebuild-helpers/prepall
index 701ecba..49e646c 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepall
+++ b/portage_with_autodep/bin/ebuild-helpers/prepall
@@ -4,12 +4,15 @@
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
if has chflags $FEATURES ; then
# Save all the file flags for restoration at the end of prepall.
- mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree"
+ mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
# Remove all the file flags so that prepall can do anything necessary.
- chflags -R noschg,nouchg,nosappnd,nouappnd "${D}"
- chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null
+ chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
+ chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
fi
prepallman
@@ -19,5 +22,5 @@ prepallstrip
if has chflags $FEATURES ; then
# Restore all the file flags that were saved at the beginning of prepall.
- mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
+ mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
fi
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepalldocs b/portage_with_autodep/bin/ebuild-helpers/prepalldocs
index fdc735d..560a02b 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepalldocs
+++ b/portage_with_autodep/bin/ebuild-helpers/prepalldocs
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
@@ -8,8 +8,10 @@ if [[ -n $1 ]] ; then
vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
fi
-cd "${D}"
-[[ -d usr/share/doc ]] || exit 0
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+[[ -d ${ED}usr/share/doc ]] || exit 0
ecompressdir --ignore /usr/share/doc/${PF}/html
ecompressdir --queue /usr/share/doc
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepallinfo b/portage_with_autodep/bin/ebuild-helpers/prepallinfo
index 0d97803..db9bbfa 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepallinfo
+++ b/portage_with_autodep/bin/ebuild-helpers/prepallinfo
@@ -1,9 +1,12 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-[[ ! -d ${D}usr/share/info ]] && exit 0
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+[[ -d ${ED}usr/share/info ]] || exit 0
exec prepinfo
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepallman b/portage_with_autodep/bin/ebuild-helpers/prepallman
index e50de6d..dee1c72 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepallman
+++ b/portage_with_autodep/bin/ebuild-helpers/prepallman
@@ -7,11 +7,14 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
# replaced by controllable compression in EAPI 4
has "${EAPI}" 0 1 2 3 || exit 0
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
ret=0
-find "${D}" -type d -name man > "${T}"/prepallman.filelist
+find "${ED}" -type d -name man > "${T}"/prepallman.filelist
while read -r mandir ; do
- mandir=${mandir#${D}}
+ mandir=${mandir#${ED}}
prepman "${mandir%/man}"
((ret|=$?))
done < "${T}"/prepallman.filelist
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepallstrip b/portage_with_autodep/bin/ebuild-helpers/prepallstrip
index ec12ce6..28320d9 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepallstrip
+++ b/portage_with_autodep/bin/ebuild-helpers/prepallstrip
@@ -1,5 +1,8 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-exec prepstrip "${D}"
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+exec prepstrip "${ED}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepinfo b/portage_with_autodep/bin/ebuild-helpers/prepinfo
index 691fd13..ffe2ece 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepinfo
+++ b/portage_with_autodep/bin/ebuild-helpers/prepinfo
@@ -4,17 +4,20 @@
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
if [[ -z $1 ]] ; then
infodir="/usr/share/info"
else
- if [[ -d ${D}$1/share/info ]] ; then
+ if [[ -d ${ED}$1/share/info ]] ; then
infodir="$1/share/info"
else
infodir="$1/info"
fi
fi
-if [[ ! -d ${D}${infodir} ]] ; then
+if [[ ! -d ${ED}${infodir} ]] ; then
if [[ -n $1 ]] ; then
vecho "${0##*/}: '${infodir}' does not exist!"
exit 1
@@ -23,7 +26,7 @@ if [[ ! -d ${D}${infodir} ]] ; then
fi
fi
-find "${D}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
+find "${ED}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
for f in "${x}"/.keepinfodir*; do
[[ -e ${f} ]] && continue 2
done
diff --git a/portage_with_autodep/bin/ebuild-helpers/preplib b/portage_with_autodep/bin/ebuild-helpers/preplib
index 76aabe6..6e91cf3 100755
--- a/portage_with_autodep/bin/ebuild-helpers/preplib
+++ b/portage_with_autodep/bin/ebuild-helpers/preplib
@@ -1,11 +1,14 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
eqawarn "QA Notice: Deprecated call to 'preplib'"
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
LIBDIR_VAR="LIBDIR_${ABI}"
if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
CONF_LIBDIR="${!LIBDIR_VAR}"
@@ -18,9 +21,9 @@ if [ -z "${CONF_LIBDIR}" ]; then
fi
if [ -z "$1" ] ; then
- z="${D}usr/${CONF_LIBDIR}"
+ z="${ED}usr/${CONF_LIBDIR}"
else
- z="${D}$1/${CONF_LIBDIR}"
+ z="${ED}$1/${CONF_LIBDIR}"
fi
if [ -d "${z}" ] ; then
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepman b/portage_with_autodep/bin/ebuild-helpers/prepman
index c9add8a..f96b641 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepman
+++ b/portage_with_autodep/bin/ebuild-helpers/prepman
@@ -4,14 +4,17 @@
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
if [[ -z $1 ]] ; then
- mandir="${D}usr/share/man"
+ mandir="${ED}usr/share/man"
else
- mandir="${D}$1/man"
+ mandir="${ED}$1/man"
fi
if [[ ! -d ${mandir} ]] ; then
- eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}}'"
+ eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED}}'"
exit 0
fi
@@ -27,6 +30,6 @@ for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
[[ -d ${subdir} ]] && really_is_mandir=1 && break
done
-[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${D}}"
+[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${ED}}"
exit 0
diff --git a/portage_with_autodep/bin/ebuild-helpers/prepstrip b/portage_with_autodep/bin/ebuild-helpers/prepstrip
index d25259d..85d5d6a 100755
--- a/portage_with_autodep/bin/ebuild-helpers/prepstrip
+++ b/portage_with_autodep/bin/ebuild-helpers/prepstrip
@@ -1,85 +1,153 @@
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
+
+# avoid multiple calls to `has`. this creates things like:
+# FEATURES_foo=false
+# if "foo" is not in $FEATURES
+tf() { "$@" && echo true || echo false ; }
+exp_tf() {
+ local flag var=$1
+ shift
+ for flag in "$@" ; do
+ eval ${var}_${flag}=$(tf has ${flag} ${!var})
+ done
+}
+exp_tf FEATURES compressdebug installsources nostrip splitdebug
+exp_tf RESTRICT binchecks installsources strip
+
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "${EAPI}" in 0|1|2) EPREFIX= ED=${D} ;; esac
banner=false
SKIP_STRIP=false
-if has nostrip ${FEATURES} || \
- has strip ${RESTRICT}
-then
+if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
SKIP_STRIP=true
banner=true
- has installsources ${FEATURES} || exit 0
+ ${FEATURES_installsources} || exit 0
fi
-STRIP=${STRIP:-${CHOST}-strip}
-type -P -- ${STRIP} > /dev/null || STRIP=strip
-OBJCOPY=${OBJCOPY:-${CHOST}-objcopy}
-type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy
+# look up the tools we might be using
+for t in STRIP:strip OBJCOPY:objcopy READELF:readelf ; do
+ v=${t%:*} # STRIP
+ t=${t#*:} # strip
+ eval ${v}=\"${!v:-${CHOST}-${t}}\"
+ type -P -- ${!v} >/dev/null || eval ${v}=${t}
+done
-# We'll leave out -R .note for now until we can check out the relevance
-# of the section when it has the ALLOC flag set on it ...
-export SAFE_STRIP_FLAGS="--strip-unneeded"
-export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment}
-prepstrip_sources_dir=/usr/src/debug/${CATEGORY}/${PF}
+# Figure out what tool set we're using to strip stuff
+unset SAFE_STRIP_FLAGS DEF_STRIP_FLAGS SPLIT_STRIP_FLAGS
+case $(${STRIP} --version 2>/dev/null) in
+*elfutils*) # dev-libs/elfutils
+ # elfutils default behavior is always safe, so don't need to specify
+ # any flags at all
+ SAFE_STRIP_FLAGS=""
+ DEF_STRIP_FLAGS="--remove-comment"
+ SPLIT_STRIP_FLAGS="-f"
+ ;;
+*GNU*) # sys-devel/binutils
+ # We'll leave out -R .note for now until we can check out the relevance
+ # of the section when it has the ALLOC flag set on it ...
+ SAFE_STRIP_FLAGS="--strip-unneeded"
+ DEF_STRIP_FLAGS="-R .comment -R .GCC.command.line"
+ SPLIT_STRIP_FLAGS=
+ ;;
+esac
+: ${PORTAGE_STRIP_FLAGS=${SAFE_STRIP_FLAGS} ${DEF_STRIP_FLAGS}}
-if has installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then
- ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
- ewarn "be found. This feature will not work unless debugedit is installed!"
-fi
+prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
+
+type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false
+debugedit_warned=false
-unset ${!INODE_*}
+multijob_init
-inode_var_name() {
- if [[ $USERLAND = BSD ]] ; then
- stat -f 'INODE_%d_%i' "$1"
+# Setup $T filesystem layout that we care about.
+tmpdir="${T}/prepstrip"
+rm -rf "${tmpdir}"
+mkdir -p "${tmpdir}"/{inodes,splitdebug,sources}
+
+# Usage: inode_var_name: <file>
+inode_file_link() {
+ echo -n "${tmpdir}/inodes/"
+ if [[ ${USERLAND} == "BSD" ]] ; then
+ stat -f '%i' "$1"
else
- stat -c 'INODE_%d_%i' "$1"
+ stat -c '%i' "$1"
fi
}
+# Usage: save_elf_sources <elf>
save_elf_sources() {
- has installsources ${FEATURES} || return 0
- has installsources ${RESTRICT} && return 0
- type -P debugedit >/dev/null || return 0
+ ${FEATURES_installsources} || return 0
+ ${RESTRICT_installsources} && return 0
+ if ! ${debugedit_found} ; then
+ if ! ${debugedit_warned} ; then
+ debugedit_warned=true
+ ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
+ ewarn "be found. This feature will not work unless debugedit is installed!"
+ fi
+ return 0
+ fi
local x=$1
- local inode=$(inode_var_name "$x")
- [[ -n ${!inode} ]] && return 0
- debugedit -b "${WORKDIR}" -d "${prepstrip_sources_dir}" \
- -l "${T}"/debug.sources "${x}"
+ [[ -f $(inode_file_link "${x}") ]] && return 0
+
+ # since we're editing the ELF here, we should recompute the build-id
+ # (the -i flag below). save that output so we don't need to recompute
+ # it later on in the save_elf_debug step.
+ buildid=$(debugedit -i \
+ -b "${WORKDIR}" \
+ -d "${prepstrip_sources_dir}" \
+ -l "${tmpdir}/sources/${x##*/}.${BASHPID}" \
+ "${x}")
}
+# Usage: save_elf_debug <elf> [splitdebug file]
save_elf_debug() {
- has splitdebug ${FEATURES} || return 0
+ ${FEATURES_splitdebug} || return 0
+ # NOTE: Debug files must be installed in
+ # ${EPREFIX}/usr/lib/debug/${EPREFIX} (note that ${EPREFIX} occurs
+ # twice in this path) in order for gdb's debug-file-directory
+ # lookup to work correctly.
local x=$1
- local y="${D}usr/lib/debug/${x:${#D}}.debug"
+ local splitdebug=$2
+ local y=${ED}usr/lib/debug/${x:${#D}}.debug
# dont save debug info twice
[[ ${x} == *".debug" ]] && return 0
- # this will recompute the build-id, but for now that's ok
- local buildid="$( type -P debugedit >/dev/null && debugedit -i "${x}" )"
-
- mkdir -p $(dirname "${y}")
+ mkdir -p "${y%/*}"
- local inode=$(inode_var_name "$x")
- if [[ -n ${!inode} ]] ; then
- ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y"
+ local inode=$(inode_file_link "${x}")
+ if [[ -f ${inode} ]] ; then
+ ln "${inode}" "${y}"
else
- eval $inode=\$x
- ${OBJCOPY} --only-keep-debug "${x}" "${y}"
- ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}"
- [[ -g ${x} ]] && chmod go-r "${y}"
- [[ -u ${x} ]] && chmod go-r "${y}"
- chmod a-x,o-w "${y}"
+ if [[ -n ${splitdebug} ]] ; then
+ mv "${splitdebug}" "${y}"
+ else
+ local objcopy_flags="--only-keep-debug"
+ ${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections"
+ ${OBJCOPY} ${objcopy_flags} "${x}" "${y}"
+ ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}"
+ fi
+ local args="a-x,o-w"
+ [[ -g ${x} || -u ${x} ]] && args+=",go-r"
+ chmod ${args} "${y}"
+ ln "${y}" "${inode}"
fi
+ # if we don't already have build-id from debugedit, look it up
+ if [[ -z ${buildid} ]] ; then
+ # convert the readelf output to something useful
+ buildid=$(${READELF} -x .note.gnu.build-id "${x}" 2>/dev/null \
+ | awk '$NF ~ /GNU/ { getline; printf $2$3$4$5; getline; print $2 }')
+ fi
if [[ -n ${buildid} ]] ; then
- local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}"
+ local buildid_dir="${ED}usr/lib/debug/.build-id/${buildid:0:2}"
local buildid_file="${buildid_dir}/${buildid:2}"
mkdir -p "${buildid_dir}"
ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug"
@@ -87,33 +155,78 @@ save_elf_debug() {
fi
}
+# Usage: process_elf <elf>
+process_elf() {
+ local x=$1 strip_flags=${*:2}
+
+ vecho " ${x:${#ED}}"
+ save_elf_sources "${x}"
+
+ if ${strip_this} ; then
+
+ # If two processes try to strip the same hardlink at the same
+ # time, it will cause one of them to lose the splitdebug info.
+ # So, use a lockfile to prevent interference (easily observed
+ # with dev-vcs/git which creates ~109 hardlinks to one file in
+ # /usr/libexec/git-core).
+ local lockfile=$(inode_file_link "${x}")_lockfile
+ if ! ln "${x}" "${lockfile}" ; then
+ while [[ -f ${lockfile} ]] ; do
+ sleep 1
+ done
+ unset lockfile
+ fi
+
+ # see if we can split & strip at the same time
+ if [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then
+ local shortname="${x##*/}.debug"
+ local splitdebug="${tmpdir}/splitdebug/${shortname}.${BASHPID}"
+ ${STRIP} ${strip_flags} \
+ -f "${splitdebug}" \
+ -F "${shortname}" \
+ "${x}"
+ save_elf_debug "${x}" "${splitdebug}"
+ else
+ save_elf_debug "${x}"
+ ${STRIP} ${strip_flags} "${x}"
+ fi
+ [[ -n ${lockfile} ]] && rm -f "${lockfile}"
+ fi
+}
+
# The existance of the section .symtab tells us that a binary is stripped.
# We want to log already stripped binaries, as this may be a QA violation.
# They prevent us from getting the splitdebug data.
-if ! has binchecks ${RESTRICT} && \
- ! has strip ${RESTRICT} ; then
- log=$T/scanelf-already-stripped.log
+if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
+ # We need to do the non-stripped scan serially first before we turn around
+ # and start stripping the files ourselves. The log parsing can be done in
+ # parallel though.
+ log=${tmpdir}/scanelf-already-stripped.log
+ scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "${log}"
+ (
+ multijob_child_init
qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
- scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^$D##" > "$log"
- if [[ -n $QA_PRESTRIPPED && -s $log && \
+ if [[ -n ${QA_PRESTRIPPED} && -s ${log} && \
${QA_STRICT_PRESTRIPPED-unset} = unset ]] ; then
shopts=$-
set -o noglob
- for x in $QA_PRESTRIPPED ; do
- sed -e "s#^${x#/}\$##" -i "$log"
+ for x in ${QA_PRESTRIPPED} ; do
+ sed -e "s#^${x#/}\$##" -i "${log}"
done
set +o noglob
- set -$shopts
+ set -${shopts}
fi
- sed -e "/^\$/d" -e "s#^#/#" -i "$log"
- if [[ -s $log ]] ; then
+ sed -e "/^\$/d" -e "s#^#/#" -i "${log}"
+ if [[ -s ${log} ]] ; then
vecho -e "\n"
eqawarn "QA Notice: Pre-stripped files found:"
- eqawarn "$(<"$log")"
+ eqawarn "$(<"${log}")"
else
- rm -f "$log"
+ rm -f "${log}"
fi
+ ) &
+ multijob_post_fork
fi
# Now we look for unstripped binaries.
@@ -126,8 +239,10 @@ do
banner=true
fi
- f=$(file "${x}") || continue
- [[ -z ${f} ]] && continue
+ (
+ multijob_child_init
+ f=$(file "${x}") || exit 0
+ [[ -z ${f} ]] && exit 0
if ! ${SKIP_STRIP} ; then
# The noglob funk is to support STRIP_MASK="/*/booga" and to keep
@@ -136,50 +251,61 @@ do
set -o noglob
strip_this=true
for m in $(eval echo ${STRIP_MASK}) ; do
- [[ /${x#${D}} == ${m} ]] && strip_this=false && break
+ [[ /${x#${ED}} == ${m} ]] && strip_this=false && break
done
set +o noglob
else
strip_this=false
fi
+ # In Prefix we are usually an unprivileged user, so we can't strip
+ # unwritable objects. Make them temporarily writable for the
+ # stripping.
+ was_not_writable=false
+ if [[ ! -w ${x} ]] ; then
+ was_not_writable=true
+ chmod u+w "${x}"
+ fi
+
# only split debug info for final linked objects
# or kernel modules as debuginfo for intermediatary
# files (think crt*.o from gcc/glibc) is useless and
# actually causes problems. install sources for all
# elf types though cause that stuff is good.
+ buildid=
if [[ ${f} == *"current ar archive"* ]] ; then
- vecho " ${x:${#D}}"
+ vecho " ${x:${#ED}}"
if ${strip_this} ; then
# hmm, can we split debug/sources for .a ?
${STRIP} -g "${x}"
fi
elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then
- vecho " ${x:${#D}}"
- save_elf_sources "${x}"
- if ${strip_this} ; then
- save_elf_debug "${x}"
- ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}"
- fi
+ process_elf "${x}" ${PORTAGE_STRIP_FLAGS}
elif [[ ${f} == *"SB relocatable"* ]] ; then
- vecho " ${x:${#D}}"
- save_elf_sources "${x}"
- if ${strip_this} ; then
- [[ ${x} == *.ko ]] && save_elf_debug "${x}"
- ${STRIP} ${SAFE_STRIP_FLAGS} "${x}"
- fi
+ process_elf "${x}" ${SAFE_STRIP_FLAGS}
fi
+
+ if ${was_not_writable} ; then
+ chmod u-w "${x}"
+ fi
+ ) &
+ multijob_post_fork
done
-if [[ -s ${T}/debug.sources ]] && \
- has installsources ${FEATURES} && \
- ! has installsources ${RESTRICT} && \
- type -P debugedit >/dev/null
+# With a bit more work, we could run the rsync processes below in
+# parallel, but not sure that'd be an overall improvement.
+multijob_finish
+
+cd "${tmpdir}"/sources/ && cat * > "${tmpdir}/debug.sources" 2>/dev/null
+if [[ -s ${tmpdir}/debug.sources ]] && \
+ ${FEATURES_installsources} && \
+ ! ${RESTRICT_installsources} && \
+ ${debugedit_found}
then
vecho "installsources: rsyncing source files"
[[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}"
- grep -zv '/<[^/>]*>$' "${T}"/debug.sources | \
+ grep -zv '/<[^/>]*>$' "${tmpdir}"/debug.sources | \
(cd "${WORKDIR}"; LANG=C sort -z -u | \
rsync -tL0 --files-from=- "${WORKDIR}/" "${D}${prepstrip_sources_dir}/" )
@@ -188,6 +314,8 @@ then
# https://bugzilla.redhat.com/show_bug.cgi?id=444310
while read -r -d $'\0' emptydir
do
- >> "$emptydir"/.keepdir
+ >> "${emptydir}"/.keepdir
done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0)
fi
+
+rm -rf "${tmpdir}"
diff --git a/portage_with_autodep/bin/ebuild-helpers/unprivileged/chgrp b/portage_with_autodep/bin/ebuild-helpers/unprivileged/chgrp
new file mode 120000
index 0000000..6fb0fcd
--- /dev/null
+++ b/portage_with_autodep/bin/ebuild-helpers/unprivileged/chgrp
@@ -0,0 +1 @@
+chown \ No newline at end of file
diff --git a/portage_with_autodep/bin/ebuild-helpers/unprivileged/chown b/portage_with_autodep/bin/ebuild-helpers/unprivileged/chown
new file mode 100755
index 0000000..08fa650
--- /dev/null
+++ b/portage_with_autodep/bin/ebuild-helpers/unprivileged/chown
@@ -0,0 +1,41 @@
+#!/bin/bash
+# Copyright 2012-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+scriptpath=${BASH_SOURCE[0]}
+scriptname=${scriptpath##*/}
+
+IFS=':'
+
+for path in ${PATH}; do
+ [[ -x ${path}/${scriptname} ]] || continue
+ [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
+ IFS=$' \t\n'
+ output=$("${path}/${scriptname}" "$@" 2>&1)
+ if [[ $? -ne 0 ]] ; then
+
+ # Avoid an extreme performance problem when the
+ # output is very long (bug #470992).
+ if [[ $(wc -l <<< "${output}") -gt 100 ]]; then
+ output=$(head -n100 <<< "${output}")
+ output="${output}\n ... (further messages truncated)"
+ fi
+
+ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+ if ! ___eapi_has_prefix_variables; then
+ EPREFIX=
+ fi
+ msg="${scriptname} failure ignored with unprivileged user:\n ${scriptname} $*\n ${output}"
+ # Reverse expansion of ${D} and ${EPREFIX}, for readability.
+ msg=${msg//${D}/'${D}'}
+ if [[ -n ${EPREFIX} ]] ; then
+ msg=${msg//${EPREFIX}/'${EPREFIX}'}
+ msg=${msg//${EPREFIX#/}/'${EPREFIX}'}
+ fi
+ ewarn "${msg}"
+ fi
+ exit 0
+done
+
+exit 1
diff --git a/portage_with_autodep/bin/ebuild-helpers/xattr/install b/portage_with_autodep/bin/ebuild-helpers/xattr/install
new file mode 100755
index 0000000..f51f621
--- /dev/null
+++ b/portage_with_autodep/bin/ebuild-helpers/xattr/install
@@ -0,0 +1,12 @@
+#!/bin/bash
+# Copyright 2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
+PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
+# Use safe cwd, avoiding unsafe import for bug #469338.
+export __PORTAGE_HELPER_CWD=${PWD}
+cd "${PORTAGE_PYM_PATH}"
+export __PORTAGE_HELPER_PATH=${BASH_SOURCE[0]}
+PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
+ exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/install.py" "$@"
diff --git a/portage_with_autodep/bin/ebuild-ipc.py b/portage_with_autodep/bin/ebuild-ipc.py
index 68ad985..29d4c23 100755
--- a/portage_with_autodep/bin/ebuild-ipc.py
+++ b/portage_with_autodep/bin/ebuild-ipc.py
@@ -13,6 +13,7 @@ import select
import signal
import sys
import time
+import traceback
def debug_signal(signum, frame):
import pdb
@@ -228,14 +229,22 @@ class EbuildIpc(object):
pid = os.fork()
if pid == 0:
- os.close(pr)
-
- # File streams are in unbuffered mode since we do atomic
- # read and write of whole pickles.
- output_file = open(self.ipc_in_fifo, 'wb', 0)
- output_file.write(pickle.dumps(args))
- output_file.close()
- os._exit(os.EX_OK)
+ retval = 2
+ try:
+ os.close(pr)
+
+ # File streams are in unbuffered mode since we do atomic
+ # read and write of whole pickles.
+ output_file = open(self.ipc_in_fifo, 'wb', 0)
+ output_file.write(pickle.dumps(args))
+ output_file.close()
+ retval = os.EX_OK
+ except SystemExit:
+ raise
+ except:
+ traceback.print_exc()
+ finally:
+ os._exit(retval)
os.close(pw)
@@ -258,9 +267,16 @@ class EbuildIpc(object):
pid = os.fork()
if pid == 0:
- os.close(pr)
- retval = self._receive_reply(input_fd)
- os._exit(retval)
+ retval = 2
+ try:
+ os.close(pr)
+ retval = self._receive_reply(input_fd)
+ except SystemExit:
+ raise
+ except:
+ traceback.print_exc()
+ finally:
+ os._exit(retval)
os.close(pw)
retval = self._wait(pid, pr, portage.localization._('during read'))
diff --git a/portage_with_autodep/bin/ebuild.sh b/portage_with_autodep/bin/ebuild.sh
index d68e54b..2589113 100755
--- a/portage_with_autodep/bin/ebuild.sh
+++ b/portage_with_autodep/bin/ebuild.sh
@@ -1,17 +1,53 @@
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"
PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}"
-if [[ $PORTAGE_SANDBOX_COMPAT_LEVEL -lt 22 ]] ; then
- # Ensure that /dev/std* streams have appropriate sandbox permission for
- # bug #288863. This can be removed after sandbox is fixed and portage
- # depends on the fixed version (sandbox-2.2 has the fix but it is
- # currently unstable).
- export SANDBOX_WRITE="${SANDBOX_WRITE:+${SANDBOX_WRITE}:}/dev/stdout:/dev/stderr"
- export SANDBOX_READ="${SANDBOX_READ:+${SANDBOX_READ}:}/dev/stdin"
+# Prevent aliases from causing portage to act inappropriately.
+# Make sure it's before everything so we don't mess aliases that follow.
+unalias -a
+
+source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1
+
+if [[ $EBUILD_PHASE != depend ]] ; then
+ source "${PORTAGE_BIN_PATH}/phase-functions.sh" || die
+ source "${PORTAGE_BIN_PATH}/save-ebuild-env.sh" || die
+ source "${PORTAGE_BIN_PATH}/phase-helpers.sh" || die
+ source "${PORTAGE_BIN_PATH}/bashrc-functions.sh" || die
+else
+ # These dummy functions are for things that are likely to be called
+ # in global scope, even though they are completely useless during
+ # the "depend" phase.
+ for x in diropts docompress exeopts get_KV insopts \
+ keepdir KV_major KV_micro KV_minor KV_to_int \
+ libopts register_die_hook register_success_hook \
+ remove_path_entry set_unless_changed strip_duplicate_slashes \
+ unset_unless_changed use_with use_enable ; do
+ eval "${x}() {
+ if has \"\${EAPI:-0}\" 4-python; then
+ die \"\${FUNCNAME}() calls are not allowed in global scope\"
+ fi
+ }"
+ done
+ # These dummy functions return false in older EAPIs, in order to ensure that
+ # `use multislot` is false for the "depend" phase.
+ for x in use useq usev ; do
+ eval "${x}() {
+ if has \"\${EAPI:-0}\" 4-python; then
+ die \"\${FUNCNAME}() calls are not allowed in global scope\"
+ else
+ return 1
+ fi
+ }"
+ done
+ # These functions die because calls to them during the "depend" phase
+ # are considered to be severe QA violations.
+ for x in best_version has_version portageq ; do
+ eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }"
+ done
+ unset x
fi
# Don't use sandbox's BASH_ENV for new shells because it does
@@ -19,13 +55,6 @@ fi
# environment by modifying our PATH.
unset BASH_ENV
-ROOTPATH=${ROOTPATH##:}
-ROOTPATH=${ROOTPATH%%:}
-PREROOTPATH=${PREROOTPATH##:}
-PREROOTPATH=${PREROOTPATH%%:}
-PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
-export PATH
-
# This is just a temporary workaround for portage-9999 users since
# earlier portage versions do not detect a version change in this case
# (9999 to 9999) and therefore they try execute an incompatible version of
@@ -67,15 +96,9 @@ EBUILD_SH_ARGS="$*"
shift $#
-# Prevent aliases from causing portage to act inappropriately.
-# Make sure it's before everything so we don't mess aliases that follow.
-unalias -a
-
# Unset some variables that break things.
unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
-source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null
-
[[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
# sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex)
@@ -113,191 +136,12 @@ fi
# the sandbox is disabled by default except when overridden in the relevant stages
export SANDBOX_ON=0
-lchown() {
- chown -h "$@"
-}
-
-lchgrp() {
- chgrp -h "$@"
-}
-
esyslog() {
# Custom version of esyslog() to take care of the "Red Star" bug.
# MUST follow functions.sh to override the "" parameter problem.
return 0
}
-useq() {
- has $EBUILD_PHASE prerm postrm || eqawarn \
- "QA Notice: The 'useq' function is deprecated (replaced by 'use')"
- use ${1}
-}
-
-usev() {
- if use ${1}; then
- echo "${1#!}"
- return 0
- fi
- return 1
-}
-
-use() {
- local u=$1
- local found=0
-
- # if we got something like '!flag', then invert the return value
- if [[ ${u:0:1} == "!" ]] ; then
- u=${u:1}
- found=1
- fi
-
- if [[ $EBUILD_PHASE = depend ]] ; then
- # TODO: Add a registration interface for eclasses to register
- # any number of phase hooks, so that global scope eclass
- # initialization can by migrated to phase hooks in new EAPIs.
- # Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup
- #if [[ -n $EAPI ]] && ! has "$EAPI" 0 1 2 3 ; then
- # die "use() called during invalid phase: $EBUILD_PHASE"
- #fi
- true
-
- # Make sure we have this USE flag in IUSE
- elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then
- [[ $u =~ $PORTAGE_IUSE ]] || \
- eqawarn "QA Notice: USE Flag '${u}' not" \
- "in IUSE for ${CATEGORY}/${PF}"
- fi
-
- if has ${u} ${USE} ; then
- return ${found}
- else
- return $((!found))
- fi
-}
-
-# Return true if given package is installed. Otherwise return false.
-# Takes single depend-type atoms.
-has_version() {
- if [ "${EBUILD_PHASE}" == "depend" ]; then
- die "portageq calls (has_version calls portageq) are not allowed in the global scope"
- fi
-
- if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
- "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1"
- else
- PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
- "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1"
- fi
- local retval=$?
- case "${retval}" in
- 0|1)
- return ${retval}
- ;;
- *)
- die "unexpected portageq exit code: ${retval}"
- ;;
- esac
-}
-
-portageq() {
- if [ "${EBUILD_PHASE}" == "depend" ]; then
- die "portageq calls are not allowed in the global scope"
- fi
-
- PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
- "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" "$@"
-}
-
-
-# ----------------------------------------------------------------------------
-# ----------------------------------------------------------------------------
-# ----------------------------------------------------------------------------
-
-
-# Returns the best/most-current match.
-# Takes single depend-type atoms.
-best_version() {
- if [ "${EBUILD_PHASE}" == "depend" ]; then
- die "portageq calls (best_version calls portageq) are not allowed in the global scope"
- fi
-
- if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
- "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1"
- else
- PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
- "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1"
- fi
- local retval=$?
- case "${retval}" in
- 0|1)
- return ${retval}
- ;;
- *)
- die "unexpected portageq exit code: ${retval}"
- ;;
- esac
-}
-
-use_with() {
- if [ -z "$1" ]; then
- echo "!!! use_with() called without a parameter." >&2
- echo "!!! use_with <USEFLAG> [<flagname> [value]]" >&2
- return 1
- fi
-
- if ! has "${EAPI:-0}" 0 1 2 3 ; then
- local UW_SUFFIX=${3+=$3}
- else
- local UW_SUFFIX=${3:+=$3}
- fi
- local UWORD=${2:-$1}
-
- if use $1; then
- echo "--with-${UWORD}${UW_SUFFIX}"
- else
- echo "--without-${UWORD}"
- fi
- return 0
-}
-
-use_enable() {
- if [ -z "$1" ]; then
- echo "!!! use_enable() called without a parameter." >&2
- echo "!!! use_enable <USEFLAG> [<flagname> [value]]" >&2
- return 1
- fi
-
- if ! has "${EAPI:-0}" 0 1 2 3 ; then
- local UE_SUFFIX=${3+=$3}
- else
- local UE_SUFFIX=${3:+=$3}
- fi
- local UWORD=${2:-$1}
-
- if use $1; then
- echo "--enable-${UWORD}${UE_SUFFIX}"
- else
- echo "--disable-${UWORD}"
- fi
- return 0
-}
-
-register_die_hook() {
- local x
- for x in $* ; do
- has $x $EBUILD_DEATH_HOOKS || \
- export EBUILD_DEATH_HOOKS="$EBUILD_DEATH_HOOKS $x"
- done
-}
-
-register_success_hook() {
- local x
- for x in $* ; do
- has $x $EBUILD_SUCCESS_HOOKS || \
- export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x"
- done
-}
-
# Ensure that $PWD is sane whenever possible, to protect against
# exploitation of insecure search path for python -c in ebuilds.
# See bug #239560.
@@ -309,985 +153,6 @@ fi
#if no perms are specified, dirs/files will have decent defaults
#(not secretive, but not stupid)
umask 022
-export DESTTREE=/usr
-export INSDESTTREE=""
-export _E_EXEDESTTREE_=""
-export _E_DOCDESTTREE_=""
-export INSOPTIONS="-m0644"
-export EXEOPTIONS="-m0755"
-export LIBOPTIONS="-m0644"
-export DIROPTIONS="-m0755"
-export MOPREFIX=${PN}
-declare -a PORTAGE_DOCOMPRESS=( /usr/share/{doc,info,man} )
-declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html )
-
-# adds ".keep" files so that dirs aren't auto-cleaned
-keepdir() {
- dodir "$@"
- local x
- if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
- shift
- find "$@" -type d -printf "${D}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
- | tr "\n" "\0" | \
- while read -r -d $'\0' ; do
- >> "$REPLY" || \
- die "Failed to recursively create .keep files"
- done
- else
- for x in "$@"; do
- >> "${D}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
- die "Failed to create .keep in ${D}${x}"
- done
- fi
-}
-
-unpack() {
- local srcdir
- local x
- local y
- local myfail
- local eapi=${EAPI:-0}
- [ -z "$*" ] && die "Nothing passed to the 'unpack' command"
-
- for x in "$@"; do
- vecho ">>> Unpacking ${x} to ${PWD}"
- y=${x%.*}
- y=${y##*.}
-
- if [[ ${x} == "./"* ]] ; then
- srcdir=""
- elif [[ ${x} == ${DISTDIR%/}/* ]] ; then
- die "Arguments to unpack() cannot begin with \${DISTDIR}."
- elif [[ ${x} == "/"* ]] ; then
- die "Arguments to unpack() cannot be absolute"
- else
- srcdir="${DISTDIR}/"
- fi
- [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist"
-
- _unpack_tar() {
- if [ "${y}" == "tar" ]; then
- $1 -c -- "$srcdir$x" | tar xof -
- assert_sigpipe_ok "$myfail"
- else
- local cwd_dest=${x##*/}
- cwd_dest=${cwd_dest%.*}
- $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail"
- fi
- }
-
- myfail="failure unpacking ${x}"
- case "${x##*.}" in
- tar)
- tar xof "$srcdir$x" || die "$myfail"
- ;;
- tgz)
- tar xozf "$srcdir$x" || die "$myfail"
- ;;
- tbz|tbz2)
- ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof -
- assert_sigpipe_ok "$myfail"
- ;;
- ZIP|zip|jar)
- # unzip will interactively prompt under some error conditions,
- # as reported in bug #336285
- ( while true ; do echo n || break ; done ) | \
- unzip -qo "${srcdir}${x}" || die "$myfail"
- ;;
- gz|Z|z)
- _unpack_tar "gzip -d"
- ;;
- bz2|bz)
- _unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}"
- ;;
- 7Z|7z)
- local my_output
- my_output="$(7z x -y "${srcdir}${x}")"
- if [ $? -ne 0 ]; then
- echo "${my_output}" >&2
- die "$myfail"
- fi
- ;;
- RAR|rar)
- unrar x -idq -o+ "${srcdir}${x}" || die "$myfail"
- ;;
- LHa|LHA|lha|lzh)
- lha xfq "${srcdir}${x}" || die "$myfail"
- ;;
- a)
- ar x "${srcdir}${x}" || die "$myfail"
- ;;
- deb)
- # Unpacking .deb archives can not always be done with
- # `ar`. For instance on AIX this doesn't work out. If
- # we have `deb2targz` installed, prefer it over `ar` for
- # that reason. We just make sure on AIX `deb2targz` is
- # installed.
- if type -P deb2targz > /dev/null; then
- y=${x##*/}
- local created_symlink=0
- if [ ! "$srcdir$x" -ef "$y" ] ; then
- # deb2targz always extracts into the same directory as
- # the source file, so create a symlink in the current
- # working directory if necessary.
- ln -sf "$srcdir$x" "$y" || die "$myfail"
- created_symlink=1
- fi
- deb2targz "$y" || die "$myfail"
- if [ $created_symlink = 1 ] ; then
- # Clean up the symlink so the ebuild
- # doesn't inadvertently install it.
- rm -f "$y"
- fi
- mv -f "${y%.deb}".tar.gz data.tar.gz || die "$myfail"
- else
- ar x "$srcdir$x" || die "$myfail"
- fi
- ;;
- lzma)
- _unpack_tar "lzma -d"
- ;;
- xz)
- if has $eapi 0 1 2 ; then
- vecho "unpack ${x}: file format not recognized. Ignoring."
- else
- _unpack_tar "xz -d"
- fi
- ;;
- *)
- vecho "unpack ${x}: file format not recognized. Ignoring."
- ;;
- esac
- done
- # Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE
- # should be preserved.
- find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \
- ${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w
-}
-
-strip_duplicate_slashes() {
- if [[ -n $1 ]] ; then
- local removed=$1
- while [[ ${removed} == *//* ]] ; do
- removed=${removed//\/\///}
- done
- echo ${removed}
- fi
-}
-
-hasg() {
- local x s=$1
- shift
- for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done
- return 1
-}
-hasgq() { hasg "$@" >/dev/null ; }
-econf() {
- local x
-
- local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
- if [[ -n $phase_func ]] ; then
- if has "$EAPI" 0 1 ; then
- [[ $phase_func != src_compile ]] && \
- eqawarn "QA Notice: econf called in" \
- "$phase_func instead of src_compile"
- else
- [[ $phase_func != src_configure ]] && \
- eqawarn "QA Notice: econf called in" \
- "$phase_func instead of src_configure"
- fi
- fi
-
- : ${ECONF_SOURCE:=.}
- if [ -x "${ECONF_SOURCE}/configure" ]; then
- if [[ -n $CONFIG_SHELL && \
- "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then
- sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
- die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
- fi
- if [ -e /usr/share/gnuconfig/ ]; then
- find "${WORKDIR}" -type f '(' \
- -name config.guess -o -name config.sub ')' -print0 | \
- while read -r -d $'\0' x ; do
- vecho " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}"
- cp -f /usr/share/gnuconfig/"${x##*/}" "${x}"
- done
- fi
-
- # EAPI=4 adds --disable-dependency-tracking to econf
- if ! has "$EAPI" 0 1 2 3 3_pre2 && \
- "${ECONF_SOURCE}/configure" --help 2>/dev/null | \
- grep -q disable-dependency-tracking ; then
- set -- --disable-dependency-tracking "$@"
- fi
-
- # if the profile defines a location to install libs to aside from default, pass it on.
- # if the ebuild passes in --libdir, they're responsible for the conf_libdir fun.
- local CONF_LIBDIR LIBDIR_VAR="LIBDIR_${ABI}"
- if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
- CONF_LIBDIR=${!LIBDIR_VAR}
- fi
- if [[ -n ${CONF_LIBDIR} ]] && ! hasgq --libdir=\* "$@" ; then
- export CONF_PREFIX=$(hasg --exec-prefix=\* "$@")
- [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(hasg --prefix=\* "$@")
- : ${CONF_PREFIX:=/usr}
- CONF_PREFIX=${CONF_PREFIX#*=}
- [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
- [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
- set -- --libdir="$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@"
- fi
-
- set -- \
- --prefix=/usr \
- ${CBUILD:+--build=${CBUILD}} \
- --host=${CHOST} \
- ${CTARGET:+--target=${CTARGET}} \
- --mandir=/usr/share/man \
- --infodir=/usr/share/info \
- --datadir=/usr/share \
- --sysconfdir=/etc \
- --localstatedir=/var/lib \
- "$@" \
- ${EXTRA_ECONF}
- vecho "${ECONF_SOURCE}/configure" "$@"
-
- if ! "${ECONF_SOURCE}/configure" "$@" ; then
-
- if [ -s config.log ]; then
- echo
- echo "!!! Please attach the following file when seeking support:"
- echo "!!! ${PWD}/config.log"
- fi
- die "econf failed"
- fi
- elif [ -f "${ECONF_SOURCE}/configure" ]; then
- die "configure is not executable"
- else
- die "no configure script found"
- fi
-}
-
-einstall() {
- # CONF_PREFIX is only set if they didn't pass in libdir above.
- local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
- LIBDIR_VAR="LIBDIR_${ABI}"
- if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
- CONF_LIBDIR="${!LIBDIR_VAR}"
- fi
- unset LIBDIR_VAR
- if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then
- EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}"
- EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})"
- LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}"
- unset EI_DESTLIBDIR
- fi
-
- if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
- if [ "${PORTAGE_DEBUG}" == "1" ]; then
- ${MAKE:-make} -n prefix="${D}usr" \
- datadir="${D}usr/share" \
- infodir="${D}usr/share/info" \
- localstatedir="${D}var/lib" \
- mandir="${D}usr/share/man" \
- sysconfdir="${D}etc" \
- ${LOCAL_EXTRA_EINSTALL} \
- ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
- "$@" install
- fi
- ${MAKE:-make} prefix="${D}usr" \
- datadir="${D}usr/share" \
- infodir="${D}usr/share/info" \
- localstatedir="${D}var/lib" \
- mandir="${D}usr/share/man" \
- sysconfdir="${D}etc" \
- ${LOCAL_EXTRA_EINSTALL} \
- ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
- "$@" install || die "einstall failed"
- else
- die "no Makefile found"
- fi
-}
-
-_eapi0_pkg_nofetch() {
- [ -z "${SRC_URI}" ] && return
-
- elog "The following are listed in SRC_URI for ${PN}:"
- local x
- for x in $(echo ${SRC_URI}); do
- elog " ${x}"
- done
-}
-
-_eapi0_src_unpack() {
- [[ -n ${A} ]] && unpack ${A}
-}
-
-_eapi0_src_compile() {
- if [ -x ./configure ] ; then
- econf
- fi
- _eapi2_src_compile
-}
-
-_eapi0_src_test() {
- # Since we don't want emake's automatic die
- # support (EAPI 4 and later), and we also don't
- # want the warning messages that it produces if
- # we call it in 'nonfatal' mode, we use emake_cmd
- # to emulate the desired parts of emake behavior.
- local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
- if $emake_cmd -j1 check -n &> /dev/null; then
- vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
- if ! $emake_cmd -j1 check; then
- has test $FEATURES && die "Make check failed. See above for details."
- has test $FEATURES || eerror "Make check failed. See above for details."
- fi
- elif $emake_cmd -j1 test -n &> /dev/null; then
- vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
- if ! $emake_cmd -j1 test; then
- has test $FEATURES && die "Make test failed. See above for details."
- has test $FEATURES || eerror "Make test failed. See above for details."
- fi
- else
- vecho ">>> Test phase [none]: ${CATEGORY}/${PF}"
- fi
-}
-
-_eapi1_src_compile() {
- _eapi2_src_configure
- _eapi2_src_compile
-}
-
-_eapi2_src_configure() {
- if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then
- econf
- fi
-}
-
-_eapi2_src_compile() {
- if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
- emake || die "emake failed"
- fi
-}
-
-_eapi4_src_install() {
- if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
- emake DESTDIR="${D}" install
- fi
-
- if ! declare -p DOCS &>/dev/null ; then
- local d
- for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
- THANKS BUGS FAQ CREDITS CHANGELOG ; do
- [[ -s "${d}" ]] && dodoc "${d}"
- done
- elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then
- dodoc "${DOCS[@]}"
- else
- dodoc ${DOCS}
- fi
-}
-
-ebuild_phase() {
- declare -F "$1" >/dev/null && qa_call $1
-}
-
-ebuild_phase_with_hooks() {
- local x phase_name=${1}
- for x in {pre_,,post_}${phase_name} ; do
- ebuild_phase ${x}
- done
-}
-
-dyn_pretend() {
- if [[ -e $PORTAGE_BUILDDIR/.pretended ]] ; then
- vecho ">>> It appears that '$PF' is already pretended; skipping."
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend."
- return 0
- fi
- ebuild_phase pre_pkg_pretend
- ebuild_phase pkg_pretend
- >> "$PORTAGE_BUILDDIR/.pretended" || \
- die "Failed to create $PORTAGE_BUILDDIR/.pretended"
- ebuild_phase post_pkg_pretend
-}
-
-dyn_setup() {
- if [[ -e $PORTAGE_BUILDDIR/.setuped ]] ; then
- vecho ">>> It appears that '$PF' is already setup; skipping."
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force setup."
- return 0
- fi
- ebuild_phase pre_pkg_setup
- ebuild_phase pkg_setup
- >> "$PORTAGE_BUILDDIR/.setuped" || \
- die "Failed to create $PORTAGE_BUILDDIR/.setuped"
- ebuild_phase post_pkg_setup
-}
-
-dyn_unpack() {
- local newstuff="no"
- if [ -e "${WORKDIR}" ]; then
- local x
- local checkme
- for x in $A ; do
- vecho ">>> Checking ${x}'s mtime..."
- if [ "${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/${x}" -nt "${WORKDIR}" ]; then
- vecho ">>> ${x} has been updated; recreating WORKDIR..."
- newstuff="yes"
- break
- fi
- done
- if [ ! -f "${PORTAGE_BUILDDIR}/.unpacked" ] ; then
- vecho ">>> Not marked as unpacked; recreating WORKDIR..."
- newstuff="yes"
- fi
- fi
- if [ "${newstuff}" == "yes" ]; then
- # We don't necessarily have privileges to do a full dyn_clean here.
- rm -rf "${PORTAGE_BUILDDIR}"/{.setuped,.unpacked,.prepared,.configured,.compiled,.tested,.installed,.packaged,build-info}
- if ! has keepwork $FEATURES ; then
- rm -rf "${WORKDIR}"
- fi
- if [ -d "${T}" ] && \
- ! has keeptemp $FEATURES ; then
- rm -rf "${T}" && mkdir "${T}"
- fi
- fi
- if [ -e "${WORKDIR}" ]; then
- if [ "$newstuff" == "no" ]; then
- vecho ">>> WORKDIR is up-to-date, keeping..."
- return 0
- fi
- fi
-
- if [ ! -d "${WORKDIR}" ]; then
- install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
- fi
- cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`"
- ebuild_phase pre_src_unpack
- vecho ">>> Unpacking source..."
- ebuild_phase src_unpack
- >> "$PORTAGE_BUILDDIR/.unpacked" || \
- die "Failed to create $PORTAGE_BUILDDIR/.unpacked"
- vecho ">>> Source unpacked in ${WORKDIR}"
- ebuild_phase post_src_unpack
-}
-
-dyn_clean() {
- if [ -z "${PORTAGE_BUILDDIR}" ]; then
- echo "Aborting clean phase because PORTAGE_BUILDDIR is unset!"
- return 1
- elif [ ! -d "${PORTAGE_BUILDDIR}" ] ; then
- return 0
- fi
- if has chflags $FEATURES ; then
- chflags -R noschg,nouchg,nosappnd,nouappnd "${PORTAGE_BUILDDIR}"
- chflags -R nosunlnk,nouunlnk "${PORTAGE_BUILDDIR}" 2>/dev/null
- fi
-
- rm -rf "${PORTAGE_BUILDDIR}/image" "${PORTAGE_BUILDDIR}/homedir"
- rm -f "${PORTAGE_BUILDDIR}/.installed"
-
- if [[ $EMERGE_FROM = binary ]] || \
- ! has keeptemp $FEATURES && ! has keepwork $FEATURES ; then
- rm -rf "${T}"
- fi
-
- if [[ $EMERGE_FROM = binary ]] || ! has keepwork $FEATURES; then
- rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,pretended,setuped,unpacked,prepared} \
- "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \
- "$PORTAGE_BUILDDIR"/.die_hooks \
- "$PORTAGE_BUILDDIR"/.ipc_{in,out,lock} \
- "$PORTAGE_BUILDDIR"/.exit_status
-
- rm -rf "${PORTAGE_BUILDDIR}/build-info"
- rm -rf "${WORKDIR}"
- fi
-
- if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then
- find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null
- fi
-
- # do not bind this to doebuild defined DISTDIR; don't trust doebuild, and if mistakes are made it'll
- # result in it wiping the users distfiles directory (bad).
- rm -rf "${PORTAGE_BUILDDIR}/distdir"
-
- # Some kernels, such as Solaris, return EINVAL when an attempt
- # is made to remove the current working directory.
- cd "$PORTAGE_BUILDDIR"/../..
- rmdir "$PORTAGE_BUILDDIR" 2>/dev/null
-
- true
-}
-
-into() {
- if [ "$1" == "/" ]; then
- export DESTTREE=""
- else
- export DESTTREE=$1
- if [ ! -d "${D}${DESTTREE}" ]; then
- install -d "${D}${DESTTREE}"
- local ret=$?
- if [[ $ret -ne 0 ]] ; then
- helpers_die "${FUNCNAME[0]} failed"
- return $ret
- fi
- fi
- fi
-}
-
-insinto() {
- if [ "$1" == "/" ]; then
- export INSDESTTREE=""
- else
- export INSDESTTREE=$1
- if [ ! -d "${D}${INSDESTTREE}" ]; then
- install -d "${D}${INSDESTTREE}"
- local ret=$?
- if [[ $ret -ne 0 ]] ; then
- helpers_die "${FUNCNAME[0]} failed"
- return $ret
- fi
- fi
- fi
-}
-
-exeinto() {
- if [ "$1" == "/" ]; then
- export _E_EXEDESTTREE_=""
- else
- export _E_EXEDESTTREE_="$1"
- if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then
- install -d "${D}${_E_EXEDESTTREE_}"
- local ret=$?
- if [[ $ret -ne 0 ]] ; then
- helpers_die "${FUNCNAME[0]} failed"
- return $ret
- fi
- fi
- fi
-}
-
-docinto() {
- if [ "$1" == "/" ]; then
- export _E_DOCDESTTREE_=""
- else
- export _E_DOCDESTTREE_="$1"
- if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
- install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
- local ret=$?
- if [[ $ret -ne 0 ]] ; then
- helpers_die "${FUNCNAME[0]} failed"
- return $ret
- fi
- fi
- fi
-}
-
-insopts() {
- export INSOPTIONS="$@"
-
- # `install` should never be called with '-s' ...
- has -s ${INSOPTIONS} && die "Never call insopts() with -s"
-}
-
-diropts() {
- export DIROPTIONS="$@"
-}
-
-exeopts() {
- export EXEOPTIONS="$@"
-
- # `install` should never be called with '-s' ...
- has -s ${EXEOPTIONS} && die "Never call exeopts() with -s"
-}
-
-libopts() {
- export LIBOPTIONS="$@"
-
- # `install` should never be called with '-s' ...
- has -s ${LIBOPTIONS} && die "Never call libopts() with -s"
-}
-
-docompress() {
- has "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI"
-
- local f g
- if [[ $1 = "-x" ]]; then
- shift
- for f; do
- f=$(strip_duplicate_slashes "${f}"); f=${f%/}
- [[ ${f:0:1} = / ]] || f="/${f}"
- for g in "${PORTAGE_DOCOMPRESS_SKIP[@]}"; do
- [[ ${f} = "${g}" ]] && continue 2
- done
- PORTAGE_DOCOMPRESS_SKIP[${#PORTAGE_DOCOMPRESS_SKIP[@]}]=${f}
- done
- else
- for f; do
- f=$(strip_duplicate_slashes "${f}"); f=${f%/}
- [[ ${f:0:1} = / ]] || f="/${f}"
- for g in "${PORTAGE_DOCOMPRESS[@]}"; do
- [[ ${f} = "${g}" ]] && continue 2
- done
- PORTAGE_DOCOMPRESS[${#PORTAGE_DOCOMPRESS[@]}]=${f}
- done
- fi
-}
-
-abort_handler() {
- local msg
- if [ "$2" != "fail" ]; then
- msg="${EBUILD}: ${1} aborted; exiting."
- else
- msg="${EBUILD}: ${1} failed; exiting."
- fi
- echo
- echo "$msg"
- echo
- eval ${3}
- #unset signal handler
- trap - SIGINT SIGQUIT
-}
-
-abort_prepare() {
- abort_handler src_prepare $1
- rm -f "$PORTAGE_BUILDDIR/.prepared"
- exit 1
-}
-
-abort_configure() {
- abort_handler src_configure $1
- rm -f "$PORTAGE_BUILDDIR/.configured"
- exit 1
-}
-
-abort_compile() {
- abort_handler "src_compile" $1
- rm -f "${PORTAGE_BUILDDIR}/.compiled"
- exit 1
-}
-
-abort_test() {
- abort_handler "dyn_test" $1
- rm -f "${PORTAGE_BUILDDIR}/.tested"
- exit 1
-}
-
-abort_install() {
- abort_handler "src_install" $1
- rm -rf "${PORTAGE_BUILDDIR}/image"
- exit 1
-}
-
-has_phase_defined_up_to() {
- local phase
- for phase in unpack prepare configure compile install; do
- has ${phase} ${DEFINED_PHASES} && return 0
- [[ ${phase} == $1 ]] && return 1
- done
- # We shouldn't actually get here
- return 1
-}
-
-dyn_prepare() {
-
- if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then
- vecho ">>> It appears that '$PF' is already prepared; skipping."
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.prepared' to force prepare."
- return 0
- fi
-
- if [[ -d $S ]] ; then
- cd "${S}"
- elif has $EAPI 0 1 2 3 3_pre2 ; then
- cd "${WORKDIR}"
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then
- cd "${WORKDIR}"
- else
- die "The source directory '${S}' doesn't exist"
- fi
-
- trap abort_prepare SIGINT SIGQUIT
-
- ebuild_phase pre_src_prepare
- vecho ">>> Preparing source in $PWD ..."
- ebuild_phase src_prepare
- >> "$PORTAGE_BUILDDIR/.prepared" || \
- die "Failed to create $PORTAGE_BUILDDIR/.prepared"
- vecho ">>> Source prepared."
- ebuild_phase post_src_prepare
-
- trap - SIGINT SIGQUIT
-}
-
-dyn_configure() {
-
- if [[ -e $PORTAGE_BUILDDIR/.configured ]] ; then
- vecho ">>> It appears that '$PF' is already configured; skipping."
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration."
- return 0
- fi
-
- if [[ -d $S ]] ; then
- cd "${S}"
- elif has $EAPI 0 1 2 3 3_pre2 ; then
- cd "${WORKDIR}"
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then
- cd "${WORKDIR}"
- else
- die "The source directory '${S}' doesn't exist"
- fi
-
- trap abort_configure SIGINT SIGQUIT
-
- ebuild_phase pre_src_configure
-
- vecho ">>> Configuring source in $PWD ..."
- ebuild_phase src_configure
- >> "$PORTAGE_BUILDDIR/.configured" || \
- die "Failed to create $PORTAGE_BUILDDIR/.configured"
- vecho ">>> Source configured."
-
- ebuild_phase post_src_configure
-
- trap - SIGINT SIGQUIT
-}
-
-dyn_compile() {
-
- if [[ -e $PORTAGE_BUILDDIR/.compiled ]] ; then
- vecho ">>> It appears that '${PF}' is already compiled; skipping."
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation."
- return 0
- fi
-
- if [[ -d $S ]] ; then
- cd "${S}"
- elif has $EAPI 0 1 2 3 3_pre2 ; then
- cd "${WORKDIR}"
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then
- cd "${WORKDIR}"
- else
- die "The source directory '${S}' doesn't exist"
- fi
-
- trap abort_compile SIGINT SIGQUIT
-
- if has distcc $FEATURES && has distcc-pump $FEATURES ; then
- if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]] ; then
- eval $(pump --startup)
- trap "pump --shutdown" EXIT
- fi
- fi
-
- ebuild_phase pre_src_compile
-
- vecho ">>> Compiling source in $PWD ..."
- ebuild_phase src_compile
- >> "$PORTAGE_BUILDDIR/.compiled" || \
- die "Failed to create $PORTAGE_BUILDDIR/.compiled"
- vecho ">>> Source compiled."
-
- ebuild_phase post_src_compile
-
- trap - SIGINT SIGQUIT
-}
-
-dyn_test() {
-
- if [[ -e $PORTAGE_BUILDDIR/.tested ]] ; then
- vecho ">>> It appears that ${PN} has already been tested; skipping."
- vecho ">>> Remove '${PORTAGE_BUILDDIR}/.tested' to force test."
- return
- fi
-
- if [ "${EBUILD_FORCE_TEST}" == "1" ] ; then
- # If USE came from ${T}/environment then it might not have USE=test
- # like it's supposed to here.
- ! has test ${USE} && export USE="${USE} test"
- fi
-
- trap "abort_test" SIGINT SIGQUIT
- if [ -d "${S}" ]; then
- cd "${S}"
- else
- cd "${WORKDIR}"
- fi
-
- if ! has test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
- vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
- elif has test $RESTRICT; then
- einfo "Skipping make test/check due to ebuild restriction."
- vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
- else
- local save_sp=${SANDBOX_PREDICT}
- addpredict /
- ebuild_phase pre_src_test
- ebuild_phase src_test
- >> "$PORTAGE_BUILDDIR/.tested" || \
- die "Failed to create $PORTAGE_BUILDDIR/.tested"
- ebuild_phase post_src_test
- SANDBOX_PREDICT=${save_sp}
- fi
-
- trap - SIGINT SIGQUIT
-}
-
-dyn_install() {
- [ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset"
- if has noauto $FEATURES ; then
- rm -f "${PORTAGE_BUILDDIR}/.installed"
- elif [[ -e $PORTAGE_BUILDDIR/.installed ]] ; then
- vecho ">>> It appears that '${PF}' is already installed; skipping."
- vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install."
- return 0
- fi
- trap "abort_install" SIGINT SIGQUIT
- ebuild_phase pre_src_install
- rm -rf "${PORTAGE_BUILDDIR}/image"
- mkdir "${PORTAGE_BUILDDIR}/image"
- if [[ -d $S ]] ; then
- cd "${S}"
- elif has $EAPI 0 1 2 3 3_pre2 ; then
- cd "${WORKDIR}"
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then
- cd "${WORKDIR}"
- else
- die "The source directory '${S}' doesn't exist"
- fi
-
- vecho
- vecho ">>> Install ${PF} into ${D} category ${CATEGORY}"
- #our custom version of libtool uses $S and $D to fix
- #invalid paths in .la files
- export S D
-
- # Reset exeinto(), docinto(), insinto(), and into() state variables
- # in case the user is running the install phase multiple times
- # consecutively via the ebuild command.
- export DESTTREE=/usr
- export INSDESTTREE=""
- export _E_EXEDESTTREE_=""
- export _E_DOCDESTTREE_=""
-
- ebuild_phase src_install
- >> "$PORTAGE_BUILDDIR/.installed" || \
- die "Failed to create $PORTAGE_BUILDDIR/.installed"
- vecho ">>> Completed installing ${PF} into ${D}"
- vecho
- ebuild_phase post_src_install
-
- cd "${PORTAGE_BUILDDIR}"/build-info
- set -f
- local f x
- IFS=$' \t\n\r'
- for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE REQUIRED_USE \
- PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do
- x=$(echo -n ${!f})
- [[ -n $x ]] && echo "$x" > $f
- done
- if [[ $CATEGORY != virtual ]] ; then
- for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \
- CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
- LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do
- x=$(echo -n ${!f})
- [[ -n $x ]] && echo "$x" > $f
- done
- fi
- echo "${USE}" > USE
- echo "${EAPI:-0}" > EAPI
- set +f
-
- # local variables can leak into the saved environment.
- unset f
-
- save_ebuild_env --exclude-init-phases | filter_readonly_variables \
- --filter-path --filter-sandbox --allow-extra-vars > environment
- assert "save_ebuild_env failed"
-
- ${PORTAGE_BZIP2_COMMAND} -f9 environment
-
- cp "${EBUILD}" "${PF}.ebuild"
- [ -n "${PORTAGE_REPO_NAME}" ] && echo "${PORTAGE_REPO_NAME}" > repository
- if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
- then
- >> DEBUGBUILD
- fi
- trap - SIGINT SIGQUIT
-}
-
-dyn_preinst() {
- if [ -z "${D}" ]; then
- eerror "${FUNCNAME}: D is unset"
- return 1
- fi
- ebuild_phase_with_hooks pkg_preinst
-}
-
-dyn_help() {
- echo
- echo "Portage"
- echo "Copyright 1999-2010 Gentoo Foundation"
- echo
- echo "How to use the ebuild command:"
- echo
- echo "The first argument to ebuild should be an existing .ebuild file."
- echo
- echo "One or more of the following options can then be specified. If more"
- echo "than one option is specified, each will be executed in order."
- echo
- echo " help : show this help screen"
- echo " pretend : execute package specific pretend actions"
- echo " setup : execute package specific setup actions"
- echo " fetch : download source archive(s) and patches"
- echo " digest : create a manifest file for the package"
- echo " manifest : create a manifest file for the package"
- echo " unpack : unpack sources (auto-dependencies if needed)"
- echo " prepare : prepare sources (auto-dependencies if needed)"
- echo " configure : configure sources (auto-fetch/unpack if needed)"
- echo " compile : compile sources (auto-fetch/unpack/configure if needed)"
- echo " test : test package (auto-fetch/unpack/configure/compile if needed)"
- echo " preinst : execute pre-install instructions"
- echo " postinst : execute post-install instructions"
- echo " install : install the package to the temporary install directory"
- echo " qmerge : merge image into live filesystem, recording files in db"
- echo " merge : do fetch, unpack, compile, install and qmerge"
- echo " prerm : execute pre-removal instructions"
- echo " postrm : execute post-removal instructions"
- echo " unmerge : remove package from live filesystem"
- echo " config : execute package specific configuration actions"
- echo " package : create a tarball package in ${PKGDIR}/All"
- echo " rpm : build a RedHat RPM package"
- echo " clean : clean up all source and temporary files"
- echo
- echo "The following settings will be used for the ebuild process:"
- echo
- echo " package : ${PF}"
- echo " slot : ${SLOT}"
- echo " category : ${CATEGORY}"
- echo " description : ${DESCRIPTION}"
- echo " system : ${CHOST}"
- echo " c flags : ${CFLAGS}"
- echo " c++ flags : ${CXXFLAGS}"
- echo " make flags : ${MAKEOPTS}"
- echo -n " build mode : "
- if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} ;
- then
- echo "debug (large)"
- else
- echo "production (stripped)"
- fi
- echo " merge to : ${ROOT}"
- echo
- if [ -n "$USE" ]; then
- echo "Additionally, support for the following optional features will be enabled:"
- echo
- echo " ${USE}"
- fi
- echo
-}
# debug-print() gets called from many places with verbose status information useful
# for tracking down problems. The output is in $T/eclass-debug.log.
@@ -1365,11 +230,15 @@ inherit() {
unset $__export_funcs_var
if [ "${EBUILD_PHASE}" != "depend" ] && \
+ [ "${EBUILD_PHASE}" != "nofetch" ] && \
[[ ${EBUILD_PHASE} != *rm ]] && \
[[ ${EMERGE_FROM} != "binary" ]] ; then
# This is disabled in the *rm phases because they frequently give
# false alarms due to INHERITED in /var/db/pkg being outdated
- # in comparison the the eclasses from the portage tree.
+ # in comparison the the eclasses from the portage tree. It's
+ # disabled for nofetch, since that can be called by repoman and
+ # that triggers bug #407449 due to repoman not exporting
+ # non-essential variables such as INHERITED.
if ! has $ECLASS $INHERITED $__INHERITED_QA_CACHE ; then
eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF $EBUILD_PHASE"
fi
@@ -1418,11 +287,11 @@ inherit() {
# If each var has a value, append it to the global variable E_* to
# be applied after everything is finished. New incremental behavior.
- [ "${IUSE+set}" = set ] && export E_IUSE="${E_IUSE} ${IUSE}"
- [ "${REQUIRED_USE+set}" = set ] && export E_REQUIRED_USE="${E_REQUIRED_USE} ${REQUIRED_USE}"
- [ "${DEPEND+set}" = set ] && export E_DEPEND="${E_DEPEND} ${DEPEND}"
- [ "${RDEPEND+set}" = set ] && export E_RDEPEND="${E_RDEPEND} ${RDEPEND}"
- [ "${PDEPEND+set}" = set ] && export E_PDEPEND="${E_PDEPEND} ${PDEPEND}"
+ [ "${IUSE+set}" = set ] && E_IUSE+="${E_IUSE:+ }${IUSE}"
+ [ "${REQUIRED_USE+set}" = set ] && E_REQUIRED_USE+="${E_REQUIRED_USE:+ }${REQUIRED_USE}"
+ [ "${DEPEND+set}" = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}"
+ [ "${RDEPEND+set}" = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
+ [ "${PDEPEND+set}" = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
[ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}"
[ "${B_IUSE+set}" = set ] || unset IUSE
@@ -1477,214 +346,6 @@ EXPORT_FUNCTIONS() {
eval $__export_funcs_var+=\" $*\"
}
-# this is a function for removing any directory matching a passed in pattern from
-# PATH
-remove_path_entry() {
- save_IFS
- IFS=":"
- stripped_path="${PATH}"
- while [ -n "$1" ]; do
- cur_path=""
- for p in ${stripped_path}; do
- if [ "${p/${1}}" == "${p}" ]; then
- cur_path="${cur_path}:${p}"
- fi
- done
- stripped_path="${cur_path#:*}"
- shift
- done
- restore_IFS
- PATH="${stripped_path}"
-}
-
-# @FUNCTION: _ebuild_arg_to_phase
-# @DESCRIPTION:
-# Translate a known ebuild(1) argument into the precise
-# name of it's corresponding ebuild phase.
-_ebuild_arg_to_phase() {
- [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
- local eapi=$1
- local arg=$2
- local phase_func=""
-
- case "$arg" in
- pretend)
- ! has $eapi 0 1 2 3 3_pre2 && \
- phase_func=pkg_pretend
- ;;
- setup)
- phase_func=pkg_setup
- ;;
- nofetch)
- phase_func=pkg_nofetch
- ;;
- unpack)
- phase_func=src_unpack
- ;;
- prepare)
- ! has $eapi 0 1 && \
- phase_func=src_prepare
- ;;
- configure)
- ! has $eapi 0 1 && \
- phase_func=src_configure
- ;;
- compile)
- phase_func=src_compile
- ;;
- test)
- phase_func=src_test
- ;;
- install)
- phase_func=src_install
- ;;
- preinst)
- phase_func=pkg_preinst
- ;;
- postinst)
- phase_func=pkg_postinst
- ;;
- prerm)
- phase_func=pkg_prerm
- ;;
- postrm)
- phase_func=pkg_postrm
- ;;
- esac
-
- [[ -z $phase_func ]] && return 1
- echo "$phase_func"
- return 0
-}
-
-_ebuild_phase_funcs() {
- [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
- local eapi=$1
- local phase_func=$2
- local default_phases="pkg_nofetch src_unpack src_prepare src_configure
- src_compile src_install src_test"
- local x y default_func=""
-
- for x in pkg_nofetch src_unpack src_test ; do
- declare -F $x >/dev/null || \
- eval "$x() { _eapi0_$x \"\$@\" ; }"
- done
-
- case $eapi in
-
- 0|1)
-
- if ! declare -F src_compile >/dev/null ; then
- case $eapi in
- 0)
- src_compile() { _eapi0_src_compile "$@" ; }
- ;;
- *)
- src_compile() { _eapi1_src_compile "$@" ; }
- ;;
- esac
- fi
-
- for x in $default_phases ; do
- eval "default_$x() {
- die \"default_$x() is not supported with EAPI='$eapi' during phase $phase_func\"
- }"
- done
-
- eval "default() {
- die \"default() is not supported with EAPI='$eapi' during phase $phase_func\"
- }"
-
- ;;
-
- *)
-
- declare -F src_configure >/dev/null || \
- src_configure() { _eapi2_src_configure "$@" ; }
-
- declare -F src_compile >/dev/null || \
- src_compile() { _eapi2_src_compile "$@" ; }
-
- has $eapi 2 3 3_pre2 || declare -F src_install >/dev/null || \
- src_install() { _eapi4_src_install "$@" ; }
-
- if has $phase_func $default_phases ; then
-
- _eapi2_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; }
- _eapi2_src_unpack () { _eapi0_src_unpack "$@" ; }
- _eapi2_src_prepare () { true ; }
- _eapi2_src_test () { _eapi0_src_test "$@" ; }
- _eapi2_src_install () { die "$FUNCNAME is not supported" ; }
-
- for x in $default_phases ; do
- eval "default_$x() { _eapi2_$x \"\$@\" ; }"
- done
-
- eval "default() { _eapi2_$phase_func \"\$@\" ; }"
-
- case $eapi in
- 2|3)
- ;;
- *)
- eval "default_src_install() { _eapi4_src_install \"\$@\" ; }"
- [[ $phase_func = src_install ]] && \
- eval "default() { _eapi4_$phase_func \"\$@\" ; }"
- ;;
- esac
-
- else
-
- for x in $default_phases ; do
- eval "default_$x() {
- die \"default_$x() is not supported in phase $default_func\"
- }"
- done
-
- eval "default() {
- die \"default() is not supported with EAPI='$eapi' during phase $phase_func\"
- }"
-
- fi
-
- ;;
- esac
-}
-
-# Set given variables unless these variable have been already set (e.g. during emerge
-# invocation) to values different than values set in make.conf.
-set_unless_changed() {
- if [[ $# -lt 1 ]]; then
- die "${FUNCNAME}() requires at least 1 argument: VARIABLE=VALUE"
- fi
-
- local argument value variable
- for argument in "$@"; do
- if [[ ${argument} != *=* ]]; then
- die "${FUNCNAME}(): Argument '${argument}' has incorrect syntax"
- fi
- variable="${argument%%=*}"
- value="${argument#*=}"
- if eval "[[ \${${variable}} == \$(env -u ${variable} portageq envvar ${variable}) ]]"; then
- eval "${variable}=\"\${value}\""
- fi
- done
-}
-
-# Unset given variables unless these variable have been set (e.g. during emerge
-# invocation) to values different than values set in make.conf.
-unset_unless_changed() {
- if [[ $# -lt 1 ]]; then
- die "${FUNCNAME}() requires at least 1 argument: VARIABLE"
- fi
-
- local variable
- for variable in "$@"; do
- if eval "[[ \${${variable}} == \$(env -u ${variable} portageq envvar ${variable}) ]]"; then
- unset ${variable}
- fi
- done
-}
-
PORTAGE_BASHRCS_SOURCED=0
# @FUNCTION: source_all_bashrcs
@@ -1716,222 +377,46 @@ source_all_bashrcs() {
done
fi
- # We assume if people are changing shopts in their bashrc they do so at their
- # own peril. This is the ONLY non-portage bit of code that can change shopts
- # without a QA violation.
- for x in "${PORTAGE_BASHRC}" "${PM_EBUILD_HOOK_DIR}"/${CATEGORY}/{${PN},${PN}:${SLOT},${P},${PF}}; do
- if [ -r "${x}" ]; then
- # If $- contains x, then tracing has already enabled elsewhere for some
- # reason. We preserve it's state so as not to interfere.
- if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
- source "${x}"
- else
- set -x
- source "${x}"
- set +x
- fi
+ if [ -r "${PORTAGE_BASHRC}" ] ; then
+ if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
+ source "${PORTAGE_BASHRC}"
+ else
+ set -x
+ source "${PORTAGE_BASHRC}"
+ set +x
fi
- done
-
- [ ! -z "${OCC}" ] && export CC="${OCC}"
- [ ! -z "${OCXX}" ] && export CXX="${OCXX}"
-}
-
-# Hardcoded bash lists are needed for backward compatibility with
-# <portage-2.1.4 since they assume that a newly installed version
-# of ebuild.sh will work for pkg_postinst, pkg_prerm, and pkg_postrm
-# when portage is upgrading itself.
-
-PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
- EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE
- PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI"
-
-PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE \
- EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \
- PM_EBUILD_HOOK_DIR \
- PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
- PORTAGE_BINPKG_FILE PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE \
- PORTAGE_BIN_PATH PORTAGE_BUILDDIR PORTAGE_BUNZIP2_COMMAND \
- PORTAGE_BZIP2_COMMAND PORTAGE_COLORMAP PORTAGE_CONFIGROOT \
- PORTAGE_DEBUG PORTAGE_DEPCACHEDIR PORTAGE_EBUILD_EXIT_FILE \
- PORTAGE_GID PORTAGE_GRPNAME PORTAGE_INST_GID PORTAGE_INST_UID \
- PORTAGE_IPC_DAEMON PORTAGE_IUSE PORTAGE_LOG_FILE \
- PORTAGE_MUTABLE_FILTERED_VARS PORTAGE_PYM_PATH PORTAGE_PYTHON \
- PORTAGE_READONLY_METADATA PORTAGE_READONLY_VARS \
- PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_SANDBOX_COMPAT_LEVEL \
- PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
- PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
- PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR PORTDIR_OVERLAY \
- PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR"
-
-PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR"
-
-# Variables that portage sets but doesn't mark readonly.
-# In order to prevent changed values from causing unexpected
-# interference, they are filtered out of the environment when
-# it is saved or loaded (any mutations do not persist).
-PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
-
-# @FUNCTION: filter_readonly_variables
-# @DESCRIPTION: [--filter-sandbox] [--allow-extra-vars]
-# Read an environment from stdin and echo to stdout while filtering variables
-# with names that are known to cause interference:
-#
-# * some specific variables for which bash does not allow assignment
-# * some specific variables that affect portage or sandbox behavior
-# * variable names that begin with a digit or that contain any
-# non-alphanumeric characters that are not be supported by bash
-#
-# --filter-sandbox causes all SANDBOX_* variables to be filtered, which
-# is only desired in certain cases, such as during preprocessing or when
-# saving environment.bz2 for a binary or installed package.
-#
-# --filter-features causes the special FEATURES variable to be filtered.
-# Generally, we want it to persist between phases since the user might
-# want to modify it via bashrc to enable things like splitdebug and
-# installsources for specific packages. They should be able to modify it
-# in pre_pkg_setup() and have it persist all the way through the install
-# phase. However, if FEATURES exist inside environment.bz2 then they
-# should be overridden by current settings.
-#
-# --filter-locale causes locale related variables such as LANG and LC_*
-# variables to be filtered. These variables should persist between phases,
-# in case they are modified by the ebuild. However, the current user
-# settings should be used when loading the environment from a binary or
-# installed package.
-#
-# --filter-path causes the PATH variable to be filtered. This variable
-# should persist between phases, in case it is modified by the ebuild.
-# However, old settings should be overridden when loading the
-# environment from a binary or installed package.
-#
-# ---allow-extra-vars causes some extra vars to be allowd through, such
-# as ${PORTAGE_SAVED_READONLY_VARS} and ${PORTAGE_MUTABLE_FILTERED_VARS}.
-#
-# In bash-3.2_p20+ an attempt to assign BASH_*, FUNCNAME, GROUPS or any
-# readonly variable cause the shell to exit while executing the "source"
-# builtin command. To avoid this problem, this function filters those
-# variables out and discards them. See bug #190128.
-filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
- local bash_misc_vars="BASH BASH_.* COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
- SECONDS SHELL SHLVL"
- local filtered_sandbox_vars="SANDBOX_ACTIVE SANDBOX_BASHRC
- SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
- SANDBOX_LOG SANDBOX_ON"
- local misc_garbage_vars="_portage_filter_opts"
- filtered_vars="$readonly_bash_vars $bash_misc_vars
- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
- case "${EAPI:-0}" in
- 0|1|2)
- ;;
- *)
- filtered_vars+=" ED EPREFIX EROOT"
- ;;
- esac
-
- if has --filter-sandbox $* ; then
- filtered_vars="${filtered_vars} SANDBOX_.*"
- else
- filtered_vars="${filtered_vars} ${filtered_sandbox_vars}"
- fi
- if has --filter-features $* ; then
- filtered_vars="${filtered_vars} FEATURES PORTAGE_FEATURES"
fi
- if has --filter-path $* ; then
- filtered_vars+=" PATH"
- fi
- if has --filter-locale $* ; then
- filtered_vars+=" LANG LC_ALL LC_COLLATE
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
- if ! has --allow-extra-vars $* ; then
- filtered_vars="
- ${filtered_vars}
- ${PORTAGE_SAVED_READONLY_VARS}
- ${PORTAGE_MUTABLE_FILTERED_VARS}
- "
- fi
-
- "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
-}
-# @FUNCTION: preprocess_ebuild_env
-# @DESCRIPTION:
-# Filter any readonly variables from ${T}/environment, source it, and then
-# save it via save_ebuild_env(). This process should be sufficient to prevent
-# any stale variables or functions from an arbitrary environment from
-# interfering with the current environment. This is useful when an existing
-# environment needs to be loaded from a binary or installed package.
-preprocess_ebuild_env() {
- local _portage_filter_opts="--filter-features --filter-locale --filter-path --filter-sandbox"
-
- # If environment.raw is present, this is a signal from the python side,
- # indicating that the environment may contain stale FEATURES and
- # SANDBOX_{DENY,PREDICT,READ,WRITE} variables that should be filtered out.
- # Otherwise, we don't need to filter the environment.
- [ -f "${T}/environment.raw" ] || return 0
-
- filter_readonly_variables $_portage_filter_opts < "${T}"/environment \
- >> "$T/environment.filtered" || return $?
- unset _portage_filter_opts
- mv "${T}"/environment.filtered "${T}"/environment || return $?
- rm -f "${T}/environment.success" || return $?
- # WARNING: Code inside this subshell should avoid making assumptions
- # about variables or functions after source "${T}"/environment has been
- # called. Any variables that need to be relied upon should already be
- # filtered out above.
- (
- export SANDBOX_ON=1
- source "${T}/environment" || exit $?
- # We have to temporarily disable sandbox since the
- # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded
- # may be unusable (triggering in spurious sandbox violations)
- # until we've merged them with our current values.
- export SANDBOX_ON=0
-
- # It's remotely possible that save_ebuild_env() has been overridden
- # by the above source command. To protect ourselves, we override it
- # here with our own version. ${PORTAGE_BIN_PATH} is safe to use here
- # because it's already filtered above.
- source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit $?
-
- # Rely on save_ebuild_env() to filter out any remaining variables
- # and functions that could interfere with the current environment.
- save_ebuild_env || exit $?
- >> "$T/environment.success" || exit $?
- ) > "${T}/environment.filtered"
- local retval
- if [ -e "${T}/environment.success" ] ; then
- filter_readonly_variables --filter-features < \
- "${T}/environment.filtered" > "${T}/environment"
- retval=$?
- else
- retval=1
+ if [[ $EBUILD_PHASE != depend ]] ; then
+ # The user's bashrc is the ONLY non-portage bit of code that can
+ # change shopts without a QA violation.
+ for x in "${PM_EBUILD_HOOK_DIR}"/${CATEGORY}/{${PN},${PN}:${SLOT},${P},${PF}}; do
+ if [ -r "${x}" ]; then
+ # If $- contains x, then tracing has already been enabled
+ # elsewhere for some reason. We preserve it's state so as
+ # not to interfere.
+ if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
+ source "${x}"
+ else
+ set -x
+ source "${x}"
+ set +x
+ fi
+ fi
+ done
fi
- rm -f "${T}"/environment.{filtered,raw,success}
- return ${retval}
+
+ [ ! -z "${OCC}" ] && export CC="${OCC}"
+ [ ! -z "${OCXX}" ] && export CXX="${OCXX}"
}
# === === === === === === === === === === === === === === === === === ===
# === === === === === functions end, main part begins === === === === ===
-# === === === === === functions end, main part begins === === === === ===
-# === === === === === functions end, main part begins === === === === ===
# === === === === === === === === === === === === === === === === === ===
export SANDBOX_ON="1"
export S=${WORKDIR}/${P}
-unset E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND
-
# Turn of extended glob matching so that g++ doesn't get incorrectly matched.
shopt -u extglob
@@ -1993,11 +478,12 @@ if ! has "$EBUILD_PHASE" clean cleanrm depend && \
# The environment may have been extracted from environment.bz2 or
# may have come from another version of ebuild.sh or something.
# In any case, preprocess it to prevent any potential interference.
+ # NOTE: export ${FOO}=... requires quoting, unlike normal exports
preprocess_ebuild_env || \
die "error processing environment"
# Colon separated SANDBOX_* variables need to be cumulative.
for x in SANDBOX_DENY SANDBOX_READ SANDBOX_PREDICT SANDBOX_WRITE ; do
- export PORTAGE_${x}=${!x}
+ export PORTAGE_${x}="${!x}"
done
PORTAGE_SANDBOX_ON=${SANDBOX_ON}
export SANDBOX_ON=1
@@ -2011,13 +497,13 @@ if ! has "$EBUILD_PHASE" clean cleanrm depend && \
for x in SANDBOX_DENY SANDBOX_PREDICT SANDBOX_READ SANDBOX_WRITE ; do
y="PORTAGE_${x}"
if [ -z "${!x}" ] ; then
- export ${x}=${!y}
+ export ${x}="${!y}"
elif [ -n "${!y}" ] && [ "${!y}" != "${!x}" ] ; then
# filter out dupes
- export ${x}=$(printf "${!y}:${!x}" | tr ":" "\0" | \
- sort -z -u | tr "\0" ":")
+ export ${x}="$(printf "${!y}:${!x}" | tr ":" "\0" | \
+ sort -z -u | tr "\0" ":")"
fi
- export ${x}=${!x%:}
+ export ${x}="${!x%:}"
unset PORTAGE_${x}
done
unset x y
@@ -2026,6 +512,10 @@ if ! has "$EBUILD_PHASE" clean cleanrm depend && \
[[ -n $EAPI ]] || EAPI=0
fi
+if has "${EAPI:-0}" 4-python; then
+ shopt -s globstar
+fi
+
if ! has "$EBUILD_PHASE" clean cleanrm ; then
if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \
-f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \
@@ -2044,7 +534,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
# In order to ensure correct interaction between ebuilds and
# eclasses, they need to be unset before this process of
# interaction begins.
- unset DEPEND RDEPEND PDEPEND INHERITED IUSE REQUIRED_USE \
+ unset EAPI DEPEND RDEPEND PDEPEND INHERITED IUSE REQUIRED_USE \
ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND
if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
@@ -2061,7 +551,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
rm "$PORTAGE_BUILDDIR/.ebuild_changed"
fi
- [[ -n $EAPI ]] || EAPI=0
+ [ "${EAPI+set}" = set ] || EAPI=0
if has "$EAPI" 0 1 2 3 3_pre2 ; then
export RDEPEND=${RDEPEND-${DEPEND}}
@@ -2069,11 +559,11 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
fi
# add in dependency info from eclasses
- IUSE="${IUSE} ${E_IUSE}"
- DEPEND="${DEPEND} ${E_DEPEND}"
- RDEPEND="${RDEPEND} ${E_RDEPEND}"
- PDEPEND="${PDEPEND} ${E_PDEPEND}"
- REQUIRED_USE="${REQUIRED_USE} ${E_REQUIRED_USE}"
+ IUSE+="${IUSE:+ }${E_IUSE}"
+ DEPEND+="${DEPEND:+ }${E_DEPEND}"
+ RDEPEND+="${RDEPEND:+ }${E_RDEPEND}"
+ PDEPEND+="${PDEPEND:+ }${E_PDEPEND}"
+ REQUIRED_USE+="${REQUIRED_USE:+ }${E_REQUIRED_USE}"
unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \
__INHERITED_QA_CACHE
@@ -2110,29 +600,11 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
if [[ $EBUILD_PHASE != depend ]] ; then
- case "$EAPI" in
- 0|1|2|3)
- _ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers"
- ;;
- *)
- _ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers/4:$PORTAGE_BIN_PATH/ebuild-helpers"
- ;;
- esac
-
- PATH=$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
- unset _ebuild_helpers_path
-
- # Use default ABI libdir in accordance with bug #355283.
- x=LIBDIR_${DEFAULT_ABI}
- [[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
-
if has distcc $FEATURES ; then
- PATH="/usr/$x/distcc/bin:$PATH"
[[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
fi
if has ccache $FEATURES ; then
- PATH="/usr/$x/ccache/bin:$PATH"
if [[ -n $CCACHE_DIR ]] ; then
addread "$CCACHE_DIR"
@@ -2142,8 +614,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
[[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
fi
- unset x
-
if [[ -n $QA_PREBUILT ]] ; then
# these ones support fnmatch patterns
@@ -2153,7 +623,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
# these ones support regular expressions, so translate
# fnmatch patterns to regular expressions
- for x in QA_DT_HASH QA_DT_NEEDED QA_PRESTRIPPED QA_SONAME ; do
+ for x in QA_DT_NEEDED QA_FLAGS_IGNORED QA_PRESTRIPPED QA_SONAME ; do
if [[ $(declare -p $x 2>/dev/null) = declare\ -a* ]] ; then
eval "$x=(\"\${$x[@]}\" ${QA_PREBUILT//\*/.*})"
else
@@ -2183,241 +653,60 @@ then
export DEBUGBUILD=1
fi
-#a reasonable default for $S
-[[ -z ${S} ]] && export S=${WORKDIR}/${P}
+if [[ $EBUILD_PHASE = depend ]] ; then
+ export SANDBOX_ON="0"
+ set -f
+
+ if [ -n "${dbkey}" ] ; then
+ if [ ! -d "${dbkey%/*}" ]; then
+ install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
+ fi
+ # Make it group writable. 666&~002==664
+ umask 002
+ fi
+
+ auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
+ DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
+ PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
+ UNUSED_03 UNUSED_02 UNUSED_01"
-# Note: readonly variables interfere with preprocess_ebuild_env(), so
-# declare them only after it has already run.
-if [ "${EBUILD_PHASE}" != "depend" ] ; then
+ # The extra $(echo) commands remove newlines.
+ if [ -n "${dbkey}" ] ; then
+ > "${dbkey}"
+ for f in ${auxdbkeys} ; do
+ echo $(echo ${!f}) >> "${dbkey}" || exit $?
+ done
+ else
+ for f in ${auxdbkeys} ; do
+ echo $(echo ${!f}) 1>&9 || exit $?
+ done
+ exec 9>&-
+ fi
+ set +f
+else
+ # Note: readonly variables interfere with preprocess_ebuild_env(), so
+ # declare them only after it has already run.
declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
case "$EAPI" in
0|1|2)
+ [[ " ${FEATURES} " == *" force-prefix "* ]] && \
+ declare -r ED EPREFIX EROOT
;;
*)
declare -r ED EPREFIX EROOT
;;
esac
-fi
-
-ebuild_main() {
-
- # Subshell/helper die support (must export for the die helper).
- # Since this function is typically executed in a subshell,
- # setup EBUILD_MASTER_PID to refer to the current $BASHPID,
- # which seems to give the best results when further
- # nested subshells call die.
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
-
- if [[ $EBUILD_PHASE != depend ]] ; then
- # Force configure scripts that automatically detect ccache to
- # respect FEATURES="-ccache".
- has ccache $FEATURES || export CCACHE_DISABLE=1
-
- local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
- [[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func"
- unset phase_func
- fi
-
- source_all_bashrcs
-
- case ${EBUILD_SH_ARGS} in
- nofetch)
- ebuild_phase_with_hooks pkg_nofetch
- ;;
- prerm|postrm|postinst|config|info)
- if has "$EBUILD_SH_ARGS" config info && \
- ! declare -F "pkg_$EBUILD_SH_ARGS" >/dev/null ; then
- ewarn "pkg_${EBUILD_SH_ARGS}() is not defined: '${EBUILD##*/}'"
- fi
- export SANDBOX_ON="0"
- if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
- ebuild_phase_with_hooks pkg_${EBUILD_SH_ARGS}
- else
- set -x
- ebuild_phase_with_hooks pkg_${EBUILD_SH_ARGS}
- set +x
- fi
- if [[ $EBUILD_PHASE == postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]]; then
- # Update environment.bz2 in case installation phases
- # need to pass some variables to uninstallation phases.
- save_ebuild_env --exclude-init-phases | \
- filter_readonly_variables --filter-path \
- --filter-sandbox --allow-extra-vars \
- | ${PORTAGE_BZIP2_COMMAND} -c -f9 > "$PORTAGE_UPDATE_ENV"
- assert "save_ebuild_env failed"
- fi
- ;;
- unpack|prepare|configure|compile|test|clean|install)
- if [[ ${SANDBOX_DISABLED:-0} = 0 ]] ; then
- export SANDBOX_ON="1"
- else
- export SANDBOX_ON="0"
- fi
-
- case "$EBUILD_SH_ARGS" in
- configure|compile)
-
- local x
- for x in ASFLAGS CCACHE_DIR CCACHE_SIZE \
- CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do
- [[ ${!x+set} = set ]] && export $x
- done
- unset x
-
- has distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \
- [[ ${SANDBOX_WRITE/$DISTCC_DIR} = $SANDBOX_WRITE ]] && \
- addwrite "$DISTCC_DIR"
-
- x=LIBDIR_$ABI
- [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \
- export PKG_CONFIG_PATH=/usr/${!x}/pkgconfig
-
- if has noauto $FEATURES && \
- [[ ! -f $PORTAGE_BUILDDIR/.unpacked ]] ; then
- echo
- echo "!!! We apparently haven't unpacked..." \
- "This is probably not what you"
- echo "!!! want to be doing... You are using" \
- "FEATURES=noauto so I'll assume"
- echo "!!! that you know what you are doing..." \
- "You have 5 seconds to abort..."
- echo
-
- local x
- for x in 1 2 3 4 5 6 7 8; do
- LC_ALL=C sleep 0.25
- done
-
- sleep 3
- fi
-
- cd "$PORTAGE_BUILDDIR"
- if [ ! -d build-info ] ; then
- mkdir build-info
- cp "$EBUILD" "build-info/$PF.ebuild"
- fi
-
- #our custom version of libtool uses $S and $D to fix
- #invalid paths in .la files
- export S D
-
- ;;
- esac
- if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
- dyn_${EBUILD_SH_ARGS}
- else
- set -x
- dyn_${EBUILD_SH_ARGS}
- set +x
- fi
- export SANDBOX_ON="0"
- ;;
- help|pretend|setup|preinst)
- #pkg_setup needs to be out of the sandbox for tmp file creation;
- #for example, awking and piping a file in /tmp requires a temp file to be created
- #in /etc. If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
- export SANDBOX_ON="0"
- if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
- dyn_${EBUILD_SH_ARGS}
- else
- set -x
- dyn_${EBUILD_SH_ARGS}
- set +x
- fi
- ;;
- depend)
- export SANDBOX_ON="0"
- set -f
-
- if [ -n "${dbkey}" ] ; then
- if [ ! -d "${dbkey%/*}" ]; then
- install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
- fi
- # Make it group writable. 666&~002==664
- umask 002
- fi
-
- auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
- DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
- PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
- UNUSED_03 UNUSED_02 UNUSED_01"
-
- #the extra $(echo) commands remove newlines
- [ -n "${EAPI}" ] || EAPI=0
-
- if [ -n "${dbkey}" ] ; then
- > "${dbkey}"
- for f in ${auxdbkeys} ; do
- echo $(echo ${!f}) >> "${dbkey}" || exit $?
- done
- else
- for f in ${auxdbkeys} ; do
- echo $(echo ${!f}) 1>&9 || exit $?
- done
+ if [[ -n $EBUILD_SH_ARGS ]] ; then
+ (
+ # Don't allow subprocesses to inherit the pipe which
+ # emerge uses to monitor ebuild.sh.
exec 9>&-
- fi
- set +f
- ;;
- _internal_test)
- ;;
- *)
- export SANDBOX_ON="1"
- echo "Unrecognized EBUILD_SH_ARGS: '${EBUILD_SH_ARGS}'"
- echo
- dyn_help
- exit 1
- ;;
- esac
-}
-
-if [[ -s $SANDBOX_LOG ]] ; then
- # We use SANDBOX_LOG to check for sandbox violations,
- # so we ensure that there can't be a stale log to
- # interfere with our logic.
- x=
- if [[ -n SANDBOX_ON ]] ; then
- x=$SANDBOX_ON
- export SANDBOX_ON=0
+ ebuild_main ${EBUILD_SH_ARGS}
+ exit 0
+ )
+ exit $?
fi
-
- rm -f "$SANDBOX_LOG" || \
- die "failed to remove stale sandbox log: '$SANDBOX_LOG'"
-
- if [[ -n $x ]] ; then
- export SANDBOX_ON=$x
- fi
- unset x
-fi
-
-if [[ $EBUILD_PHASE = depend ]] ; then
- ebuild_main
-elif [[ -n $EBUILD_SH_ARGS ]] ; then
- (
- # Don't allow subprocesses to inherit the pipe which
- # emerge uses to monitor ebuild.sh.
- exec 9>&-
-
- ebuild_main
-
- # Save the env only for relevant phases.
- if ! has "$EBUILD_SH_ARGS" clean help info nofetch ; then
- umask 002
- save_ebuild_env | filter_readonly_variables \
- --filter-features > "$T/environment"
- assert "save_ebuild_env failed"
- chown portage:portage "$T/environment" &>/dev/null
- chmod g+w "$T/environment" &>/dev/null
- fi
- [[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE"
- if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
- [[ ! -s $SANDBOX_LOG ]]
- "$PORTAGE_BIN_PATH"/ebuild-ipc exit $?
- fi
- exit 0
- )
- exit $?
fi
# Do not exit when ebuild.sh is sourced by other scripts.
diff --git a/portage_with_autodep/bin/egencache b/portage_with_autodep/bin/egencache
index 1b4265d..2f53b40 100755
--- a/portage_with_autodep/bin/egencache
+++ b/portage_with_autodep/bin/egencache
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright 2009-2011 Gentoo Foundation
+# Copyright 2009-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
@@ -42,7 +42,7 @@ from portage.manifest import guessManifestFileType
from portage.util import cmp_sort_key, writemsg_level
from portage import cpv_getkey
from portage.dep import Atom, isjustname
-from portage.versions import pkgcmp, pkgsplit, vercmp
+from portage.versions import pkgsplit, vercmp
try:
from xml.etree import ElementTree
@@ -87,6 +87,9 @@ def parse_args(args):
common.add_option("--portdir",
help="override the portage tree location",
dest="portdir")
+ common.add_option("--portdir-overlay",
+ help="override the PORTDIR_OVERLAY variable (requires that --repo is also specified)",
+ dest="portdir_overlay")
common.add_option("--tolerant",
action="store_true",
help="exit successfully if only minor errors occurred")
@@ -160,9 +163,17 @@ def parse_args(args):
parser.error("Not a directory: --config-root='%s'" % \
(options.config_root,))
- if options.cache_dir is not None and not os.path.isdir(options.cache_dir):
- parser.error("Not a directory: --cache-dir='%s'" % \
- (options.cache_dir,))
+ if options.cache_dir is not None:
+ if not os.path.isdir(options.cache_dir):
+ parser.error("Not a directory: --cache-dir='%s'" % \
+ (options.cache_dir,))
+ if not os.access(options.cache_dir, os.W_OK):
+ parser.error("Write access denied: --cache-dir='%s'" % \
+ (options.cache_dir,))
+
+ if options.portdir_overlay is not None and \
+ options.repo is None:
+ parser.error("--portdir-overlay option requires --repo option")
for atom in args:
try:
@@ -188,7 +199,12 @@ def parse_args(args):
class GenCache(object):
def __init__(self, portdb, cp_iter=None, max_jobs=None, max_load=None,
rsync=False):
+ # The caller must set portdb.porttrees in order to constrain
+ # findname, cp_list, and cpv_list to the desired tree.
+ tree = portdb.porttrees[0]
self._portdb = portdb
+ self._eclass_db = portdb.repositories.get_repo_for_location(tree).eclass_db
+ self._auxdbkeys = portdb._known_keys
# We can globally cleanse stale cache only if we
# iterate over every single cp.
self._global_cleanse = cp_iter is None
@@ -203,27 +219,67 @@ class GenCache(object):
consumer=self._metadata_callback,
max_jobs=max_jobs, max_load=max_load)
self.returncode = os.EX_OK
- metadbmodule = portdb.settings.load_best_module("portdbapi.metadbmodule")
- self._trg_cache = metadbmodule(portdb.porttrees[0],
- "metadata/cache", portage.auxdbkeys[:])
+ conf = portdb.repositories.get_repo_for_location(tree)
+ self._trg_caches = tuple(conf.iter_pregenerated_caches(
+ self._auxdbkeys, force=True, readonly=False))
+ if not self._trg_caches:
+ raise Exception("cache formats '%s' aren't supported" %
+ (" ".join(conf.cache_formats),))
+
if rsync:
- self._trg_cache.raise_stat_collision = True
- try:
- self._trg_cache.ec = \
- portdb._repo_info[portdb.porttrees[0]].eclass_db
- except AttributeError:
- pass
+ for trg_cache in self._trg_caches:
+ if hasattr(trg_cache, 'raise_stat_collision'):
+ trg_cache.raise_stat_collision = True
+ # Make _metadata_callback write this cache first, in case
+ # it raises a StatCollision and triggers mtime
+ # modification.
+ self._trg_caches = tuple([trg_cache] +
+ [x for x in self._trg_caches if x is not trg_cache])
+
self._existing_nodes = set()
- def _metadata_callback(self, cpv, ebuild_path, repo_path, metadata):
+ def _metadata_callback(self, cpv, repo_path, metadata,
+ ebuild_hash, eapi_supported):
self._existing_nodes.add(cpv)
self._cp_missing.discard(cpv_getkey(cpv))
- if metadata is not None:
+
+ # Since we're supposed to be able to efficiently obtain the
+ # EAPI from _parse_eapi_ebuild_head, we don't write cache
+ # entries for unsupported EAPIs.
+ if metadata is not None and eapi_supported:
if metadata.get('EAPI') == '0':
del metadata['EAPI']
+ for trg_cache in self._trg_caches:
+ self._write_cache(trg_cache,
+ cpv, repo_path, metadata, ebuild_hash)
+
+ def _write_cache(self, trg_cache, cpv, repo_path, metadata, ebuild_hash):
+
+ if not hasattr(trg_cache, 'raise_stat_collision'):
+ # This cache does not avoid redundant writes automatically,
+ # so check for an identical existing entry before writing.
+ # This prevents unnecessary disk writes and can also prevent
+ # unnecessary rsync transfers.
+ try:
+ dest = trg_cache[cpv]
+ except (KeyError, CacheError):
+ pass
+ else:
+ if trg_cache.validate_entry(dest,
+ ebuild_hash, self._eclass_db):
+ identical = True
+ for k in self._auxdbkeys:
+ if dest.get(k, '') != metadata.get(k, ''):
+ identical = False
+ break
+ if identical:
+ return
+
try:
+ chf = trg_cache.validation_chf
+ metadata['_%s_' % chf] = getattr(ebuild_hash, chf)
try:
- self._trg_cache[cpv] = metadata
+ trg_cache[cpv] = metadata
except StatCollision as sc:
# If the content of a cache entry changes and neither the
# file mtime nor size changes, it will prevent rsync from
@@ -231,24 +287,30 @@ class GenCache(object):
# exception from _setitem() if they detect this type of stat
# collision. These exceptions are handled by bumping the
# mtime on the ebuild (and the corresponding cache entry).
- # See bug #139134.
+ # See bug #139134. It is convenient to include checks for
+ # redundant writes along with the internal StatCollision
+ # detection code, so for caches with the
+ # raise_stat_collision attribute, we do not need to
+ # explicitly check for redundant writes like we do for the
+ # other cache types above.
max_mtime = sc.mtime
- for ec, (loc, ec_mtime) in metadata['_eclasses_'].items():
- if max_mtime < ec_mtime:
- max_mtime = ec_mtime
+ for ec, ec_hash in metadata['_eclasses_'].items():
+ if max_mtime < ec_hash.mtime:
+ max_mtime = ec_hash.mtime
if max_mtime == sc.mtime:
max_mtime += 1
max_mtime = long(max_mtime)
try:
- os.utime(ebuild_path, (max_mtime, max_mtime))
+ os.utime(ebuild_hash.location, (max_mtime, max_mtime))
except OSError as e:
self.returncode |= 1
writemsg_level(
"%s writing target: %s\n" % (cpv, e),
level=logging.ERROR, noiselevel=-1)
else:
+ ebuild_hash.mtime = max_mtime
metadata['_mtime_'] = max_mtime
- self._trg_cache[cpv] = metadata
+ trg_cache[cpv] = metadata
self._portdb.auxdb[repo_path][cpv] = metadata
except CacheError as ce:
@@ -287,9 +349,12 @@ class GenCache(object):
sys.exit(received_signal[0])
self.returncode |= self._regen.returncode
- cp_missing = self._cp_missing
- trg_cache = self._trg_cache
+ for trg_cache in self._trg_caches:
+ self._cleanse_cache(trg_cache)
+
+ def _cleanse_cache(self, trg_cache):
+ cp_missing = self._cp_missing
dead_nodes = set()
if self._global_cleanse:
try:
@@ -443,12 +508,12 @@ class GenUseLocalDesc(object):
errors='backslashreplace')
output.write(_unicode_decode('\n'))
else:
- output.write(_unicode_decode('''
-# This file is deprecated as per GLEP 56 in favor of metadata.xml. Please add
-# your descriptions to your package's metadata.xml ONLY.
-# * generated automatically using egencache *
+ output.write(textwrap.dedent(_unicode_decode('''\
+ # This file is deprecated as per GLEP 56 in favor of metadata.xml. Please add
+ # your descriptions to your package's metadata.xml ONLY.
+ # * generated automatically using egencache *
-'''.lstrip()))
+ ''')))
# The cmp function no longer exists in python3, so we'll
# implement our own here under a slightly different name
@@ -465,10 +530,20 @@ class GenUseLocalDesc(object):
return 1
return (a > b) - (a < b)
+ class _MetadataTreeBuilder(ElementTree.TreeBuilder):
+ """
+ Implements doctype() as required to avoid deprecation warnings
+ since Python >=2.7
+ """
+ def doctype(self, name, pubid, system):
+ pass
+
for cp in self._portdb.cp_all():
metadata_path = os.path.join(repo_path, cp, 'metadata.xml')
try:
- metadata = ElementTree.parse(metadata_path)
+ metadata = ElementTree.parse(metadata_path,
+ parser=ElementTree.XMLParser(
+ target=_MetadataTreeBuilder()))
except IOError:
pass
except (ExpatError, EnvironmentError) as e:
@@ -495,7 +570,7 @@ class GenUseLocalDesc(object):
return cmp_func(atomb.operator, atoma.operator)
# Version matching
elif atoma.cpv != atomb.cpv:
- return pkgcmp(pkgsplit(atoma.cpv), pkgsplit(atomb.cpv))
+ return vercmp(atoma.version, atomb.version)
# Versions match, let's fallback to operator matching
else:
return cmp_func(ops.get(atoma.operator, -1),
@@ -620,12 +695,12 @@ class GenChangeLogs(object):
self.returncode |= 2
return
- output.write(_unicode_decode('''
-# ChangeLog for %s
-# Copyright 1999-%s Gentoo Foundation; Distributed under the GPL v2
-# $Header: $
+ output.write(textwrap.dedent(_unicode_decode('''\
+ # ChangeLog for %s
+ # Copyright 1999-%s Gentoo Foundation; Distributed under the GPL v2
+ # $Header: $
-''' % (cp, time.strftime('%Y'))).lstrip())
+ ''' % (cp, time.strftime('%Y')))))
# now grab all the commits
commits = self.grab(['git', 'rev-list', 'HEAD', '--', '.']).split()
@@ -755,8 +830,6 @@ def egencache_main(args):
parser, options, atoms = parse_args(args)
config_root = options.config_root
- if config_root is None:
- config_root = '/'
# The calling environment is ignored, so the program is
# completely controlled by commandline arguments.
@@ -764,6 +837,8 @@ def egencache_main(args):
if options.repo is None:
env['PORTDIR_OVERLAY'] = ''
+ elif options.portdir_overlay:
+ env['PORTDIR_OVERLAY'] = options.portdir_overlay
if options.cache_dir is not None:
env['PORTAGE_DEPCACHEDIR'] = options.cache_dir
@@ -772,7 +847,7 @@ def egencache_main(args):
env['PORTDIR'] = options.portdir
settings = portage.config(config_root=config_root,
- target_root='/', local_config=False, env=env)
+ local_config=False, env=env)
default_opts = None
if not options.ignore_default_opts:
@@ -781,14 +856,11 @@ def egencache_main(args):
if default_opts:
parser, options, args = parse_args(default_opts + args)
- if options.config_root is not None:
- config_root = options.config_root
-
if options.cache_dir is not None:
env['PORTAGE_DEPCACHEDIR'] = options.cache_dir
settings = portage.config(config_root=config_root,
- target_root='/', local_config=False, env=env)
+ local_config=False, env=env)
if not options.update and not options.update_use_local_desc \
and not options.update_changelogs:
@@ -796,14 +868,27 @@ def egencache_main(args):
return 1
if options.update and 'metadata-transfer' not in settings.features:
- writemsg_level("ecachegen: warning: " + \
- "automatically enabling FEATURES=metadata-transfer\n",
- level=logging.WARNING, noiselevel=-1)
settings.features.add('metadata-transfer')
settings.lock()
portdb = portage.portdbapi(mysettings=settings)
+
+ if options.update:
+ if options.cache_dir is not None:
+ # already validated earlier
+ pass
+ else:
+ # We check write access after the portdbapi constructor
+ # has had an opportunity to create it. This ensures that
+ # we don't use the cache in the "volatile" mode which is
+ # undesirable for egencache.
+ if not os.access(settings["PORTAGE_DEPCACHEDIR"], os.W_OK):
+ writemsg_level("ecachegen: error: " + \
+ "write access denied: %s\n" % (settings["PORTAGE_DEPCACHEDIR"],),
+ level=logging.ERROR, noiselevel=-1)
+ return 1
+
if options.repo is not None:
repo_path = portdb.getRepositoryPath(options.repo)
if repo_path is None:
@@ -813,6 +898,8 @@ def egencache_main(args):
# Limit ebuilds to the specified repo.
portdb.porttrees = [repo_path]
+ else:
+ portdb.porttrees = [portdb.porttree_root]
ret = [os.EX_OK]
diff --git a/portage_with_autodep/bin/emaint b/portage_with_autodep/bin/emaint
index fdd01ed..1bee0fe 100755
--- a/portage_with_autodep/bin/emaint
+++ b/portage_with_autodep/bin/emaint
@@ -40,15 +40,15 @@ class WorldHandler(object):
self.okay = []
from portage._sets import load_default_config
setconfig = load_default_config(portage.settings,
- portage.db[portage.settings["ROOT"]])
+ portage.db[portage.settings['EROOT']])
self._sets = setconfig.getSets()
def _check_world(self, onProgress):
categories = set(portage.settings.categories)
- myroot = portage.settings["ROOT"]
- self.world_file = os.path.join(portage.settings["EROOT"], portage.const.WORLD_FILE)
+ eroot = portage.settings['EROOT']
+ self.world_file = os.path.join(eroot, portage.const.WORLD_FILE)
self.found = os.access(self.world_file, os.R_OK)
- vardb = portage.db[myroot]["vartree"].dbapi
+ vardb = portage.db[eroot]["vartree"].dbapi
from portage._sets import SETPREFIX
sets = self._sets
@@ -120,8 +120,8 @@ class BinhostHandler(object):
name = staticmethod(name)
def __init__(self):
- myroot = portage.settings["ROOT"]
- self._bintree = portage.db[myroot]["bintree"]
+ eroot = portage.settings['EROOT']
+ self._bintree = portage.db[eroot]["bintree"]
self._bintree.populate()
self._pkgindex_file = self._bintree._pkgindex_file
self._pkgindex = self._bintree._load_pkgindex()
@@ -403,8 +403,8 @@ class MoveInstalled(MoveHandler):
return "moveinst"
name = staticmethod(name)
def __init__(self):
- myroot = portage.settings["ROOT"]
- MoveHandler.__init__(self, portage.db[myroot]["vartree"], portage.db[myroot]["porttree"])
+ eroot = portage.settings['EROOT']
+ MoveHandler.__init__(self, portage.db[eroot]["vartree"], portage.db[eroot]["porttree"])
class MoveBinary(MoveHandler):
@@ -414,8 +414,8 @@ class MoveBinary(MoveHandler):
return "movebin"
name = staticmethod(name)
def __init__(self):
- myroot = portage.settings["ROOT"]
- MoveHandler.__init__(self, portage.db[myroot]["bintree"], portage.db[myroot]["porttree"])
+ eroot = portage.settings['EROOT']
+ MoveHandler.__init__(self, portage.db[eroot]["bintree"], portage.db[eroot]['porttree'])
class VdbKeyHandler(object):
def name():
@@ -423,7 +423,7 @@ class VdbKeyHandler(object):
name = staticmethod(name)
def __init__(self):
- self.list = portage.db["/"]["vartree"].dbapi.cpv_all()
+ self.list = portage.db[portage.settings["EROOT"]]["vartree"].dbapi.cpv_all()
self.missing = []
self.keys = ["HOMEPAGE", "SRC_URI", "KEYWORDS", "DESCRIPTION"]
diff --git a/portage_with_autodep/bin/emerge-webrsync b/portage_with_autodep/bin/emerge-webrsync
index d933871..bfd9aa2 100755
--- a/portage_with_autodep/bin/emerge-webrsync
+++ b/portage_with_autodep/bin/emerge-webrsync
@@ -12,7 +12,7 @@
#
# gpg key import
-# KEY_ID=0x239C75C4
+# KEY_ID=0x96D8BF6D
# gpg --homedir /etc/portage/gnupg --keyserver subkeys.pgp.net --recv-keys $KEY_ID
# gpg --homedir /etc/portage/gnupg --edit-key $KEY_ID trust
#
@@ -27,11 +27,19 @@ wecho() { echo "${argv0}: warning: $*" 1>&2 ; }
eecho() { echo "${argv0}: error: $*" 1>&2 ; }
argv0=$0
-if ! type -P portageq > /dev/null ; then
+
+# Use portageq from the same directory/prefix as the current script, so
+# that we don't have to rely on PATH including the current EPREFIX.
+scriptpath=${BASH_SOURCE[0]}
+if [ -x "${scriptpath%/*}/portageq" ]; then
+ portageq=${scriptpath%/*}/portageq
+elif type -P portageq > /dev/null ; then
+ portageq=portageq
+else
eecho "could not find 'portageq'; aborting"
exit 1
fi
-eval $(portageq envvar -v FEATURES FETCHCOMMAND GENTOO_MIRRORS \
+eval $("${portageq}" envvar -v FEATURES FETCHCOMMAND GENTOO_MIRRORS \
PORTAGE_BIN_PATH PORTAGE_GPG_DIR \
PORTAGE_NICENESS PORTAGE_RSYNC_EXTRA_OPTS PORTAGE_TMPDIR PORTDIR \
SYNC http_proxy ftp_proxy)
@@ -157,6 +165,7 @@ check_file_signature() {
gpg --homedir "${PORTAGE_GPG_DIR}" --verify "$signature" "$file" && r=0
else
eecho "cannot check signature: gpg binary not found"
+ exit 1
fi
else
r=0
@@ -211,6 +220,8 @@ sync_local() {
emerge --metadata
fi
[ -x /etc/portage/bin/post_sync ] && /etc/portage/bin/post_sync
+ # --quiet suppresses output if there are no relevant news items
+ has news ${FEATURES} && emerge --check-news --quiet
return 0
}
diff --git a/portage_with_autodep/bin/emirrordist b/portage_with_autodep/bin/emirrordist
new file mode 100755
index 0000000..8d93de9
--- /dev/null
+++ b/portage_with_autodep/bin/emirrordist
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+# Copyright 2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import sys
+
+import portage
+portage._internal_caller = True
+portage._disable_legacy_globals()
+from portage._emirrordist.main import emirrordist_main
+
+if __name__ == "__main__":
+ sys.exit(emirrordist_main(sys.argv[1:]))
diff --git a/portage_with_autodep/bin/etc-update b/portage_with_autodep/bin/etc-update
index 42518ad..1edc91f 100755
--- a/portage_with_autodep/bin/etc-update
+++ b/portage_with_autodep/bin/etc-update
@@ -1,8 +1,9 @@
#!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Author Brandon Low <lostlogic@gentoo.org>
+# Mike Frysinger <vapier@gentoo.org>
#
# Previous version (from which I've borrowed a few bits) by:
# Jochem Kossen <j.kossen@home.nl>
@@ -11,9 +12,7 @@
cd /
-if type -P gsed >/dev/null ; then
- sed() { gsed "$@"; }
-fi
+type -P gsed >/dev/null && sed() { gsed "$@"; }
get_config() {
# the sed here does:
@@ -25,54 +24,92 @@ get_config() {
# If there's more than one of the same configuration item, then
# the store to the hold space clobbers previous value so the last
# setting takes precedence.
- local item=$1
- eval echo $(sed -n \
+ local match=$1
+ eval $(sed -n -r \
-e 's:[[:space:]]*#.*$::' \
- -e "/^[[:space:]]*$item[[:space:]]*=/{s:[^=]*=[[:space:]]*\([\"']\{0,1\}\)\(.*\)\1:\2:;h}" \
+ -e "/^[[:space:]]*${match}[[:space:]]*=/{s:^([^=]*)=[[:space:]]*([\"']{0,1})(.*)\2:\1=\2\3\2:;H}" \
-e '${g;p}' \
"${PORTAGE_CONFIGROOT}"etc/etc-update.conf)
}
+cmd_var_is_valid() {
+ # return true if the first whitespace-separated token contained
+ # in "${1}" is an executable file, false otherwise
+ [[ -x $(type -P ${1%%[[:space:]]*}) ]]
+}
+
diff_command() {
local cmd=${diff_command//%file1/$1}
${cmd//%file2/$2}
}
+# Usage: do_mv_ln [options] <src> <dst>
+# Files have to be the last two args, and has to be
+# files so we can handle symlinked target sanely.
+do_mv_ln() {
+ local opts=( ${@:1:$(( $# - 2 ))} )
+ local src=${@:$(( $# - 1 )):1}
+ local dst=${@:$(( $# - 0 )):1}
+
+ if [[ -L ${dst} ]] ; then #330221
+ local lfile=$(readlink "${dst}")
+ [[ ${lfile} == /* ]] || lfile="${dst%/*}/${lfile}"
+ echo " Target is a symlink; replacing ${lfile}"
+ dst=${lfile}
+ fi
+
+ mv "${opts[@]}" "${src}" "${dst}"
+}
+
scan() {
echo "Scanning Configuration files..."
- rm -rf ${TMP}/files > /dev/null 2>&1
- mkdir ${TMP}/files || die "Failed mkdir command!" 1
+ rm -rf "${TMP}"/files > /dev/null 2>&1
+ mkdir "${TMP}"/files || die "Failed mkdir command!"
count=0
input=0
local find_opts
- local my_basename
-
- for path in ${CONFIG_PROTECT} ; do
- path="${ROOT}${path}"
- # Do not traverse hidden directories such as .svn or .git.
- find_opts="-name .* -type d -prune -o -name ._cfg????_*"
- if [ ! -d "${path}" ]; then
- [ ! -f "${path}" ] && continue
- my_basename="${path##*/}"
+ local path
+
+ for path in ${SCAN_PATHS} ; do
+ path="${EROOT%/}${path}"
+
+ if [[ ! -d ${path} ]] ; then
+ [[ ! -f ${path} ]] && continue
+ local my_basename="${path##*/}"
path="${path%/*}"
- find_opts="-maxdepth 1 -name ._cfg????_${my_basename}"
+ find_opts=( -maxdepth 1 -name "._cfg????_${my_basename}" )
+ else
+ # Do not traverse hidden directories such as .svn or .git.
+ find_opts=( -name '.*' -type d -prune -o -name '._cfg????_*' )
fi
+ find_opts+=( ! -name '.*~' ! -iname '.*.bak' -print )
- ofile=""
- # The below set -f turns off file name globbing in the ${find_opts} expansion.
- for file in $(set -f ; find ${path}/ ${find_opts} \
- ! -name '.*~' ! -iname '.*.bak' -print |
- sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\1%\2\%\3:" |
- sort -t'%' -k2,2 -k4,4 -k3,3 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'); do
+ if [ ! -w "${path}" ] ; then
+ [ -e "${path}" ] || continue
+ die "Need write access to ${path}"
+ fi
- rpath=$(echo "${file/\/\///}" | sed -e "s:/[^/]*$::")
- rfile=$(echo "${file/\/\///}" | sed -e "s:^.*/::")
+ local file ofile b=$'\001'
+ for file in $(find "${path}"/ "${find_opts[@]}" |
+ sed \
+ -e 's://*:/:g' \
+ -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3$b\1$b\2$b\3:" |
+ sort -t"$b" -k2,2 -k4,4 -k3,3 |
+ LC_ALL=C cut -f1 -d"$b")
+ do
+ local rpath rfile cfg_file live_file
+ rpath=${file%/*}
+ rfile=${file##*/}
+ cfg_file="${rpath}/${rfile}"
+ live_file="${rpath}/${rfile:10}"
+
+ local mpath
for mpath in ${CONFIG_PROTECT_MASK}; do
- mpath="${ROOT}${mpath}"
- mpath=$(echo "${mpath/\/\///}")
- if [[ "${rpath}" == "${mpath}"* ]]; then
- mv ${rpath}/${rfile} ${rpath}/${rfile:10}
- break
+ mpath="${EROOT%/}${mpath}"
+ if [[ "${rpath}" == "${mpath}"* ]] ; then
+ echo "Updating masked file: ${live_file}"
+ mv "${cfg_file}" "${live_file}"
+ continue 2
fi
done
if [[ ! -f ${file} ]] ; then
@@ -81,45 +118,88 @@ scan() {
fi
if [[ "${ofile:10}" != "${rfile:10}" ]] ||
- [[ ${opath} != ${rpath} ]]; then
+ [[ ${opath} != ${rpath} ]]
+ then
MATCHES=0
- if [[ "${EU_AUTOMERGE}" == "yes" ]]; then
- if [ ! -e "${rpath}/${rfile}" ] || [ ! -e "${rpath}/${rfile:10}" ]; then
+ if [[ ${eu_automerge} == "yes" ]] ; then
+ if [[ ! -e ${cfg_file} || ! -e ${live_file} ]] ; then
MATCHES=0
else
- diff -Bbua ${rpath}/${rfile} ${rpath}/${rfile:10} | egrep '^[+-]' | egrep -v '^[+-][\t ]*#|^--- |^\+\+\+ ' | egrep -qv '^[-+][\t ]*$'
- MATCHES=$?
+ diff -Bbua "${cfg_file}" "${live_file}" | \
+ sed -n -r \
+ -e '/^[+-]/{/^([+-][\t ]*(#|$)|-{3} |\+{3} )/d;q1}'
+ : $(( MATCHES = ($? == 0) ))
fi
- elif [[ -z $(diff -Nua ${rpath}/${rfile} ${rpath}/${rfile:10}|
- grep "^[+-][^+-]"|grep -v '# .Header:.*') ]]; then
- MATCHES=1
+
+ else
+ diff -Nbua "${cfg_file}" "${live_file}" |
+ sed -n \
+ -e '/# .Header:/d' \
+ -e '/^[+-][^+-]/q1'
+ : $(( MATCHES = ($? == 0) ))
fi
- if [[ "${MATCHES}" == "1" ]]; then
- echo "Automerging trivial changes in: ${rpath}/${rfile:10}"
- mv ${rpath}/${rfile} ${rpath}/${rfile:10}
+
+ if [[ ${MATCHES} == 1 ]] ; then
+ echo "Automerging trivial changes in: ${live_file}"
+ do_mv_ln "${cfg_file}" "${live_file}"
continue
else
- count=${count}+1
- echo "${rpath}/${rfile:10}" > ${TMP}/files/${count}
- echo "${rpath}/${rfile}" >> ${TMP}/files/${count}
+ : $(( ++count ))
+ echo "${live_file}" > "${TMP}"/files/${count}
+ echo "${cfg_file}" >> "${TMP}"/files/${count}
ofile="${rfile}"
opath="${rpath}"
continue
fi
fi
- if [[ -z $(diff -Nua ${rpath}/${rfile} ${rpath}/${ofile}|
- grep "^[+-][^+-]"|grep -v '# .Header:.*') ]]; then
- mv ${rpath}/${rfile} ${rpath}/${ofile}
- continue
- else
- echo "${rpath}/${rfile}" >> ${TMP}/files/${count}
+ if ! diff -Nbua "${cfg_file}" "${rpath}/${ofile}" |
+ sed -n \
+ -e '/# .Header:/d' \
+ -e '/^[+-][^+-]/q1'
+ then
+ echo "${cfg_file}" >> "${TMP}"/files/${count}
ofile="${rfile}"
opath="${rpath}"
+ else
+ mv "${cfg_file}" "${rpath}/${ofile}"
+ continue
fi
done
done
+}
+parse_automode_flag() {
+ case $1 in
+ -9)
+ local reply
+ read -p "Are you sure that you want to delete all updates (type YES): " reply
+ if [[ ${reply} != "YES" ]] ; then
+ echo "Did not get a 'YES', so ignoring request"
+ return 1
+ else
+ parse_automode_flag -7
+ export rm_opts=""
+ fi
+ ;;
+ -7)
+ input=0
+ export DELETE_ALL="yes"
+ ;;
+ -5)
+ parse_automode_flag -3
+ export mv_opts=" ${mv_opts} "
+ mv_opts="${mv_opts// -i / }"
+ ;;
+ -3)
+ input=0
+ export OVERWRITE_ALL="yes"
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+ return 0
}
sel_file() {
@@ -128,88 +208,77 @@ sel_file() {
[[ ${input} == -1 ]] || \
[[ ${input} == -3 ]]
do
- local numfiles=$(ls ${TMP}/files|wc -l)
- local numwidth=${#numfiles}
- for file in $(ls ${TMP}/files|sort -n); do
- if [[ ${isfirst} == 0 ]] ; then
- isfirst=${file}
- fi
- numshow=$(printf "%${numwidth}i${PAR} " ${file})
- numupdates=$(( $(wc -l <${TMP}/files/${file}) - 1 ))
- echo -n "${numshow}"
- if [[ ${mode} == 0 ]] ; then
- echo "$(head -n1 ${TMP}/files/${file}) (${numupdates})"
- else
- head -n1 ${TMP}/files/${file}
- fi
- done > ${TMP}/menuitems
+ local allfiles=( $(cd "${TMP}"/files/ && printf '%s\n' * | sort -n) )
+ local isfirst=${allfiles[0]}
- if [ "${OVERWRITE_ALL}" == "yes" ]; then
- input=0
- elif [ "${DELETE_ALL}" == "yes" ]; then
+ # Optimize: no point in building the whole file list if
+ # we're not actually going to talk to the user.
+ if [[ ${OVERWRITE_ALL} == "yes" || ${DELETE_ALL} == "yes" ]] ; then
input=0
else
- [[ $CLEAR_TERM == yes ]] && clear
- if [[ ${mode} == 0 ]] ; then
- echo "The following is the list of files which need updating, each
-configuration file is followed by a list of possible replacement files."
- else
- local my_title="Please select a file to update"
- fi
+ local numfiles=${#allfiles[@]}
+ local numwidth=${#numfiles}
+ local file fullfile line
+ for file in "${allfiles[@]}" ; do
+ fullfile="${TMP}/files/${file}"
+ line=$(head -n1 "${fullfile}")
+ printf '%*i%s %s' ${numwidth} ${file} "${PAR}" "${line}"
+ if [[ ${mode} == 0 ]] ; then
+ local numupdates=$(( $(wc -l <"${fullfile}") - 1 ))
+ echo " (${numupdates})"
+ else
+ echo
+ fi
+ done > "${TMP}"/menuitems
+
+ clear
if [[ ${mode} == 0 ]] ; then
- cat ${TMP}/menuitems
- echo "Please select a file to edit by entering the corresponding number."
- echo " (don't use -3, -5, -7 or -9 if you're unsure what to do)"
- echo " (-1 to exit) (-3 to auto merge all remaining files)"
- echo " (-5 to auto-merge AND not use 'mv -i')"
- echo " (-7 to discard all updates)"
- echo -n " (-9 to discard all updates AND not use 'rm -i'): "
+ cat <<-EOF
+ The following is the list of files which need updating, each
+ configuration file is followed by a list of possible replacement files.
+ $(<"${TMP}"/menuitems)
+ Please select a file to edit by entering the corresponding number.
+ (don't use -3, -5, -7 or -9 if you're unsure what to do)
+ (-1 to exit) (${_3_HELP_TEXT})
+ (${_5_HELP_TEXT})
+ (${_7_HELP_TEXT})
+ EOF
+ printf " (${_9_HELP_TEXT}): "
input=$(read_int)
else
- dialog --title "${title}" --menu "${my_title}" \
- 0 0 0 $(echo -e "-1 Exit\n$(<${TMP}/menuitems)") \
- 2> ${TMP}/input || die "User termination!" 0
- input=$(<${TMP}/input)
+ dialog \
+ --title "${title}" \
+ --menu "Please select a file to update" \
+ 0 0 0 $(<"${TMP}"/menuitems) \
+ 2> "${TMP}"/input \
+ || die "$(<"${TMP}"/input)\n\nUser termination!" 0
+ input=$(<"${TMP}"/input)
fi
- if [[ ${input} == -9 ]]; then
- read -p "Are you sure that you want to delete all updates (type YES):" reply
- if [[ ${reply} != "YES" ]]; then
- continue
- else
- input=-7
- export rm_opts=""
- fi
- fi
- if [[ ${input} == -7 ]]; then
- input=0
- export DELETE_ALL="yes"
- fi
- if [[ ${input} == -5 ]] ; then
- input=-3
- export mv_opts=" ${mv_opts} "
- mv_opts="${mv_opts// -i / }"
- fi
- if [[ ${input} == -3 ]] ; then
- input=0
- export OVERWRITE_ALL="yes"
+ : ${input:=0}
+
+ if [[ ${input} != 0 ]] ; then
+ parse_automode_flag ${input} || continue
fi
fi # -3 automerge
- if [[ -z ${input} ]] || [[ ${input} == 0 ]] ; then
+ if [[ ${input} == 0 ]] ; then
input=${isfirst}
fi
done
}
user_special() {
- if [ -r ${PORTAGE_CONFIGROOT}etc/etc-update.special ]; then
- if [ -z "$1" ]; then
- echo "ERROR: user_special() called without arguments"
+ local special="${PORTAGE_CONFIGROOT}etc/etc-update.special"
+
+ if [[ -r ${special} ]] ; then
+ if [[ -z $1 ]] ; then
+ error "user_special() called without arguments"
return 1
fi
- while read -r pat; do
- echo ${1} | grep "${pat}" > /dev/null && return 0
- done < ${PORTAGE_CONFIGROOT}etc/etc-update.special
+ local pat
+ while read -r pat ; do
+ echo "$1" | grep -q "${pat}" && return 0
+ done < "${special}"
fi
return 1
}
@@ -219,12 +288,12 @@ read_int() {
# read. This is a workaround for odd behavior of bash when an attempt is
# made to store a value such as "1y" into an integer-only variable.
local my_input
- while true; do
+ while : ; do
read my_input
# failed integer conversions will break a loop unless they're enclosed
# in a subshell.
- echo "${my_input}" | ( declare -i x; read x) 2>/dev/null && break
- echo -n "Value '$my_input' is not valid. Please enter an integer value:" >&2
+ echo "${my_input}" | (declare -i x; read x) 2>/dev/null && break
+ printf 'Value "%s" is not valid. Please enter an integer value: ' "${my_input}" >&2
done
echo ${my_input}
}
@@ -233,141 +302,147 @@ do_file() {
interactive_echo() { [ "${OVERWRITE_ALL}" != "yes" ] && [ "${DELETE_ALL}" != "yes" ] && echo; }
interactive_echo
local -i my_input
- local -i fcount=0
- until (( $(wc -l < ${TMP}/files/${input}) < 2 )); do
- my_input=0
- if (( $(wc -l < ${TMP}/files/${input}) == 2 )); then
+ local -i linecnt
+ local fullfile="${TMP}/files/${input}"
+ local ofile=$(head -n1 "${fullfile}")
+
+ # Walk through all the pending updates for this one file.
+ linecnt=$(wc -l <"${fullfile}")
+ while (( linecnt > 1 )) ; do
+ if (( linecnt == 2 )) ; then
+ # Only one update ... keeps things simple.
my_input=1
+ else
+ my_input=0
fi
- until (( ${my_input} > 0 )) && (( ${my_input} < $(wc -l < ${TMP}/files/${input}) )); do
- fcount=0
- if [ "${OVERWRITE_ALL}" == "yes" ]; then
- my_input=0
- elif [ "${DELETE_ALL}" == "yes" ]; then
- my_input=0
- else
- for line in $(<${TMP}/files/${input}); do
- if (( ${fcount} > 0 )); then
- echo -n "${fcount}${PAR} "
- echo "${line}"
- else
- if [[ ${mode} == 0 ]] ; then
- echo "Below are the new config files for ${line}:"
- else
- local my_title="Please select a file to process for ${line}"
- fi
- fi
- fcount=${fcount}+1
- done > ${TMP}/menuitems
+ # Optimize: no point in scanning the file list when we know
+ # we're just going to consume all the ones available.
+ if [[ ${OVERWRITE_ALL} == "yes" || ${DELETE_ALL} == "yes" ]] ; then
+ my_input=1
+ fi
- if [[ ${mode} == 0 ]] ; then
- cat ${TMP}/menuitems
- echo -n "Please select a file to process (-1 to exit this file): "
- my_input=$(read_int)
- else
- dialog --title "${title}" --menu "${my_title}" \
- 0 0 0 $(echo -e "$(<${TMP}/menuitems)\n${fcount} Exit") \
- 2> ${TMP}/input || die "User termination!" 0
- my_input=$(<${TMP}/input)
+ # Figure out which file they wish to operate on.
+ while (( my_input <= 0 || my_input >= linecnt )) ; do
+ local fcount=0
+ for line in $(<"${fullfile}"); do
+ if (( fcount > 0 )); then
+ printf '%i%s %s\n' ${fcount} "${PAR}" "${line}"
fi
- fi # OVERWRITE_ALL
+ : $(( ++fcount ))
+ done > "${TMP}"/menuitems
+
+ if [[ ${mode} == 0 ]] ; then
+ echo "Below are the new config files for ${ofile}:"
+ cat "${TMP}"/menuitems
+ echo -n "Please select a file to process (-1 to exit this file): "
+ my_input=$(read_int)
+ else
+ dialog \
+ --title "${title}" \
+ --menu "Please select a file to process for ${ofile}" \
+ 0 0 0 $(<"${TMP}"/menuitems) \
+ 2> "${TMP}"/input \
+ || die "$(<"${TMP}"/input)\n\nUser termination!" 0
+ my_input=$(<"${TMP}"/input)
+ fi
if [[ ${my_input} == 0 ]] ; then
+ # Auto select the first file.
my_input=1
elif [[ ${my_input} == -1 ]] ; then
input=0
return
- elif [[ ${my_input} == ${fcount} ]] ; then
- break
fi
done
- if [[ ${my_input} == ${fcount} ]] ; then
- break
- fi
-
- fcount=${my_input}+1
-
- file=$(sed -e "${fcount}p;d" ${TMP}/files/${input})
- ofile=$(head -n1 ${TMP}/files/${input})
+ # First line is the old file while the rest are the config files.
+ : $(( ++my_input ))
+ local file=$(sed -n -e "${my_input}p" "${fullfile}")
do_cfg "${file}" "${ofile}"
- sed -e "${fcount}!p;d" ${TMP}/files/${input} > ${TMP}/files/sed
- mv ${TMP}/files/sed ${TMP}/files/${input}
+ sed -i -e "${my_input}d" "${fullfile}"
- if [[ ${my_input} == -1 ]] ; then
- break
- fi
+ : $(( --linecnt ))
done
+
interactive_echo
- rm ${TMP}/files/${input}
- count=${count}-1
+ rm "${fullfile}"
+ : $(( --count ))
}
-do_cfg() {
+show_diff() {
+ clear
+ local file1=$1 file2=$2
+ if [[ ${using_editor} == 0 ]] ; then
+ (
+ echo "Showing differences between ${file1} and ${file2}"
+ diff_command "${file1}" "${file2}"
+ ) | ${pager}
+ else
+ echo "Beginning of differences between ${file1} and ${file2}"
+ diff_command "${file1}" "${file2}"
+ echo "End of differences between ${file1} and ${file2}"
+ fi
+}
- local file="${1}"
- local ofile="${2}"
+do_cfg() {
+ local file=$1
+ local ofile=$2
local -i my_input=0
- until (( ${my_input} == -1 )) || [ ! -f ${file} ]; do
+ until (( my_input == -1 )) || [ ! -f "${file}" ] ; do
if [[ "${OVERWRITE_ALL}" == "yes" ]] && ! user_special "${ofile}"; then
my_input=1
elif [[ "${DELETE_ALL}" == "yes" ]] && ! user_special "${ofile}"; then
my_input=2
else
- [[ $CLEAR_TERM == yes ]] && clear
- if [ "${using_editor}" == 0 ]; then
- (
- echo "Showing differences between ${ofile} and ${file}"
- diff_command "${ofile}" "${file}"
- ) | ${pager}
- else
- echo "Beginning of differences between ${ofile} and ${file}"
- diff_command "${ofile}" "${file}"
- echo "End of differences between ${ofile} and ${file}"
- fi
- if [ -L "${file}" ]; then
- echo
- echo "-------------------------------------------------------------"
- echo "NOTE: File is a symlink to another file. REPLACE recommended."
- echo " The original file may simply have moved. Please review."
- echo "-------------------------------------------------------------"
- echo
+ show_diff "${ofile}" "${file}"
+ if [[ -L ${file} ]] ; then
+ cat <<-EOF
+
+ -------------------------------------------------------------
+ NOTE: File is a symlink to another file. REPLACE recommended.
+ The original file may simply have moved. Please review.
+ -------------------------------------------------------------
+
+ EOF
fi
- echo -n "File: ${file}
-1) Replace original with update
-2) Delete update, keeping original as is
-3) Interactively merge original with update
-4) Show differences again
-5) Save update as example config
-Please select from the menu above (-1 to ignore this update): "
+ cat <<-EOF
+
+ File: ${file}
+ 1) Replace original with update
+ 2) Delete update, keeping original as is
+ 3) Interactively merge original with update
+ 4) Show differences again
+ 5) Save update as example config
+ EOF
+ printf 'Please select from the menu above (-1 to ignore this update): '
my_input=$(read_int)
fi
case ${my_input} in
- 1) echo "Replacing ${ofile} with ${file}"
- mv ${mv_opts} ${file} ${ofile}
- [ -n "${OVERWRITE_ALL}" ] && my_input=-1
- continue
- ;;
- 2) echo "Deleting ${file}"
- rm ${rm_opts} ${file}
- [ -n "${DELETE_ALL}" ] && my_input=-1
- continue
- ;;
- 3) do_merge "${file}" "${ofile}"
- my_input=${?}
-# [ ${my_input} == 255 ] && my_input=-1
- continue
- ;;
- 4) continue
- ;;
- 5) do_distconf "${file}" "${ofile}"
- ;;
- *) continue
- ;;
+ 1) echo "Replacing ${ofile} with ${file}"
+ do_mv_ln ${mv_opts} "${file}" "${ofile}"
+ [ -n "${OVERWRITE_ALL}" ] && my_input=-1
+ continue
+ ;;
+ 2) echo "Deleting ${file}"
+ rm ${rm_opts} "${file}"
+ [ -n "${DELETE_ALL}" ] && my_input=-1
+ continue
+ ;;
+ 3) do_merge "${file}" "${ofile}"
+ my_input=${?}
+# [ ${my_input} == 255 ] && my_input=-1
+ continue
+ ;;
+ 4) continue
+ ;;
+ 5) do_distconf "${file}" "${ofile}"
+ ;;
+ *) continue
+ ;;
esac
done
}
@@ -393,57 +468,48 @@ do_merge() {
# need to make sure the full /path/to/ exists ahead of time
mkdir -p "${mfile%/*}"
- until (( ${my_input} == -1 )); do
+ until (( my_input == -1 )); do
echo "Merging ${file} and ${ofile}"
$(echo "${merge_command}" |
sed -e "s:%merged:${mfile}:g" \
-e "s:%orig:${ofile}:g" \
-e "s:%new:${file}:g")
- until (( ${my_input} == -1 )); do
- echo -n "1) Replace ${ofile} with merged file
-2) Show differences between merged file and original
-3) Remerge original with update
-4) Edit merged file
-5) Return to the previous menu
-Please select from the menu above (-1 to exit, losing this merge): "
+ until (( my_input == -1 )); do
+ cat <<-EOF
+ 1) Replace ${ofile} with merged file
+ 2) Show differences between merged file and original
+ 3) Remerge original with update
+ 4) Edit merged file
+ 5) Return to the previous menu
+ EOF
+ printf 'Please select from the menu above (-1 to exit, losing this merge): '
my_input=$(read_int)
case ${my_input} in
- 1) echo "Replacing ${ofile} with ${mfile}"
- if [[ ${USERLAND} == BSD ]] ; then
- chown "$(stat -f %Su:%Sg "${ofile}")" "${mfile}"
- chmod $(stat -f %Mp%Lp "${ofile}") "${mfile}"
- else
- chown --reference="${ofile}" "${mfile}"
- chmod --reference="${ofile}" "${mfile}"
- fi
- mv ${mv_opts} "${mfile}" "${ofile}"
- rm ${rm_opts} "${file}"
- return 255
- ;;
- 2)
- [[ $CLEAR_TERM == yes ]] && clear
- if [ "${using_editor}" == 0 ]; then
- (
- echo "Showing differences between ${ofile} and ${mfile}"
- diff_command "${ofile}" "${mfile}"
- ) | ${pager}
+ 1) echo "Replacing ${ofile} with ${mfile}"
+ if [[ ${USERLAND} == BSD ]] ; then
+ chown "$(stat -f %Su:%Sg "${ofile}")" "${mfile}"
+ chmod $(stat -f %Mp%Lp "${ofile}") "${mfile}"
else
- echo "Beginning of differences between ${ofile} and ${mfile}"
- diff_command "${ofile}" "${mfile}"
- echo "End of differences between ${ofile} and ${mfile}"
+ chown --reference="${ofile}" "${mfile}"
+ chmod --reference="${ofile}" "${mfile}"
fi
- continue
- ;;
- 3) break
- ;;
- 4) ${EDITOR:-nano -w} "${mfile}"
- continue
- ;;
- 5) rm ${rm_opts} "${mfile}"
- return 0
- ;;
- *) continue
- ;;
+ do_mv_ln ${mv_opts} "${mfile}" "${ofile}"
+ rm ${rm_opts} "${file}"
+ return 255
+ ;;
+ 2) show_diff "${ofile}" "${mfile}"
+ continue
+ ;;
+ 3) break
+ ;;
+ 4) ${EDITOR:-nano -w} "${mfile}"
+ continue
+ ;;
+ 5) rm ${rm_opts} "${mfile}"
+ return 0
+ ;;
+ *) continue
+ ;;
esac
done
done
@@ -455,21 +521,15 @@ do_distconf() {
# search for any previously saved distribution config
# files and number the current one accordingly
- local file="${1}"
- local ofile="${2}"
+ local file=$1 ofile=$2
local -i count
- local -i fill
local suffix
local efile
- for ((count = 0; count <= 9999; count++)); do
- suffix=".dist_"
- for ((fill = 4 - ${#count}; fill > 0; fill--)); do
- suffix+="0"
- done
- suffix+="${count}"
+ for (( count = 0; count <= 9999; ++count )) ; do
+ suffix=$(printf ".dist_%04i" ${count})
efile="${ofile}${suffix}"
- if [[ ! -f ${efile} ]]; then
+ if [[ ! -f ${efile} ]] ; then
mv ${mv_opts} "${file}" "${efile}"
break
elif diff_command "${file}" "${efile}" &> /dev/null; then
@@ -480,35 +540,51 @@ do_distconf() {
done
}
+error() { echo "etc-update: ERROR: $*" 1>&2 ; return 1 ; }
die() {
trap SIGTERM
trap SIGINT
+ local msg=$1 exitcode=${2:-1}
- if [ "$2" -eq 0 ]; then
- echo "Exiting: ${1}"
+ if [ ${exitcode} -eq 0 ] ; then
+ printf 'Exiting: %b\n' "${msg}"
scan > /dev/null
[ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining"
else
- echo "ERROR: ${1}"
+ error "${msg}"
fi
rm -rf "${TMP}"
- exit ${2}
+ exit ${exitcode}
}
+_3_HELP_TEXT="-3 to auto merge all files"
+_5_HELP_TEXT="-5 to auto-merge AND not use 'mv -i'"
+_7_HELP_TEXT="-7 to discard all updates"
+_9_HELP_TEXT="-9 to discard all updates AND not use 'rm -i'"
usage() {
cat <<-EOF
etc-update: Handle configuration file updates
- Usage: etc-update [options]
+ Usage: etc-update [options] [paths to scan]
+
+ If no paths are specified, then \${CONFIG_PROTECT} will be used.
Options:
-d, --debug Enable shell debugging
-h, --help Show help and run away
+ -p, --preen Automerge trivial changes only and quit
+ -v, --verbose Show settings and such along the way
-V, --version Show version and trundle away
+
+ --automode <mode>
+ ${_3_HELP_TEXT}
+ ${_5_HELP_TEXT}
+ ${_7_HELP_TEXT}
+ ${_9_HELP_TEXT}
EOF
- [[ -n ${*:2} ]] && printf "\nError: %s\n" "${*:2}" 1>&2
+ [[ $# -gt 1 ]] && printf "\nError: %s\n" "${*:2}" 1>&2
exit ${1:-0}
}
@@ -517,98 +593,121 @@ usage() {
# Run the script
#
+declare -i count=0
+declare input=0
+declare title="Gentoo's etc-update tool!"
+
+PREEN=false
SET_X=false
+VERBOSE=false
while [[ -n $1 ]] ; do
case $1 in
-d|--debug) SET_X=true;;
-h|--help) usage;;
- -V|--version) emerge --version ; exit 0;;
- *) usage 1 "Invalid option '$1'";;
+ -p|--preen) PREEN=true;;
+ -v|--verbose) VERBOSE=true;;
+ -V|--version) emerge --version; exit 0;;
+ --automode) parse_automode_flag $2 && shift || usage 1 "Invalid mode '$2'";;
+ -*) usage 1 "Invalid option '$1'";;
+ *) break;;
esac
shift
done
${SET_X} && set -x
-type portageq > /dev/null || exit $?
-eval $(portageq envvar -v CONFIG_PROTECT \
- CONFIG_PROTECT_MASK PORTAGE_CONFIGROOT PORTAGE_TMPDIR ROOT USERLAND)
+type portageq >/dev/null || die "missing portageq"
+portage_vars=(
+ CONFIG_PROTECT{,_MASK}
+ PORTAGE_CONFIGROOT
+ PORTAGE_INST_{G,U}ID
+ PORTAGE_TMPDIR
+ EROOT
+ USERLAND
+ NOCOLOR
+)
+eval $(portageq envvar -v ${portage_vars[@]})
export PORTAGE_TMPDIR
+SCAN_PATHS=${*:-${CONFIG_PROTECT}}
TMP="${PORTAGE_TMPDIR}/etc-update-$$"
-trap "die terminated 1" SIGTERM
-trap "die interrupted 1" SIGINT
+trap "die terminated" SIGTERM
+trap "die interrupted" SIGINT
-[ -w ${PORTAGE_CONFIGROOT}etc ] || die "Need write access to ${PORTAGE_CONFIGROOT}etc" 1
-#echo $PORTAGE_TMPDIR
-#echo $CONFIG_PROTECT
-#echo $CONFIG_PROTECT_MASK
-#export PORTAGE_TMPDIR=$(/usr/lib/portage/bin/portageq envvar PORTAGE_TMPDIR)
-
-rm -rf "${TMP}" 2> /dev/null
-mkdir "${TMP}" || die "failed to create temp dir" 1
+rm -rf "${TMP}" 2>/dev/null
+mkdir "${TMP}" || die "failed to create temp dir"
# make sure we have a secure directory to work in
-chmod 0700 "${TMP}" || die "failed to set perms on temp dir" 1
-chown ${UID:-0}:${GID:-0} "${TMP}" || die "failed to set ownership on temp dir" 1
-
-# I need the CONFIG_PROTECT value
-#CONFIG_PROTECT=$(/usr/lib/portage/bin/portageq envvar CONFIG_PROTECT)
-#CONFIG_PROTECT_MASK=$(/usr/lib/portage/bin/portageq envvar CONFIG_PROTECT_MASK)
-
-# load etc-config's configuration
-CLEAR_TERM=$(get_config clear_term)
-EU_AUTOMERGE=$(get_config eu_automerge)
-rm_opts=$(get_config rm_opts)
-mv_opts=$(get_config mv_opts)
-cp_opts=$(get_config cp_opts)
-pager=$(get_config pager)
-diff_command=$(get_config diff_command)
-using_editor=$(get_config using_editor)
-merge_command=$(get_config merge_command)
-declare -i mode=$(get_config mode)
-[[ -z ${mode} ]] && mode=0
-[[ -z ${pager} ]] && pager="cat"
-
-if [ "${using_editor}" == 0 ]; then
+chmod 0700 "${TMP}" || die "failed to set perms on temp dir"
+chown ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${TMP}" || \
+ die "failed to set ownership on temp dir"
+
+# Get all the user settings from etc-update.conf
+cfg_vars=(
+ clear_term
+ eu_automerge
+ rm_opts
+ mv_opts
+ pager
+ diff_command
+ using_editor
+ merge_command
+ mode
+)
+# default them all to ""
+eval ${cfg_vars[@]/%/=}
+# then extract them all from the conf in one shot
+# (ugly var at end is due to printf appending a '|' to last item)
+get_config "($(printf '%s|' "${cfg_vars[@]}")NOVARFOROLDMEN)"
+
+# finally setup any specific defaults
+: ${mode:="0"}
+if ! cmd_var_is_valid "${pager}" ; then
+ pager=${PAGER}
+ cmd_var_is_valid "${pager}" || pager=cat
+fi
+
+[[ ${clear_term} == "yes" ]] || clear() { :; }
+
+if [[ ${using_editor} == "0" ]] ; then
# Sanity check to make sure diff exists and works
echo > "${TMP}"/.diff-test-1
echo > "${TMP}"/.diff-test-2
-
+
if ! diff_command "${TMP}"/.diff-test-1 "${TMP}"/.diff-test-2 ; then
- die "'${diff_command}' does not seem to work, aborting" 1
+ die "'${diff_command}' does not seem to work, aborting"
fi
else
- if ! type ${diff_command%% *} >/dev/null; then
- die "'${diff_command}' does not seem to work, aborting" 1
+ # NOTE: cmd_var_is_valid doesn't work with diff_command="eval emacs..."
+ # because it uses type -P.
+ if ! type ${diff_command%%[[:space:]]*} >/dev/null; then
+ die "'${diff_command}' does not seem to work, aborting"
fi
fi
-if [[ ${mode} == "1" ]] ; then
- if ! type dialog >/dev/null || ! dialog --help >/dev/null ; then
- die "mode=1 and 'dialog' not found or not executable, aborting" 1
- fi
-fi
-
-#echo "rm_opts: $rm_opts, mv_opts: $mv_opts, cp_opts: $cp_opts"
-#echo "pager: $pager, diff_command: $diff_command, merge_command: $merge_command"
-
-if (( ${mode} == 0 )); then
+if [[ ${mode} == "0" ]] ; then
PAR=")"
else
PAR=""
+ if ! type dialog >/dev/null || ! dialog --help >/dev/null ; then
+ die "mode=1 and 'dialog' not found or not executable, aborting"
+ fi
fi
-declare -i count=0
-declare input=0
-declare title="Gentoo's etc-update tool!"
+if ${VERBOSE} ; then
+ for v in ${portage_vars[@]} ${cfg_vars[@]} TMP SCAN_PATHS ; do
+ echo "${v}=${!v}"
+ done
+fi
scan
-until (( ${input} == -1 )); do
- if (( ${count} == 0 )); then
+${PREEN} && exit 0
+
+until (( input == -1 )); do
+ if (( count == 0 )); then
die "Nothing left to do; exiting. :)" 0
fi
sel_file
- if (( ${input} != -1 )); then
+ if (( input != -1 )); then
do_file
fi
done
diff --git a/portage_with_autodep/bin/fixpackages b/portage_with_autodep/bin/fixpackages
index 5e1df70..dc43ed2 100755
--- a/portage_with_autodep/bin/fixpackages
+++ b/portage_with_autodep/bin/fixpackages
@@ -1,11 +1,12 @@
#!/usr/bin/python
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
-import os,sys
-os.environ["PORTAGE_CALLER"]="fixpackages"
+import os
+import sys
+
try:
import portage
except ImportError:
@@ -38,7 +39,7 @@ except (OSError, ValueError) as e:
portage.writemsg("!!! %s\n" % str(e))
del e
-_global_updates(mytrees, mtimedb["updates"])
+_global_updates(mytrees, mtimedb["updates"], if_mtime_changed=False)
print()
print("Done.")
diff --git a/portage_with_autodep/bin/glsa-check b/portage_with_autodep/bin/glsa-check
index 2f2d555..a840c32 100755
--- a/portage_with_autodep/bin/glsa-check
+++ b/portage_with_autodep/bin/glsa-check
@@ -103,8 +103,9 @@ elif mode == "list" and not params:
# delay this for speed increase
from portage.glsa import *
-vardb = portage.db[portage.settings["ROOT"]]["vartree"].dbapi
-portdb = portage.db["/"]["porttree"].dbapi
+eroot = portage.settings['EROOT']
+vardb = portage.db[eroot]["vartree"].dbapi
+portdb = portage.db[eroot]["porttree"].dbapi
# build glsa lists
completelist = get_glsa_list(portage.settings)
diff --git a/portage_with_autodep/bin/helper-functions.sh b/portage_with_autodep/bin/helper-functions.sh
new file mode 100755
index 0000000..afe14af
--- /dev/null
+++ b/portage_with_autodep/bin/helper-functions.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# For routines we want to use in ebuild-helpers/ but don't want to
+# expose to the general ebuild environment.
+
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+#
+# API functions for doing parallel processing
+#
+numjobs() {
+ # Copied from eutils.eclass:makeopts_jobs()
+ local jobs=$(echo " ${MAKEOPTS} " | \
+ sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p')
+ echo ${jobs:-1}
+}
+
+multijob_init() {
+ # Setup a pipe for children to write their pids to when they finish.
+ mj_control_pipe=$(mktemp -t multijob.XXXXXX)
+ rm "${mj_control_pipe}"
+ mkfifo "${mj_control_pipe}"
+ exec {mj_control_fd}<>${mj_control_pipe}
+ rm -f "${mj_control_pipe}"
+
+ # See how many children we can fork based on the user's settings.
+ mj_max_jobs=$(numjobs)
+ mj_num_jobs=0
+}
+
+multijob_child_init() {
+ trap 'echo ${BASHPID} $? >&'${mj_control_fd} EXIT
+ trap 'exit 1' INT TERM
+}
+
+multijob_finish_one() {
+ local pid ret
+ read -r -u ${mj_control_fd} pid ret
+ : $(( --mj_num_jobs ))
+ return ${ret}
+}
+
+multijob_finish() {
+ local ret=0
+ while [[ ${mj_num_jobs} -gt 0 ]] ; do
+ multijob_finish_one
+ : $(( ret |= $? ))
+ done
+ # Let bash clean up its internal child tracking state.
+ wait
+ return ${ret}
+}
+
+multijob_post_fork() {
+ : $(( ++mj_num_jobs ))
+ if [[ ${mj_num_jobs} -ge ${mj_max_jobs} ]] ; then
+ multijob_finish_one
+ fi
+ return $?
+}
diff --git a/portage_with_autodep/bin/install.py b/portage_with_autodep/bin/install.py
new file mode 100755
index 0000000..2c6dfbe
--- /dev/null
+++ b/portage_with_autodep/bin/install.py
@@ -0,0 +1,253 @@
+#!/usr/bin/python
+# Copyright 2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import os
+import stat
+import sys
+import subprocess
+import traceback
+
+import portage
+from portage.util._argparse import ArgumentParser
+from portage.util.movefile import _copyxattr
+from portage.exception import OperationNotSupported
+
+# Change back to original cwd _after_ all imports (bug #469338).
+os.chdir(os.environ["__PORTAGE_HELPER_CWD"])
+
+def parse_args(args):
+ """
+ Parse the command line arguments using optparse for python 2.6 compatibility
+ Args:
+ args: a list of the white space delimited command line
+ Returns:
+ tuple of the Namespace of parsed options, and a list of order parameters
+ """
+ parser = ArgumentParser(add_help=False)
+
+ parser.add_argument(
+ "-b",
+ action="store_true",
+ dest="shortopt_b"
+ )
+ parser.add_argument(
+ "--backup",
+ action="store",
+ dest="backup"
+ )
+ parser.add_argument(
+ "-c",
+ action="store_true",
+ dest="shortopt_c"
+ )
+ parser.add_argument(
+ "--compare",
+ "-C",
+ action="store_true",
+ dest="compare"
+ )
+ parser.add_argument(
+ "--directory",
+ "-d",
+ action="store_true",
+ dest="directory"
+ )
+ parser.add_argument(
+ "-D",
+ action="store_true",
+ dest="shortopt_D"
+ )
+ parser.add_argument(
+ "--owner",
+ "-o",
+ action="store",
+ dest="owner"
+ )
+ parser.add_argument(
+ "--group",
+ "-g",
+ action="store",
+ dest="group"
+ )
+ parser.add_argument(
+ "--mode",
+ "-m",
+ action="store",
+ dest="mode"
+ )
+ parser.add_argument(
+ "--preserve-timestamps",
+ "-p",
+ action="store_true",
+ dest="preserve_timestamps"
+ )
+ parser.add_argument(
+ "--strip",
+ "-s",
+ action="store_true",
+ dest="strip"
+ )
+ parser.add_argument(
+ "--strip-program",
+ action="store",
+ dest="strip_program"
+ )
+ parser.add_argument(
+ "--suffix",
+ "-S",
+ action="store",
+ dest="suffix"
+ )
+ parser.add_argument(
+ "--target-directory",
+ "-t",
+ action="store",
+ dest="target_directory"
+ )
+ parser.add_argument(
+ "--no-target-directory",
+ "-T",
+ action="store_true",
+ dest="no_target_directory"
+ )
+ parser.add_argument(
+ "--context",
+ "-Z",
+ action="store",
+ dest="context"
+ )
+ parser.add_argument(
+ "--verbose",
+ "-v",
+ action="store_true",
+ dest="verbose"
+ )
+ parser.add_argument(
+ "--help",
+ action="store_true",
+ dest="help"
+ )
+ parser.add_argument(
+ "--version",
+ action="store_true",
+ dest="version"
+ )
+
+ # Use parse_known_args for maximum compatibility with
+ # getopt handling of non-option file arguments. Note
+ # that parser.add_argument("files", nargs='+') would
+ # be subtly incompatible because it requires that all
+ # of the file arguments be grouped sequentially. Also
+ # note that we have to explicitly call add_argument
+ # for known options in order for argparse to correctly
+ # separate option arguments from file arguments in all
+ # cases (it also allows for optparse compatibility).
+ parsed_args = parser.parse_known_args()
+
+ opts = parsed_args[0]
+ files = parsed_args[1]
+ files = [f for f in files if f != "--"] # filter out "--"
+
+ return (opts, files)
+
+
+def copy_xattrs(opts, files):
+ """
+ Copy the extended attributes using portage.util.movefile._copyxattr
+ Args:
+ opts: Namespace of the parsed command line otions
+ files: list of ordered command line parameters which should be files/directories
+ Returns:
+ system exit code
+ """
+ if opts.directory or not files:
+ return os.EX_OK
+
+ if opts.target_directory is None:
+ source, target = files[:-1], files[-1]
+ target_is_directory = os.path.isdir(target)
+ else:
+ source, target = files, opts.target_directory
+ target_is_directory = True
+
+ exclude = os.environ.get("PORTAGE_XATTR_EXCLUDE", "security.* system.nfs4_acl")
+
+ try:
+ if target_is_directory:
+ for s in source:
+ abs_path = os.path.join(target, os.path.basename(s))
+ _copyxattr(s, abs_path, exclude=exclude)
+ else:
+ _copyxattr(source[0], target, exclude=exclude)
+ return os.EX_OK
+
+ except OperationNotSupported:
+ traceback.print_exc()
+ return os.EX_OSERR
+
+
+def Which(filename, path=None, exclude=None):
+ """
+ Find the absolute path of 'filename' in a given search 'path'
+ Args:
+ filename: basename of the file
+ path: colon delimited search path
+ exclude: path of file to exclude
+ """
+ if path is None:
+ path = os.environ.get('PATH', '')
+
+ if exclude is not None:
+ st = os.stat(exclude)
+ exclude = (st.st_ino, st.st_dev)
+
+ for p in path.split(':'):
+ p = os.path.join(p, filename)
+ if os.access(p, os.X_OK):
+ try:
+ st = os.stat(p)
+ except OSError:
+ # file disappeared?
+ pass
+ else:
+ if stat.S_ISREG(st.st_mode) and \
+ (exclude is None or exclude != (st.st_ino, st.st_dev)):
+ return p
+
+ return None
+
+
+def main(args):
+ opts, files = parse_args(args)
+ install_binary = Which('install', exclude=os.environ["__PORTAGE_HELPER_PATH"])
+ if install_binary is None:
+ sys.stderr.write("install: command not found\n")
+ return 127
+
+ cmdline = [install_binary]
+ cmdline += args
+
+ if sys.hexversion >= 0x3000000:
+ # We can't trust that the filesystem encoding (locale dependent)
+ # correctly matches the arguments, so use surrogateescape to
+ # pass through the original argv bytes for Python 3.
+ fs_encoding = sys.getfilesystemencoding()
+ cmdline = [x.encode(fs_encoding, 'surrogateescape') for x in cmdline]
+ files = [x.encode(fs_encoding, 'surrogateescape') for x in files]
+ if opts.target_directory is not None:
+ opts.target_directory = \
+ opts.target_directory.encode(fs_encoding, 'surrogateescape')
+
+ returncode = subprocess.call(cmdline)
+ if returncode == os.EX_OK:
+ returncode = copy_xattrs(opts, files)
+ if returncode != os.EX_OK:
+ portage.util.writemsg("!!! install: copy_xattrs failed with the "
+ "following arguments: %s\n" %
+ " ".join(portage._shell_quote(x) for x in args), noiselevel=-1)
+ return returncode
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/portage_with_autodep/bin/isolated-functions.sh b/portage_with_autodep/bin/isolated-functions.sh
index 65bb1d5..dbf988b 100644..100755
--- a/portage_with_autodep/bin/isolated-functions.sh
+++ b/portage_with_autodep/bin/isolated-functions.sh
@@ -173,8 +173,8 @@ die() {
| while read -r n ; do eerror " ${n#RETAIN-LEADING-SPACE}" ; done
eerror
fi
- eerror "If you need support, post the output of 'emerge --info =$CATEGORY/$PF',"
- eerror "the complete build log and the output of 'emerge -pqv =$CATEGORY/$PF'."
+ eerror "If you need support, post the output of \`emerge --info '=$CATEGORY/$PF'\`,"
+ eerror "the complete build log and the output of \`emerge -pqv '=$CATEGORY/$PF'\`."
if [[ -n ${EBUILD_OVERLAY_ECLASSES} ]] ; then
eerror "This ebuild used the following eclasses from overlays:"
local x
@@ -203,7 +203,12 @@ die() {
fi
fi
- if [[ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]] ; then
+ # Only call die hooks here if we are executed via ebuild.sh or
+ # misc-functions.sh, since those are the only cases where the environment
+ # contains the hook functions. When necessary (like for helpers_die), die
+ # hooks are automatically called later by a misc-functions.sh invocation.
+ if has ${BASH_SOURCE[$main_index]##*/} ebuild.sh misc-functions.sh && \
+ [[ ${EBUILD_PHASE} != depend ]] ; then
local x
for x in $EBUILD_DEATH_HOOKS; do
${x} "$@" >&2 1>&2
@@ -211,8 +216,15 @@ die() {
> "$PORTAGE_BUILDDIR/.die_hooks"
fi
- [[ -n ${PORTAGE_LOG_FILE} ]] \
- && eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+ if [[ -n ${PORTAGE_LOG_FILE} ]] ; then
+ eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+ if [[ ${PORTAGE_LOG_FILE} != ${T}/* ]] ; then
+ # Display path to symlink in ${T}, as requested in bug #412865.
+ local log_ext=log
+ [[ ${PORTAGE_LOG_FILE} != *.log ]] && log_ext+=.${PORTAGE_LOG_FILE##*.}
+ eerror "For convenience, a symlink to the build log is located at '${T}/build.${log_ext}'."
+ fi
+ fi
if [ -f "${T}/environment" ] ; then
eerror "The ebuild environment file is located at '${T}/environment'."
elif [ -d "${T}" ] ; then
@@ -222,6 +234,7 @@ die() {
} > "${T}/die.env"
eerror "The ebuild environment file is located at '${T}/die.env'."
fi
+ eerror "Working directory: '$(pwd)'"
eerror "S: '${S}'"
[[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE"
@@ -392,57 +405,6 @@ eend() {
return ${retval}
}
-KV_major() {
- [[ -z $1 ]] && return 1
-
- local KV=$@
- echo "${KV%%.*}"
-}
-
-KV_minor() {
- [[ -z $1 ]] && return 1
-
- local KV=$@
- KV=${KV#*.}
- echo "${KV%%.*}"
-}
-
-KV_micro() {
- [[ -z $1 ]] && return 1
-
- local KV=$@
- KV=${KV#*.*.}
- echo "${KV%%[^[:digit:]]*}"
-}
-
-KV_to_int() {
- [[ -z $1 ]] && return 1
-
- local KV_MAJOR=$(KV_major "$1")
- local KV_MINOR=$(KV_minor "$1")
- local KV_MICRO=$(KV_micro "$1")
- local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
-
- # We make version 2.2.0 the minimum version we will handle as
- # a sanity check ... if its less, we fail ...
- if [[ ${KV_int} -ge 131584 ]] ; then
- echo "${KV_int}"
- return 0
- fi
-
- return 1
-}
-
-_RC_GET_KV_CACHE=""
-get_KV() {
- [[ -z ${_RC_GET_KV_CACHE} ]] \
- && _RC_GET_KV_CACHE=$(uname -r)
-
- echo $(KV_to_int "${_RC_GET_KV_CACHE}")
-
- return $?
-}
-
unset_colors() {
COLS=80
ENDCOL=
@@ -457,7 +419,13 @@ unset_colors() {
set_colors() {
COLS=${COLUMNS:-0} # bash's internal COLUMNS variable
- (( COLS == 0 )) && COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
+ # Avoid wasteful stty calls during the "depend" phases.
+ # If stdout is a pipe, the parent process can export COLUMNS
+ # if it's relevant. Use an extra subshell for stty calls, in
+ # order to redirect "/dev/tty: No such device or address"
+ # error from bash to /dev/null.
+ [[ $COLS == 0 && $EBUILD_PHASE != depend ]] && \
+ COLS=$(set -- $( ( stty size </dev/tty ) 2>/dev/null || echo 24 80 ) ; echo $2)
(( COLS > 0 )) || (( COLS = 80 ))
# Now, ${ENDCOL} will move us to the end of the
@@ -471,8 +439,8 @@ set_colors() {
BAD=$'\e[31;01m'
HILITE=$'\e[36;01m'
BRACKET=$'\e[34;01m'
+ NORMAL=$'\e[0m'
fi
- NORMAL=$'\e[0m'
}
RC_ENDCOL="yes"
@@ -536,95 +504,4 @@ has() {
return 1
}
-# @FUNCTION: save_ebuild_env
-# @DESCRIPTION:
-# echo the current environment to stdout, filtering out redundant info.
-#
-# --exclude-init-phases causes pkg_nofetch and src_* phase functions to
-# be excluded from the output. These function are not needed for installation
-# or removal of the packages, and can therefore be safely excluded.
-#
-save_ebuild_env() {
- (
-
- if has --exclude-init-phases $* ; then
- unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_
- if [[ -n $PYTHONPATH ]] ; then
- export PYTHONPATH=${PYTHONPATH/${PORTAGE_PYM_PATH}:}
- [[ -z $PYTHONPATH ]] && unset PYTHONPATH
- fi
- fi
-
- # misc variables inherited from the calling environment
- unset COLORTERM DISPLAY EDITOR LESS LESSOPEN LOGNAME LS_COLORS PAGER \
- TERM TERMCAP USER ftp_proxy http_proxy no_proxy
-
- # other variables inherited from the calling environment
- unset CVS_RSH ECHANGELOG_USER GPG_AGENT_INFO \
- SSH_AGENT_PID SSH_AUTH_SOCK STY WINDOW XAUTHORITY
-
- # CCACHE and DISTCC config
- unset ${!CCACHE_*} ${!DISTCC_*}
-
- # There's no need to bloat environment.bz2 with internally defined
- # functions and variables, so filter them out if possible.
-
- for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \
- src_compile src_test src_install pkg_preinst pkg_postinst \
- pkg_prerm pkg_postrm ; do
- unset -f default_$x _eapi{0,1,2,3,4}_$x
- done
- unset x
-
- unset -f assert assert_sigpipe_ok dump_trace die diefunc \
- quiet_mode vecho elog_base eqawarn elog \
- esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \
- has_phase_defined_up_to \
- hasg hasgq hasv hasq qa_source qa_call \
- addread addwrite adddeny addpredict _sb_append_var \
- lchown lchgrp esyslog use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
- keepdir unpack strip_duplicate_slashes econf einstall \
- dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \
- insopts diropts exeopts libopts docompress \
- abort_handler abort_prepare abort_configure abort_compile \
- abort_test abort_install dyn_prepare dyn_configure \
- dyn_compile dyn_test dyn_install \
- dyn_preinst dyn_help debug-print debug-print-function \
- debug-print-section inherit EXPORT_FUNCTIONS remove_path_entry \
- save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
- set_unless_changed unset_unless_changed source_all_bashrcs \
- ebuild_main ebuild_phase ebuild_phase_with_hooks \
- _ebuild_arg_to_phase _ebuild_phase_funcs default \
- _pipestatus \
- ${QA_INTERCEPTORS}
-
- # portage config variables and variables set directly by portage
- unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \
- DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \
- EBUILD_FORCE_TEST EBUILD_MASTER_PID \
- ECLASS_DEPTH ENDCOL FAKEROOTKEY \
- GOOD HILITE HOME \
- LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \
- NOCOLOR NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
- PORTAGE_BASHRCS_SOURCED PORTAGE_NONFATAL PORTAGE_QUIET \
- PORTAGE_SANDBOX_DENY PORTAGE_SANDBOX_PREDICT \
- PORTAGE_SANDBOX_READ PORTAGE_SANDBOX_WRITE PREROOTPATH \
- QA_INTERCEPTORS \
- RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL RC_INDENTATION \
- ROOT ROOTPATH RPMDIR TEMP TMP TMPDIR USE_EXPAND \
- WARN XARGS _RC_GET_KV_CACHE
-
- # user config variables
- unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK
-
- declare -p
- declare -fp
- if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
- export
- fi
- )
-}
-
true
diff --git a/portage_with_autodep/bin/lock-helper.py b/portage_with_autodep/bin/lock-helper.py
index 5f3ea9f..dfb8876 100755
--- a/portage_with_autodep/bin/lock-helper.py
+++ b/portage_with_autodep/bin/lock-helper.py
@@ -1,15 +1,16 @@
#!/usr/bin/python
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import os
import sys
sys.path.insert(0, os.environ['PORTAGE_PYM_PATH'])
import portage
+portage._disable_legacy_globals()
def main(args):
- if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode):
+ if args and isinstance(args[0], bytes):
for i, x in enumerate(args):
args[i] = portage._unicode_decode(x, errors='strict')
diff --git a/portage_with_autodep/bin/misc-functions.sh b/portage_with_autodep/bin/misc-functions.sh
index 8c191ff..564af85 100755
--- a/portage_with_autodep/bin/misc-functions.sh
+++ b/portage_with_autodep/bin/misc-functions.sh
@@ -17,7 +17,9 @@ shift $#
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
install_symlink_html_docs() {
- cd "${D}" || die "cd failed"
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ cd "${ED}" || die "cd failed"
#symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
local mydocdir docdir
@@ -64,11 +66,13 @@ canonicalize() {
prepcompress() {
local -a include exclude incl_d incl_f
local f g i real_f real_d
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
# Canonicalize path names and check for their existence.
- real_d=$(canonicalize "${D}")
+ real_d=$(canonicalize "${ED}")
for (( i = 0; i < ${#PORTAGE_DOCOMPRESS[@]}; i++ )); do
- real_f=$(canonicalize "${D}${PORTAGE_DOCOMPRESS[i]}")
+ real_f=$(canonicalize "${ED}${PORTAGE_DOCOMPRESS[i]}")
f=${real_f#"${real_d}"}
if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]]
then
@@ -79,7 +83,7 @@ prepcompress() {
fi
done
for (( i = 0; i < ${#PORTAGE_DOCOMPRESS_SKIP[@]}; i++ )); do
- real_f=$(canonicalize "${D}${PORTAGE_DOCOMPRESS_SKIP[i]}")
+ real_f=$(canonicalize "${ED}${PORTAGE_DOCOMPRESS_SKIP[i]}")
f=${real_f#"${real_d}"}
if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]]
then
@@ -128,7 +132,7 @@ prepcompress() {
# Split the include list into directories and files
for f in "${include[@]}"; do
- if [[ -d ${D}${f} ]]; then
+ if [[ -d ${ED}${f} ]]; then
incl_d[${#incl_d[@]}]=${f}
else
incl_f[${#incl_f[@]}]=${f}
@@ -138,15 +142,101 @@ prepcompress() {
# Queue up for compression.
# ecompress{,dir} doesn't like to be called with empty argument lists.
[[ ${#incl_d[@]} -gt 0 ]] && ecompressdir --queue "${incl_d[@]}"
- [[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${D}}"
+ [[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${ED}}"
[[ ${#exclude[@]} -gt 0 ]] && ecompressdir --ignore "${exclude[@]}"
return 0
}
install_qa_check() {
- local f x
+ local f i qa_var x
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local EPREFIX= ED=${D} ;; esac
+
+ cd "${ED}" || die "cd failed"
+
+ # Merge QA_FLAGS_IGNORED and QA_DT_HASH into a single array, since
+ # QA_DT_HASH is deprecated.
+ qa_var="QA_FLAGS_IGNORED_${ARCH/-/_}"
+ eval "[[ -n \${!qa_var} ]] && QA_FLAGS_IGNORED=(\"\${${qa_var}[@]}\")"
+ if [[ ${#QA_FLAGS_IGNORED[@]} -eq 1 ]] ; then
+ local shopts=$-
+ set -o noglob
+ QA_FLAGS_IGNORED=(${QA_FLAGS_IGNORED})
+ set +o noglob
+ set -${shopts}
+ fi
+
+ qa_var="QA_DT_HASH_${ARCH/-/_}"
+ eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")"
+ if [[ ${#QA_DT_HASH[@]} -eq 1 ]] ; then
+ local shopts=$-
+ set -o noglob
+ QA_DT_HASH=(${QA_DT_HASH})
+ set +o noglob
+ set -${shopts}
+ fi
+
+ if [[ -n ${QA_DT_HASH} ]] ; then
+ QA_FLAGS_IGNORED=("${QA_FLAGS_IGNORED[@]}" "${QA_DT_HASH[@]}")
+ unset QA_DT_HASH
+ fi
- cd "${D}" || die "cd failed"
+ # Merge QA_STRICT_FLAGS_IGNORED and QA_STRICT_DT_HASH, since
+ # QA_STRICT_DT_HASH is deprecated
+ if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] && \
+ [ "${QA_STRICT_DT_HASH-unset}" != unset ] ; then
+ QA_STRICT_FLAGS_IGNORED=1
+ unset QA_STRICT_DT_HASH
+ fi
+
+ # Check for files built without respecting *FLAGS. Note that
+ # -frecord-gcc-switches must be in all *FLAGS variables, in
+ # order to avoid false positive results here.
+ # NOTE: This check must execute before prepall/prepstrip, since
+ # prepstrip strips the .GCC.command.line sections.
+ if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT} && \
+ [[ "${CFLAGS}" == *-frecord-gcc-switches* ]] && \
+ [[ "${CXXFLAGS}" == *-frecord-gcc-switches* ]] && \
+ [[ "${FFLAGS}" == *-frecord-gcc-switches* ]] && \
+ [[ "${FCFLAGS}" == *-frecord-gcc-switches* ]] ; then
+ rm -f "${T}"/scanelf-ignored-CFLAGS.log
+ for x in $(scanelf -qyRF '%k %p' -k \!.GCC.command.line "${ED}" | \
+ sed -e "s:\!.GCC.command.line ::") ; do
+ # Separate out file types that are known to support
+ # .GCC.command.line sections, using the `file` command
+ # similar to how prepstrip uses it.
+ f=$(file "${x}") || continue
+ [[ -z ${f} ]] && continue
+ if [[ ${f} == *"SB executable"* ||
+ ${f} == *"SB shared object"* ]] ; then
+ echo "${x}" >> "${T}"/scanelf-ignored-CFLAGS.log
+ fi
+ done
+
+ if [[ -f "${T}"/scanelf-ignored-CFLAGS.log ]] ; then
+
+ if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] ; then
+ for x in "${QA_FLAGS_IGNORED[@]}" ; do
+ sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log
+ done
+ fi
+ # Filter anything under /usr/lib/debug/ in order to avoid
+ # duplicate warnings for splitdebug files.
+ sed -e "s#^usr/lib/debug/.*##" -e "/^\$/d" -e "s#^#/#" \
+ -i "${T}"/scanelf-ignored-CFLAGS.log
+ f=$(<"${T}"/scanelf-ignored-CFLAGS.log)
+ if [[ -n ${f} ]] ; then
+ vecho -ne '\n'
+ eqawarn "${BAD}QA Notice: Files built without respecting CFLAGS have been detected${NORMAL}"
+ eqawarn " Please include the following list of files in your report:"
+ eqawarn "${f}"
+ vecho -ne '\n'
+ sleep 1
+ else
+ rm -f "${T}"/scanelf-ignored-CFLAGS.log
+ fi
+ fi
+ fi
export STRIP_MASK
prepall
@@ -154,9 +244,12 @@ install_qa_check() {
ecompressdir --dequeue
ecompress --dequeue
+ # Prefix specific checks
+ [[ ${ED} != ${D} ]] && install_qa_check_prefix
+
f=
for x in etc/app-defaults usr/man usr/info usr/X11R6 usr/doc usr/locale ; do
- [[ -d $D/$x ]] && f+=" $x\n"
+ [[ -d ${ED}/$x ]] && f+=" $x\n"
done
if [[ -n $f ]] ; then
@@ -165,18 +258,30 @@ install_qa_check() {
eqawarn "$f"
fi
+ if [[ -d ${ED}/etc/udev/rules.d ]] ; then
+ f=
+ for x in $(ls "${ED}/etc/udev/rules.d") ; do
+ f+=" etc/udev/rules.d/$x\n"
+ done
+ if [[ -n $f ]] ; then
+ eqawarn "QA Notice: udev rules should be installed in /lib/udev/rules.d:"
+ eqawarn
+ eqawarn "$f"
+ fi
+ fi
+
# Now we look for all world writable files.
- local i
- for i in $(find "${D}/" -type f -perm -2); do
- vecho "QA Security Notice:"
- vecho "- ${i:${#D}:${#i}} will be a world writable file."
+ local unsafe_files=$(find "${ED}" -type f -perm -2 | sed -e "s:^${ED}:- :")
+ if [[ -n ${unsafe_files} ]] ; then
+ vecho "QA Security Notice: world writable file(s):"
+ vecho "${unsafe_files}"
vecho "- This may or may not be a security problem, most of the time it is one."
vecho "- Please double check that $PF really needs a world writeable bit and file bugs accordingly."
sleep 1
- done
+ fi
if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT}; then
- local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
+ local insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
local x
# display warnings when using stricter because we die afterwards
@@ -196,7 +301,7 @@ install_qa_check() {
if [[ -n "${ROOT}" && "${ROOT}" != "/" ]]; then
forbidden_dirs+=" ${ROOT}"
fi
- local dir l rpath_files=$(scanelf -F '%F:%r' -qBR "${D}")
+ local dir l rpath_files=$(scanelf -F '%F:%r' -qBR "${ED}")
f=""
for dir in ${forbidden_dirs}; do
for l in $(echo "${rpath_files}" | grep -E ":${dir}|::|: "); do
@@ -210,7 +315,7 @@ install_qa_check() {
# Reject set*id binaries with $ORIGIN in RPATH #260331
x=$(
- find "${D}" -type f \( -perm -u+s -o -perm -g+s \) -print0 | \
+ find "${ED}" -type f \( -perm -u+s -o -perm -g+s \) -print0 | \
xargs -0 scanelf -qyRF '%r %p' | grep '$ORIGIN'
)
@@ -236,7 +341,7 @@ install_qa_check() {
[[ -n ${!qa_var} ]] && QA_TEXTRELS=${!qa_var}
[[ -n ${QA_STRICT_TEXTRELS} ]] && QA_TEXTRELS=""
export QA_TEXTRELS="${QA_TEXTRELS} lib*/modules/*.ko"
- f=$(scanelf -qyRF '%t %p' "${D}" | grep -v 'usr/lib/debug/')
+ f=$(scanelf -qyRF '%t %p' "${ED}" | grep -v 'usr/lib/debug/')
if [[ -n ${f} ]] ; then
scanelf -qyRAF '%T %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-textrel.log
vecho -ne '\n'
@@ -276,7 +381,7 @@ install_qa_check() {
[[ -n ${QA_STRICT_WX_LOAD} ]] && QA_WX_LOAD=""
export QA_EXECSTACK="${QA_EXECSTACK} lib*/modules/*.ko"
export QA_WX_LOAD="${QA_WX_LOAD} lib*/modules/*.ko"
- f=$(scanelf -qyRAF '%e %p' "${D}" | grep -v 'usr/lib/debug/')
+ f=$(scanelf -qyRAF '%e %p' "${ED}" | grep -v 'usr/lib/debug/')
;;
esac
;;
@@ -300,26 +405,15 @@ install_qa_check() {
fi
# Check for files built without respecting LDFLAGS
- if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && [[ "${PN}" != *-bin ]] ; then
- qa_var="QA_DT_HASH_${ARCH/-/_}"
- eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")"
- f=$(scanelf -qyRF '%k %p' -k .hash "${D}" | sed -e "s:\.hash ::")
+ if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && \
+ ! has binchecks ${RESTRICT} ; then
+ f=$(scanelf -qyRF '%k %p' -k .hash "${ED}" | sed -e "s:\.hash ::")
if [[ -n ${f} ]] ; then
echo "${f}" > "${T}"/scanelf-ignored-LDFLAGS.log
- if [ "${QA_STRICT_DT_HASH-unset}" == unset ] ; then
- if [[ ${#QA_DT_HASH[@]} -gt 1 ]] ; then
- for x in "${QA_DT_HASH[@]}" ; do
- sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-LDFLAGS.log
- done
- else
- local shopts=$-
- set -o noglob
- for x in ${QA_DT_HASH} ; do
- sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-LDFLAGS.log
- done
- set +o noglob
- set -${shopts}
- fi
+ if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] ; then
+ for x in "${QA_FLAGS_IGNORED[@]}" ; do
+ sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-LDFLAGS.log
+ done
fi
# Filter anything under /usr/lib/debug/ in order to avoid
# duplicate warnings for splitdebug files.
@@ -339,39 +433,6 @@ install_qa_check() {
fi
fi
- # Save NEEDED information after removing self-contained providers
- rm -f "$PORTAGE_BUILDDIR"/build-info/NEEDED{,.ELF.2}
- scanelf -qyRF '%a;%p;%S;%r;%n' "${D}" | { while IFS= read -r l; do
- arch=${l%%;*}; l=${l#*;}
- obj="/${l%%;*}"; l=${l#*;}
- soname=${l%%;*}; l=${l#*;}
- rpath=${l%%;*}; l=${l#*;}; [ "${rpath}" = " - " ] && rpath=""
- needed=${l%%;*}; l=${l#*;}
- if [ -z "${rpath}" -o -n "${rpath//*ORIGIN*}" ]; then
- # object doesn't contain $ORIGIN in its runpath attribute
- echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
- echo "${arch:3};${obj};${soname};${rpath};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.ELF.2
- else
- dir=${obj%/*}
- # replace $ORIGIN with the dirname of the current object for the lookup
- opath=$(echo :${rpath}: | sed -e "s#.*:\(.*\)\$ORIGIN\(.*\):.*#\1${dir}\2#")
- sneeded=$(echo ${needed} | tr , ' ')
- rneeded=""
- for lib in ${sneeded}; do
- found=0
- for path in ${opath//:/ }; do
- [ -e "${D}/${path}/${lib}" ] && found=1 && break
- done
- [ "${found}" -eq 0 ] && rneeded="${rneeded},${lib}"
- done
- rneeded=${rneeded:1}
- if [ -n "${rneeded}" ]; then
- echo "${obj} ${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
- echo "${arch:3};${obj};${soname};${rpath};${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.ELF.2
- fi
- fi
- done }
-
if [[ ${insecure_rpath} -eq 1 ]] ; then
die "Aborting due to serious QA concerns with RUNPATH/RPATH"
elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
@@ -381,7 +442,7 @@ install_qa_check() {
# Check for shared libraries lacking SONAMEs
qa_var="QA_SONAME_${ARCH/-/_}"
eval "[[ -n \${!qa_var} ]] && QA_SONAME=(\"\${${qa_var}[@]}\")"
- f=$(scanelf -ByF '%S %p' "${D}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
+ f=$(scanelf -ByF '%S %p' "${ED}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:")
if [[ -n ${f} ]] ; then
echo "${f}" > "${T}"/scanelf-missing-SONAME.log
if [[ "${QA_STRICT_SONAME-unset}" == unset ]] ; then
@@ -415,7 +476,7 @@ install_qa_check() {
# Check for shared libraries lacking NEEDED entries
qa_var="QA_DT_NEEDED_${ARCH/-/_}"
eval "[[ -n \${!qa_var} ]] && QA_DT_NEEDED=(\"\${${qa_var}[@]}\")"
- f=$(scanelf -ByF '%n %p' "${D}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
+ f=$(scanelf -ByF '%n %p' "${ED}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:")
if [[ -n ${f} ]] ; then
echo "${f}" > "${T}"/scanelf-missing-NEEDED.log
if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then
@@ -449,7 +510,35 @@ install_qa_check() {
PORTAGE_QUIET=${tmp_quiet}
fi
- local unsafe_files=$(find "${D}" -type f '(' -perm -2002 -o -perm -4002 ')')
+ # Create NEEDED.ELF.2 regardless of RESTRICT=binchecks, since this info is
+ # too useful not to have (it's required for things like preserve-libs), and
+ # it's tempting for ebuild authors to set RESTRICT=binchecks for packages
+ # containing pre-built binaries.
+ if type -P scanelf > /dev/null ; then
+ # Save NEEDED information after removing self-contained providers
+ rm -f "$PORTAGE_BUILDDIR"/build-info/NEEDED{,.ELF.2}
+ scanelf -qyRF '%a;%p;%S;%r;%n' "${D}" | { while IFS= read -r l; do
+ arch=${l%%;*}; l=${l#*;}
+ obj="/${l%%;*}"; l=${l#*;}
+ soname=${l%%;*}; l=${l#*;}
+ rpath=${l%%;*}; l=${l#*;}; [ "${rpath}" = " - " ] && rpath=""
+ needed=${l%%;*}; l=${l#*;}
+ echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+ echo "${arch:3};${obj};${soname};${rpath};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.ELF.2
+ done }
+
+ [ -n "${QA_SONAME_NO_SYMLINK}" ] && \
+ echo "${QA_SONAME_NO_SYMLINK}" > \
+ "${PORTAGE_BUILDDIR}"/build-info/QA_SONAME_NO_SYMLINK
+
+ if has binchecks ${RESTRICT} && \
+ [ -s "${PORTAGE_BUILDDIR}/build-info/NEEDED.ELF.2" ] ; then
+ eqawarn "QA Notice: RESTRICT=binchecks prevented checks on these ELF files:"
+ eqawarn "$(while read -r x; do x=${x#*;} ; x=${x%%;*} ; echo "${x#${EPREFIX}}" ; done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED.ELF.2)"
+ fi
+ fi
+
+ local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${ED}:/:")
if [[ -n ${unsafe_files} ]] ; then
eqawarn "QA Notice: Unsafe files detected (set*id and world writable)"
eqawarn "${unsafe_files}"
@@ -469,8 +558,8 @@ install_qa_check() {
# Sanity check syntax errors in init.d scripts
local d
for d in /etc/conf.d /etc/init.d ; do
- [[ -d ${D}/${d} ]] || continue
- for i in "${D}"/${d}/* ; do
+ [[ -d ${ED}/${d} ]] || continue
+ for i in "${ED}"/${d}/* ; do
[[ -L ${i} ]] && continue
# if empty conf.d/init.d dir exists (baselayout), then i will be "/etc/conf.d/*" and not exist
[[ ! -e ${i} ]] && continue
@@ -478,20 +567,27 @@ install_qa_check() {
done
done
+ # Look for leaking LDFLAGS into pkg-config files
+ f=$(egrep -sH '^Libs.*-Wl,(-O[012]|--hash-style)' "${ED}"/usr/*/pkgconfig/*.pc)
+ if [[ -n ${f} ]] ; then
+ eqawarn "QA Notice: pkg-config files with wrong LDFLAGS detected:"
+ eqawarn "${f//${D}}"
+ fi
+
# this should help to ensure that all (most?) shared libraries are executable
# and that all libtool scripts / static libraries are not executable
local j
- for i in "${D}"opt/*/lib{,32,64} \
- "${D}"lib{,32,64} \
- "${D}"usr/lib{,32,64} \
- "${D}"usr/X11R6/lib{,32,64} ; do
+ for i in "${ED}"opt/*/lib{,32,64} \
+ "${ED}"lib{,32,64} \
+ "${ED}"usr/lib{,32,64} \
+ "${ED}"usr/X11R6/lib{,32,64} ; do
[[ ! -d ${i} ]] && continue
for j in "${i}"/*.so.* "${i}"/*.so ; do
[[ ! -e ${j} ]] && continue
[[ -L ${j} ]] && continue
[[ -x ${j} ]] && continue
- vecho "making executable: ${j#${D}}"
+ vecho "making executable: ${j#${ED}}"
chmod +x "${j}"
done
@@ -499,7 +595,7 @@ install_qa_check() {
[[ ! -e ${j} ]] && continue
[[ -L ${j} ]] && continue
[[ ! -x ${j} ]] && continue
- vecho "removing executable bit: ${j#${D}}"
+ vecho "removing executable bit: ${j#${ED}}"
chmod -x "${j}"
done
@@ -523,7 +619,7 @@ install_qa_check() {
# http://bugs.gentoo.org/4411
abort="no"
local a s
- for a in "${D}"usr/lib*/*.a ; do
+ for a in "${ED}"usr/lib*/*.a ; do
s=${a%.a}.so
if [[ ! -e ${s} ]] ; then
s=${s%usr/*}${s##*/usr/}
@@ -537,7 +633,7 @@ install_qa_check() {
[[ ${abort} == "yes" ]] && die "add those ldscripts"
# Make sure people don't store libtool files or static libs in /lib
- f=$(ls "${D}"lib*/*.{a,la} 2>/dev/null)
+ f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null)
if [[ -n ${f} ]] ; then
vecho -ne '\n'
eqawarn "QA Notice: Excessive files found in the / partition"
@@ -548,9 +644,9 @@ install_qa_check() {
# Verify that the libtool files don't contain bogus $D entries.
local abort=no gentoo_bug=no always_overflow=no
- for a in "${D}"usr/lib*/*.la ; do
+ for a in "${ED}"usr/lib*/*.la ; do
s=${a##*/}
- if grep -qs "${D}" "${a}" ; then
+ if grep -qs "${ED}" "${a}" ; then
vecho -ne '\n'
eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths"
abort="yes"
@@ -621,8 +717,8 @@ install_qa_check() {
#esac
if [[ $always_overflow = yes ]] ; then
eerror
- eerror "QA Notice: Package has poor programming practices which may compile"
- eerror " fine but exhibit random runtime failures."
+ eerror "QA Notice: Package triggers severe warnings which indicate that it"
+ eerror " may exhibit random runtime failures."
eerror
eerror "${f}"
eerror
@@ -631,8 +727,8 @@ install_qa_check() {
eerror
else
vecho -ne '\n'
- eqawarn "QA Notice: Package has poor programming practices which may compile"
- eqawarn " fine but exhibit random runtime failures."
+ eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
+ eqawarn " may exhibit random runtime failures."
eqawarn "${f}"
vecho -ne '\n'
fi
@@ -658,8 +754,8 @@ install_qa_check() {
if [[ $gentoo_bug = yes ]] ; then
eerror
- eerror "QA Notice: Package has poor programming practices which may compile"
- eerror " but will almost certainly crash on 64bit architectures."
+ eerror "QA Notice: Package triggers severe warnings which indicate that it"
+ eerror " will almost certainly crash on 64bit architectures."
eerror
eerror "${f}"
eerror
@@ -668,8 +764,8 @@ install_qa_check() {
eerror
else
vecho -ne '\n'
- eqawarn "QA Notice: Package has poor programming practices which may compile"
- eqawarn " but will almost certainly crash on 64bit architectures."
+ eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
+ eqawarn " will almost certainly crash on 64bit architectures."
eqawarn "${f}"
vecho -ne '\n'
fi
@@ -678,7 +774,7 @@ install_qa_check() {
if [[ ${abort} == "yes" ]] ; then
if [[ $gentoo_bug = yes || $always_overflow = yes ]] ; then
die "install aborted due to" \
- "poor programming practices shown above"
+ "severe warnings shown above"
else
echo "Please do not file a Gentoo bug and instead" \
"report the above QA issues directly to the upstream" \
@@ -686,13 +782,13 @@ install_qa_check() {
while read -r line ; do eqawarn "${line}" ; done
eqawarn "Homepage: ${HOMEPAGE}"
has stricter ${FEATURES} && die "install aborted due to" \
- "poor programming practices shown above"
+ "severe warnings shown above"
fi
fi
fi
# Portage regenerates this on the installed system.
- rm -f "${D}"/usr/share/info/dir{,.gz,.bz2}
+ rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!"
if has multilib-strict ${FEATURES} && \
[[ -x /usr/bin/file && -x /usr/bin/find ]] && \
@@ -701,15 +797,15 @@ install_qa_check() {
local abort=no dir file firstrun=yes
MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT} | sed -e 's:\([(|)]\):\\\1:g')
for dir in ${MULTILIB_STRICT_DIRS} ; do
- [[ -d ${D}/${dir} ]] || continue
- for file in $(find ${D}/${dir} -type f | grep -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
+ [[ -d ${ED}/${dir} ]] || continue
+ for file in $(find ${ED}/${dir} -type f | grep -v "^${ED}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
if file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" ; then
if [[ ${firstrun} == yes ]] ; then
echo "Files matching a file type that is not allowed:"
firstrun=no
fi
abort=yes
- echo " ${file#${D}//}"
+ echo " ${file#${ED}//}"
fi
done
done
@@ -718,7 +814,7 @@ install_qa_check() {
# ensure packages don't install systemd units automagically
if ! has systemd ${INHERITED} && \
- [[ -d "${D}"/lib/systemd/system ]]
+ [[ -d "${ED}"/lib/systemd/system ]]
then
eqawarn "QA Notice: package installs systemd unit files (/lib/systemd/system)"
eqawarn " but does not inherit systemd.eclass."
@@ -727,6 +823,124 @@ install_qa_check() {
fi
}
+install_qa_check_prefix() {
+ if [[ -d ${ED}/${D} ]] ; then
+ find "${ED}/${D}" | \
+ while read i ; do
+ eqawarn "QA Notice: /${i##${ED}/${D}} installed in \${ED}/\${D}"
+ done
+ die "Aborting due to QA concerns: files installed in ${ED}/${D}"
+ fi
+
+ if [[ -d ${ED}/${EPREFIX} ]] ; then
+ find "${ED}/${EPREFIX}/" | \
+ while read i ; do
+ eqawarn "QA Notice: ${i#${D}} double prefix"
+ done
+ die "Aborting due to QA concerns: double prefix files installed"
+ fi
+
+ if [[ -d ${D} ]] ; then
+ INSTALLTOD=$(find ${D%/} | egrep -v "^${ED}" | sed -e "s|^${D%/}||" | awk '{if (length($0) <= length("'"${EPREFIX}"'")) { if (substr("'"${EPREFIX}"'", 1, length($0)) != $0) {print $0;} } else if (substr($0, 1, length("'"${EPREFIX}"'")) != "'"${EPREFIX}"'") {print $0;} }')
+ if [[ -n ${INSTALLTOD} ]] ; then
+ eqawarn "QA Notice: the following files are outside of the prefix:"
+ eqawarn "${INSTALLTOD}"
+ die "Aborting due to QA concerns: there are files installed outside the prefix"
+ fi
+ fi
+
+ # all further checks rely on ${ED} existing
+ [[ -d ${ED} ]] || return
+
+ # this does not really belong here, but it's closely tied to
+ # the code below; many runscripts generate positives here, and we
+ # know they don't work (bug #196294) so as long as that one
+ # remains an issue, simply remove them as they won't work
+ # anyway, avoid etc/init.d/functions.sh from being thrown away
+ if [[ ( -d "${ED}"/etc/conf.d || -d "${ED}"/etc/init.d ) && ! -f "${ED}"/etc/init.d/functions.sh ]] ; then
+ ewarn "removed /etc/init.d and /etc/conf.d directories until bug #196294 has been resolved"
+ rm -Rf "${ED}"/etc/{conf,init}.d
+ fi
+
+ # check shebangs, bug #282539
+ rm -f "${T}"/non-prefix-shebangs-errs
+ local WHITELIST=" /usr/bin/env "
+ # this is hell expensive, but how else?
+ find "${ED}" -executable \! -type d -print0 \
+ | xargs -0 grep -H -n -m1 "^#!" \
+ | while read f ;
+ do
+ local fn=${f%%:*}
+ local pos=${f#*:} ; pos=${pos%:*}
+ local line=${f##*:}
+ # shebang always appears on the first line ;)
+ [[ ${pos} != 1 ]] && continue
+ local oldIFS=${IFS}
+ IFS=$'\r'$'\n'$'\t'" "
+ line=( ${line#"#!"} )
+ IFS=${oldIFS}
+ [[ ${WHITELIST} == *" ${line[0]} "* ]] && continue
+ local fp=${fn#${D}} ; fp=/${fp%/*}
+ # line[0] can be an absolutised path, bug #342929
+ local eprefix=$(canonicalize ${EPREFIX})
+ local rf=${fn}
+ # in case we deal with a symlink, make sure we don't replace it
+ # with a real file (sed -i does that)
+ if [[ -L ${fn} ]] ; then
+ rf=$(readlink ${fn})
+ [[ ${rf} != /* ]] && rf=${fn%/*}/${rf}
+ # ignore symlinks pointing to outside prefix
+ # as seen in sys-devel/native-cctools
+ [[ $(canonicalize "/${rf#${D}}") != ${eprefix}/* ]] && continue
+ fi
+ # does the shebang start with ${EPREFIX}, and does it exist?
+ if [[ ${line[0]} == ${EPREFIX}/* || ${line[0]} == ${eprefix}/* ]] ; then
+ if [[ ! -e ${ROOT%/}${line[0]} && ! -e ${D%/}${line[0]} ]] ; then
+ # hmm, refers explicitly to $EPREFIX, but doesn't exist,
+ # if it's in PATH that's wrong in any case
+ if [[ ":${PATH}:" == *":${fp}:"* ]] ; then
+ echo "${fn#${D}}:${line[0]} (explicit EPREFIX but target not found)" \
+ >> "${T}"/non-prefix-shebangs-errs
+ else
+ eqawarn "${fn#${D}} has explicit EPREFIX in shebang but target not found (${line[0]})"
+ fi
+ fi
+ continue
+ fi
+ # unprefixed shebang, is the script directly in $PATH?
+ if [[ ":${PATH}:" == *":${fp}:"* ]] ; then
+ if [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then
+ # is it unprefixed, but we can just fix it because a
+ # prefixed variant exists
+ eqawarn "prefixing shebang of ${fn#${D}}"
+ # statement is made idempotent on purpose, because
+ # symlinks may point to the same target, and hence the
+ # same real file may be sedded multiple times since we
+ # read the shebangs in one go upfront for performance
+ # reasons
+ sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${EPREFIX}"${line[0]}':' "${rf}"
+ continue
+ else
+ # this is definitely wrong: script in $PATH and invalid shebang
+ echo "${fn#${D}}:${line[0]} (script ${fn##*/} installed in PATH but interpreter ${line[0]} not found)" \
+ >> "${T}"/non-prefix-shebangs-errs
+ fi
+ else
+ # unprefixed/invalid shebang, but outside $PATH, this may be
+ # intended (e.g. config.guess) so remain silent by default
+ has stricter ${FEATURES} && \
+ eqawarn "invalid shebang in ${fn#${D}}: ${line[0]}"
+ fi
+ done
+ if [[ -e "${T}"/non-prefix-shebangs-errs ]] ; then
+ eqawarn "QA Notice: the following files use invalid (possible non-prefixed) shebangs:"
+ while read line ; do
+ eqawarn " ${line}"
+ done < "${T}"/non-prefix-shebangs-errs
+ rm -f "${T}"/non-prefix-shebangs-errs
+ die "Aborting due to QA concerns: invalid shebangs found"
+ fi
+}
install_mask() {
local root="$1"
@@ -758,6 +972,9 @@ preinst_mask() {
return 1
fi
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+
# Make sure $PWD is not ${D} so that we don't leave gmon.out files
# in there in case any tools were built with -pg in CFLAGS.
cd "${T}"
@@ -770,11 +987,11 @@ preinst_mask() {
fi
done
- install_mask "${D}" "${INSTALL_MASK}"
+ install_mask "${ED}" "${INSTALL_MASK}"
# remove share dir if unnessesary
if has nodoc $FEATURES || has noman $FEATURES || has noinfo $FEATURES; then
- rmdir "${D}usr/share" &> /dev/null
+ rmdir "${ED}usr/share" &> /dev/null
fi
}
@@ -783,29 +1000,33 @@ preinst_sfperms() {
eerror "${FUNCNAME}: D is unset"
return 1
fi
+
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+
# Smart FileSystem Permissions
if has sfperms $FEATURES; then
local i
- find "${D}" -type f -perm -4000 -print0 | \
+ find "${ED}" -type f -perm -4000 -print0 | \
while read -r -d $'\0' i ; do
if [ -n "$(find "$i" -perm -2000)" ] ; then
- ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${D}}"
+ ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${ED}}"
chmod o-r "$i"
eend $?
else
- ebegin ">>> SetUID: [chmod go-r] /${i#${D}}"
+ ebegin ">>> SetUID: [chmod go-r] /${i#${ED}}"
chmod go-r "$i"
eend $?
fi
done
- find "${D}" -type f -perm -2000 -print0 | \
+ find "${ED}" -type f -perm -2000 -print0 | \
while read -r -d $'\0' i ; do
if [ -n "$(find "$i" -perm -4000)" ] ; then
# This case is already handled
# by the SetUID check above.
true
else
- ebegin ">>> SetGID: [chmod o-r] /${i#${D}}"
+ ebegin ">>> SetGID: [chmod o-r] /${i#${ED}}"
chmod o-r "$i"
eend $?
fi
@@ -818,6 +1039,10 @@ preinst_suid_scan() {
eerror "${FUNCNAME}: D is unset"
return 1
fi
+
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+
# total suid control.
if has suidctl $FEATURES; then
local i sfconf x
@@ -826,10 +1051,10 @@ preinst_suid_scan() {
# to files outside of the sandbox, but this
# can easly be bypassed using the addwrite() function
addwrite "${sfconf}"
- vecho ">>> Performing suid scan in ${D}"
- for i in $(find "${D}" -type f \( -perm -4000 -o -perm -2000 \) ); do
+ vecho ">>> Performing suid scan in ${ED}"
+ for i in $(find "${ED}" -type f \( -perm -4000 -o -perm -2000 \) ); do
if [ -s "${sfconf}" ]; then
- install_path=/${i#${D}}
+ install_path=/${i#${ED}}
if grep -q "^${install_path}\$" "${sfconf}" ; then
vecho "- ${install_path} is an approved suid file"
else
@@ -839,7 +1064,7 @@ preinst_suid_scan() {
chmod ugo-s "${i}"
grep "^#${install_path}$" "${sfconf}" > /dev/null || {
vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
- echo "## ${ls_ret%${D}*}${install_path}" >> "${sfconf}"
+ echo "## ${ls_ret%${ED}*}${install_path}" >> "${sfconf}"
echo "#${install_path}" >> "${sfconf}"
# no delwrite() eh?
# delwrite ${sconf}
@@ -861,13 +1086,15 @@ preinst_selinux_labels() {
# SELinux file labeling (needs to always be last in dyn_preinst)
# only attempt to label if setfiles is executable
# and 'context' is available on selinuxfs.
- if [ -f /selinux/context -a -x /usr/sbin/setfiles -a -x /usr/sbin/selinuxconfig ]; then
+ if [ -f /selinux/context -o -f /sys/fs/selinux/context ] && \
+ [ -x /usr/sbin/setfiles -a -x /usr/sbin/selinuxconfig ]; then
vecho ">>> Setting SELinux security labels"
(
eval "$(/usr/sbin/selinuxconfig)" || \
die "Failed to determine SELinux policy paths.";
- addwrite /selinux/context;
+ addwrite /selinux/context
+ addwrite /sys/fs/selinux/context
/usr/sbin/setfiles "${file_contexts_path}" -r "${D}" "${D}"
) || die "Failed to set SELinux security labels."
@@ -880,10 +1107,30 @@ preinst_selinux_labels() {
}
dyn_package() {
+ local PROOT
+
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local EPREFIX= ED=${D} ;; esac
+
# Make sure $PWD is not ${D} so that we don't leave gmon.out files
# in there in case any tools were built with -pg in CFLAGS.
+
cd "${T}"
- install_mask "${PORTAGE_BUILDDIR}/image" "${PKG_INSTALL_MASK}"
+
+ if [[ -n ${PKG_INSTALL_MASK} ]] ; then
+ PROOT=${T}/packaging/
+ # make a temporary copy of ${D} so that any modifications we do that
+ # are binpkg specific, do not influence the actual installed image.
+ rm -rf "${PROOT}" || die "failed removing stale package tree"
+ cp -pPR $(cp --help | grep -qs -e-l && echo -l) \
+ "${D}" "${PROOT}" \
+ || die "failed creating packaging tree"
+
+ install_mask "${PROOT%/}${EPREFIX}/" "${PKG_INSTALL_MASK}"
+ else
+ PROOT=${D}
+ fi
+
local tar_options=""
[[ $PORTAGE_VERBOSE = 1 ]] && tar_options+=" -v"
# Sandbox is disabled in case the user wants to use a symlink
@@ -892,7 +1139,7 @@ dyn_package() {
[ -z "${PORTAGE_BINPKG_TMPFILE}" ] && \
die "PORTAGE_BINPKG_TMPFILE is unset"
mkdir -p "${PORTAGE_BINPKG_TMPFILE%/*}" || die "mkdir failed"
- tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
+ tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${PROOT}" . | \
$PORTAGE_BZIP2_COMMAND -c > "$PORTAGE_BINPKG_TMPFILE"
assert "failed to pack binary package: '$PORTAGE_BINPKG_TMPFILE'"
PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
@@ -913,6 +1160,9 @@ dyn_package() {
[ -n "${md5_hash}" ] && \
echo ${md5_hash} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
vecho ">>> Done."
+
+ # cleanup our temp tree
+ [[ -n ${PKG_INSTALL_MASK} ]] && rm -rf "${PROOT}"
cd "${PORTAGE_BUILDDIR}"
>> "$PORTAGE_BUILDDIR/.packaged" || \
die "Failed to create $PORTAGE_BUILDDIR/.packaged"
@@ -957,10 +1207,14 @@ __END1__
}
dyn_rpm() {
+
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+
cd "${T}" || die "cd failed"
local machine_name=$(uname -m)
- local dest_dir=/usr/src/rpm/RPMS/${machine_name}
- addwrite /usr/src/rpm
+ local dest_dir=${EPREFIX}/usr/src/rpm/RPMS/${machine_name}
+ addwrite ${EPREFIX}/usr/src/rpm
addwrite "${RPMDIR}"
dyn_spec
rpmbuild -bb --clean --rmsource "${PF}.spec" || die "Failed to integrate rpm spec file"
@@ -985,6 +1239,21 @@ success_hooks() {
done
}
+install_hooks() {
+ local hooks_dir="${PORTAGE_CONFIGROOT}etc/portage/hooks/install"
+ local fp
+ local ret=0
+ shopt -s nullglob
+ for fp in "${hooks_dir}"/*; do
+ if [ -x "$fp" ]; then
+ "$fp"
+ ret=$(( $ret | $? ))
+ fi
+ done
+ shopt -u nullglob
+ return $ret
+}
+
if [ -n "${MISC_FUNCTIONS_ARGS}" ]; then
source_all_bashrcs
[ "$PORTAGE_DEBUG" == "1" ] && set -x
diff --git a/portage_with_autodep/bin/phase-functions.sh b/portage_with_autodep/bin/phase-functions.sh
new file mode 100755
index 0000000..ce251ce
--- /dev/null
+++ b/portage_with_autodep/bin/phase-functions.sh
@@ -0,0 +1,1001 @@
+#!/bin/bash
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Hardcoded bash lists are needed for backward compatibility with
+# <portage-2.1.4 since they assume that a newly installed version
+# of ebuild.sh will work for pkg_postinst, pkg_prerm, and pkg_postrm
+# when portage is upgrading itself.
+
+PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
+ EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE
+ PDEPEND PROVIDE RDEPEND REPOSITORY RESTRICT SLOT SRC_URI"
+
+PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE \
+ EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \
+ PM_EBUILD_HOOK_DIR \
+ PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
+ PORTAGE_BINPKG_FILE PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE \
+ PORTAGE_BIN_PATH PORTAGE_BUILDDIR PORTAGE_BUNZIP2_COMMAND \
+ PORTAGE_BZIP2_COMMAND PORTAGE_COLORMAP PORTAGE_CONFIGROOT \
+ PORTAGE_DEBUG PORTAGE_DEPCACHEDIR PORTAGE_EBUILD_EXIT_FILE \
+ PORTAGE_GID PORTAGE_GRPNAME PORTAGE_INST_GID PORTAGE_INST_UID \
+ PORTAGE_IPC_DAEMON PORTAGE_IUSE PORTAGE_LOG_FILE \
+ PORTAGE_MUTABLE_FILTERED_VARS PORTAGE_OVERRIDE_EPREFIX \
+ PORTAGE_PYM_PATH PORTAGE_PYTHON \
+ PORTAGE_READONLY_METADATA PORTAGE_READONLY_VARS \
+ PORTAGE_REPO_NAME PORTAGE_RESTRICT \
+ PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
+ PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
+ PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR PORTDIR_OVERLAY \
+ PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
+ __PORTAGE_TEST_HARDLINK_LOCKS"
+
+PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR"
+
+# Variables that portage sets but doesn't mark readonly.
+# In order to prevent changed values from causing unexpected
+# interference, they are filtered out of the environment when
+# it is saved or loaded (any mutations do not persist).
+PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
+
+# @FUNCTION: filter_readonly_variables
+# @DESCRIPTION: [--filter-sandbox] [--allow-extra-vars]
+# Read an environment from stdin and echo to stdout while filtering variables
+# with names that are known to cause interference:
+#
+# * some specific variables for which bash does not allow assignment
+# * some specific variables that affect portage or sandbox behavior
+# * variable names that begin with a digit or that contain any
+# non-alphanumeric characters that are not be supported by bash
+#
+# --filter-sandbox causes all SANDBOX_* variables to be filtered, which
+# is only desired in certain cases, such as during preprocessing or when
+# saving environment.bz2 for a binary or installed package.
+#
+# --filter-features causes the special FEATURES variable to be filtered.
+# Generally, we want it to persist between phases since the user might
+# want to modify it via bashrc to enable things like splitdebug and
+# installsources for specific packages. They should be able to modify it
+# in pre_pkg_setup() and have it persist all the way through the install
+# phase. However, if FEATURES exist inside environment.bz2 then they
+# should be overridden by current settings.
+#
+# --filter-locale causes locale related variables such as LANG and LC_*
+# variables to be filtered. These variables should persist between phases,
+# in case they are modified by the ebuild. However, the current user
+# settings should be used when loading the environment from a binary or
+# installed package.
+#
+# --filter-path causes the PATH variable to be filtered. This variable
+# should persist between phases, in case it is modified by the ebuild.
+# However, old settings should be overridden when loading the
+# environment from a binary or installed package.
+#
+# ---allow-extra-vars causes some extra vars to be allowd through, such
+# as ${PORTAGE_SAVED_READONLY_VARS} and ${PORTAGE_MUTABLE_FILTERED_VARS}.
+# This is enabled automatically if EMERGE_FROM=binary, since it preserves
+# variables from when the package was originally built.
+#
+# In bash-3.2_p20+ an attempt to assign BASH_*, FUNCNAME, GROUPS or any
+# readonly variable cause the shell to exit while executing the "source"
+# builtin command. To avoid this problem, this function filters those
+# variables out and discards them. See bug #190128.
+filter_readonly_variables() {
+ local x filtered_vars
+ local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
+ local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
+ HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
+ OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
+ SECONDS SHELL SHLVL _"
+ local filtered_sandbox_vars="SANDBOX_ACTIVE SANDBOX_BASHRC
+ SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
+ SANDBOX_LOG SANDBOX_ON"
+ # Untrusted due to possible application of package renames to binpkgs
+ local binpkg_untrusted_vars="CATEGORY P PF PN PR PV PVR"
+ local misc_garbage_vars="_portage_filter_opts"
+ filtered_vars="$readonly_bash_vars $bash_misc_vars
+ $PORTAGE_READONLY_VARS $misc_garbage_vars"
+
+ # Don't filter/interfere with prefix variables unless they are
+ # supported by the current EAPI.
+ case "${EAPI:-0}" in
+ 0|1|2)
+ [[ " ${FEATURES} " == *" force-prefix "* ]] && \
+ filtered_vars+=" ED EPREFIX EROOT"
+ ;;
+ *)
+ filtered_vars+=" ED EPREFIX EROOT"
+ ;;
+ esac
+
+ if has --filter-sandbox $* ; then
+ filtered_vars="${filtered_vars} SANDBOX_.*"
+ else
+ filtered_vars="${filtered_vars} ${filtered_sandbox_vars}"
+ fi
+ if has --filter-features $* ; then
+ filtered_vars="${filtered_vars} FEATURES PORTAGE_FEATURES"
+ fi
+ if has --filter-path $* ; then
+ filtered_vars+=" PATH"
+ fi
+ if has --filter-locale $* ; then
+ filtered_vars+=" LANG LC_ALL LC_COLLATE
+ LC_CTYPE LC_MESSAGES LC_MONETARY
+ LC_NUMERIC LC_PAPER LC_TIME"
+ fi
+ if ! has --allow-extra-vars $* ; then
+ if [ "${EMERGE_FROM}" = binary ] ; then
+ # preserve additional variables from build time,
+ # while excluding untrusted variables
+ filtered_vars+=" ${binpkg_untrusted_vars}"
+ else
+ filtered_vars+=" ${PORTAGE_SAVED_READONLY_VARS}"
+ filtered_vars+=" ${PORTAGE_MUTABLE_FILTERED_VARS}"
+ fi
+ fi
+
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
+}
+
+# @FUNCTION: preprocess_ebuild_env
+# @DESCRIPTION:
+# Filter any readonly variables from ${T}/environment, source it, and then
+# save it via save_ebuild_env(). This process should be sufficient to prevent
+# any stale variables or functions from an arbitrary environment from
+# interfering with the current environment. This is useful when an existing
+# environment needs to be loaded from a binary or installed package.
+preprocess_ebuild_env() {
+ local _portage_filter_opts="--filter-features --filter-locale --filter-path --filter-sandbox"
+
+ # If environment.raw is present, this is a signal from the python side,
+ # indicating that the environment may contain stale FEATURES and
+ # SANDBOX_{DENY,PREDICT,READ,WRITE} variables that should be filtered out.
+ # Otherwise, we don't need to filter the environment.
+ [ -f "${T}/environment.raw" ] || return 0
+
+ filter_readonly_variables $_portage_filter_opts < "${T}"/environment \
+ >> "$T/environment.filtered" || return $?
+ unset _portage_filter_opts
+ mv "${T}"/environment.filtered "${T}"/environment || return $?
+ rm -f "${T}/environment.success" || return $?
+ # WARNING: Code inside this subshell should avoid making assumptions
+ # about variables or functions after source "${T}"/environment has been
+ # called. Any variables that need to be relied upon should already be
+ # filtered out above.
+ (
+ export SANDBOX_ON=1
+ source "${T}/environment" || exit $?
+ # We have to temporarily disable sandbox since the
+ # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded
+ # may be unusable (triggering in spurious sandbox violations)
+ # until we've merged them with our current values.
+ export SANDBOX_ON=0
+
+ # It's remotely possible that save_ebuild_env() has been overridden
+ # by the above source command. To protect ourselves, we override it
+ # here with our own version. ${PORTAGE_BIN_PATH} is safe to use here
+ # because it's already filtered above.
+ source "${PORTAGE_BIN_PATH}/save-ebuild-env.sh" || exit $?
+
+ # Rely on save_ebuild_env() to filter out any remaining variables
+ # and functions that could interfere with the current environment.
+ save_ebuild_env || exit $?
+ >> "$T/environment.success" || exit $?
+ ) > "${T}/environment.filtered"
+ local retval
+ if [ -e "${T}/environment.success" ] ; then
+ filter_readonly_variables --filter-features < \
+ "${T}/environment.filtered" > "${T}/environment"
+ retval=$?
+ else
+ retval=1
+ fi
+ rm -f "${T}"/environment.{filtered,raw,success}
+ return ${retval}
+}
+
+ebuild_phase() {
+ declare -F "$1" >/dev/null && qa_call $1
+}
+
+ebuild_phase_with_hooks() {
+ local x phase_name=${1}
+ for x in {pre_,,post_}${phase_name} ; do
+ ebuild_phase ${x}
+ done
+}
+
+dyn_pretend() {
+ if [[ -e $PORTAGE_BUILDDIR/.pretended ]] ; then
+ vecho ">>> It appears that '$PF' is already pretended; skipping."
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend."
+ return 0
+ fi
+ ebuild_phase pre_pkg_pretend
+ ebuild_phase pkg_pretend
+ >> "$PORTAGE_BUILDDIR/.pretended" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.pretended"
+ ebuild_phase post_pkg_pretend
+}
+
+dyn_setup() {
+ if [[ -e $PORTAGE_BUILDDIR/.setuped ]] ; then
+ vecho ">>> It appears that '$PF' is already setup; skipping."
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force setup."
+ return 0
+ fi
+ ebuild_phase pre_pkg_setup
+ ebuild_phase pkg_setup
+ >> "$PORTAGE_BUILDDIR/.setuped" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.setuped"
+ ebuild_phase post_pkg_setup
+}
+
+dyn_unpack() {
+ if [[ -f ${PORTAGE_BUILDDIR}/.unpacked ]] ; then
+ vecho ">>> WORKDIR is up-to-date, keeping..."
+ return 0
+ fi
+ if [ ! -d "${WORKDIR}" ]; then
+ install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
+ fi
+ cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`"
+ ebuild_phase pre_src_unpack
+ vecho ">>> Unpacking source..."
+ ebuild_phase src_unpack
+ >> "$PORTAGE_BUILDDIR/.unpacked" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.unpacked"
+ vecho ">>> Source unpacked in ${WORKDIR}"
+ ebuild_phase post_src_unpack
+}
+
+dyn_clean() {
+ if [ -z "${PORTAGE_BUILDDIR}" ]; then
+ echo "Aborting clean phase because PORTAGE_BUILDDIR is unset!"
+ return 1
+ elif [ ! -d "${PORTAGE_BUILDDIR}" ] ; then
+ return 0
+ fi
+ if has chflags $FEATURES ; then
+ chflags -R noschg,nouchg,nosappnd,nouappnd "${PORTAGE_BUILDDIR}"
+ chflags -R nosunlnk,nouunlnk "${PORTAGE_BUILDDIR}" 2>/dev/null
+ fi
+
+ rm -rf "${PORTAGE_BUILDDIR}/image" "${PORTAGE_BUILDDIR}/homedir"
+ rm -f "${PORTAGE_BUILDDIR}/.installed"
+
+ if [[ $EMERGE_FROM = binary ]] || \
+ ! has keeptemp $FEATURES && ! has keepwork $FEATURES ; then
+ rm -rf "${T}"
+ fi
+
+ if [[ $EMERGE_FROM = binary ]] || ! has keepwork $FEATURES; then
+ rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,pretended,setuped,unpacked,prepared} \
+ "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \
+ "$PORTAGE_BUILDDIR"/.die_hooks \
+ "$PORTAGE_BUILDDIR"/.ipc_{in,out,lock} \
+ "$PORTAGE_BUILDDIR"/.exit_status
+
+ rm -rf "${PORTAGE_BUILDDIR}/build-info"
+ rm -rf "${WORKDIR}"
+ fi
+
+ if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then
+ find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null
+ fi
+
+ # do not bind this to doebuild defined DISTDIR; don't trust doebuild, and if mistakes are made it'll
+ # result in it wiping the users distfiles directory (bad).
+ rm -rf "${PORTAGE_BUILDDIR}/distdir"
+
+ # Some kernels, such as Solaris, return EINVAL when an attempt
+ # is made to remove the current working directory.
+ cd "$PORTAGE_BUILDDIR"/../..
+ rmdir "$PORTAGE_BUILDDIR" 2>/dev/null
+
+ true
+}
+
+abort_handler() {
+ local msg
+ if [ "$2" != "fail" ]; then
+ msg="${EBUILD}: ${1} aborted; exiting."
+ else
+ msg="${EBUILD}: ${1} failed; exiting."
+ fi
+ echo
+ echo "$msg"
+ echo
+ eval ${3}
+ #unset signal handler
+ trap - SIGINT SIGQUIT
+}
+
+abort_prepare() {
+ abort_handler src_prepare $1
+ rm -f "$PORTAGE_BUILDDIR/.prepared"
+ exit 1
+}
+
+abort_configure() {
+ abort_handler src_configure $1
+ rm -f "$PORTAGE_BUILDDIR/.configured"
+ exit 1
+}
+
+abort_compile() {
+ abort_handler "src_compile" $1
+ rm -f "${PORTAGE_BUILDDIR}/.compiled"
+ exit 1
+}
+
+abort_test() {
+ abort_handler "dyn_test" $1
+ rm -f "${PORTAGE_BUILDDIR}/.tested"
+ exit 1
+}
+
+abort_install() {
+ abort_handler "src_install" $1
+ rm -rf "${PORTAGE_BUILDDIR}/image"
+ exit 1
+}
+
+has_phase_defined_up_to() {
+ local phase
+ for phase in unpack prepare configure compile install; do
+ has ${phase} ${DEFINED_PHASES} && return 0
+ [[ ${phase} == $1 ]] && return 1
+ done
+ # We shouldn't actually get here
+ return 1
+}
+
+dyn_prepare() {
+
+ if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then
+ vecho ">>> It appears that '$PF' is already prepared; skipping."
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.prepared' to force prepare."
+ return 0
+ fi
+
+ if [[ -d $S ]] ; then
+ cd "${S}"
+ elif has $EAPI 0 1 2 3 3_pre2 ; then
+ cd "${WORKDIR}"
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then
+ cd "${WORKDIR}"
+ else
+ die "The source directory '${S}' doesn't exist"
+ fi
+
+ trap abort_prepare SIGINT SIGQUIT
+
+ ebuild_phase pre_src_prepare
+ vecho ">>> Preparing source in $PWD ..."
+ ebuild_phase src_prepare
+ >> "$PORTAGE_BUILDDIR/.prepared" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.prepared"
+ vecho ">>> Source prepared."
+ ebuild_phase post_src_prepare
+
+ trap - SIGINT SIGQUIT
+}
+
+dyn_configure() {
+
+ if [[ -e $PORTAGE_BUILDDIR/.configured ]] ; then
+ vecho ">>> It appears that '$PF' is already configured; skipping."
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration."
+ return 0
+ fi
+
+ if [[ -d $S ]] ; then
+ cd "${S}"
+ elif has $EAPI 0 1 2 3 3_pre2 ; then
+ cd "${WORKDIR}"
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then
+ cd "${WORKDIR}"
+ else
+ die "The source directory '${S}' doesn't exist"
+ fi
+
+ trap abort_configure SIGINT SIGQUIT
+
+ ebuild_phase pre_src_configure
+
+ vecho ">>> Configuring source in $PWD ..."
+ ebuild_phase src_configure
+ >> "$PORTAGE_BUILDDIR/.configured" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.configured"
+ vecho ">>> Source configured."
+
+ ebuild_phase post_src_configure
+
+ trap - SIGINT SIGQUIT
+}
+
+dyn_compile() {
+
+ if [[ -e $PORTAGE_BUILDDIR/.compiled ]] ; then
+ vecho ">>> It appears that '${PF}' is already compiled; skipping."
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation."
+ return 0
+ fi
+
+ if [[ -d $S ]] ; then
+ cd "${S}"
+ elif has $EAPI 0 1 2 3 3_pre2 ; then
+ cd "${WORKDIR}"
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then
+ cd "${WORKDIR}"
+ else
+ die "The source directory '${S}' doesn't exist"
+ fi
+
+ trap abort_compile SIGINT SIGQUIT
+
+ if has distcc $FEATURES && has distcc-pump $FEATURES ; then
+ if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]] ; then
+ eval $(pump --startup)
+ trap "pump --shutdown" EXIT
+ fi
+ fi
+
+ ebuild_phase pre_src_compile
+
+ vecho ">>> Compiling source in $PWD ..."
+ ebuild_phase src_compile
+ >> "$PORTAGE_BUILDDIR/.compiled" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.compiled"
+ vecho ">>> Source compiled."
+
+ ebuild_phase post_src_compile
+
+ trap - SIGINT SIGQUIT
+}
+
+dyn_test() {
+
+ if [[ -e $PORTAGE_BUILDDIR/.tested ]] ; then
+ vecho ">>> It appears that ${PN} has already been tested; skipping."
+ vecho ">>> Remove '${PORTAGE_BUILDDIR}/.tested' to force test."
+ return
+ fi
+
+ if [ "${EBUILD_FORCE_TEST}" == "1" ] ; then
+ # If USE came from ${T}/environment then it might not have USE=test
+ # like it's supposed to here.
+ ! has test ${USE} && export USE="${USE} test"
+ fi
+
+ trap "abort_test" SIGINT SIGQUIT
+ if [ -d "${S}" ]; then
+ cd "${S}"
+ else
+ cd "${WORKDIR}"
+ fi
+
+ if ! has test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
+ vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
+ elif has test $RESTRICT; then
+ einfo "Skipping make test/check due to ebuild restriction."
+ vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
+ else
+ local save_sp=${SANDBOX_PREDICT}
+ addpredict /
+ ebuild_phase pre_src_test
+ ebuild_phase src_test
+ >> "$PORTAGE_BUILDDIR/.tested" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.tested"
+ ebuild_phase post_src_test
+ SANDBOX_PREDICT=${save_sp}
+ fi
+
+ trap - SIGINT SIGQUIT
+}
+
+dyn_install() {
+ [ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset"
+ if has noauto $FEATURES ; then
+ rm -f "${PORTAGE_BUILDDIR}/.installed"
+ elif [[ -e $PORTAGE_BUILDDIR/.installed ]] ; then
+ vecho ">>> It appears that '${PF}' is already installed; skipping."
+ vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install."
+ return 0
+ fi
+ trap "abort_install" SIGINT SIGQUIT
+ ebuild_phase pre_src_install
+
+ _x=${ED}
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) _x=${D} ;; esac
+ rm -rf "${D}"
+ mkdir -p "${_x}"
+ unset _x
+
+ if [[ -d $S ]] ; then
+ cd "${S}"
+ elif has $EAPI 0 1 2 3 3_pre2 ; then
+ cd "${WORKDIR}"
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then
+ cd "${WORKDIR}"
+ else
+ die "The source directory '${S}' doesn't exist"
+ fi
+
+ vecho
+ vecho ">>> Install ${PF} into ${D} category ${CATEGORY}"
+ #our custom version of libtool uses $S and $D to fix
+ #invalid paths in .la files
+ export S D
+
+ # Reset exeinto(), docinto(), insinto(), and into() state variables
+ # in case the user is running the install phase multiple times
+ # consecutively via the ebuild command.
+ export DESTTREE=/usr
+ export INSDESTTREE=""
+ export _E_EXEDESTTREE_=""
+ export _E_DOCDESTTREE_=""
+
+ ebuild_phase src_install
+ >> "$PORTAGE_BUILDDIR/.installed" || \
+ die "Failed to create $PORTAGE_BUILDDIR/.installed"
+ vecho ">>> Completed installing ${PF} into ${D}"
+ vecho
+ ebuild_phase post_src_install
+
+ cd "${PORTAGE_BUILDDIR}"/build-info
+ set -f
+ local f x
+ IFS=$' \t\n\r'
+ for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE \
+ PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do
+ x=$(echo -n ${!f})
+ [[ -n $x ]] && echo "$x" > $f
+ done
+ if [[ $CATEGORY != virtual ]] ; then
+ for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \
+ CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
+ LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do
+ x=$(echo -n ${!f})
+ [[ -n $x ]] && echo "$x" > $f
+ done
+ fi
+ echo "${USE}" > USE
+ echo "${EAPI:-0}" > EAPI
+
+ # Save EPREFIX, since it makes it easy to use chpathtool to
+ # adjust the content of a binary package so that it will
+ # work in a different EPREFIX from the one is was built for.
+ case "${EAPI:-0}" in
+ 0|1|2)
+ [[ " ${FEATURES} " == *" force-prefix "* ]] && \
+ [ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX
+ ;;
+ *)
+ [ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX
+ ;;
+ esac
+
+ set +f
+
+ # local variables can leak into the saved environment.
+ unset f
+
+ save_ebuild_env --exclude-init-phases | filter_readonly_variables \
+ --filter-path --filter-sandbox --allow-extra-vars > environment
+ assert "save_ebuild_env failed"
+
+ ${PORTAGE_BZIP2_COMMAND} -f9 environment
+
+ cp "${EBUILD}" "${PF}.ebuild"
+ [ -n "${PORTAGE_REPO_NAME}" ] && echo "${PORTAGE_REPO_NAME}" > repository
+ if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
+ then
+ >> DEBUGBUILD
+ fi
+ trap - SIGINT SIGQUIT
+}
+
+dyn_preinst() {
+ if [ -z "${D}" ]; then
+ eerror "${FUNCNAME}: D is unset"
+ return 1
+ fi
+ ebuild_phase_with_hooks pkg_preinst
+}
+
+dyn_help() {
+ echo
+ echo "Portage"
+ echo "Copyright 1999-2010 Gentoo Foundation"
+ echo
+ echo "How to use the ebuild command:"
+ echo
+ echo "The first argument to ebuild should be an existing .ebuild file."
+ echo
+ echo "One or more of the following options can then be specified. If more"
+ echo "than one option is specified, each will be executed in order."
+ echo
+ echo " help : show this help screen"
+ echo " pretend : execute package specific pretend actions"
+ echo " setup : execute package specific setup actions"
+ echo " fetch : download source archive(s) and patches"
+ echo " digest : create a manifest file for the package"
+ echo " manifest : create a manifest file for the package"
+ echo " unpack : unpack sources (auto-dependencies if needed)"
+ echo " prepare : prepare sources (auto-dependencies if needed)"
+ echo " configure : configure sources (auto-fetch/unpack if needed)"
+ echo " compile : compile sources (auto-fetch/unpack/configure if needed)"
+ echo " test : test package (auto-fetch/unpack/configure/compile if needed)"
+ echo " preinst : execute pre-install instructions"
+ echo " postinst : execute post-install instructions"
+ echo " install : install the package to the temporary install directory"
+ echo " qmerge : merge image into live filesystem, recording files in db"
+ echo " merge : do fetch, unpack, compile, install and qmerge"
+ echo " prerm : execute pre-removal instructions"
+ echo " postrm : execute post-removal instructions"
+ echo " unmerge : remove package from live filesystem"
+ echo " config : execute package specific configuration actions"
+ echo " package : create a tarball package in ${PKGDIR}/All"
+ echo " rpm : build a RedHat RPM package"
+ echo " clean : clean up all source and temporary files"
+ echo
+ echo "The following settings will be used for the ebuild process:"
+ echo
+ echo " package : ${PF}"
+ echo " slot : ${SLOT}"
+ echo " category : ${CATEGORY}"
+ echo " description : ${DESCRIPTION}"
+ echo " system : ${CHOST}"
+ echo " c flags : ${CFLAGS}"
+ echo " c++ flags : ${CXXFLAGS}"
+ echo " make flags : ${MAKEOPTS}"
+ echo -n " build mode : "
+ if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} ;
+ then
+ echo "debug (large)"
+ else
+ echo "production (stripped)"
+ fi
+ echo " merge to : ${ROOT}"
+ echo
+ if [ -n "$USE" ]; then
+ echo "Additionally, support for the following optional features will be enabled:"
+ echo
+ echo " ${USE}"
+ fi
+ echo
+}
+
+# @FUNCTION: _ebuild_arg_to_phase
+# @DESCRIPTION:
+# Translate a known ebuild(1) argument into the precise
+# name of it's corresponding ebuild phase.
+_ebuild_arg_to_phase() {
+ [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
+ local eapi=$1
+ local arg=$2
+ local phase_func=""
+
+ case "$arg" in
+ pretend)
+ ! has $eapi 0 1 2 3 3_pre2 && \
+ phase_func=pkg_pretend
+ ;;
+ setup)
+ phase_func=pkg_setup
+ ;;
+ nofetch)
+ phase_func=pkg_nofetch
+ ;;
+ unpack)
+ phase_func=src_unpack
+ ;;
+ prepare)
+ ! has $eapi 0 1 && \
+ phase_func=src_prepare
+ ;;
+ configure)
+ ! has $eapi 0 1 && \
+ phase_func=src_configure
+ ;;
+ compile)
+ phase_func=src_compile
+ ;;
+ test)
+ phase_func=src_test
+ ;;
+ install)
+ phase_func=src_install
+ ;;
+ preinst)
+ phase_func=pkg_preinst
+ ;;
+ postinst)
+ phase_func=pkg_postinst
+ ;;
+ prerm)
+ phase_func=pkg_prerm
+ ;;
+ postrm)
+ phase_func=pkg_postrm
+ ;;
+ esac
+
+ [[ -z $phase_func ]] && return 1
+ echo "$phase_func"
+ return 0
+}
+
+_ebuild_phase_funcs() {
+ [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
+ local eapi=$1
+ local phase_func=$2
+ local default_phases="pkg_nofetch src_unpack src_prepare src_configure
+ src_compile src_install src_test"
+ local x y default_func=""
+
+ for x in pkg_nofetch src_unpack src_test ; do
+ declare -F $x >/dev/null || \
+ eval "$x() { _eapi0_$x \"\$@\" ; }"
+ done
+
+ case $eapi in
+
+ 0|1)
+
+ if ! declare -F src_compile >/dev/null ; then
+ case $eapi in
+ 0)
+ src_compile() { _eapi0_src_compile "$@" ; }
+ ;;
+ *)
+ src_compile() { _eapi1_src_compile "$@" ; }
+ ;;
+ esac
+ fi
+
+ for x in $default_phases ; do
+ eval "default_$x() {
+ die \"default_$x() is not supported with EAPI='$eapi' during phase $phase_func\"
+ }"
+ done
+
+ eval "default() {
+ die \"default() is not supported with EAPI='$eapi' during phase $phase_func\"
+ }"
+
+ ;;
+
+ *)
+
+ declare -F src_configure >/dev/null || \
+ src_configure() { _eapi2_src_configure "$@" ; }
+
+ declare -F src_compile >/dev/null || \
+ src_compile() { _eapi2_src_compile "$@" ; }
+
+ has $eapi 2 3 3_pre2 || declare -F src_install >/dev/null || \
+ src_install() { _eapi4_src_install "$@" ; }
+
+ if has $phase_func $default_phases ; then
+
+ _eapi2_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; }
+ _eapi2_src_unpack () { _eapi0_src_unpack "$@" ; }
+ _eapi2_src_prepare () { true ; }
+ _eapi2_src_test () { _eapi0_src_test "$@" ; }
+ _eapi2_src_install () { die "$FUNCNAME is not supported" ; }
+
+ for x in $default_phases ; do
+ eval "default_$x() { _eapi2_$x \"\$@\" ; }"
+ done
+
+ eval "default() { _eapi2_$phase_func \"\$@\" ; }"
+
+ case $eapi in
+ 2|3)
+ ;;
+ *)
+ eval "default_src_install() { _eapi4_src_install \"\$@\" ; }"
+ [[ $phase_func = src_install ]] && \
+ eval "default() { _eapi4_$phase_func \"\$@\" ; }"
+ ;;
+ esac
+
+ else
+
+ for x in $default_phases ; do
+ eval "default_$x() {
+ die \"default_$x() is not supported in phase $default_func\"
+ }"
+ done
+
+ eval "default() {
+ die \"default() is not supported with EAPI='$eapi' during phase $phase_func\"
+ }"
+
+ fi
+
+ ;;
+ esac
+}
+
+ebuild_main() {
+
+ # Subshell/helper die support (must export for the die helper).
+ # Since this function is typically executed in a subshell,
+ # setup EBUILD_MASTER_PID to refer to the current $BASHPID,
+ # which seems to give the best results when further
+ # nested subshells call die.
+ export EBUILD_MASTER_PID=$BASHPID
+ trap 'exit 1' SIGTERM
+
+ #a reasonable default for $S
+ [[ -z ${S} ]] && export S=${WORKDIR}/${P}
+
+ if [[ -s $SANDBOX_LOG ]] ; then
+ # We use SANDBOX_LOG to check for sandbox violations,
+ # so we ensure that there can't be a stale log to
+ # interfere with our logic.
+ local x=
+ if [[ -n SANDBOX_ON ]] ; then
+ x=$SANDBOX_ON
+ export SANDBOX_ON=0
+ fi
+
+ rm -f "$SANDBOX_LOG" || \
+ die "failed to remove stale sandbox log: '$SANDBOX_LOG'"
+
+ if [[ -n $x ]] ; then
+ export SANDBOX_ON=$x
+ fi
+ unset x
+ fi
+
+ # Force configure scripts that automatically detect ccache to
+ # respect FEATURES="-ccache".
+ has ccache $FEATURES || export CCACHE_DISABLE=1
+
+ local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+ [[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func"
+ unset phase_func
+
+ source_all_bashrcs
+
+ case ${1} in
+ nofetch)
+ ebuild_phase_with_hooks pkg_nofetch
+ ;;
+ prerm|postrm|postinst|config|info)
+ if has "${1}" config info && \
+ ! declare -F "pkg_${1}" >/dev/null ; then
+ ewarn "pkg_${1}() is not defined: '${EBUILD##*/}'"
+ fi
+ export SANDBOX_ON="0"
+ if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
+ ebuild_phase_with_hooks pkg_${1}
+ else
+ set -x
+ ebuild_phase_with_hooks pkg_${1}
+ set +x
+ fi
+ if [[ $EBUILD_PHASE == postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]]; then
+ # Update environment.bz2 in case installation phases
+ # need to pass some variables to uninstallation phases.
+ save_ebuild_env --exclude-init-phases | \
+ filter_readonly_variables --filter-path \
+ --filter-sandbox --allow-extra-vars \
+ | ${PORTAGE_BZIP2_COMMAND} -c -f9 > "$PORTAGE_UPDATE_ENV"
+ assert "save_ebuild_env failed"
+ fi
+ ;;
+ unpack|prepare|configure|compile|test|clean|install)
+ if [[ ${SANDBOX_DISABLED:-0} = 0 ]] ; then
+ export SANDBOX_ON="1"
+ else
+ export SANDBOX_ON="0"
+ fi
+
+ case "${1}" in
+ configure|compile)
+
+ local x
+ for x in ASFLAGS CCACHE_DIR CCACHE_SIZE \
+ CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do
+ [[ ${!x+set} = set ]] && export $x
+ done
+ unset x
+
+ has distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \
+ [[ ${SANDBOX_WRITE/$DISTCC_DIR} = $SANDBOX_WRITE ]] && \
+ addwrite "$DISTCC_DIR"
+
+ x=LIBDIR_$ABI
+ [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \
+ export PKG_CONFIG_PATH=/usr/${!x}/pkgconfig
+
+ if has noauto $FEATURES && \
+ [[ ! -f $PORTAGE_BUILDDIR/.unpacked ]] ; then
+ echo
+ echo "!!! We apparently haven't unpacked..." \
+ "This is probably not what you"
+ echo "!!! want to be doing... You are using" \
+ "FEATURES=noauto so I'll assume"
+ echo "!!! that you know what you are doing..." \
+ "You have 5 seconds to abort..."
+ echo
+
+ local x
+ for x in 1 2 3 4 5 6 7 8; do
+ LC_ALL=C sleep 0.25
+ done
+
+ sleep 3
+ fi
+
+ cd "$PORTAGE_BUILDDIR"
+ if [ ! -d build-info ] ; then
+ mkdir build-info
+ cp "$EBUILD" "build-info/$PF.ebuild"
+ fi
+
+ #our custom version of libtool uses $S and $D to fix
+ #invalid paths in .la files
+ export S D
+
+ ;;
+ esac
+
+ if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
+ dyn_${1}
+ else
+ set -x
+ dyn_${1}
+ set +x
+ fi
+ export SANDBOX_ON="0"
+ ;;
+ help|pretend|setup|preinst)
+ #pkg_setup needs to be out of the sandbox for tmp file creation;
+ #for example, awking and piping a file in /tmp requires a temp file to be created
+ #in /etc. If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
+ export SANDBOX_ON="0"
+ if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
+ dyn_${1}
+ else
+ set -x
+ dyn_${1}
+ set +x
+ fi
+ ;;
+ _internal_test)
+ ;;
+ *)
+ export SANDBOX_ON="1"
+ echo "Unrecognized arg '${1}'"
+ echo
+ dyn_help
+ exit 1
+ ;;
+ esac
+
+ # Save the env only for relevant phases.
+ if ! has "${1}" clean help info nofetch ; then
+ umask 002
+ save_ebuild_env | filter_readonly_variables \
+ --filter-features > "$T/environment"
+ assert "save_ebuild_env failed"
+ chown portage:portage "$T/environment" &>/dev/null
+ chmod g+w "$T/environment" &>/dev/null
+ fi
+ [[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE"
+ if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
+ [[ ! -s $SANDBOX_LOG ]]
+ "$PORTAGE_BIN_PATH"/ebuild-ipc exit $?
+ fi
+}
diff --git a/portage_with_autodep/bin/phase-helpers.sh b/portage_with_autodep/bin/phase-helpers.sh
new file mode 100755
index 0000000..946520b
--- /dev/null
+++ b/portage_with_autodep/bin/phase-helpers.sh
@@ -0,0 +1,663 @@
+#!/bin/bash
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+export DESTTREE=/usr
+export INSDESTTREE=""
+export _E_EXEDESTTREE_=""
+export _E_DOCDESTTREE_=""
+export INSOPTIONS="-m0644"
+export EXEOPTIONS="-m0755"
+export LIBOPTIONS="-m0644"
+export DIROPTIONS="-m0755"
+export MOPREFIX=${PN}
+declare -a PORTAGE_DOCOMPRESS=( /usr/share/{doc,info,man} )
+declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html )
+
+into() {
+ if [ "$1" == "/" ]; then
+ export DESTTREE=""
+ else
+ export DESTTREE=$1
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if [ ! -d "${ED}${DESTTREE}" ]; then
+ install -d "${ED}${DESTTREE}"
+ local ret=$?
+ if [[ $ret -ne 0 ]] ; then
+ helpers_die "${FUNCNAME[0]} failed"
+ return $ret
+ fi
+ fi
+ fi
+}
+
+insinto() {
+ if [ "$1" == "/" ]; then
+ export INSDESTTREE=""
+ else
+ export INSDESTTREE=$1
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if [ ! -d "${ED}${INSDESTTREE}" ]; then
+ install -d "${ED}${INSDESTTREE}"
+ local ret=$?
+ if [[ $ret -ne 0 ]] ; then
+ helpers_die "${FUNCNAME[0]} failed"
+ return $ret
+ fi
+ fi
+ fi
+}
+
+exeinto() {
+ if [ "$1" == "/" ]; then
+ export _E_EXEDESTTREE_=""
+ else
+ export _E_EXEDESTTREE_="$1"
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then
+ install -d "${ED}${_E_EXEDESTTREE_}"
+ local ret=$?
+ if [[ $ret -ne 0 ]] ; then
+ helpers_die "${FUNCNAME[0]} failed"
+ return $ret
+ fi
+ fi
+ fi
+}
+
+docinto() {
+ if [ "$1" == "/" ]; then
+ export _E_DOCDESTTREE_=""
+ else
+ export _E_DOCDESTTREE_="$1"
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
+ install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+ local ret=$?
+ if [[ $ret -ne 0 ]] ; then
+ helpers_die "${FUNCNAME[0]} failed"
+ return $ret
+ fi
+ fi
+ fi
+}
+
+insopts() {
+ export INSOPTIONS="$@"
+
+ # `install` should never be called with '-s' ...
+ has -s ${INSOPTIONS} && die "Never call insopts() with -s"
+}
+
+diropts() {
+ export DIROPTIONS="$@"
+}
+
+exeopts() {
+ export EXEOPTIONS="$@"
+
+ # `install` should never be called with '-s' ...
+ has -s ${EXEOPTIONS} && die "Never call exeopts() with -s"
+}
+
+libopts() {
+ export LIBOPTIONS="$@"
+
+ # `install` should never be called with '-s' ...
+ has -s ${LIBOPTIONS} && die "Never call libopts() with -s"
+}
+
+docompress() {
+ has "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI"
+
+ local f g
+ if [[ $1 = "-x" ]]; then
+ shift
+ for f; do
+ f=$(strip_duplicate_slashes "${f}"); f=${f%/}
+ [[ ${f:0:1} = / ]] || f="/${f}"
+ for g in "${PORTAGE_DOCOMPRESS_SKIP[@]}"; do
+ [[ ${f} = "${g}" ]] && continue 2
+ done
+ PORTAGE_DOCOMPRESS_SKIP[${#PORTAGE_DOCOMPRESS_SKIP[@]}]=${f}
+ done
+ else
+ for f; do
+ f=$(strip_duplicate_slashes "${f}"); f=${f%/}
+ [[ ${f:0:1} = / ]] || f="/${f}"
+ for g in "${PORTAGE_DOCOMPRESS[@]}"; do
+ [[ ${f} = "${g}" ]] && continue 2
+ done
+ PORTAGE_DOCOMPRESS[${#PORTAGE_DOCOMPRESS[@]}]=${f}
+ done
+ fi
+}
+
+# adds ".keep" files so that dirs aren't auto-cleaned
+keepdir() {
+ dodir "$@"
+ local x
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
+ shift
+ find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
+ | tr "\n" "\0" | \
+ while read -r -d $'\0' ; do
+ >> "$REPLY" || \
+ die "Failed to recursively create .keep files"
+ done
+ else
+ for x in "$@"; do
+ >> "${ED}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
+ die "Failed to create .keep in ${ED}${x}"
+ done
+ fi
+}
+
+
+useq() {
+ has $EBUILD_PHASE prerm postrm || eqawarn \
+ "QA Notice: The 'useq' function is deprecated (replaced by 'use')"
+ use ${1}
+}
+
+usev() {
+ if use ${1}; then
+ echo "${1#!}"
+ return 0
+ fi
+ return 1
+}
+
+use() {
+ local u=$1
+ local found=0
+
+ # if we got something like '!flag', then invert the return value
+ if [[ ${u:0:1} == "!" ]] ; then
+ u=${u:1}
+ found=1
+ fi
+
+ if [[ $EBUILD_PHASE = depend ]] ; then
+ # TODO: Add a registration interface for eclasses to register
+ # any number of phase hooks, so that global scope eclass
+ # initialization can by migrated to phase hooks in new EAPIs.
+ # Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup
+ #if [[ -n $EAPI ]] && ! has "$EAPI" 0 1 2 3 ; then
+ # die "use() called during invalid phase: $EBUILD_PHASE"
+ #fi
+ true
+
+ # Make sure we have this USE flag in IUSE
+ elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then
+ [[ $u =~ $PORTAGE_IUSE ]] || \
+ eqawarn "QA Notice: USE Flag '${u}' not" \
+ "in IUSE for ${CATEGORY}/${PF}"
+ fi
+
+ if has ${u} ${USE} ; then
+ return ${found}
+ else
+ return $((!found))
+ fi
+}
+
+use_with() {
+ if [ -z "$1" ]; then
+ echo "!!! use_with() called without a parameter." >&2
+ echo "!!! use_with <USEFLAG> [<flagname> [value]]" >&2
+ return 1
+ fi
+
+ if ! has "${EAPI:-0}" 0 1 2 3 ; then
+ local UW_SUFFIX=${3+=$3}
+ else
+ local UW_SUFFIX=${3:+=$3}
+ fi
+ local UWORD=${2:-$1}
+
+ if use $1; then
+ echo "--with-${UWORD}${UW_SUFFIX}"
+ else
+ echo "--without-${UWORD}"
+ fi
+ return 0
+}
+
+use_enable() {
+ if [ -z "$1" ]; then
+ echo "!!! use_enable() called without a parameter." >&2
+ echo "!!! use_enable <USEFLAG> [<flagname> [value]]" >&2
+ return 1
+ fi
+
+ if ! has "${EAPI:-0}" 0 1 2 3 ; then
+ local UE_SUFFIX=${3+=$3}
+ else
+ local UE_SUFFIX=${3:+=$3}
+ fi
+ local UWORD=${2:-$1}
+
+ if use $1; then
+ echo "--enable-${UWORD}${UE_SUFFIX}"
+ else
+ echo "--disable-${UWORD}"
+ fi
+ return 0
+}
+
+unpack() {
+ local srcdir
+ local x
+ local y
+ local myfail
+ local eapi=${EAPI:-0}
+ [ -z "$*" ] && die "Nothing passed to the 'unpack' command"
+
+ for x in "$@"; do
+ vecho ">>> Unpacking ${x} to ${PWD}"
+ y=${x%.*}
+ y=${y##*.}
+
+ if [[ ${x} == "./"* ]] ; then
+ srcdir=""
+ elif [[ ${x} == ${DISTDIR%/}/* ]] ; then
+ die "Arguments to unpack() cannot begin with \${DISTDIR}."
+ elif [[ ${x} == "/"* ]] ; then
+ die "Arguments to unpack() cannot be absolute"
+ else
+ srcdir="${DISTDIR}/"
+ fi
+ [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist"
+
+ _unpack_tar() {
+ if [ "${y}" == "tar" ]; then
+ $1 -c -- "$srcdir$x" | tar xof -
+ assert_sigpipe_ok "$myfail"
+ else
+ local cwd_dest=${x##*/}
+ cwd_dest=${cwd_dest%.*}
+ $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail"
+ fi
+ }
+
+ myfail="failure unpacking ${x}"
+ case "${x##*.}" in
+ tar)
+ tar xof "$srcdir$x" || die "$myfail"
+ ;;
+ tgz)
+ tar xozf "$srcdir$x" || die "$myfail"
+ ;;
+ tbz|tbz2)
+ ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof -
+ assert_sigpipe_ok "$myfail"
+ ;;
+ ZIP|zip|jar)
+ # unzip will interactively prompt under some error conditions,
+ # as reported in bug #336285
+ ( set +x ; while true ; do echo n || break ; done ) | \
+ unzip -qo "${srcdir}${x}" || die "$myfail"
+ ;;
+ gz|Z|z)
+ _unpack_tar "gzip -d"
+ ;;
+ bz2|bz)
+ _unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}"
+ ;;
+ 7Z|7z)
+ local my_output
+ my_output="$(7z x -y "${srcdir}${x}")"
+ if [ $? -ne 0 ]; then
+ echo "${my_output}" >&2
+ die "$myfail"
+ fi
+ ;;
+ RAR|rar)
+ unrar x -idq -o+ "${srcdir}${x}" || die "$myfail"
+ ;;
+ LHa|LHA|lha|lzh)
+ lha xfq "${srcdir}${x}" || die "$myfail"
+ ;;
+ a)
+ ar x "${srcdir}${x}" || die "$myfail"
+ ;;
+ deb)
+ # Unpacking .deb archives can not always be done with
+ # `ar`. For instance on AIX this doesn't work out. If
+ # we have `deb2targz` installed, prefer it over `ar` for
+ # that reason. We just make sure on AIX `deb2targz` is
+ # installed.
+ if type -P deb2targz > /dev/null; then
+ y=${x##*/}
+ local created_symlink=0
+ if [ ! "$srcdir$x" -ef "$y" ] ; then
+ # deb2targz always extracts into the same directory as
+ # the source file, so create a symlink in the current
+ # working directory if necessary.
+ ln -sf "$srcdir$x" "$y" || die "$myfail"
+ created_symlink=1
+ fi
+ deb2targz "$y" || die "$myfail"
+ if [ $created_symlink = 1 ] ; then
+ # Clean up the symlink so the ebuild
+ # doesn't inadvertently install it.
+ rm -f "$y"
+ fi
+ mv -f "${y%.deb}".tar.gz data.tar.gz || die "$myfail"
+ else
+ ar x "$srcdir$x" || die "$myfail"
+ fi
+ ;;
+ lzma)
+ _unpack_tar "lzma -d"
+ ;;
+ xz)
+ if has $eapi 0 1 2 ; then
+ vecho "unpack ${x}: file format not recognized. Ignoring."
+ else
+ _unpack_tar "xz -d"
+ fi
+ ;;
+ *)
+ vecho "unpack ${x}: file format not recognized. Ignoring."
+ ;;
+ esac
+ done
+ # Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE
+ # should be preserved.
+ find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \
+ ${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w
+}
+
+econf() {
+ local x
+
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
+
+ _hasg() {
+ local x s=$1
+ shift
+ for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done
+ return 1
+ }
+
+ _hasgq() { _hasg "$@" >/dev/null ; }
+
+ local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+ if [[ -n $phase_func ]] ; then
+ if has "$EAPI" 0 1 ; then
+ [[ $phase_func != src_compile ]] && \
+ eqawarn "QA Notice: econf called in" \
+ "$phase_func instead of src_compile"
+ else
+ [[ $phase_func != src_configure ]] && \
+ eqawarn "QA Notice: econf called in" \
+ "$phase_func instead of src_configure"
+ fi
+ fi
+
+ : ${ECONF_SOURCE:=.}
+ if [ -x "${ECONF_SOURCE}/configure" ]; then
+ if [[ -n $CONFIG_SHELL && \
+ "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then
+ sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
+ die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
+ fi
+ if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then
+ find "${WORKDIR}" -type f '(' \
+ -name config.guess -o -name config.sub ')' -print0 | \
+ while read -r -d $'\0' x ; do
+ vecho " * econf: updating ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}"
+ cp -f "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}"
+ done
+ fi
+
+ # EAPI=4 adds --disable-dependency-tracking to econf
+ if ! has "$EAPI" 0 1 2 3 3_pre2 && \
+ "${ECONF_SOURCE}/configure" --help 2>/dev/null | \
+ grep -q disable-dependency-tracking ; then
+ set -- --disable-dependency-tracking "$@"
+ fi
+
+ # if the profile defines a location to install libs to aside from default, pass it on.
+ # if the ebuild passes in --libdir, they're responsible for the conf_libdir fun.
+ local CONF_LIBDIR LIBDIR_VAR="LIBDIR_${ABI}"
+ if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
+ CONF_LIBDIR=${!LIBDIR_VAR}
+ fi
+ if [[ -n ${CONF_LIBDIR} ]] && ! _hasgq --libdir=\* "$@" ; then
+ export CONF_PREFIX=$(_hasg --exec-prefix=\* "$@")
+ [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(_hasg --prefix=\* "$@")
+ : ${CONF_PREFIX:=${EPREFIX}/usr}
+ CONF_PREFIX=${CONF_PREFIX#*=}
+ [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
+ [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
+ set -- --libdir="$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@"
+ fi
+
+ set -- \
+ --prefix="${EPREFIX}"/usr \
+ ${CBUILD:+--build=${CBUILD}} \
+ --host=${CHOST} \
+ ${CTARGET:+--target=${CTARGET}} \
+ --mandir="${EPREFIX}"/usr/share/man \
+ --infodir="${EPREFIX}"/usr/share/info \
+ --datadir="${EPREFIX}"/usr/share \
+ --sysconfdir="${EPREFIX}"/etc \
+ --localstatedir="${EPREFIX}"/var/lib \
+ "$@" \
+ ${EXTRA_ECONF}
+ vecho "${ECONF_SOURCE}/configure" "$@"
+
+ if ! "${ECONF_SOURCE}/configure" "$@" ; then
+
+ if [ -s config.log ]; then
+ echo
+ echo "!!! Please attach the following file when seeking support:"
+ echo "!!! ${PWD}/config.log"
+ fi
+ die "econf failed"
+ fi
+ elif [ -f "${ECONF_SOURCE}/configure" ]; then
+ die "configure is not executable"
+ else
+ die "no configure script found"
+ fi
+}
+
+einstall() {
+ # CONF_PREFIX is only set if they didn't pass in libdir above.
+ local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
+ [[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ LIBDIR_VAR="LIBDIR_${ABI}"
+ if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
+ CONF_LIBDIR="${!LIBDIR_VAR}"
+ fi
+ unset LIBDIR_VAR
+ if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then
+ EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}"
+ EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})"
+ LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}"
+ unset EI_DESTLIBDIR
+ fi
+
+ if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
+ if [ "${PORTAGE_DEBUG}" == "1" ]; then
+ ${MAKE:-make} -n prefix="${ED}usr" \
+ datadir="${ED}usr/share" \
+ infodir="${ED}usr/share/info" \
+ localstatedir="${ED}var/lib" \
+ mandir="${ED}usr/share/man" \
+ sysconfdir="${ED}etc" \
+ ${LOCAL_EXTRA_EINSTALL} \
+ ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
+ "$@" install
+ fi
+ ${MAKE:-make} prefix="${ED}usr" \
+ datadir="${ED}usr/share" \
+ infodir="${ED}usr/share/info" \
+ localstatedir="${ED}var/lib" \
+ mandir="${ED}usr/share/man" \
+ sysconfdir="${ED}etc" \
+ ${LOCAL_EXTRA_EINSTALL} \
+ ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
+ "$@" install || die "einstall failed"
+ else
+ die "no Makefile found"
+ fi
+}
+
+_eapi0_pkg_nofetch() {
+ [ -z "${SRC_URI}" ] && return
+
+ elog "The following are listed in SRC_URI for ${PN}:"
+ local x
+ for x in $(echo ${SRC_URI}); do
+ elog " ${x}"
+ done
+}
+
+_eapi0_src_unpack() {
+ [[ -n ${A} ]] && unpack ${A}
+}
+
+_eapi0_src_compile() {
+ if [ -x ./configure ] ; then
+ econf
+ fi
+ _eapi2_src_compile
+}
+
+_eapi0_src_test() {
+ # Since we don't want emake's automatic die
+ # support (EAPI 4 and later), and we also don't
+ # want the warning messages that it produces if
+ # we call it in 'nonfatal' mode, we use emake_cmd
+ # to emulate the desired parts of emake behavior.
+ local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
+ if $emake_cmd -j1 check -n &> /dev/null; then
+ vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
+ $emake_cmd -j1 check || \
+ die "Make check failed. See above for details."
+ elif $emake_cmd -j1 test -n &> /dev/null; then
+ vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
+ $emake_cmd -j1 test || \
+ die "Make test failed. See above for details."
+ else
+ vecho ">>> Test phase [none]: ${CATEGORY}/${PF}"
+ fi
+}
+
+_eapi1_src_compile() {
+ _eapi2_src_configure
+ _eapi2_src_compile
+}
+
+_eapi2_src_configure() {
+ if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then
+ econf
+ fi
+}
+
+_eapi2_src_compile() {
+ if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
+ emake || die "emake failed"
+ fi
+}
+
+_eapi4_src_install() {
+ if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
+ emake DESTDIR="${D}" install
+ fi
+
+ if ! declare -p DOCS &>/dev/null ; then
+ local d
+ for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
+ THANKS BUGS FAQ CREDITS CHANGELOG ; do
+ [[ -s "${d}" ]] && dodoc "${d}"
+ done
+ elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then
+ dodoc "${DOCS[@]}"
+ else
+ dodoc ${DOCS}
+ fi
+}
+
+# @FUNCTION: has_version
+# @USAGE: <DEPEND ATOM>
+# @DESCRIPTION:
+# Return true if given package is installed. Otherwise return false.
+# Callers may override the ROOT variable in order to match packages from an
+# alternative ROOT.
+has_version() {
+
+ local eroot
+ case "$EAPI" in
+ 0|1|2)
+ [[ " ${FEATURES} " == *" force-prefix "* ]] && \
+ eroot=${ROOT%/}${EPREFIX}/ || eroot=${ROOT}
+ ;;
+ *)
+ eroot=${ROOT%/}${EPREFIX}/
+ ;;
+ esac
+ if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
+ "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "$1"
+ else
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${eroot}" "$1"
+ fi
+ local retval=$?
+ case "${retval}" in
+ 0|1)
+ return ${retval}
+ ;;
+ *)
+ die "unexpected portageq exit code: ${retval}"
+ ;;
+ esac
+}
+
+# @FUNCTION: best_version
+# @USAGE: <DEPEND ATOM>
+# @DESCRIPTION:
+# Returns the best/most-current match.
+# Callers may override the ROOT variable in order to match packages from an
+# alternative ROOT.
+best_version() {
+
+ local eroot
+ case "$EAPI" in
+ 0|1|2)
+ [[ " ${FEATURES} " == *" force-prefix "* ]] && \
+ eroot=${ROOT%/}${EPREFIX}/ || eroot=${ROOT}
+ ;;
+ *)
+ eroot=${ROOT%/}${EPREFIX}/
+ ;;
+ esac
+ if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
+ "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "$1"
+ else
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" best_version "${eroot}" "$1"
+ fi
+ local retval=$?
+ case "${retval}" in
+ 0|1)
+ return ${retval}
+ ;;
+ *)
+ die "unexpected portageq exit code: ${retval}"
+ ;;
+ esac
+}
diff --git a/portage_with_autodep/bin/portageq b/portage_with_autodep/bin/portageq
index 57a7c39..280fe94 100755
--- a/portage_with_autodep/bin/portageq
+++ b/portage_with_autodep/bin/portageq
@@ -1,5 +1,5 @@
#!/usr/bin/python -O
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
@@ -42,12 +42,15 @@ except ImportError:
del pym_path
from portage import os
+from portage.eapi import eapi_has_repo_deps
from portage.util import writemsg, writemsg_stdout
+from portage.output import colormap
portage.proxy.lazyimport.lazyimport(globals(),
'subprocess',
'_emerge.Package:Package',
'_emerge.RootConfig:RootConfig',
'portage.dbapi._expand_new_virt:expand_new_virt',
+ 'portage._sets.base:InternalPackageSet',
)
def eval_atom_use(atom):
@@ -78,17 +81,18 @@ def eval_atom_use(atom):
#
def has_version(argv):
- """<root> <category/package>
+ """<eroot> <category/package>
Return code 0 if it's available, 1 otherwise.
"""
if (len(argv) < 2):
print("ERROR: insufficient parameters!")
- sys.exit(2)
+ return 2
warnings = []
+ allow_repo = atom_validate_strict is False or eapi_has_repo_deps(eapi)
try:
- atom = portage.dep.Atom(argv[1])
+ atom = portage.dep.Atom(argv[1], allow_repo=allow_repo)
except portage.exception.InvalidAtom:
if atom_validate_strict:
portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
@@ -99,7 +103,7 @@ def has_version(argv):
else:
if atom_validate_strict:
try:
- atom = portage.dep.Atom(argv[1], eapi=eapi)
+ atom = portage.dep.Atom(argv[1], allow_repo=allow_repo, eapi=eapi)
except portage.exception.InvalidAtom as e:
warnings.append(
portage._unicode_decode("QA Notice: %s: %s") % \
@@ -112,11 +116,11 @@ def has_version(argv):
try:
mylist = portage.db[argv[0]]["vartree"].dbapi.match(atom)
if mylist:
- sys.exit(0)
+ return 0
else:
- sys.exit(1)
+ return 1
except KeyError:
- sys.exit(1)
+ return 1
except portage.exception.InvalidAtom:
portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
noiselevel=-1)
@@ -125,17 +129,18 @@ has_version.uses_root = True
def best_version(argv):
- """<root> <category/package>
+ """<eroot> <category/package>
Returns category/package-version (without .ebuild).
"""
if (len(argv) < 2):
print("ERROR: insufficient parameters!")
- sys.exit(2)
+ return 2
warnings = []
+ allow_repo = atom_validate_strict is False or eapi_has_repo_deps(eapi)
try:
- atom = portage.dep.Atom(argv[1])
+ atom = portage.dep.Atom(argv[1], allow_repo=allow_repo)
except portage.exception.InvalidAtom:
if atom_validate_strict:
portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
@@ -146,7 +151,7 @@ def best_version(argv):
else:
if atom_validate_strict:
try:
- atom = portage.dep.Atom(argv[1], eapi=eapi)
+ atom = portage.dep.Atom(argv[1], allow_repo=allow_repo, eapi=eapi)
except portage.exception.InvalidAtom as e:
warnings.append(
portage._unicode_decode("QA Notice: %s: %s") % \
@@ -160,31 +165,31 @@ def best_version(argv):
mylist = portage.db[argv[0]]["vartree"].dbapi.match(atom)
print(portage.best(mylist))
except KeyError:
- sys.exit(1)
+ return 1
best_version.uses_root = True
def mass_best_version(argv):
- """<root> [<category/package>]+
+ """<eroot> [<category/package>]+
Returns category/package-version (without .ebuild).
"""
if (len(argv) < 2):
print("ERROR: insufficient parameters!")
- sys.exit(2)
+ return 2
try:
for pack in argv[1:]:
mylist=portage.db[argv[0]]["vartree"].dbapi.match(pack)
print(pack+":"+portage.best(mylist))
except KeyError:
- sys.exit(1)
+ return 1
mass_best_version.uses_root = True
def metadata(argv):
if (len(argv) < 4):
print("ERROR: insufficient parameters!", file=sys.stderr)
- sys.exit(2)
+ return 2
- root, pkgtype, pkgspec = argv[0:3]
+ eroot, pkgtype, pkgspec = argv[0:3]
metakeys = argv[3:]
type_map = {
"ebuild":"porttree",
@@ -192,20 +197,20 @@ def metadata(argv):
"installed":"vartree"}
if pkgtype not in type_map:
print("Unrecognized package type: '%s'" % pkgtype, file=sys.stderr)
- sys.exit(1)
+ return 1
trees = portage.db
- if os.path.realpath(root) == os.path.realpath(portage.settings["ROOT"]):
- root = portage.settings["ROOT"] # contains the normalized $ROOT
+ repo = portage.dep.dep_getrepo(pkgspec)
+ pkgspec = portage.dep.remove_slot(pkgspec)
try:
- values = trees[root][type_map[pkgtype]].dbapi.aux_get(
- pkgspec, metakeys)
+ values = trees[eroot][type_map[pkgtype]].dbapi.aux_get(
+ pkgspec, metakeys, myrepo=repo)
writemsg_stdout(''.join('%s\n' % x for x in values), noiselevel=-1)
except KeyError:
print("Package not found: '%s'" % pkgspec, file=sys.stderr)
- sys.exit(1)
+ return 1
metadata.__doc__ = """
-<root> <pkgtype> <category/package> [<key>]+
+<eroot> <pkgtype> <category/package> [<key>]+
Returns metadata values for the specified package.
Available keys: %s
""" % ','.join(sorted(x for x in portage.auxdbkeys \
@@ -214,10 +219,10 @@ if not x.startswith('UNUSED_')))
metadata.uses_root = True
def contents(argv):
- """<root> <category/package>
+ """<eroot> <category/package>
List the files that are installed for a given package, with
one file listed on each line. All file names will begin with
- <root>.
+ <eroot>.
"""
if len(argv) != 2:
print("ERROR: expected 2 parameters, got %d!" % len(argv))
@@ -236,11 +241,11 @@ def contents(argv):
contents.uses_root = True
def owners(argv):
- """<root> [<filename>]+
+ """<eroot> [<filename>]+
Given a list of files, print the packages that own the files and which
files belong to each package. Files owned by a package are listed on
the lines below it, indented by a single tab character (\\t). All file
- paths must either start with <root> or be a basename alone.
+ paths must either start with <eroot> or be a basename alone.
Returns 1 if no owners could be found, and 0 otherwise.
"""
if len(argv) < 2:
@@ -249,9 +254,9 @@ def owners(argv):
return 2
from portage import catsplit, dblink
- settings = portage.settings
- root = settings["ROOT"]
- vardb = portage.db[root]["vartree"].dbapi
+ eroot = argv[0]
+ vardb = portage.db[eroot]["vartree"].dbapi
+ root = portage.settings['ROOT']
cwd = None
try:
@@ -272,8 +277,8 @@ def owners(argv):
return 2
f = os.path.join(cwd, f)
f = portage.normalize_path(f)
- if not is_basename and not f.startswith(root):
- sys.stderr.write("ERROR: file paths must begin with <root>!\n")
+ if not is_basename and not f.startswith(eroot):
+ sys.stderr.write("ERROR: file paths must begin with <eroot>!\n")
sys.stderr.flush()
return 2
if is_basename:
@@ -317,9 +322,9 @@ def owners(argv):
owners.uses_root = True
def is_protected(argv):
- """<root> <filename>
+ """<eroot> <filename>
Given a single filename, return code 0 if it's protected, 1 otherwise.
- The filename must begin with <root>.
+ The filename must begin with <eroot>.
"""
if len(argv) != 2:
sys.stderr.write("ERROR: expected 2 parameters, got %d!\n" % len(argv))
@@ -345,7 +350,7 @@ def is_protected(argv):
f = portage.normalize_path(f)
if not f.startswith(root):
- err.write("ERROR: file paths must begin with <root>!\n")
+ err.write("ERROR: file paths must begin with <eroot>!\n")
err.flush()
return 2
@@ -364,9 +369,9 @@ def is_protected(argv):
is_protected.uses_root = True
def filter_protected(argv):
- """<root>
+ """<eroot>
Read filenames from stdin and write them to stdout if they are protected.
- All filenames are delimited by \\n and must begin with <root>.
+ All filenames are delimited by \\n and must begin with <eroot>.
"""
if len(argv) != 1:
sys.stderr.write("ERROR: expected 1 parameter, got %d!\n" % len(argv))
@@ -406,7 +411,7 @@ def filter_protected(argv):
f = portage.normalize_path(f)
if not f.startswith(root):
- err.write("ERROR: file paths must begin with <root>!\n")
+ err.write("ERROR: file paths must begin with <eroot>!\n")
err.flush()
errors += 1
continue
@@ -424,7 +429,7 @@ def filter_protected(argv):
filter_protected.uses_root = True
def best_visible(argv):
- """<root> [pkgtype] <atom>
+ """<eroot> [pkgtype] <atom>
Returns category/package-version (without .ebuild).
The pkgtype argument defaults to "ebuild" if unspecified,
otherwise it must be one of ebuild, binary, or installed.
@@ -450,7 +455,8 @@ def best_visible(argv):
noiselevel=-1)
return 2
- db = portage.db[portage.settings["ROOT"]][type_map[pkgtype]].dbapi
+ eroot = argv[0]
+ db = portage.db[eroot][type_map[pkgtype]].dbapi
try:
atom = portage.dep_expand(atom, mydb=db, settings=portage.settings)
@@ -460,43 +466,80 @@ def best_visible(argv):
return 2
root_config = RootConfig(portage.settings,
- portage.db[portage.settings["ROOT"]], None)
+ portage.db[eroot], None)
- try:
+ if hasattr(db, "xmatch"):
+ cpv_list = db.xmatch("match-all-cpv-only", atom)
+ else:
+ cpv_list = db.match(atom)
+
+ if cpv_list:
# reversed, for descending order
- for cpv in reversed(db.match(atom)):
- metadata = dict(zip(Package.metadata_keys,
- db.aux_get(cpv, Package.metadata_keys, myrepo=atom.repo)))
- pkg = Package(built=(pkgtype != "ebuild"), cpv=cpv,
- installed=(pkgtype=="installed"), metadata=metadata,
- root_config=root_config, type_name=pkgtype)
- if pkg.visible:
- writemsg_stdout("%s\n" % (pkg.cpv,), noiselevel=-1)
- return os.EX_OK
- except KeyError:
- pass
+ cpv_list.reverse()
+ # verify match, since the atom may match the package
+ # for a given cpv from one repo but not another, and
+ # we can use match-all-cpv-only to avoid redundant
+ # metadata access.
+ atom_set = InternalPackageSet(initial_atoms=(atom,))
+
+ if atom.repo is None and hasattr(db, "getRepositories"):
+ repo_list = db.getRepositories()
+ else:
+ repo_list = [atom.repo]
+
+ for cpv in cpv_list:
+ for repo in repo_list:
+ try:
+ metadata = dict(zip(Package.metadata_keys,
+ db.aux_get(cpv, Package.metadata_keys, myrepo=repo)))
+ except KeyError:
+ continue
+ pkg = Package(built=(pkgtype != "ebuild"), cpv=cpv,
+ installed=(pkgtype=="installed"), metadata=metadata,
+ root_config=root_config, type_name=pkgtype)
+ if not atom_set.findAtomForPackage(pkg):
+ continue
+
+ if pkg.visible:
+ writemsg_stdout("%s\n" % (pkg.cpv,), noiselevel=-1)
+ return os.EX_OK
+
+ # No package found, write out an empty line.
+ writemsg_stdout("\n", noiselevel=-1)
+
return 1
best_visible.uses_root = True
def mass_best_visible(argv):
- """<root> [<category/package>]+
+ """<root> [<type>] [<category/package>]+
Returns category/package-version (without .ebuild).
+ The pkgtype argument defaults to "ebuild" if unspecified,
+ otherwise it must be one of ebuild, binary, or installed.
"""
+ type_map = {
+ "ebuild":"porttree",
+ "binary":"bintree",
+ "installed":"vartree"}
+
if (len(argv) < 2):
print("ERROR: insufficient parameters!")
- sys.exit(2)
+ return 2
try:
- for pack in argv[1:]:
- mylist=portage.db[argv[0]]["porttree"].dbapi.match(pack)
- print(pack+":"+portage.best(mylist))
+ root = argv.pop(0)
+ pkgtype = "ebuild"
+ if argv[0] in type_map:
+ pkgtype = argv.pop(0)
+ for pack in argv:
+ writemsg_stdout("%s:" % pack, noiselevel=-1)
+ best_visible([root, pkgtype, pack])
except KeyError:
- sys.exit(1)
+ return 1
mass_best_visible.uses_root = True
def all_best_visible(argv):
- """<root>
+ """<eroot>
Returns all best_visible packages (without .ebuild).
"""
if len(argv) < 1:
@@ -513,30 +556,57 @@ all_best_visible.uses_root = True
def match(argv):
- """<root> <atom>
+ """<eroot> <atom>
Returns a \\n separated list of category/package-version.
When given an empty string, all installed packages will
be listed.
"""
if len(argv) != 2:
print("ERROR: expected 2 parameters, got %d!" % len(argv))
- sys.exit(2)
+ return 2
root, atom = argv
- if atom:
- if atom_validate_strict and not portage.isvalidatom(atom):
- portage.writemsg("ERROR: Invalid atom: '%s'\n" % atom,
- noiselevel=-1)
- return 2
- results = portage.db[root]["vartree"].dbapi.match(atom)
- else:
- results = portage.db[root]["vartree"].dbapi.cpv_all()
+ if not atom:
+ atom = "*/*"
+
+ vardb = portage.db[root]["vartree"].dbapi
+ try:
+ atom = portage.dep.Atom(atom, allow_wildcard=True, allow_repo=True)
+ except portage.exception.InvalidAtom:
+ # maybe it's valid but missing category
+ atom = portage.dep_expand(atom, mydb=vardb, settings=vardb.settings)
+
+ if atom.extended_syntax:
+ if atom == "*/*":
+ results = vardb.cpv_all()
+ else:
+ results = []
+ require_metadata = atom.slot or atom.repo
+ for cpv in vardb.cpv_all():
+
+ if not portage.dep.extended_cp_match(
+ atom.cp, portage.cpv_getkey(cpv)):
+ continue
+
+ if require_metadata:
+ slot, repo = vardb.aux_get(cpv, ["SLOT", "repository"])
+
+ if atom.slot is not None and atom.slot != slot:
+ continue
+
+ if atom.repo is not None and atom.repo != repo:
+ continue
+
+ results.append(cpv)
+
results.sort()
+ else:
+ results = vardb.match(atom)
for cpv in results:
print(cpv)
match.uses_root = True
def expand_virtual(argv):
- """<root> <atom>
+ """<eroot> <atom>
Returns a \\n separated list of atoms expanded from a
given virtual atom (GLEP 37 virtuals only),
excluding blocker atoms. Satisfied
@@ -630,6 +700,13 @@ def distdir(argv):
print(portage.settings["DISTDIR"])
+def colormap(argv):
+ """
+ Display the color.map as environment variables.
+ """
+ print(portage.output.colormap())
+
+
def envvar(argv):
"""<variable>+
Returns a specific environment variable as exists prior to ebuild.sh.
@@ -641,7 +718,7 @@ def envvar(argv):
if len(argv) == 0:
print("ERROR: insufficient parameters!")
- sys.exit(2)
+ return 2
for arg in argv:
if verbose:
@@ -650,29 +727,33 @@ def envvar(argv):
print(portage.settings[arg])
def get_repos(argv):
- """<root>
- Returns all repos with names (repo_name file) argv[0] = $ROOT
+ """<eroot>
+ Returns all repos with names (repo_name file) argv[0] = $EROOT
"""
if len(argv) < 1:
print("ERROR: insufficient parameters!")
- sys.exit(2)
+ return 2
print(" ".join(portage.db[argv[0]]["porttree"].dbapi.getRepositories()))
+get_repos.uses_root = True
+
def get_repo_path(argv):
- """<root> <repo_id>+
- Returns the path to the repo named argv[1], argv[0] = $ROOT
+ """<eroot> <repo_id>+
+ Returns the path to the repo named argv[1], argv[0] = $EROOT
"""
if len(argv) < 2:
print("ERROR: insufficient parameters!")
- sys.exit(2)
+ return 2
for arg in argv[1:]:
path = portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(arg)
if path is None:
path = ""
print(path)
+get_repo_path.uses_root = True
+
def list_preserved_libs(argv):
- """<root>
+ """<eroot>
Print a list of libraries preserved during a package update in the form
package: path. Returns 1 if no preserved libraries could be found,
0 otherwise.
@@ -680,7 +761,7 @@ def list_preserved_libs(argv):
if len(argv) != 1:
print("ERROR: wrong number of arguments")
- sys.exit(2)
+ return 2
mylibs = portage.db[argv[0]]["vartree"].dbapi._plib_registry.getPreservedLibs()
rValue = 1
msg = []
@@ -788,16 +869,22 @@ def main():
sys.stderr.write("Run portageq with --help for info\n")
sys.stderr.flush()
sys.exit(os.EX_USAGE)
- os.environ["ROOT"] = sys.argv[2]
+ eprefix = portage.const.EPREFIX
+ eroot = portage.util.normalize_path(sys.argv[2])
+ if eprefix:
+ root = eroot[:1-len(eprefix)]
+ else:
+ root = eroot
+ os.environ["ROOT"] = root
args = sys.argv[2:]
- if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode):
+ if args and isinstance(args[0], bytes):
for i in range(len(args)):
args[i] = portage._unicode_decode(args[i])
try:
if uses_root:
- args[0] = portage.settings["ROOT"]
+ args[0] = portage.settings['EROOT']
retval = function(args)
if retval:
sys.exit(retval)
diff --git a/portage_with_autodep/bin/quickpkg b/portage_with_autodep/bin/quickpkg
index 09723f5..d908c03 100755
--- a/portage_with_autodep/bin/quickpkg
+++ b/portage_with_autodep/bin/quickpkg
@@ -21,9 +21,9 @@ except ImportError:
from portage import os
from portage import xpak
from portage.dbapi.dep_expand import dep_expand
-from portage.dep import use_reduce
-from portage.exception import InvalidAtom, InvalidData, InvalidDependString, \
- PackageSetNotFound, PermissionDenied
+from portage.dep import Atom, extended_cp_match, use_reduce
+from portage.exception import (AmbiguousPackageName, InvalidAtom, InvalidData,
+ InvalidDependString, PackageSetNotFound, PermissionDenied)
from portage.util import ConfigProtect, ensure_dirs, shlex_split
from portage.dbapi.vartree import dblink, tar_contents
from portage.checksum import perform_md5
@@ -31,8 +31,9 @@ from portage._sets import load_default_config, SETPREFIX
def quickpkg_atom(options, infos, arg, eout):
settings = portage.settings
- root = portage.settings["ROOT"]
- trees = portage.db[root]
+ root = portage.settings['ROOT']
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
vartree = trees["vartree"]
vardb = vartree.dbapi
bintree = trees["bintree"]
@@ -43,7 +44,7 @@ def quickpkg_atom(options, infos, arg, eout):
try:
atom = dep_expand(arg, mydb=vardb, settings=vartree.settings)
- except ValueError as e:
+ except AmbiguousPackageName as e:
# Multiple matches thrown from cpv_expand
eout.eerror("Please use a more specific atom: %s" % \
" ".join(e.args[0]))
@@ -65,10 +66,7 @@ def quickpkg_atom(options, infos, arg, eout):
for cpv in matches:
excluded_config_files = []
bintree.prevent_collision(cpv)
- cat, pkg = portage.catsplit(cpv)
- dblnk = dblink(cat, pkg, root,
- vartree.settings, treetype="vartree",
- vartree=vartree)
+ dblnk = vardb._dblink(cpv)
have_lock = False
try:
dblnk.lockdb()
@@ -101,7 +99,7 @@ def quickpkg_atom(options, infos, arg, eout):
contents = dblnk.getcontents()
protect = None
if not include_config:
- confprot = ConfigProtect(root,
+ confprot = ConfigProtect(eroot,
shlex_split(settings.get("CONFIG_PROTECT", "")),
shlex_split(settings.get("CONFIG_PROTECT_MASK", "")))
def protect(filename):
@@ -161,8 +159,8 @@ def quickpkg_atom(options, infos, arg, eout):
infos["missing"].append(arg)
def quickpkg_set(options, infos, arg, eout):
- root = portage.settings["ROOT"]
- trees = portage.db[root]
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
vartree = trees["vartree"]
settings = vartree.settings
@@ -187,9 +185,43 @@ def quickpkg_set(options, infos, arg, eout):
for atom in atoms:
quickpkg_atom(options, infos, atom, eout)
+
+def quickpkg_extended_atom(options, infos, atom, eout):
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
+ vartree = trees["vartree"]
+ vardb = vartree.dbapi
+
+ require_metadata = atom.slot or atom.repo
+ atoms = []
+ for cpv in vardb.cpv_all():
+ cpv_atom = Atom("=%s" % cpv)
+
+ if atom == "*/*":
+ atoms.append(cpv_atom)
+ continue
+
+ if not extended_cp_match(atom.cp, cpv_atom.cp):
+ continue
+
+ if require_metadata:
+ slot, repo = vardb.aux_get(cpv, ["SLOT", "repository"])
+
+ if atom.slot and atom.slot != slot:
+ continue
+
+ if atom.repo and atom.repo != repo:
+ continue
+
+ atoms.append(cpv_atom)
+
+ for atom in atoms:
+ quickpkg_atom(options, infos, atom, eout)
+
+
def quickpkg_main(options, args, eout):
- root = portage.settings["ROOT"]
- trees = portage.db[root]
+ eroot = portage.settings['EROOT']
+ trees = portage.db[eroot]
bintree = trees["bintree"]
try:
@@ -207,8 +239,17 @@ def quickpkg_main(options, args, eout):
for arg in args:
if arg[0] == SETPREFIX:
quickpkg_set(options, infos, arg, eout)
- else:
+ continue
+ try:
+ atom = Atom(arg, allow_wildcard=True, allow_repo=True)
+ except (InvalidAtom, InvalidData):
+ # maybe it's valid but missing category (requires dep_expand)
quickpkg_atom(options, infos, arg, eout)
+ else:
+ if atom.extended_syntax:
+ quickpkg_extended_atom(options, infos, atom, eout)
+ else:
+ quickpkg_atom(options, infos, atom, eout)
if not infos["successes"]:
eout.eerror("No packages found")
diff --git a/portage_with_autodep/bin/regenworld b/portage_with_autodep/bin/regenworld
index 6b5af4c..3199fdf 100755
--- a/portage_with_autodep/bin/regenworld
+++ b/portage_with_autodep/bin/regenworld
@@ -47,7 +47,6 @@ def isunwanted(pkgline):
__uniqlist__.append(pkgline)
return True
-root = portage.settings['ROOT']
eroot = portage.settings['EROOT']
world_file = os.path.join(eroot, portage.WORLD_FILE)
@@ -78,7 +77,7 @@ for mykey in syslist:
# drop the asterix
mykey = mykey[1:]
#print("candidate:",mykey)
- mylist = portage.db[root]["vartree"].dbapi.match(mykey)
+ mylist = portage.db[eroot]["vartree"].dbapi.match(mykey)
if mylist:
mykey=portage.cpv_getkey(mylist[0])
if mykey not in realsyslist:
@@ -87,7 +86,7 @@ for mykey in syslist:
for mykey in biglist:
#print("checking:",mykey)
try:
- mylist = portage.db[root]["vartree"].dbapi.match(mykey)
+ mylist = portage.db[eroot]["vartree"].dbapi.match(mykey)
except (portage.exception.InvalidAtom, KeyError):
if "--debug" in sys.argv:
print("* ignoring broken log entry for %s (likely injected)" % mykey)
diff --git a/portage_with_autodep/bin/repoman b/portage_with_autodep/bin/repoman
index f1fbc24..fd87847 100755
--- a/portage_with_autodep/bin/repoman
+++ b/portage_with_autodep/bin/repoman
@@ -1,5 +1,5 @@
#!/usr/bin/python -O
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Next to do: dep syntax checking in mask files
@@ -18,8 +18,10 @@ import optparse
import re
import signal
import stat
+import subprocess
import sys
import tempfile
+import textwrap
import time
import platform
@@ -43,7 +45,7 @@ portage.dep._internal_warnings = True
try:
import xml.etree.ElementTree
from xml.parsers.expat import ExpatError
-except ImportError:
+except (ImportError, SystemError):
msg = ["Please enable python's \"xml\" USE flag in order to use repoman."]
from portage.output import EOutput
out = EOutput()
@@ -67,16 +69,16 @@ from portage import cvstree, normalize_path
from portage import util
from portage.exception import (FileNotFound, MissingParameter,
ParseError, PermissionDenied)
-from portage.manifest import Manifest
+from portage.manifest import _prohibited_filename_chars_re as \
+ disallowed_filename_chars_re
from portage.process import find_binary, spawn
from portage.output import bold, create_color_func, \
green, nocolor, red
from portage.output import ConsoleStyleFile, StyleWriter
-from portage.util import cmp_sort_key, writemsg_level
+from portage.util import writemsg_level
+from portage.util._desktop_entry import validate_desktop_entry
from portage.package.ebuild.digestgen import digestgen
-from portage.eapi import eapi_has_slot_deps, \
- eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_iuse_defaults, \
- eapi_has_required_use, eapi_has_use_dep_defaults
+from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
if sys.hexversion >= 0x3000000:
basestring = str
@@ -86,7 +88,6 @@ util.initialize_logger()
# 14 is the length of DESCRIPTION=""
max_desc_len = 100
allowed_filename_chars="a-zA-Z0-9._-+:"
-disallowed_filename_chars_re = re.compile(r'[^a-zA-Z0-9._\-+:]')
pv_toolong_re = re.compile(r'[0-9]{19,}')
bad = create_color_func("BAD")
@@ -96,8 +97,8 @@ os.umask(0o22)
# behave incrementally.
repoman_incrementals = tuple(x for x in \
portage.const.INCREMENTALS if x != 'ACCEPT_KEYWORDS')
-repoman_settings = portage.config(local_config=False)
-repoman_settings.lock()
+config_root = os.environ.get("PORTAGE_CONFIGROOT")
+repoman_settings = portage.config(config_root=config_root, local_config=False)
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
repoman_settings.get('TERM') == 'dumb' or \
@@ -156,7 +157,7 @@ def ParseArgs(argv, qahelp):
(opts, args), just like a call to parser.parse_args()
"""
- if argv and sys.hexversion < 0x3000000 and not isinstance(argv[0], unicode):
+ if argv and isinstance(argv[0], bytes):
argv = [portage._unicode_decode(x) for x in argv]
modes = {
@@ -188,12 +189,21 @@ def ParseArgs(argv, qahelp):
parser.add_option('-M', '--commitmsgfile', dest='commitmsgfile',
help='specify a path to a file that contains a commit message')
+ parser.add_option('--digest',
+ type='choice', choices=('y', 'n'), metavar='<y|n>',
+ help='Automatically update Manifest digests for modified files')
+
parser.add_option('-p', '--pretend', dest='pretend', default=False,
action='store_true', help='don\'t commit or fix anything; just show what would be done')
parser.add_option('-q', '--quiet', dest="quiet", action="count", default=0,
help='do not print unnecessary messages')
+ parser.add_option(
+ '--echangelog', type='choice', choices=('y', 'n', 'force'), metavar="<y|n|force>",
+ help='for commit mode, call echangelog if ChangeLog is unmodified (or '
+ 'regardless of modification if \'force\' is specified)')
+
parser.add_option('-f', '--force', dest='force', default=False, action='store_true',
help='Commit with QA violations')
@@ -209,9 +219,18 @@ def ParseArgs(argv, qahelp):
parser.add_option('-x', '--xmlparse', dest='xml_parse', action='store_true',
default=False, help='forces the metadata.xml parse check to be carried out')
+ parser.add_option(
+ '--if-modified', type='choice', choices=('y', 'n'), default='n',
+ metavar="<y|n>",
+ help='only check packages that have uncommitted modifications')
+
parser.add_option('-i', '--ignore-arches', dest='ignore_arches', action='store_true',
default=False, help='ignore arch-specific failures (where arch != host)')
+ parser.add_option("--ignore-default-opts",
+ action="store_true",
+ help="do not use the REPOMAN_DEFAULT_OPTS environment variable")
+
parser.add_option('-I', '--ignore-masked', dest='ignore_masked', action='store_true',
default=False, help='ignore masked packages (not allowed with commit mode)')
@@ -241,6 +260,11 @@ def ParseArgs(argv, qahelp):
opts, args = parser.parse_args(argv[1:])
+ if not opts.ignore_default_opts:
+ default_opts = repoman_settings.get("REPOMAN_DEFAULT_OPTS", "").split()
+ if default_opts:
+ opts, args = parser.parse_args(default_opts + sys.argv[1:])
+
if opts.mode == 'help':
parser.print_help(short=False)
@@ -285,8 +309,8 @@ qahelp={
"ebuild.notadded":"Ebuilds that exist but have not been added to cvs",
"ebuild.patches":"PATCHES variable should be a bash array to ensure white space safety",
"changelog.notadded":"ChangeLogs that exist but have not been added to cvs",
- "dependency.unknown" : "Ebuild has a dependency that refers to an unknown package (which may be provided by an overlay)",
- "file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit",
+ "dependency.unknown" : "Ebuild has a dependency that refers to an unknown package (which may be valid if it is a blocker for a renamed/removed package, or is an alternative choice provided by an overlay)",
+ "file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need the executable bit",
"file.size":"Files in the files directory must be under 20 KiB",
"file.size.fatal":"Files in the files directory must be under 60 KiB",
"file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars,
@@ -303,7 +327,7 @@ qahelp={
"LICENSE.virtual":"Virtuals that have a non-empty LICENSE variable",
"DESCRIPTION.missing":"Ebuilds that have a missing or empty DESCRIPTION variable",
"DESCRIPTION.toolong":"DESCRIPTION is over %d characters" % max_desc_len,
- "EAPI.definition":"EAPI is defined after an inherit call (must be defined before)",
+ "EAPI.definition":"EAPI definition does not conform to PMS section 7.3.1 (first non-comment, non-blank line)",
"EAPI.deprecated":"Ebuilds that use features that are deprecated in the current EAPI",
"EAPI.incompatible":"Ebuilds that use features that are only available with a different EAPI",
"EAPI.unsupported":"Ebuilds that have an unsupported EAPI version (you must upgrade portage)",
@@ -355,8 +379,6 @@ qahelp={
"digest.assumed":"Existing digest must be assumed correct (Package level only)",
"digest.missing":"Some files listed in SRC_URI aren't referenced in the Manifest",
"digest.unused":"Some files listed in the Manifest aren't referenced in SRC_URI",
- "ebuild.nostable":"There are no ebuilds that are marked as stable for your ARCH",
- "ebuild.allmasked":"All ebuilds are masked for this package (Package level only)",
"ebuild.majorsyn":"This ebuild has a major syntax error that may cause the ebuild to fail partially or fully",
"ebuild.minorsyn":"This ebuild has a minor syntax error that contravenes gentoo coding style",
"ebuild.badheader":"This ebuild has a malformed header",
@@ -381,8 +403,6 @@ qawarnings = set((
"digest.assumed",
"digest.unused",
"ebuild.notadded",
-"ebuild.nostable",
-"ebuild.allmasked",
"ebuild.nesteddie",
"desktop.invalid",
"DEPEND.badmasked","RDEPEND.badmasked","PDEPEND.badmasked",
@@ -401,7 +421,6 @@ qawarnings = set((
"RDEPEND.implicit",
"RDEPEND.suspect",
"RESTRICT.invalid",
-"SRC_URI.mirror",
"ebuild.minorsyn",
"ebuild.badheader",
"ebuild.patches",
@@ -414,7 +433,6 @@ qawarnings = set((
"portage.internal",
"usage.obsolete",
"upstream.workaround",
-"virtual.oldstyle",
"LIVEVCS.stable",
"LIVEVCS.unmasked",
))
@@ -524,14 +542,13 @@ else:
else:
vcs = None
-# Note: We don't use ChangeLogs in distributed SCMs.
-# It will be generated on server side from scm log,
-# before package moves to the rsync server.
-# This is needed because we try to avoid merge collisions.
-check_changelog = vcs in ('cvs', 'svn')
+if options.if_modified == "y" and vcs is None:
+ logging.info("Not in a version controlled repository; "
+ "disabling --if-modified.")
+ options.if_modified = "n"
# Disable copyright/mtime check if vcs does not preserve mtime (bug #324075).
-vcs_preserves_mtime = vcs not in ('git',)
+vcs_preserves_mtime = vcs in ('cvs',)
vcs_local_opts = repoman_settings.get("REPOMAN_VCS_LOCAL_OPTS", "").split()
vcs_global_opts = repoman_settings.get("REPOMAN_VCS_GLOBAL_OPTS")
@@ -542,50 +559,115 @@ if vcs_global_opts is None:
vcs_global_opts = ""
vcs_global_opts = vcs_global_opts.split()
-if vcs == "cvs" and \
- "commit" == options.mode and \
- "RMD160" not in portage.checksum.hashorigin_map:
- from portage.util import grablines
- repo_lines = grablines("./CVS/Repository")
- if repo_lines and \
- "gentoo-x86" == repo_lines[0].strip().split(os.path.sep)[0]:
- msg = "Please install " \
- "pycrypto or enable python's ssl USE flag in order " \
- "to enable RMD160 hash support. See bug #198398 for " \
- "more information."
- prefix = bad(" * ")
- from textwrap import wrap
- for line in wrap(msg, 70):
- print(prefix + line)
- sys.exit(1)
- del repo_lines
-
if options.mode == 'commit' and not options.pretend and not vcs:
logging.info("Not in a version controlled repository; enabling pretend mode.")
options.pretend = True
# Ensure that PORTDIR_OVERLAY contains the repository corresponding to $PWD.
-repoman_settings = portage.config(local_config=False)
repoman_settings['PORTDIR_OVERLAY'] = "%s %s" % \
- (repoman_settings.get('PORTDIR_OVERLAY', ''), portdir_overlay)
+ (repoman_settings.get('PORTDIR_OVERLAY', ''),
+ portage._shell_quote(portdir_overlay))
# We have to call the config constructor again so
# that config.repositories is initialized correctly.
-repoman_settings = portage.config(local_config=False, env=dict(os.environ,
- PORTDIR_OVERLAY=repoman_settings['PORTDIR_OVERLAY']))
+repoman_settings = portage.config(config_root=config_root, local_config=False,
+ env=dict(os.environ, PORTDIR_OVERLAY=repoman_settings['PORTDIR_OVERLAY']))
-root = '/'
+root = repoman_settings['EROOT']
trees = {
- root : {'porttree' : portage.portagetree(root, settings=repoman_settings)}
+ root : {'porttree' : portage.portagetree(settings=repoman_settings)}
}
portdb = trees[root]['porttree'].dbapi
# Constrain dependency resolution to the master(s)
# that are specified in layout.conf.
-portdir_overlay = os.path.realpath(portdir_overlay)
-repo_info = portdb._repo_info[portdir_overlay]
-portdb.porttrees = list(repo_info.eclass_db.porttrees)
+repodir = os.path.realpath(portdir_overlay)
+repo_config = repoman_settings.repositories.get_repo_for_location(repodir)
+portdb.porttrees = list(repo_config.eclass_db.porttrees)
portdir = portdb.porttrees[0]
+if repo_config.allow_provide_virtual:
+ qawarnings.add("virtual.oldstyle")
+
+if repo_config.sign_commit:
+ if vcs == 'git':
+ # NOTE: It's possible to use --gpg-sign=key_id to specify the key in
+ # the commit arguments. If key_id is unspecified, then it must be
+ # configured by `git config user.signingkey key_id`.
+ vcs_local_opts.append("--gpg-sign")
+
+# In order to disable manifest signatures, repos may set
+# "sign-manifests = false" in metadata/layout.conf. This
+# can be used to prevent merge conflicts like those that
+# thin-manifests is designed to prevent.
+sign_manifests = "sign" in repoman_settings.features and \
+ repo_config.sign_manifest
+
+manifest_hashes = repo_config.manifest_hashes
+if manifest_hashes is None:
+ manifest_hashes = portage.const.MANIFEST2_HASH_DEFAULTS
+
+if options.mode in ("commit", "fix", "manifest"):
+ if portage.const.MANIFEST2_REQUIRED_HASH not in manifest_hashes:
+ msg = ("The 'manifest-hashes' setting in the '%s' repository's "
+ "metadata/layout.conf does not contain the '%s' hash which "
+ "is required by this portage version. You will have to "
+ "upgrade portage if you want to generate valid manifests for "
+ "this repository.") % \
+ (repo_config.name, portage.const.MANIFEST2_REQUIRED_HASH)
+ for line in textwrap.wrap(msg, 70):
+ logging.error(line)
+ sys.exit(1)
+
+ unsupported_hashes = manifest_hashes.difference(
+ portage.const.MANIFEST2_HASH_FUNCTIONS)
+ if unsupported_hashes:
+ msg = ("The 'manifest-hashes' setting in the '%s' repository's "
+ "metadata/layout.conf contains one or more hash types '%s' "
+ "which are not supported by this portage version. You will "
+ "have to upgrade portage if you want to generate valid "
+ "manifests for this repository.") % \
+ (repo_config.name, " ".join(sorted(unsupported_hashes)))
+ for line in textwrap.wrap(msg, 70):
+ logging.error(line)
+ sys.exit(1)
+
+if "commit" == options.mode and \
+ repo_config.name == "gentoo" and \
+ "RMD160" in manifest_hashes and \
+ "RMD160" not in portage.checksum.hashorigin_map:
+ msg = "Please install " \
+ "pycrypto or enable python's ssl USE flag in order " \
+ "to enable RMD160 hash support. See bug #198398 for " \
+ "more information."
+ prefix = bad(" * ")
+ for line in textwrap.wrap(msg, 70):
+ print(prefix + line)
+ sys.exit(1)
+
+if options.echangelog is None and repo_config.update_changelog:
+ options.echangelog = 'y'
+
+if vcs is None:
+ options.echangelog = 'n'
+
+# The --echangelog option causes automatic ChangeLog generation,
+# which invalidates changelog.ebuildadded and changelog.missing
+# checks.
+# Note: Some don't use ChangeLogs in distributed SCMs.
+# It will be generated on server side from scm log,
+# before package moves to the rsync server.
+# This is needed because they try to avoid merge collisions.
+# Gentoo's Council decided to always use the ChangeLog file.
+# TODO: shouldn't this just be switched on the repo, iso the VCS?
+check_changelog = options.echangelog not in ('y', 'force') and vcs in ('cvs', 'svn')
+
+if 'digest' in repoman_settings.features and options.digest != 'n':
+ options.digest = 'y'
+
+logging.debug("vcs: %s" % (vcs,))
+logging.debug("repo config: %s" % (repo_config,))
+logging.debug("options: %s" % (options,))
+
# Generate an appropriate PORTDIR_OVERLAY value for passing into the
# profile-specific config constructor calls.
env = os.environ.copy()
@@ -601,19 +683,19 @@ logging.info('PORTDIR_OVERLAY = "%s"' % env['PORTDIR_OVERLAY'])
env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
categories = []
-for path in set([portdir, portdir_overlay]):
+for path in repo_config.eclass_db.porttrees:
categories.extend(portage.util.grabfile(
os.path.join(path, 'profiles', 'categories')))
-repoman_settings.categories = tuple(sorted(
- portage.util.stack_lists([categories], incremental=1)))
-del categories
+repoman_settings.categories = frozenset(
+ portage.util.stack_lists([categories], incremental=1))
+categories = repoman_settings.categories
portdb.settings = repoman_settings
root_config = RootConfig(repoman_settings, trees[root], None)
# We really only need to cache the metadata that's necessary for visibility
# filtering. Anything else can be discarded to reduce memory consumption.
portdb._aux_cache_keys.clear()
-portdb._aux_cache_keys.update(["EAPI", "KEYWORDS", "SLOT"])
+portdb._aux_cache_keys.update(["EAPI", "IUSE", "KEYWORDS", "repository", "SLOT"])
reposplit = myreporoot.split(os.path.sep)
repolevel = len(reposplit)
@@ -628,11 +710,13 @@ if options.mode == 'commit' and repolevel not in [1,2,3]:
print(red("***"))
err("Unable to identify level we're commiting from for %s" % '/'.join(reposplit))
-startdir = normalize_path(mydir)
-repodir = startdir
-for x in range(0, repolevel - 1):
- repodir = os.path.dirname(repodir)
-repodir = os.path.realpath(repodir)
+# Make startdir relative to the canonical repodir, so that we can pass
+# it to digestgen and it won't have to be canonicalized again.
+if repolevel == 1:
+ startdir = repodir
+else:
+ startdir = normalize_path(mydir)
+ startdir = os.path.join(repodir, *startdir.split(os.sep)[-2-repolevel+3:])
def caterror(mycat):
err(mycat+" is not an official category. Skipping QA checks in this directory.\nPlease ensure that you add "+catdir+" to "+repodir+"/profiles/categories\nif it is a new category.")
@@ -792,7 +876,7 @@ scanlist=[]
if repolevel==2:
#we are inside a category directory
catdir=reposplit[-1]
- if catdir not in repoman_settings.categories:
+ if catdir not in categories:
caterror(catdir)
mydirlist=os.listdir(startdir)
for x in mydirlist:
@@ -802,7 +886,7 @@ if repolevel==2:
scanlist.append(catdir+"/"+x)
repo_subdir = catdir + os.sep
elif repolevel==1:
- for x in repoman_settings.categories:
+ for x in categories:
if not os.path.isdir(startdir+"/"+x):
continue
for y in os.listdir(startdir+"/"+x):
@@ -813,7 +897,7 @@ elif repolevel==1:
repo_subdir = ""
elif repolevel==3:
catdir = reposplit[-2]
- if catdir not in repoman_settings.categories:
+ if catdir not in categories:
caterror(catdir)
scanlist.append(catdir+"/"+reposplit[-1])
repo_subdir = scanlist[-1] + os.sep
@@ -828,6 +912,53 @@ scanlist.sort()
logging.debug("Found the following packages to scan:\n%s" % '\n'.join(scanlist))
+def vcs_files_to_cps(vcs_file_iter):
+ """
+ Iterate over the given modified file paths returned from the vcs,
+ and return a frozenset containing category/pn strings for each
+ modified package.
+ """
+
+ modified_cps = []
+
+ if repolevel == 3:
+ if reposplit[-2] in categories and \
+ next(vcs_file_iter, None) is not None:
+ modified_cps.append("/".join(reposplit[-2:]))
+
+ elif repolevel == 2:
+ category = reposplit[-1]
+ if category in categories:
+ for filename in vcs_file_iter:
+ f_split = filename.split(os.sep)
+ # ['.', pn,...]
+ if len(f_split) > 2:
+ modified_cps.append(category + "/" + f_split[1])
+
+ else:
+ # repolevel == 1
+ for filename in vcs_file_iter:
+ f_split = filename.split(os.sep)
+ # ['.', category, pn,...]
+ if len(f_split) > 3 and f_split[1] in categories:
+ modified_cps.append("/".join(f_split[1:3]))
+
+ return frozenset(modified_cps)
+
+def git_supports_gpg_sign():
+ status, cmd_output = \
+ subprocess_getstatusoutput("git --version")
+ cmd_output = cmd_output.split()
+ if cmd_output:
+ version = re.match(r'^(\d+)\.(\d+)\.(\d+)', cmd_output[-1])
+ if version is not None:
+ version = [int(x) for x in version.groups()[1:]]
+ if version[0] > 1 or \
+ (version[0] == 1 and version[1] > 7) or \
+ (version[0] == 1 and version[1] == 7 and version[2] >= 9):
+ return True
+ return False
+
def dev_keywords(profiles):
"""
Create a set of KEYWORDS values that exist in 'dev'
@@ -896,7 +1027,7 @@ def fetch_metadata_dtd():
Fetch metadata.dtd if it doesn't exist or the ctime is older than
metadata_dtd_ctime_interval.
@rtype: bool
- @returns: True if successful, otherwise False
+ @return: True if successful, otherwise False
"""
must_fetch = True
@@ -995,25 +1126,51 @@ if vcs == "cvs":
mycvstree = cvstree.getentries("./", recursive=1)
mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./")
mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./")
-if vcs == "svn":
- svnstatus = os.popen("svn status").readlines()
+ if options.if_modified == "y":
+ myremoved = cvstree.findremoved(mycvstree, recursive=1, basedir="./")
+
+elif vcs == "svn":
+ with os.popen("svn status") as f:
+ svnstatus = f.readlines()
mychanged = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem and elem[:1] in "MR" ]
mynew = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("A") ]
+ if options.if_modified == "y":
+ myremoved = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("D")]
+
elif vcs == "git":
- mychanged = os.popen("git diff-index --name-only --relative --diff-filter=M HEAD").readlines()
+ with os.popen("git diff-index --name-only "
+ "--relative --diff-filter=M HEAD") as f:
+ mychanged = f.readlines()
mychanged = ["./" + elem[:-1] for elem in mychanged]
- mynew = os.popen("git diff-index --name-only --relative --diff-filter=A HEAD").readlines()
+ with os.popen("git diff-index --name-only "
+ "--relative --diff-filter=A HEAD") as f:
+ mynew = f.readlines()
mynew = ["./" + elem[:-1] for elem in mynew]
+ if options.if_modified == "y":
+ with os.popen("git diff-index --name-only "
+ "--relative --diff-filter=D HEAD") as f:
+ myremoved = f.readlines()
+ myremoved = ["./" + elem[:-1] for elem in myremoved]
+
elif vcs == "bzr":
- bzrstatus = os.popen("bzr status -S .").readlines()
+ with os.popen("bzr status -S .") as f:
+ bzrstatus = f.readlines()
mychanged = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and elem[1:2] == "M" ]
mynew = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and ( elem[1:2] == "NK" or elem[0:1] == "R" ) ]
+ if options.if_modified == "y":
+ myremoved = [ "./" + elem.split()[-3:-2][0].split('/')[-1:][0] for elem in bzrstatus if elem and ( elem[1:2] == "K" or elem[0:1] == "R" ) ]
+
elif vcs == "hg":
- mychanged = os.popen("hg status --no-status --modified .").readlines()
+ with os.popen("hg status --no-status --modified .") as f:
+ mychanged = f.readlines()
mychanged = ["./" + elem.rstrip() for elem in mychanged]
mynew = os.popen("hg status --no-status --added .").readlines()
mynew = ["./" + elem.rstrip() for elem in mynew]
+ if options.if_modified == "y":
+ with os.popen("hg status --no-status --removed .") as f:
+ myremoved = f.readlines()
+ myremoved = ["./" + elem.rstrip() for elem in myremoved]
if vcs:
new_ebuilds.update(x for x in mynew if x.endswith(".ebuild"))
@@ -1021,9 +1178,18 @@ if vcs:
modified_changelogs.update(x for x in chain(mychanged, mynew) \
if os.path.basename(x) == "ChangeLog")
+def vcs_new_changed(relative_path):
+ for x in chain(mychanged, mynew):
+ if x == relative_path:
+ return True
+ return False
+
have_pmasked = False
have_dev_keywords = False
dofail = 0
+
+# NOTE: match-all caches are not shared due to potential
+# differences between profiles in _get_implicit_iuse.
arch_caches={}
arch_xmatch_caches = {}
shared_xmatch_caches = {"cp-list":{}}
@@ -1037,7 +1203,10 @@ check_ebuild_notadded = not \
# Build a regex from thirdpartymirrors for the SRC_URI.mirror check.
thirdpartymirrors = []
for v in repoman_settings.thirdpartymirrors().values():
- thirdpartymirrors.extend(v)
+ for v in v:
+ if not v.endswith("/"):
+ v += "/"
+ thirdpartymirrors.append(v)
class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
"""
@@ -1056,9 +1225,16 @@ except FileNotFound:
# disable for non-gentoo repoman users who may not have herds.
herd_base = None
-for x in scanlist:
+effective_scanlist = scanlist
+if options.if_modified == "y":
+ effective_scanlist = sorted(vcs_files_to_cps(
+ chain(mychanged, mynew, myremoved)))
+
+for x in effective_scanlist:
#ebuilds and digests added to cvs respectively.
logging.info("checking package %s" % x)
+ # save memory by discarding xmatch caches from previous package(s)
+ arch_xmatch_caches.clear()
eadded=[]
catdir,pkgdir=x.split("/")
checkdir=repodir+"/"+x
@@ -1071,8 +1247,7 @@ for x in scanlist:
generated_manifest = False
if options.mode == "manifest" or \
- (options.mode != 'manifest-check' and \
- 'digest' in repoman_settings.features) or \
+ (options.mode != 'manifest-check' and options.digest == 'y') or \
options.mode in ('commit', 'fix') and not options.pretend:
auto_assumed = set()
fetchlist_dict = portage.FetchlistDict(checkdir,
@@ -1081,7 +1256,9 @@ for x in scanlist:
portage._doebuild_manifest_exempt_depend += 1
try:
distdir = repoman_settings['DISTDIR']
- mf = portage.manifest.Manifest(checkdir, distdir,
+ mf = repoman_settings.repositories.get_repo_for_location(
+ os.path.dirname(os.path.dirname(checkdir)))
+ mf = mf.load_manifest(checkdir, distdir,
fetchlist_dict=fetchlist_dict)
mf.create(requiredDistfiles=None,
assumeDistHashesAlways=True)
@@ -1175,17 +1352,6 @@ for x in scanlist:
pkgs[pf] = Package(cpv=cpv, metadata=myaux,
root_config=root_config, type_name="ebuild")
- # Sort ebuilds in ascending order for the KEYWORDS.dropped check.
- pkgsplits = {}
- for i in range(len(ebuildlist)):
- ebuild_split = portage.pkgsplit(ebuildlist[i])
- pkgsplits[ebuild_split] = ebuildlist[i]
- ebuildlist[i] = ebuild_split
- ebuildlist.sort(key=cmp_sort_key(portage.pkgcmp))
- for i in range(len(ebuildlist)):
- ebuildlist[i] = pkgsplits[ebuildlist[i]]
- del pkgsplits
-
slot_keywords = {}
if len(pkgs) != len(ebuildlist):
@@ -1197,20 +1363,34 @@ for x in scanlist:
can_force = False
continue
+ # Sort ebuilds in ascending order for the KEYWORDS.dropped check.
+ ebuildlist = sorted(pkgs.values())
+ ebuildlist = [pkg.pf for pkg in ebuildlist]
+
for y in checkdirlist:
m = disallowed_filename_chars_re.search(y.strip(os.sep))
if m is not None:
+ y_relative = os.path.join(checkdir_relative, y)
+ if vcs is not None and not vcs_new_changed(y_relative):
+ # If the file isn't in the VCS new or changed set, then
+ # assume that it's an irrelevant temporary file (Manifest
+ # entries are not generated for file names containing
+ # prohibited characters). See bug #406877.
+ m = None
+ if m is not None:
stats["file.name"] += 1
fails["file.name"].append("%s/%s: char '%s'" % \
(checkdir, y, m.group(0)))
if not (y in ("ChangeLog", "metadata.xml") or y.endswith(".ebuild")):
continue
+ f = None
try:
line = 1
- for l in io.open(_unicode_encode(os.path.join(checkdir, y),
+ f = io.open(_unicode_encode(os.path.join(checkdir, y),
encoding=_encodings['fs'], errors='strict'),
- mode='r', encoding=_encodings['repo.content']):
+ mode='r', encoding=_encodings['repo.content'])
+ for l in f:
line +=1
except UnicodeDecodeError as ue:
stats["file.UTF8"] += 1
@@ -1220,6 +1400,9 @@ for x in scanlist:
if l2 != 0:
s = s[s.rfind("\n") + 1:]
fails["file.UTF8"].append("%s/%s: line %i, just after: '%s'" % (checkdir, y, line, s))
+ finally:
+ if f is not None:
+ f.close()
if vcs in ("git", "hg") and check_ebuild_notadded:
if vcs == "git":
@@ -1286,7 +1469,9 @@ for x in scanlist:
raise
continue
- mf = Manifest(checkdir, repoman_settings["DISTDIR"])
+ mf = repoman_settings.repositories.get_repo_for_location(
+ os.path.dirname(os.path.dirname(checkdir)))
+ mf = mf.load_manifest(checkdir, repoman_settings["DISTDIR"])
mydigests=mf.getTypeDigests("DIST")
fetchlist_dict = portage.FetchlistDict(checkdir, repoman_settings, portdb)
@@ -1361,20 +1546,27 @@ for x in scanlist:
m = disallowed_filename_chars_re.search(
os.path.basename(y.rstrip(os.sep)))
if m is not None:
+ y_relative = os.path.join(checkdir_relative, "files", y)
+ if vcs is not None and not vcs_new_changed(y_relative):
+ # If the file isn't in the VCS new or changed set, then
+ # assume that it's an irrelevant temporary file (Manifest
+ # entries are not generated for file names containing
+ # prohibited characters). See bug #406877.
+ m = None
+ if m is not None:
stats["file.name"] += 1
fails["file.name"].append("%s/files/%s: char '%s'" % \
(checkdir, y, m.group(0)))
if desktop_file_validate and desktop_pattern.match(y):
- status, cmd_output = subprocess_getstatusoutput(
- "'%s' '%s'" % (desktop_file_validate, full_path))
- if os.WIFEXITED(status) and os.WEXITSTATUS(status) != os.EX_OK:
+ cmd_output = validate_desktop_entry(full_path)
+ if cmd_output:
# Note: in the future we may want to grab the
# warnings in addition to the errors. We're
# just doing errors now since we don't want
# to generate too much noise at first.
error_re = re.compile(r'.*\s*error:\s*(.*)')
- for line in cmd_output.splitlines():
+ for line in cmd_output:
error_match = error_re.match(line)
if error_match is None:
continue
@@ -1446,7 +1638,6 @@ for x in scanlist:
changelog_path = os.path.join(checkdir_relative, "ChangeLog")
changelog_modified = changelog_path in modified_changelogs
- allmasked = True
# detect unused local USE-descriptions
used_useflags = set()
@@ -1599,7 +1790,7 @@ for x in scanlist:
Ebuilds that inherit a "Live" eclass (darcs,subversion,git,cvs,etc..) should
not be allowed to be marked stable
"""
- if live_ebuild:
+ if live_ebuild and repo_config.name == "gentoo":
bad_stable_keywords = []
for keyword in keywords:
if not keyword.startswith("~") and \
@@ -1629,13 +1820,12 @@ for x in scanlist:
arches.append([keyword, keyword[1:], [keyword[1:], keyword]])
else:
arches.append([keyword, keyword, [keyword]])
- allmasked = False
if not arches:
# Use an empty profile for checking dependencies of
# packages that have empty KEYWORDS.
arches.append(['**', '**', ['**']])
- unknown_pkgs = {}
+ unknown_pkgs = set()
baddepsyntax = False
badlicsyntax = False
badprovsyntax = False
@@ -1672,11 +1862,13 @@ for x in scanlist:
if atom == "||":
continue
- if not atom.blocker and \
- not portdb.cp_list(atom.cp) and \
+ # Skip dependency.unknown for blockers, so that we
+ # don't encourage people to remove necessary blockers,
+ # as discussed in bug #382407.
+ if atom.blocker is None and \
+ not portdb.xmatch("match-all", atom) and \
not atom.cp.startswith("virtual/"):
- unknown_pkgs.setdefault(atom.cp, set()).add(
- (mytype, atom.unevaluated_atom))
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
is_blocker = atom.blocker
@@ -1766,12 +1958,12 @@ for x in scanlist:
#keyword checks
myuse = myaux["KEYWORDS"].split()
for mykey in myuse:
- myskey=mykey[:]
- if myskey[0]=="-":
- myskey=myskey[1:]
- if myskey[0]=="~":
- myskey=myskey[1:]
- if mykey!="-*":
+ if mykey not in ("-*", "*", "~*"):
+ myskey = mykey
+ if myskey[:1] == "-":
+ myskey = myskey[1:]
+ if myskey[:1] == "~":
+ myskey = myskey[1:]
if myskey not in kwlist:
stats["KEYWORDS.invalid"] += 1
fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey)
@@ -1858,9 +2050,11 @@ for x in scanlist:
dep_settings = portage.config(
config_profile_path=prof.abs_path,
config_incrementals=repoman_incrementals,
+ config_root=config_root,
local_config=False,
_unmatched_removal=options.unmatched_removal,
env=env)
+ dep_settings.categories = repoman_settings.categories
if options.without_mask:
dep_settings._mask_manager = \
copy.deepcopy(dep_settings._mask_manager)
@@ -1876,7 +2070,7 @@ for x in scanlist:
xcache.update(shared_xmatch_caches)
arch_xmatch_caches[xmatch_cache_key] = xcache
- trees["/"]["porttree"].settings = dep_settings
+ trees[root]["porttree"].settings = dep_settings
portdb.settings = dep_settings
portdb.xcache = xcache
# for package.use.mask support inside dep_check
@@ -1887,7 +2081,7 @@ for x in scanlist:
if not baddepsyntax:
ismasked = not ebuild_archs or \
- pkg.cpv not in portdb.xmatch("list-visible", pkg.cp)
+ pkg.cpv not in portdb.xmatch("match-visible", pkg.cp)
if ismasked:
if not have_pmasked:
have_pmasked = bool(dep_settings._getMaskAtom(
@@ -1921,12 +2115,16 @@ for x in scanlist:
if success:
if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
if not atom.blocker:
- # Don't bother with dependency.unknown
- # for cases in which *DEPEND.bad is
- # triggered.
- unknown_pkgs.pop(atom.cp, None)
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
if not prof.sub_path:
# old-style virtuals currently aren't
@@ -1957,25 +2155,14 @@ for x in scanlist:
prof, repr(atoms)))
if not baddepsyntax and unknown_pkgs:
- all_unknown = set()
- all_unknown.update(*unknown_pkgs.values())
type_map = {}
- for mytype, atom in all_unknown:
+ for mytype, atom in unknown_pkgs:
type_map.setdefault(mytype, set()).add(atom)
for mytype, atoms in type_map.items():
stats["dependency.unknown"] += 1
fails["dependency.unknown"].append("%s: %s: %s" %
(relative_path, mytype, ", ".join(sorted(atoms))))
- # Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped
- # XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely.
- #if not portage.portdb.xmatch("bestmatch-visible",x):
- # stats["ebuild.nostable"]+=1
- # fails["ebuild.nostable"].append(x)
- if ebuildlist and allmasked and repolevel == 3:
- stats["ebuild.allmasked"]+=1
- fails["ebuild.allmasked"].append(x)
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if allvalid:
@@ -1985,6 +2172,9 @@ for x in scanlist:
"%s/metadata.xml: unused local USE-description: '%s'" % \
(x, myflag))
+if options.if_modified == "y" and len(effective_scanlist) < 1:
+ logging.warn("--if-modified is enabled, but no modified packages were found!")
+
if options.mode == "manifest":
sys.exit(dofail)
@@ -2099,7 +2289,8 @@ else:
err("Error retrieving CVS tree; exiting.")
if vcs == "svn":
try:
- svnstatus=os.popen("svn status --no-ignore").readlines()
+ with os.popen("svn status --no-ignore") as f:
+ svnstatus = f.readlines()
myunadded = [ "./"+elem.rstrip().split()[1] for elem in svnstatus if elem.startswith("?") or elem.startswith("I") ]
except SystemExit as e:
raise # TODO propagate this
@@ -2112,20 +2303,23 @@ else:
myf.close()
if vcs == "bzr":
try:
- bzrstatus=os.popen("bzr status -S .").readlines()
+ with os.popen("bzr status -S .") as f:
+ bzrstatus = f.readlines()
myunadded = [ "./"+elem.rstrip().split()[1].split('/')[-1:][0] for elem in bzrstatus if elem.startswith("?") or elem[0:2] == " D" ]
except SystemExit as e:
raise # TODO propagate this
except:
err("Error retrieving bzr info; exiting.")
if vcs == "hg":
- myunadded = os.popen("hg status --no-status --unknown .").readlines()
+ with os.popen("hg status --no-status --unknown .") as f:
+ myunadded = f.readlines()
myunadded = ["./" + elem.rstrip() for elem in myunadded]
# Mercurial doesn't handle manually deleted files as removed from
# the repository, so the user need to remove them before commit,
# using "hg remove [FILES]"
- mydeleted = os.popen("hg status --no-status --deleted .").readlines()
+ with os.popen("hg status --no-status --deleted .") as f:
+ mydeleted = f.readlines()
mydeleted = ["./" + elem.rstrip() for elem in mydeleted]
@@ -2141,36 +2335,6 @@ else:
myautoadd+=[myunadded[x]]
del myunadded[x]
- if myautoadd:
- print(">>> Auto-Adding missing Manifest(s)...")
- if options.pretend:
- if vcs == "cvs":
- print("(cvs add "+" ".join(myautoadd)+")")
- elif vcs == "svn":
- print("(svn add "+" ".join(myautoadd)+")")
- elif vcs == "git":
- print("(git add "+" ".join(myautoadd)+")")
- elif vcs == "bzr":
- print("(bzr add "+" ".join(myautoadd)+")")
- elif vcs == "hg":
- print("(hg add "+" ".join(myautoadd)+")")
- retval=0
- else:
- if vcs == "cvs":
- retval=os.system("cvs add "+" ".join(myautoadd))
- elif vcs == "svn":
- retval=os.system("svn add "+" ".join(myautoadd))
- elif vcs == "git":
- retval=os.system("git add "+" ".join(myautoadd))
- elif vcs == "bzr":
- retval=os.system("bzr add "+" ".join(myautoadd))
- elif vcs == "hg":
- retval=os.system("hg add "+" ".join(myautoadd))
- if retval:
- writemsg_level("!!! Exiting on %s (shell) error code: %s\n" % \
- (vcs, retval), level=logging.ERROR, noiselevel=-1)
- sys.exit(retval)
-
if myunadded:
print(red("!!! The following files are in your local tree but are not added to the master"))
print(red("!!! tree. Please remove them from the local tree or add them to the master tree."))
@@ -2200,28 +2364,37 @@ else:
if vcs == "svn":
- svnstatus = os.popen("svn status").readlines()
+ with os.popen("svn status") as f:
+ svnstatus = f.readlines()
mychanged = [ "./" + elem.split()[-1:][0] for elem in svnstatus if (elem[:1] in "MR" or elem[1:2] in "M")]
mynew = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("A")]
myremoved = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("D")]
# Subversion expands keywords specified in svn:keywords properties.
- props = os.popen("svn propget -R svn:keywords").readlines()
+ with os.popen("svn propget -R svn:keywords") as f:
+ props = f.readlines()
expansion = dict(("./" + prop.split(" - ")[0], prop.split(" - ")[1].split()) \
for prop in props if " - " in prop)
elif vcs == "git":
- mychanged = os.popen("git diff-index --name-only --relative --diff-filter=M HEAD").readlines()
+ with os.popen("git diff-index --name-only "
+ "--relative --diff-filter=M HEAD") as f:
+ mychanged = f.readlines()
mychanged = ["./" + elem[:-1] for elem in mychanged]
- mynew = os.popen("git diff-index --name-only --relative --diff-filter=A HEAD").readlines()
+ with os.popen("git diff-index --name-only "
+ "--relative --diff-filter=A HEAD") as f:
+ mynew = f.readlines()
mynew = ["./" + elem[:-1] for elem in mynew]
- myremoved = os.popen("git diff-index --name-only --relative --diff-filter=D HEAD").readlines()
+ with os.popen("git diff-index --name-only "
+ "--relative --diff-filter=D HEAD") as f:
+ myremoved = f.readlines()
myremoved = ["./" + elem[:-1] for elem in myremoved]
if vcs == "bzr":
- bzrstatus = os.popen("bzr status -S .").readlines()
+ with os.popen("bzr status -S .") as f:
+ bzrstatus = f.readlines()
mychanged = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and elem[1:2] == "M" ]
mynew = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and ( elem[1:2] in "NK" or elem[0:1] == "R" ) ]
myremoved = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem.startswith("-") ]
@@ -2229,11 +2402,16 @@ else:
# Bazaar expands nothing.
if vcs == "hg":
- mychanged = os.popen("hg status --no-status --modified .").readlines()
+ with os.popen("hg status --no-status --modified .") as f:
+ mychanged = f.readlines()
mychanged = ["./" + elem.rstrip() for elem in mychanged]
- mynew = os.popen("hg status --no-status --added .").readlines()
+
+ with os.popen("hg status --no-status --added .") as f:
+ mynew = f.readlines()
mynew = ["./" + elem.rstrip() for elem in mynew]
- myremoved = os.popen("hg status --no-status --removed .").readlines()
+
+ with os.popen("hg status --no-status --removed .") as f:
+ myremoved = f.readlines()
myremoved = ["./" + elem.rstrip() for elem in myremoved]
if vcs:
@@ -2253,20 +2431,143 @@ else:
mymanifests.add(f)
else:
myupdates.add(f)
- if vcs in ('git', 'hg'):
- myupdates.difference_update(myremoved)
+ myupdates.difference_update(myremoved)
myupdates = list(myupdates)
mymanifests = list(mymanifests)
myheaders = []
mydirty = []
+ commitmessage = options.commitmsg
+ if options.commitmsgfile:
+ try:
+ f = io.open(_unicode_encode(options.commitmsgfile,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['content'], errors='replace')
+ commitmessage = f.read()
+ f.close()
+ del f
+ except (IOError, OSError) as e:
+ if e.errno == errno.ENOENT:
+ portage.writemsg("!!! File Not Found: --commitmsgfile='%s'\n" % options.commitmsgfile)
+ else:
+ raise
+ # We've read the content so the file is no longer needed.
+ commitmessagefile = None
+ if not commitmessage or not commitmessage.strip():
+ try:
+ editor = os.environ.get("EDITOR")
+ if editor and utilities.editor_is_executable(editor):
+ commitmessage = utilities.get_commit_message_with_editor(
+ editor, message=qa_output)
+ else:
+ commitmessage = utilities.get_commit_message_with_stdin()
+ except KeyboardInterrupt:
+ exithandler()
+ if not commitmessage or not commitmessage.strip():
+ print("* no commit message? aborting commit.")
+ sys.exit(1)
+ commitmessage = commitmessage.rstrip()
+ changelog_msg = commitmessage
+ portage_version = getattr(portage, "VERSION", None)
+ if portage_version is None:
+ sys.stderr.write("Failed to insert portage version in message!\n")
+ sys.stderr.flush()
+ portage_version = "Unknown"
+ unameout = platform.system() + " "
+ if platform.system() in ["Darwin", "SunOS"]:
+ unameout += platform.processor()
+ else:
+ unameout += platform.machine()
+ commitmessage += "\n\n(Portage version: %s/%s/%s" % \
+ (portage_version, vcs, unameout)
+ if options.force:
+ commitmessage += ", RepoMan options: --force"
+ commitmessage += ")"
+
+ if options.echangelog in ('y', 'force'):
+ logging.info("checking for unmodified ChangeLog files")
+ committer_name = utilities.get_committer_name(env=repoman_settings)
+ for x in sorted(vcs_files_to_cps(
+ chain(myupdates, mymanifests, myremoved))):
+ catdir, pkgdir = x.split("/")
+ checkdir = repodir + "/" + x
+ checkdir_relative = ""
+ if repolevel < 3:
+ checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+ if repolevel < 2:
+ checkdir_relative = os.path.join(catdir, checkdir_relative)
+ checkdir_relative = os.path.join(".", checkdir_relative)
+
+ changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+ changelog_modified = changelog_path in modified_changelogs
+ if changelog_modified and options.echangelog != 'force':
+ continue
+
+ # get changes for this package
+ cdrlen = len(checkdir_relative)
+ clnew = [elem[cdrlen:] for elem in mynew if elem.startswith(checkdir_relative)]
+ clremoved = [elem[cdrlen:] for elem in myremoved if elem.startswith(checkdir_relative)]
+ clchanged = [elem[cdrlen:] for elem in mychanged if elem.startswith(checkdir_relative)]
+
+ # Skip ChangeLog generation if only the Manifest was modified,
+ # as discussed in bug #398009.
+ nontrivial_cl_files = set()
+ nontrivial_cl_files.update(clnew, clremoved, clchanged)
+ nontrivial_cl_files.difference_update(['Manifest'])
+ if not nontrivial_cl_files and options.echangelog != 'force':
+ continue
+
+ new_changelog = utilities.UpdateChangeLog(checkdir_relative,
+ committer_name, changelog_msg,
+ os.path.join(repodir, 'skel.ChangeLog'),
+ catdir, pkgdir,
+ new=clnew, removed=clremoved, changed=clchanged,
+ pretend=options.pretend)
+ if new_changelog is None:
+ writemsg_level("!!! Updating the ChangeLog failed\n", \
+ level=logging.ERROR, noiselevel=-1)
+ sys.exit(1)
+
+ # if the ChangeLog was just created, add it to vcs
+ if new_changelog:
+ myautoadd.append(changelog_path)
+ # myautoadd is appended to myupdates below
+ else:
+ myupdates.append(changelog_path)
+
+ if myautoadd:
+ print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
+ add_cmd = [vcs, "add"]
+ add_cmd += myautoadd
+ if options.pretend:
+ portage.writemsg_stdout("(%s)\n" % " ".join(add_cmd),
+ noiselevel=-1)
+ else:
+ if not (sys.hexversion >= 0x3000000 and sys.hexversion < 0x3020000):
+ # Python 3.1 produces the following TypeError if raw bytes are
+ # passed to subprocess.call():
+ # File "/usr/lib/python3.1/subprocess.py", line 646, in __init__
+ # errread, errwrite)
+ # File "/usr/lib/python3.1/subprocess.py", line 1157, in _execute_child
+ # raise child_exception
+ # TypeError: expected an object with the buffer interface
+ add_cmd = [_unicode_encode(arg) for arg in add_cmd]
+ retcode = subprocess.call(add_cmd)
+ if retcode != os.EX_OK:
+ logging.error(
+ "Exiting on %s error code: %s\n" % (vcs, retcode))
+ sys.exit(retcode)
+
+ myupdates += myautoadd
+
print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
+
if vcs not in ('cvs', 'svn'):
# With git, bzr and hg, there's never any keyword expansion, so
# there's no need to regenerate manifests and all files will be
# committed in one big commit at the end.
print()
- else:
+ elif not repo_config.thin_manifest:
if vcs == 'cvs':
headerstring = "'\$(Header|Id).*\$'"
elif vcs == "svn":
@@ -2315,60 +2616,15 @@ else:
logging.info("myupdates: %s", myupdates)
logging.info("myheaders: %s", myheaders)
- commitmessage = options.commitmsg
- if options.commitmsgfile:
- try:
- f = io.open(_unicode_encode(options.commitmsgfile,
- encoding=_encodings['fs'], errors='strict'),
- mode='r', encoding=_encodings['content'], errors='replace')
- commitmessage = f.read()
- f.close()
- del f
- except (IOError, OSError) as e:
- if e.errno == errno.ENOENT:
- portage.writemsg("!!! File Not Found: --commitmsgfile='%s'\n" % options.commitmsgfile)
- else:
- raise
- # We've read the content so the file is no longer needed.
- commitmessagefile = None
- if not commitmessage or not commitmessage.strip():
- try:
- editor = os.environ.get("EDITOR")
- if editor and utilities.editor_is_executable(editor):
- commitmessage = utilities.get_commit_message_with_editor(
- editor, message=qa_output)
- else:
- commitmessage = utilities.get_commit_message_with_stdin()
- except KeyboardInterrupt:
- exithandler()
- if not commitmessage or not commitmessage.strip():
- print("* no commit message? aborting commit.")
- sys.exit(1)
- commitmessage = commitmessage.rstrip()
- portage_version = getattr(portage, "VERSION", None)
- if portage_version is None:
- sys.stderr.write("Failed to insert portage version in message!\n")
- sys.stderr.flush()
- portage_version = "Unknown"
- unameout = platform.system() + " "
- if platform.system() in ["Darwin", "SunOS"]:
- unameout += platform.processor()
- else:
- unameout += platform.machine()
- commitmessage += "\n\n(Portage version: %s/%s/%s" % \
- (portage_version, vcs, unameout)
- if options.force:
- commitmessage += ", RepoMan options: --force"
- commitmessage += ")"
-
if options.ask and userquery('Commit changes?', True) != 'Yes':
print("* aborting commit.")
- sys.exit(1)
+ sys.exit(128 + signal.SIGINT)
- if vcs in ('cvs', 'svn') and (myupdates or myremoved):
+ # Handle the case where committed files have keywords which
+ # will change and need a priming commit before the Manifest
+ # can be committed.
+ if (myupdates or myremoved) and myheaders:
myfiles = myupdates + myremoved
- if not myheaders and "sign" not in repoman_settings.features:
- myfiles += mymanifests
fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
mymsg = os.fdopen(fd, "wb")
mymsg.write(_unicode_encode(commitmessage))
@@ -2469,121 +2725,25 @@ else:
portage.util.write_atomic(x, b''.join(mylines),
mode='wb')
- manifest_commit_required = True
- if vcs in ('cvs', 'svn') and (myupdates or myremoved):
- myfiles = myupdates + myremoved
- for x in range(len(myfiles)-1, -1, -1):
- if myfiles[x].count("/") < 4-repolevel:
- del myfiles[x]
- mydone=[]
- if repolevel==3: # In a package dir
- repoman_settings["O"] = startdir
- digestgen(mysettings=repoman_settings, myportdb=portdb)
- elif repolevel==2: # In a category dir
- for x in myfiles:
- xs=x.split("/")
- if len(xs) < 4-repolevel:
- continue
- if xs[0]==".":
- xs=xs[1:]
- if xs[0] in mydone:
- continue
- mydone.append(xs[0])
- repoman_settings["O"] = os.path.join(startdir, xs[0])
- if not os.path.isdir(repoman_settings["O"]):
- continue
- digestgen(mysettings=repoman_settings, myportdb=portdb)
- elif repolevel==1: # repo-cvsroot
- print(green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n")
- for x in myfiles:
- xs=x.split("/")
- if len(xs) < 4-repolevel:
- continue
- if xs[0]==".":
- xs=xs[1:]
- if "/".join(xs[:2]) in mydone:
- continue
- mydone.append("/".join(xs[:2]))
- repoman_settings["O"] = os.path.join(startdir, xs[0], xs[1])
- if not os.path.isdir(repoman_settings["O"]):
- continue
- digestgen(mysettings=repoman_settings, myportdb=portdb)
- else:
- print(red("I'm confused... I don't know where I am!"))
- sys.exit(1)
-
- # Force an unsigned commit when more than one Manifest needs to be signed.
- if repolevel < 3 and "sign" in repoman_settings.features:
-
- fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
- mymsg = os.fdopen(fd, "wb")
- mymsg.write(_unicode_encode(commitmessage))
- mymsg.write(b"\n (Unsigned Manifest commit)")
- mymsg.close()
+ if repolevel == 1:
+ print(green("RepoMan sez:"), "\"You're rather crazy... "
+ "doing the entire repository.\"\n")
- commit_cmd = [vcs]
- commit_cmd.extend(vcs_global_opts)
- commit_cmd.append("commit")
- commit_cmd.extend(vcs_local_opts)
- commit_cmd.extend(["-F", commitmessagefile])
- commit_cmd.extend(f.lstrip("./") for f in mymanifests)
+ if vcs in ('cvs', 'svn') and (myupdates or myremoved):
- try:
- if options.pretend:
- print("(%s)" % (" ".join(commit_cmd),))
- else:
- retval = spawn(commit_cmd, env=os.environ)
- if retval:
- writemsg_level(("!!! Exiting on %s (shell) " + \
- "error code: %s\n") % (vcs, retval),
- level=logging.ERROR, noiselevel=-1)
- sys.exit(retval)
- finally:
- try:
- os.unlink(commitmessagefile)
- except OSError:
- pass
- manifest_commit_required = False
+ for x in sorted(vcs_files_to_cps(
+ chain(myupdates, myremoved, mymanifests))):
+ repoman_settings["O"] = os.path.join(repodir, x)
+ digestgen(mysettings=repoman_settings, myportdb=portdb)
signed = False
- if "sign" in repoman_settings.features:
+ if sign_manifests:
signed = True
- myfiles = myupdates + myremoved + mymanifests
try:
- if repolevel==3: # In a package dir
- repoman_settings["O"] = "."
+ for x in sorted(vcs_files_to_cps(
+ chain(myupdates, myremoved, mymanifests))):
+ repoman_settings["O"] = os.path.join(repodir, x)
gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
- elif repolevel==2: # In a category dir
- mydone=[]
- for x in myfiles:
- xs=x.split("/")
- if len(xs) < 4-repolevel:
- continue
- if xs[0]==".":
- xs=xs[1:]
- if xs[0] in mydone:
- continue
- mydone.append(xs[0])
- repoman_settings["O"] = os.path.join(".", xs[0])
- if not os.path.isdir(repoman_settings["O"]):
- continue
- gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
- elif repolevel==1: # repo-cvsroot
- print(green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n")
- mydone=[]
- for x in myfiles:
- xs=x.split("/")
- if len(xs) < 4-repolevel:
- continue
- if xs[0]==".":
- xs=xs[1:]
- if "/".join(xs[:2]) in mydone:
- continue
- mydone.append("/".join(xs[:2]))
- repoman_settings["O"] = os.path.join(".", xs[0], xs[1])
- if not os.path.isdir(repoman_settings["O"]):
- continue
- gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
except portage.exception.PortageException as e:
portage.writemsg("!!! %s\n" % str(e))
portage.writemsg("!!! Disabled FEATURES='sign'\n")
@@ -2610,10 +2770,13 @@ else:
level=logging.ERROR, noiselevel=-1)
sys.exit(retval)
- if vcs in ['git', 'bzr', 'hg'] or manifest_commit_required or signed:
+ if True:
myfiles = mymanifests[:]
- if vcs in ['git', 'bzr', 'hg']:
+ # If there are no header (SVN/CVS keywords) changes in
+ # the files, this Manifest commit must include the
+ # other (yet uncommitted) files.
+ if not myheaders:
myfiles += myupdates
myfiles += myremoved
myfiles.sort()
@@ -2652,6 +2815,13 @@ else:
else:
retval = spawn(commit_cmd, env=os.environ)
if retval != os.EX_OK:
+
+ if repo_config.sign_commit and vcs == 'git' and \
+ not git_supports_gpg_sign():
+ # Inform user that newer git is needed (bug #403323).
+ logging.error(
+ "Git >=1.7.9 is required for signed commits!")
+
writemsg_level(("!!! Exiting on %s (shell) " + \
"error code: %s\n") % (vcs, retval),
level=logging.ERROR, noiselevel=-1)
diff --git a/portage_with_autodep/bin/save-ebuild-env.sh b/portage_with_autodep/bin/save-ebuild-env.sh
new file mode 100755
index 0000000..23e7aaa
--- /dev/null
+++ b/portage_with_autodep/bin/save-ebuild-env.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @FUNCTION: save_ebuild_env
+# @DESCRIPTION:
+# echo the current environment to stdout, filtering out redundant info.
+#
+# --exclude-init-phases causes pkg_nofetch and src_* phase functions to
+# be excluded from the output. These function are not needed for installation
+# or removal of the packages, and can therefore be safely excluded.
+#
+save_ebuild_env() {
+ (
+ if has --exclude-init-phases $* ; then
+ unset S _E_DOCDESTTREE_ _E_EXEDESTTREE_ \
+ PORTAGE_DOCOMPRESS PORTAGE_DOCOMPRESS_SKIP
+ if [[ -n $PYTHONPATH &&
+ ${PYTHONPATH%%:*} -ef $PORTAGE_PYM_PATH ]] ; then
+ if [[ $PYTHONPATH == *:* ]] ; then
+ export PYTHONPATH=${PYTHONPATH#*:}
+ else
+ unset PYTHONPATH
+ fi
+ fi
+ fi
+
+ # misc variables inherited from the calling environment
+ unset COLORTERM DISPLAY EDITOR LESS LESSOPEN LOGNAME LS_COLORS PAGER \
+ TERM TERMCAP USER ftp_proxy http_proxy no_proxy
+
+ # other variables inherited from the calling environment
+ unset CVS_RSH ECHANGELOG_USER GPG_AGENT_INFO \
+ SSH_AGENT_PID SSH_AUTH_SOCK STY WINDOW XAUTHORITY
+
+ # CCACHE and DISTCC config
+ unset ${!CCACHE_*} ${!DISTCC_*}
+
+ # There's no need to bloat environment.bz2 with internally defined
+ # functions and variables, so filter them out if possible.
+
+ for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \
+ src_compile src_test src_install pkg_preinst pkg_postinst \
+ pkg_prerm pkg_postrm ; do
+ unset -f default_$x _eapi{0,1,2,3,4}_$x
+ done
+ unset x
+
+ unset -f assert assert_sigpipe_ok dump_trace die diefunc \
+ quiet_mode vecho elog_base eqawarn elog \
+ esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \
+ KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \
+ has_phase_defined_up_to \
+ hasv hasq qa_source qa_call \
+ addread addwrite adddeny addpredict _sb_append_var \
+ use usev useq has_version portageq \
+ best_version use_with use_enable register_die_hook \
+ keepdir unpack strip_duplicate_slashes econf einstall \
+ dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \
+ insopts diropts exeopts libopts docompress \
+ abort_handler abort_prepare abort_configure abort_compile \
+ abort_test abort_install dyn_prepare dyn_configure \
+ dyn_compile dyn_test dyn_install \
+ dyn_preinst dyn_pretend dyn_help debug-print debug-print-function \
+ debug-print-section helpers_die inherit EXPORT_FUNCTIONS \
+ nonfatal register_success_hook remove_path_entry \
+ save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
+ set_unless_changed unset_unless_changed source_all_bashrcs \
+ ebuild_main ebuild_phase ebuild_phase_with_hooks \
+ _ebuild_arg_to_phase _ebuild_phase_funcs default \
+ _hasg _hasgq _unpack_tar \
+ ${QA_INTERCEPTORS}
+
+ # portage config variables and variables set directly by portage
+ unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \
+ DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \
+ EBUILD_FORCE_TEST EBUILD_MASTER_PID \
+ ECLASS_DEPTH ENDCOL FAKEROOTKEY \
+ GOOD HILITE HOME \
+ LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \
+ NOCOLOR NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
+ PORTAGE_BASHRCS_SOURCED PORTAGE_COMPRESS_EXCLUDE_SUFFIXES \
+ PORTAGE_NONFATAL PORTAGE_QUIET \
+ PORTAGE_SANDBOX_DENY PORTAGE_SANDBOX_PREDICT \
+ PORTAGE_SANDBOX_READ PORTAGE_SANDBOX_WRITE PREROOTPATH \
+ QA_INTERCEPTORS \
+ RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL RC_INDENTATION \
+ ROOT ROOTPATH RPMDIR TEMP TMP TMPDIR USE_EXPAND \
+ WARN XARGS _RC_GET_KV_CACHE
+
+ # user config variables
+ unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK
+
+ declare -p
+ declare -fp
+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
+ export
+ fi
+ )
+}
diff --git a/portage_with_autodep/bin/xattr-helper.py b/portage_with_autodep/bin/xattr-helper.py
new file mode 100755
index 0000000..6d99521
--- /dev/null
+++ b/portage_with_autodep/bin/xattr-helper.py
@@ -0,0 +1,190 @@
+#!/usr/bin/python
+# Copyright 2012-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""Dump and restore extended attributes.
+
+We use formats like that used by getfattr --dump. This is meant for shell
+helpers to save/restore. If you're looking for a python/portage API, see
+portage.util.movefile._copyxattr instead.
+
+https://en.wikipedia.org/wiki/Extended_file_attributes
+"""
+
+import array
+import os
+import re
+import sys
+
+from portage.util._argparse import ArgumentParser
+
+if hasattr(os, "getxattr"):
+
+ class xattr(object):
+ get = os.getxattr
+ set = os.setxattr
+ list = os.listxattr
+
+else:
+ import xattr
+
+
+_UNQUOTE_RE = re.compile(br'\\[0-7]{3}')
+_FS_ENCODING = sys.getfilesystemencoding()
+
+
+if sys.hexversion < 0x3000000:
+
+ def octal_quote_byte(b):
+ return b'\\%03o' % ord(b)
+
+ def unicode_encode(s):
+ if isinstance(s, unicode):
+ s = s.encode(_FS_ENCODING)
+ return s
+else:
+
+ def octal_quote_byte(b):
+ return ('\\%03o' % ord(b)).encode('ascii')
+
+ def unicode_encode(s):
+ if isinstance(s, str):
+ s = s.encode(_FS_ENCODING)
+ return s
+
+
+def quote(s, quote_chars):
+ """Convert all |quote_chars| in |s| to escape sequences
+
+ This is normally used to escape any embedded quotation marks.
+ """
+ quote_re = re.compile(b'[' + quote_chars + b']')
+ result = []
+ pos = 0
+ s_len = len(s)
+
+ while pos < s_len:
+ m = quote_re.search(s, pos=pos)
+ if m is None:
+ result.append(s[pos:])
+ pos = s_len
+ else:
+ start = m.start()
+ result.append(s[pos:start])
+ result.append(octal_quote_byte(s[start:start+1]))
+ pos = start + 1
+
+ return b''.join(result)
+
+
+def unquote(s):
+ """Process all escape sequences in |s|"""
+ result = []
+ pos = 0
+ s_len = len(s)
+
+ while pos < s_len:
+ m = _UNQUOTE_RE.search(s, pos=pos)
+ if m is None:
+ result.append(s[pos:])
+ pos = s_len
+ else:
+ start = m.start()
+ result.append(s[pos:start])
+ pos = start + 4
+ a = array.array('B')
+ a.append(int(s[start + 1:pos], 8))
+ try:
+ # Python >= 3.2
+ result.append(a.tobytes())
+ except AttributeError:
+ result.append(a.tostring())
+
+ return b''.join(result)
+
+
+def dump_xattrs(pathnames, file_out):
+ """Dump the xattr data for |pathnames| to |file_out|"""
+ # NOTE: Always quote backslashes, in order to ensure that they are
+ # not interpreted as quotes when they are processed by unquote.
+ quote_chars = b'\n\r\\\\'
+
+ for pathname in pathnames:
+ attrs = xattr.list(pathname)
+ if not attrs:
+ continue
+
+ file_out.write(b'# file: %s\n' % quote(pathname, quote_chars))
+ for attr in attrs:
+ attr = unicode_encode(attr)
+ value = xattr.get(pathname, attr)
+ file_out.write(b'%s="%s"\n' % (
+ quote(attr, b'=' + quote_chars),
+ quote(value, b'\0"' + quote_chars)))
+
+
+def restore_xattrs(file_in):
+ """Read |file_in| and restore xattrs content from it
+
+ This expects textual data in the format written by dump_xattrs.
+ """
+ pathname = None
+ for i, line in enumerate(file_in):
+ if line.startswith(b'# file: '):
+ pathname = unquote(line.rstrip(b'\n')[8:])
+ else:
+ parts = line.split(b'=', 1)
+ if len(parts) == 2:
+ if pathname is None:
+ raise ValueError('line %d: missing pathname' % (i + 1,))
+ attr = unquote(parts[0])
+ # strip trailing newline and quotes
+ value = unquote(parts[1].rstrip(b'\n')[1:-1])
+ xattr.set(pathname, attr, value)
+ elif line.strip():
+ raise ValueError('line %d: malformed entry' % (i + 1,))
+
+
+def main(argv):
+
+ parser = ArgumentParser(description=__doc__)
+ parser.add_argument('paths', nargs='*', default=[])
+
+ actions = parser.add_argument_group('Actions')
+ actions.add_argument('--dump',
+ action='store_true',
+ help='Dump the values of all extended '
+ 'attributes associated with null-separated'
+ ' paths read from stdin.')
+ actions.add_argument('--restore',
+ action='store_true',
+ help='Restore extended attributes using'
+ ' a dump read from stdin.')
+
+ options = parser.parse_args(argv)
+
+ if sys.hexversion >= 0x3000000:
+ file_in = sys.stdin.buffer.raw
+ else:
+ file_in = sys.stdin
+ if not options.paths:
+ options.paths += [x for x in file_in.read().split(b'\0') if x]
+
+ if options.dump:
+ if sys.hexversion >= 0x3000000:
+ file_out = sys.stdout.buffer
+ else:
+ file_out = sys.stdout
+ dump_xattrs(options.paths, file_out)
+
+ elif options.restore:
+ restore_xattrs(file_in)
+
+ else:
+ parser.error('missing action!')
+
+ return os.EX_OK
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/portage_with_autodep/bin/xpak-helper.py b/portage_with_autodep/bin/xpak-helper.py
index 4766d99..ef74920 100755
--- a/portage_with_autodep/bin/xpak-helper.py
+++ b/portage_with_autodep/bin/xpak-helper.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright 2009 Gentoo Foundation
+# Copyright 2009-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import optparse
@@ -36,7 +36,7 @@ def command_recompose(args):
def main(argv):
- if argv and sys.hexversion < 0x3000000 and not isinstance(argv[0], unicode):
+ if argv and isinstance(argv[0], bytes):
for i, x in enumerate(argv):
argv[i] = portage._unicode_decode(x, errors='strict')
diff --git a/portage_with_autodep/integration_with_portage.patch b/portage_with_autodep/integration_with_portage.patch
new file mode 100644
index 0000000..794c156
--- /dev/null
+++ b/portage_with_autodep/integration_with_portage.patch
@@ -0,0 +1,920 @@
+diff -urN /usr/lib/portage/pym/_emerge/EbuildBuild.py ./pym/_emerge/EbuildBuild.py
+--- /usr/lib/portage/pym/_emerge/EbuildBuild.py 2012-05-28 16:20:40.737712559 +0600
++++ ./pym/_emerge/EbuildBuild.py 2012-06-01 21:37:22.799844102 +0600
+@@ -9,6 +9,8 @@
+ from _emerge.EbuildMerge import EbuildMerge
+ from _emerge.EbuildFetchonly import EbuildFetchonly
+ from _emerge.EbuildBuildDir import EbuildBuildDir
++from _emerge.EventsAnalyser import EventsAnalyser, FilterProcGenerator
++from _emerge.EventsLogger import EventsLogger
+ from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
+ from portage.util import writemsg
+ import portage
+@@ -21,7 +23,7 @@
+ class EbuildBuild(CompositeTask):
+
+ __slots__ = ("args_set", "config_pool", "find_blockers",
+- "ldpath_mtimes", "logger", "opts", "pkg", "pkg_count",
++ "ldpath_mtimes", "logger", "logserver", "opts", "pkg", "pkg_count",
+ "prefetcher", "settings", "world_atom") + \
+ ("_build_dir", "_buildpkg", "_ebuild_path", "_issyspkg", "_tree")
+
+@@ -251,8 +253,54 @@
+
+ build = EbuildExecuter(background=self.background, pkg=pkg,
+ scheduler=scheduler, settings=settings)
++
++ build.addStartListener(self._build_start)
++ build.addExitListener(self._build_stop)
++
+ self._start_task(build, self._build_exit)
+
++ def _build_start(self,phase):
++ if "depcheck" in self.settings["FEATURES"] or \
++ "depcheckstrict" in self.settings["FEATURES"]:
++ # Lets start a log listening server
++ temp_path=self.settings.get("T",self.settings["PORTAGE_TMPDIR"])
++
++ if "depcheckstrict" not in self.settings["FEATURES"]:
++ # use default filter_proc
++ self.logserver=EventsLogger(socket_dir=temp_path)
++ else:
++ portage.util.writemsg("Getting list of allowed files..." + \
++ "This may take some time\n")
++ filter_gen=FilterProcGenerator(self.pkg.cpv, self.settings)
++ filter_proc=filter_gen.get_filter_proc()
++ self.logserver=EventsLogger(socket_dir=temp_path,
++ filter_proc=filter_proc)
++
++ self.logserver.start()
++
++ # Copy socket path to LOG_SOCKET environment variable
++ env=self.settings.configdict["pkg"]
++ env['LOG_SOCKET'] = self.logserver.socket_name
++
++ #import pdb; pdb.set_trace()
++
++ def _build_stop(self,phase):
++ if "depcheck" in self.settings["FEATURES"] or \
++ "depcheckstrict" in self.settings["FEATURES"]:
++ # Delete LOG_SOCKET from environment
++ env=self.settings.configdict["pkg"]
++ if 'LOG_SOCKET' in env:
++ del env['LOG_SOCKET']
++
++ events=self.logserver.stop()
++ self.logserver=None
++ analyser=EventsAnalyser(self.pkg.cpv, events, self.settings)
++ analyser.display() # show the analyse
++
++ #import pdb; pdb.set_trace()
++
++
++
+ def _fetch_failed(self):
+ # We only call the pkg_nofetch phase if either RESTRICT=fetch
+ # is set or the package has explicitly overridden the default
+diff -urN /usr/lib/portage/pym/_emerge/EbuildPhase.py ./pym/_emerge/EbuildPhase.py
+--- /usr/lib/portage/pym/_emerge/EbuildPhase.py 2012-05-28 16:20:40.738712559 +0600
++++ ./pym/_emerge/EbuildPhase.py 2012-06-01 21:38:11.935842036 +0600
+@@ -34,7 +34,8 @@
+
+ # FEATURES displayed prior to setup phase
+ _features_display = (
+- "ccache", "compressdebug", "distcc", "distcc-pump", "fakeroot",
++ "ccache", "compressdebug", "depcheck", "depcheckstrict",
++ "distcc", "distcc-pump", "fakeroot",
+ "installsources", "keeptemp", "keepwork", "nostrip",
+ "preserve-libs", "sandbox", "selinux", "sesandbox",
+ "splitdebug", "suidctl", "test", "userpriv",
+diff -urN /usr/lib/portage/pym/_emerge/EbuildPhase.py.rej ./pym/_emerge/EbuildPhase.py.rej
+--- /usr/lib/portage/pym/_emerge/EbuildPhase.py.rej 1970-01-01 05:00:00.000000000 +0500
++++ ./pym/_emerge/EbuildPhase.py.rej 2012-06-01 21:37:22.800844102 +0600
+@@ -0,0 +1,12 @@
++--- pym/_emerge/EbuildPhase.py
+++++ pym/_emerge/EbuildPhase.py
++@@ -33,7 +33,8 @@
++ ("_ebuild_lock",)
++
++ # FEATURES displayed prior to setup phase
++- _features_display = ("ccache", "distcc", "distcc-pump", "fakeroot",
+++ _features_display = ("ccache", "depcheck", "depcheckstrict" "distcc",
+++ "distcc-pump", "fakeroot",
++ "installsources", "keeptemp", "keepwork", "nostrip",
++ "preserve-libs", "sandbox", "selinux", "sesandbox",
++ "splitdebug", "suidctl", "test", "userpriv",
+diff -urN /usr/lib/portage/pym/_emerge/EventsAnalyser.py ./pym/_emerge/EventsAnalyser.py
+--- /usr/lib/portage/pym/_emerge/EventsAnalyser.py 1970-01-01 05:00:00.000000000 +0500
++++ ./pym/_emerge/EventsAnalyser.py 2012-06-01 21:37:22.802844102 +0600
+@@ -0,0 +1,511 @@
++# Distributed under the terms of the GNU General Public License v2
++
++import portage
++from portage.dbapi._expand_new_virt import expand_new_virt
++from portage import os
++
++import subprocess
++import re
++
++class PortageUtils:
++ """ class for accessing the portage api """
++ def __init__(self, settings):
++ """ test """
++ self.settings=settings
++ self.vartree=portage.vartree(settings=settings)
++ self.vardbapi=portage.vardbapi(settings=settings, vartree=self.vartree)
++ self.portdbapi=portage.portdbapi(mysettings=settings)
++ self.metadata_keys = [k for k in portage.auxdbkeys if not k.startswith("UNUSED_")]
++ self.use=self.settings["USE"]
++
++ def get_best_visible_pkg(self,pkg):
++ """
++ Gets best candidate on installing. Returns empty string if no found
++
++ :param pkg: package name
++
++ """
++ try:
++ return self.portdbapi.xmatch("bestmatch-visible", pkg)
++ except:
++ return ''
++
++ # non-recursive dependency getter
++ def get_dep(self,pkg,dep_type=["RDEPEND","DEPEND"]):
++ """
++ Gets current dependencies of a package. Looks in portage db
++
++ :param pkg: name of package
++ :param dep_type: type of dependencies to recurse. Can be ["DEPEND"] or
++ ["RDEPEND", "DEPEND"]
++ :returns: **set** of packages names
++ """
++ ret=set()
++
++ pkg = self.get_best_visible_pkg(pkg)
++ if not pkg:
++ return ret
++
++ # we found the best visible match in common tree
++
++
++ metadata = dict(zip(self.metadata_keys,
++ self.portdbapi.aux_get(pkg, self.metadata_keys)))
++ dep_str = " ".join(metadata[k] for k in dep_type)
++
++ # the IUSE default are very important for us
++ iuse_defaults=[
++ u[1:] for u in metadata.get("IUSE",'').split() if u.startswith("+")]
++
++ use=self.use.split()
++
++ for u in iuse_defaults:
++ if u not in use:
++ use.append(u)
++
++ success, atoms = portage.dep_check(dep_str, None, self.settings,
++ myuse=use, myroot=self.settings["ROOT"],
++ trees={self.settings["ROOT"]:{"vartree":self.vartree, "porttree": self.vartree}})
++ if not success:
++ return ret
++
++ for atom in atoms:
++ atomname = self.vartree.dep_bestmatch(atom)
++
++ if not atomname:
++ continue
++
++ for unvirt_pkg in expand_new_virt(self.vardbapi,'='+atomname):
++ for pkg in self.vartree.dep_match(unvirt_pkg):
++ ret.add(pkg)
++
++ return ret
++
++ # recursive dependency getter
++ def get_deps(self,pkg,dep_type=["RDEPEND","DEPEND"]):
++ """
++ Gets current dependencies of a package on any depth
++ All dependencies **must** be installed
++
++ :param pkg: name of package
++ :param dep_type: type of dependencies to recurse. Can be ["DEPEND"] or
++ ["RDEPEND", "DEPEND"]
++ :returns: **set** of packages names
++ """
++ ret=set()
++
++
++ # get porttree dependencies on the first package
++
++ pkg = self.portdbapi.xmatch("bestmatch-visible", pkg)
++ if not pkg:
++ return ret
++
++ known_packages=set()
++ unknown_packages=self.get_dep(pkg,dep_type)
++ ret=ret.union(unknown_packages)
++
++ while unknown_packages:
++ p=unknown_packages.pop()
++ if p in known_packages:
++ continue
++ known_packages.add(p)
++
++ metadata = dict(zip(self.metadata_keys, self.vardbapi.aux_get(p, self.metadata_keys)))
++
++ dep_str = " ".join(metadata[k] for k in dep_type)
++
++ # the IUSE default are very important for us
++ iuse_defaults=[
++ u[1:] for u in metadata.get("IUSE",'').split() if u.startswith("+")]
++
++ use=self.use.split()
++
++ for u in iuse_defaults:
++ if u not in use:
++ use.append(u)
++
++ success, atoms = portage.dep_check(dep_str, None, self.settings,
++ myuse=use, myroot=self.settings["ROOT"],
++ trees={self.settings["ROOT"]:{"vartree":self.vartree,"porttree": self.vartree}})
++
++ if not success:
++ continue
++
++ for atom in atoms:
++ atomname = self.vartree.dep_bestmatch(atom)
++ if not atomname:
++ continue
++
++ for unvirt_pkg in expand_new_virt(self.vardbapi,'='+atomname):
++ for pkg in self.vartree.dep_match(unvirt_pkg):
++ ret.add(pkg)
++ unknown_packages.add(pkg)
++ return ret
++
++ def get_deps_for_package_building(self, pkg):
++ """
++ returns buildtime dependencies of current package and
++ all runtime dependencies of that buildtime dependencies
++ """
++ buildtime_deps=self.get_dep(pkg, ["DEPEND"])
++ runtime_deps=set()
++ for dep in buildtime_deps:
++ runtime_deps=runtime_deps.union(self.get_deps(dep,["RDEPEND"]))
++
++ ret=buildtime_deps.union(runtime_deps)
++ return ret
++
++ def get_system_packages_list(self):
++ """
++ returns all packages from system set. They are always implicit dependencies
++
++ :returns: **list** of package names
++ """
++ ret=[]
++ for atom in self.settings.packages:
++ for pre_pkg in self.vartree.dep_match(atom):
++ for unvirt_pkg in expand_new_virt(self.vardbapi,'='+pre_pkg):
++ for pkg in self.vartree.dep_match(unvirt_pkg):
++ ret.append(pkg)
++ return ret
++
++
++class GentoolkitUtils:
++ """
++ Interface with qfile and qlist utils. They are much faster than
++ internals.
++ """
++
++ def getpackagesbyfiles(files):
++ """
++ :param files: list of filenames
++ :returns: **dictionary** file->package, if file doesn't belong to any
++ package it not returned as key of this dictionary
++ """
++ ret={}
++ listtocheck=[]
++ for f in files:
++ if os.path.isdir(f):
++ ret[f]="directory"
++ else:
++ listtocheck.append(f)
++
++ try:
++ proc=subprocess.Popen(['qfile']+['--nocolor','--exact','','--from','-'],
++ stdin=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE,
++ bufsize=4096)
++
++ out,err=proc.communicate("\n".join(listtocheck).encode("utf8"))
++
++ lines=out.decode("utf8").split("\n")
++ #print lines
++ line_re=re.compile(r"^([^ ]+)\s+\(([^)]+)\)$")
++ for line in lines:
++ if len(line)==0:
++ continue
++ match=line_re.match(line)
++ if match:
++ ret[match.group(2)]=match.group(1)
++ else:
++ portage.util.writemsg("Util qfile returned unparsable string: %s\n" % line)
++
++ except OSError as e:
++ portage.util.writemsg("Error while launching qfile: %s\n" % e)
++
++
++ return ret
++
++ def getfilesbypackages(packagenames):
++ """
++
++ :param packagename: name of package
++ :returns: **list** of files in package with name *packagename*
++ """
++ ret=[]
++ try:
++ proc=subprocess.Popen(['qlist']+['--nocolor',"--obj"]+packagenames,
++ stdout=subprocess.PIPE,stderr=subprocess.PIPE,
++ bufsize=4096)
++
++ out,err=proc.communicate()
++
++ ret=out.decode("utf8").split("\n")
++ if ret==['']:
++ ret=[]
++ except OSError as e:
++ portage.util.writemsg("Error while launching qfile: %s\n" % e)
++
++ return ret
++
++ def get_all_packages_files():
++ """
++ Memory-hungry operation
++
++ :returns: **set** of all files that belongs to package
++ """
++ ret=[]
++ try:
++ proc=subprocess.Popen(['qlist']+['--all',"--obj"],
++ stdout=subprocess.PIPE,stderr=subprocess.PIPE,
++ bufsize=4096)
++
++ out,err=proc.communicate()
++
++ ret=out.decode("utf8").split("\n")
++ except OSError as e:
++ portage.util.writemsg("Error while launching qfile: %s\n" % e)
++
++ return set(ret)
++
++class FilterProcGenerator:
++ def __init__(self, pkgname, settings):
++ portageutils=PortageUtils(settings=settings)
++
++ deps_all=portageutils.get_deps_for_package_building(pkgname)
++ deps_portage=portageutils.get_dep('portage',["RDEPEND"])
++
++ system_packages=portageutils.get_system_packages_list()
++
++ allfiles=GentoolkitUtils.get_all_packages_files()
++ portage.util.writemsg("All files list recieved, waiting for " \
++ "a list of allowed files\n")
++
++
++ allowedpkgs=system_packages+list(deps_portage)+list(deps_all)
++
++ allowedfiles=GentoolkitUtils.getfilesbypackages(allowedpkgs)
++ #for pkg in allowedpkgs:
++ # allowedfiles+=GentoolkitUtils.getfilesbypackage(pkg)
++
++ #import pdb; pdb.set_trace()
++
++ # manually add all python interpreters to this list
++ allowedfiles+=GentoolkitUtils.getfilesbypackages(['python'])
++ allowedfiles=set(allowedfiles)
++
++ deniedfiles=allfiles-allowedfiles
++
++ def filter_proc(eventname,filename,stage):
++ if filename in deniedfiles:
++ return False
++ return True
++
++ self.filter_proc=filter_proc
++ def get_filter_proc(self):
++ return self.filter_proc
++
++class EventsAnalyser:
++ def __init__(self, pkgname, events, settings):
++ self.pkgname=pkgname
++ self.events=events
++ self.settings=settings
++ self.portageutils=PortageUtils(settings=settings)
++
++ self.deps_all=self.portageutils.get_deps_for_package_building(pkgname)
++ self.deps_direct=self.portageutils.get_dep(pkgname,["DEPEND"])
++ self.deps_portage=self.portageutils.get_dep('portage',["RDEPEND"])
++
++ self.system_packages=self.portageutils.get_system_packages_list()
++ # All analyse work is here
++
++ # get unique filenames
++ filenames=set()
++ for stage in events:
++ succ_events=set(events[stage][0])
++ fail_events=set(events[stage][1])
++ filenames=filenames.union(succ_events)
++ filenames=filenames.union(fail_events)
++ filenames=list(filenames)
++
++ file_to_package=GentoolkitUtils.getpackagesbyfiles(filenames)
++ # This part is completly unreadable.
++ # It converting one complex struct(returned by getfsevents) to another complex
++ # struct which good for generating output.
++ #
++ # Old struct is also used during output
++
++ packagesinfo={}
++
++ for stage in sorted(events):
++ succ_events=events[stage][0]
++ fail_events=events[stage][1]
++
++ for filename in succ_events:
++ if filename in file_to_package:
++ package=file_to_package[filename]
++ else:
++ package="unknown"
++
++ if not package in packagesinfo:
++ packagesinfo[package]={}
++ stageinfo=packagesinfo[package]
++ if not stage in stageinfo:
++ stageinfo[stage]={}
++
++ filesinfo=stageinfo[stage]
++ if not filename in filesinfo:
++ filesinfo[filename]={"found":[],"notfound":[]}
++ filesinfo[filename]["found"]=succ_events[filename]
++
++ for filename in fail_events:
++ if filename in file_to_package:
++ package=file_to_package[filename]
++ else:
++ package="unknown"
++ if not package in packagesinfo:
++ packagesinfo[package]={}
++ stageinfo=packagesinfo[package]
++ if not stage in stageinfo:
++ stageinfo[stage]={}
++
++ filesinfo=stageinfo[stage]
++ if not filename in filesinfo:
++ filesinfo[filename]={"found":[],"notfound":[]}
++ filesinfo[filename]["notfound"]=fail_events[filename]
++ self.packagesinfo=packagesinfo
++
++ def display(self):
++ portage.util.writemsg(
++ portage.output.colorize(
++ "WARN", "\nFile access report for %s:\n" % self.pkgname))
++
++ stagesorder={"clean":1,"setup":2,"unpack":3,"prepare":4,"configure":5,"compile":6,"test":7,
++ "install":8,"preinst":9,"postinst":10,"prerm":11,"postrm":12,"unknown":13}
++ packagesinfo=self.packagesinfo
++ # print information grouped by package
++ for package in sorted(packagesinfo):
++ # not showing special directory package
++ if package=="directory":
++ continue
++
++ if package=="unknown":
++ continue
++
++
++ is_pkg_in_dep=package in self.deps_all
++ is_pkg_in_portage_dep=package in self.deps_portage
++ is_pkg_in_system=package in self.system_packages
++ is_pkg_python="dev-lang/python" in package
++
++ stages=[]
++ for stage in sorted(packagesinfo[package].keys(), key=stagesorder.get):
++ if stage!="unknown":
++ stages.append(stage)
++
++ if len(stages)==0:
++ continue
++
++ filenames={}
++ for stage in stages:
++ for filename in packagesinfo[package][stage]:
++ if len(packagesinfo[package][stage][filename]["found"])!=0:
++ was_readed,was_writed=packagesinfo[package][stage][filename]["found"]
++ if not filename in filenames:
++ filenames[filename]=['ok',was_readed,was_writed]
++ else:
++ status, old_was_readed, old_was_writed=filenames[filename]
++ filenames[filename]=[
++ 'ok',old_was_readed | was_readed, old_was_writed | was_writed
++ ]
++ if len(packagesinfo[package][stage][filename]["notfound"])!=0:
++ was_notfound,was_blocked=packagesinfo[package][stage][filename]["notfound"]
++ if not filename in filenames:
++ filenames[filename]=['err',was_notfound,was_blocked]
++ else:
++ status, old_was_notfound, old_was_blocked=filenames[filename]
++ filenames[filename]=[
++ 'err',old_was_notfound | was_notfound, old_was_blocked | was_blocked
++ ]
++
++
++ if is_pkg_in_dep:
++ portage.util.writemsg("[OK]")
++ elif is_pkg_in_system:
++ portage.util.writemsg("[SYSTEM]")
++ elif is_pkg_in_portage_dep:
++ portage.util.writemsg("[PORTAGE DEP]")
++ elif is_pkg_python:
++ portage.util.writemsg("[INTERPRETER]")
++ elif not self.is_package_useful(package,stages,filenames.keys()):
++ portage.util.writemsg("[LIKELY OK]")
++ else:
++ portage.util.writemsg(portage.output.colorize("BAD", "[NOT IN DEPS]"))
++ # show information about accessed files
++
++ portage.util.writemsg(" %-40s: %s\n" % (package,stages))
++
++ # this is here for readability
++ action={
++ ('ok',False,False):"accessed",
++ ('ok',True,False):"readed",
++ ('ok',False,True):"writed",
++ ('ok',True,True):"readed and writed",
++ ('err',False,False):"other error",
++ ('err',True,False):"not found",
++ ('err',False,True):"blocked",
++ ('err',True,True):"not found and blocked"
++ }
++
++ filescounter=0
++
++ for filename in filenames:
++ event_info=tuple(filenames[filename])
++ portage.util.writemsg(" %-56s %-21s\n" % (filename,action[event_info]))
++ filescounter+=1
++ if filescounter>10:
++ portage.util.writemsg(" ... and %d more ...\n" % (len(filenames)-10))
++ break
++ # ... and one more check. Making sure that direct build time
++ # dependencies were accessed
++ #import pdb; pdb.set_trace()
++ not_accessed_deps=set(self.deps_direct)-set(self.packagesinfo.keys())
++ if not_accessed_deps:
++ portage.util.writemsg(portage.output.colorize("WARN", "!!! "))
++ portage.util.writemsg("Warning! Some build time dependencies " + \
++ "of packages were not accessed: " + \
++ " ".join(not_accessed_deps) + "\n")
++
++ def is_package_useful(self,pkg,stages,files):
++ """ some basic heuristics here to cut part of packages """
++
++ excluded_paths=set(
++ ['/etc/sandbox.d/']
++ )
++
++ excluded_packages=set(
++ # autodep shows these two packages every time
++ ['net-zope/zope-fixers', 'net-zope/zope-interface']
++ )
++
++
++ def is_pkg_excluded(p):
++ for pkg in excluded_packages:
++ if p.startswith(pkg): # if package is excluded
++ return True
++ return False
++
++
++ def is_file_excluded(f):
++ for path in excluded_paths:
++ if f.startswith(path): # if path is excluded
++ return True
++ return False
++
++
++ if is_pkg_excluded(pkg):
++ return False
++
++ for f in files:
++ if is_file_excluded(f):
++ continue
++
++ # test 1: package is not useful if all files are *.desktop or *.xml or *.m4
++ if not (f.endswith(".desktop") or f.endswith(".xml") or f.endswith(".m4") or f.endswith(".pc")):
++ break
++ else:
++ return False # we get here if cycle ends not with break
++
++ return True
++
++
+\ No newline at end of file
+diff -urN /usr/lib/portage/pym/_emerge/EventsLogger.py ./pym/_emerge/EventsLogger.py
+--- /usr/lib/portage/pym/_emerge/EventsLogger.py 1970-01-01 05:00:00.000000000 +0500
++++ ./pym/_emerge/EventsLogger.py 2012-06-01 21:37:22.803844102 +0600
+@@ -0,0 +1,180 @@
++# Distributed under the terms of the GNU General Public License v2
++
++import io
++import sys
++import stat
++import socket
++import select
++import tempfile
++
++import threading
++
++from portage import os
++
++class EventsLogger(threading.Thread):
++ def default_filter(eventname, filename, stage):
++ return True
++
++ def __init__(self, socket_dir="/tmp/", filter_proc=default_filter):
++ threading.Thread.__init__(self) # init the Thread
++
++ self.alive=False
++
++ self.main_thread=threading.currentThread()
++
++ self.socket_dir=socket_dir
++ self.filter_proc=filter_proc
++
++ self.socket_name=None
++ self.socket_logger=None
++
++ self.events={}
++
++ try:
++ socket_dir_name = tempfile.mkdtemp(dir=self.socket_dir,
++ prefix="log_socket_")
++
++ socket_name = os.path.join(socket_dir_name, 'socket')
++
++ except OSError as e:
++ return
++
++ self.socket_name=socket_name
++
++ #print(self.socket_name)
++
++ try:
++ socket_logger=socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)
++ socket_logger.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
++
++ socket_logger.bind(self.socket_name)
++ socket_logger.listen(64)
++
++ except socket.error as e:
++ return
++
++ self.socket_logger=socket_logger
++
++ try:
++ # Allow connecting to socket for anyone
++ os.chmod(socket_dir_name,
++ stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR|
++ stat.S_IROTH|stat.S_IWOTH|stat.S_IXOTH)
++ os.chmod(socket_name,
++ stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR|
++ stat.S_IROTH|stat.S_IWOTH|stat.S_IXOTH)
++ except OSError as e:
++ return
++
++ def run(self):
++ """ Starts the log server """
++
++ self.alive=True
++ self.listen_thread=threading.currentThread()
++ clients={}
++
++ epoll=select.epoll()
++ epoll.register(self.socket_logger.fileno(), select.EPOLLIN)
++
++ while self.alive:
++ try:
++ sock_events = epoll.poll(3)
++
++ for fileno, sock_event in sock_events:
++ if fileno == self.socket_logger.fileno():
++ ret = self.socket_logger.accept()
++ if ret is None:
++ pass
++ else:
++ (client,addr)=ret
++ epoll.register(client.fileno(), select.EPOLLIN)
++ clients[client.fileno()]=client
++ elif sock_event & select.EPOLLIN:
++ s=clients[fileno]
++ record=s.recv(8192)
++
++ if not record: # if connection was closed
++ epoll.unregister(fileno)
++ clients[fileno].close()
++ del clients[fileno]
++ continue
++
++ #import pdb; pdb.set_trace()
++ try:
++ message=record.decode("utf8").split("\0")
++ except UnicodeDecodeError:
++ print("Bad message %s" % record)
++ continue
++
++ # continue
++
++ #print(message)
++
++ try:
++ if message[4]=="ASKING":
++ if self.filter_proc(message[1],message[2],message[3]):
++ s.sendall(b"ALLOW\0")
++ else:
++ # TODO: log through portage infrastructure
++ #print("Blocking an access to %s" % message[2])
++ s.sendall(b"DENY\0")
++ else:
++ eventname,filename,stage,result=message[1:5]
++
++ if not stage in self.events:
++ self.events[stage]=[{},{}]
++
++ hashofsucesses=self.events[stage][0]
++ hashoffailures=self.events[stage][1]
++
++ if result=="DENIED":
++ print("Blocking an access to %s" % filename)
++
++ if result=="OK":
++ if not filename in hashofsucesses:
++ hashofsucesses[filename]=[False,False]
++
++ readed_or_writed=hashofsucesses[filename]
++
++ if eventname=="read":
++ readed_or_writed[0]=True
++ elif eventname=="write":
++ readed_or_writed[1]=True
++
++ elif result[0:3]=="ERR" or result=="DENIED":
++ if not filename in hashoffailures:
++ hashoffailures[filename]=[False,False]
++ notfound_or_blocked=hashoffailures[filename]
++
++ if result=="ERR/2":
++ notfound_or_blocked[0]=True
++ elif result=="DENIED":
++ notfound_or_blocked[1]=True
++
++ else:
++ print("Error in logger module<->analyser protocol")
++
++ except IndexError:
++ print("IndexError while parsing %s" % record)
++ except IOError as e:
++ if e.errno!=4: # handling "Interrupted system call" errors
++ raise
++
++ # if main thread doesnt exists then exit
++ if not self.main_thread.is_alive():
++ break
++ epoll.unregister(self.socket_logger.fileno())
++ epoll.close()
++ self.socket_logger.close()
++
++ def stop(self):
++ """ Stops the log server. Returns all events """
++
++ self.alive=False
++
++ # Block the main thread until listener exists
++ self.listen_thread.join()
++
++ # We assume portage clears tmp folder, so no deleting a socket file
++ # We assume that no new socket data will arrive after this moment
++ return self.events
+diff -urN /usr/lib/portage/pym/portage/const.py ./pym/portage/const.py
+--- /usr/lib/portage/pym/portage/const.py 2012-05-28 16:20:40.766712558 +0600
++++ ./pym/portage/const.py 2012-06-01 21:39:51.363837853 +0600
+@@ -67,6 +67,8 @@
+ BASH_BINARY = "/bin/bash"
+ MOVE_BINARY = "/bin/mv"
+ PRELINK_BINARY = "/usr/sbin/prelink"
++AUTODEP_LIBRARY = "/usr/lib/file_hook.so"
++
+
+ INVALID_ENV_FILE = "/etc/spork/is/not/valid/profile.env"
+ REPO_NAME_FILE = "repo_name"
+@@ -89,7 +91,7 @@
+ "assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy",
+ "ccache", "chflags", "clean-logs",
+ "collision-protect", "compress-build-logs", "compressdebug",
+- "config-protect-if-modified",
++ "config-protect-if-modified", "depcheck", "depcheckstrict",
+ "digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot",
+ "fail-clean", "force-mirror", "force-prefix", "getbinpkg",
+ "installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror",
+diff -urN /usr/lib/portage/pym/portage/const.py.rej ./pym/portage/const.py.rej
+--- /usr/lib/portage/pym/portage/const.py.rej 1970-01-01 05:00:00.000000000 +0500
++++ ./pym/portage/const.py.rej 2012-06-01 21:37:22.803844102 +0600
+@@ -0,0 +1,12 @@
++--- pym/portage/const.py
+++++ pym/portage/const.py
++@@ -90,7 +92,8 @@
++ SUPPORTED_FEATURES = frozenset([
++ "allow-missing-manifests",
++ "assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy",
++- "ccache", "chflags", "collision-protect", "compress-build-logs",
+++ "ccache", "chflags", "collision-protect", "compress-build-logs",
+++ "depcheck", "depcheckstrict",
++ "digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot",
++ "fail-clean", "fixpackages", "force-mirror", "getbinpkg",
++ "installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror",
+diff -urN /usr/lib/portage/pym/portage/package/ebuild/_config/special_env_vars.py ./pym/portage/package/ebuild/_config/special_env_vars.py
+--- /usr/lib/portage/pym/portage/package/ebuild/_config/special_env_vars.py 2012-05-28 16:20:40.870712551 +0600
++++ ./pym/portage/package/ebuild/_config/special_env_vars.py 2012-06-01 21:37:22.804844102 +0600
+@@ -101,8 +101,8 @@
+ # other variables inherited from the calling environment
+ environ_whitelist += [
+ "CVS_RSH", "ECHANGELOG_USER",
+- "GPG_AGENT_INFO",
+- "SSH_AGENT_PID", "SSH_AUTH_SOCK",
++ "GPG_AGENT_INFO", "LOG_SOCKET",
++ "SSH_AGENT_PID", "SSH_AUTH_SOCK"
+ "STY", "WINDOW", "XAUTHORITY",
+ ]
+
+diff -urN /usr/lib/portage/pym/portage/package/ebuild/doebuild.py ./pym/portage/package/ebuild/doebuild.py
+--- /usr/lib/portage/pym/portage/package/ebuild/doebuild.py 2012-05-28 16:20:40.860712554 +0600
++++ ./pym/portage/package/ebuild/doebuild.py 2012-06-01 21:37:22.805844102 +0600
+@@ -1222,6 +1222,9 @@
+ nosandbox = ("sandbox" not in features and \
+ "usersandbox" not in features)
+
++ if "depcheck" in features or "depcheckstrict" in features:
++ nosandbox = True
++
+ if not portage.process.sandbox_capable:
+ nosandbox = True
+
+@@ -1401,7 +1404,10 @@
+ keywords["opt_name"] = "[%s/%s]" % \
+ (mysettings.get("CATEGORY",""), mysettings.get("PF",""))
+
+- if free or "SANDBOX_ACTIVE" in os.environ:
++ if "depcheck" in features or "depcheckstrict" in features:
++ keywords["opt_name"] += " bash"
++ spawn_func = portage.process.spawn_autodep
++ elif free or "SANDBOX_ACTIVE" in os.environ:
+ keywords["opt_name"] += " bash"
+ spawn_func = portage.process.spawn_bash
+ elif fakeroot:
+diff -urN /usr/lib/portage/pym/portage/process.py ./pym/portage/process.py
+--- /usr/lib/portage/pym/portage/process.py 2012-05-28 16:20:40.768712558 +0600
++++ ./pym/portage/process.py 2012-06-01 21:37:22.806844102 +0600
+@@ -18,7 +18,7 @@
+ 'portage.util:dump_traceback',
+ )
+
+-from portage.const import BASH_BINARY, SANDBOX_BINARY, FAKEROOT_BINARY
++from portage.const import BASH_BINARY, SANDBOX_BINARY, FAKEROOT_BINARY, AUTODEP_LIBRARY
+ from portage.exception import CommandNotFound
+
+ try:
+@@ -53,6 +53,9 @@
+ sandbox_capable = (os.path.isfile(SANDBOX_BINARY) and
+ os.access(SANDBOX_BINARY, os.X_OK))
+
++autodep_capable = (os.path.isfile(AUTODEP_LIBRARY) and
++ os.access(AUTODEP_LIBRARY, os.X_OK))
++
+ fakeroot_capable = (os.path.isfile(FAKEROOT_BINARY) and
+ os.access(FAKEROOT_BINARY, os.X_OK))
+
+@@ -80,6 +83,16 @@
+ args.append(mycommand)
+ return spawn(args, opt_name=opt_name, **keywords)
+
++def spawn_autodep(mycommand, opt_name=None, **keywords):
++ if not autodep_capable:
++ return spawn_bash(mycommand, opt_name=opt_name, **keywords)
++ if "env" not in keywords or "LOG_SOCKET" not in keywords["env"]:
++ return spawn_bash(mycommand, opt_name=opt_name, **keywords)
++
++ # Core part: tell the loader to preload logging library
++ keywords["env"]["LD_PRELOAD"]=AUTODEP_LIBRARY
++ return spawn_bash(mycommand, opt_name=opt_name, **keywords)
++
+ def spawn_sandbox(mycommand, opt_name=None, **keywords):
+ if not sandbox_capable:
+ return spawn_bash(mycommand, opt_name=opt_name, **keywords)
diff --git a/portage_with_autodep/pym/_emerge/AbstractDepPriority.py b/portage_with_autodep/pym/_emerge/AbstractDepPriority.py
index 94a9379..94f26ef 100644
--- a/portage_with_autodep/pym/_emerge/AbstractDepPriority.py
+++ b/portage_with_autodep/pym/_emerge/AbstractDepPriority.py
@@ -1,8 +1,8 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import copy
-from _emerge.SlotObject import SlotObject
+from portage.util.SlotObject import SlotObject
class AbstractDepPriority(SlotObject):
__slots__ = ("buildtime", "runtime", "runtime_post")
diff --git a/portage_with_autodep/pym/_emerge/AbstractDepPriority.pyo b/portage_with_autodep/pym/_emerge/AbstractDepPriority.pyo
new file mode 100644
index 0000000..b6a9871
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/AbstractDepPriority.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/AbstractEbuildProcess.py b/portage_with_autodep/pym/_emerge/AbstractEbuildProcess.py
index 4147ecb..c7b8f83 100644
--- a/portage_with_autodep/pym/_emerge/AbstractEbuildProcess.py
+++ b/portage_with_autodep/pym/_emerge/AbstractEbuildProcess.py
@@ -19,8 +19,9 @@ from portage.util import apply_secpass_permissions
class AbstractEbuildProcess(SpawnProcess):
__slots__ = ('phase', 'settings',) + \
- ('_build_dir', '_ipc_daemon', '_exit_command',)
+ ('_build_dir', '_ipc_daemon', '_exit_command', '_exit_timeout_id')
_phases_without_builddir = ('clean', 'cleanrm', 'depend', 'help',)
+ _phases_interactive_whitelist = ('config',)
# Number of milliseconds to allow natural exit of the ebuild
# process after it has called the exit command via IPC. It
@@ -92,7 +93,20 @@ class AbstractEbuildProcess(SpawnProcess):
else:
self.settings.pop('PORTAGE_EBUILD_EXIT_FILE', None)
- SpawnProcess._start(self)
+ if self.fd_pipes is None:
+ self.fd_pipes = {}
+ null_fd = None
+ if 0 not in self.fd_pipes and \
+ self.phase not in self._phases_interactive_whitelist and \
+ "interactive" not in self.settings.get("PROPERTIES", "").split():
+ null_fd = os.open('/dev/null', os.O_RDONLY)
+ self.fd_pipes[0] = null_fd
+
+ try:
+ SpawnProcess._start(self)
+ finally:
+ if null_fd is not None:
+ os.close(null_fd)
def _init_ipc_fifos(self):
@@ -143,13 +157,29 @@ class AbstractEbuildProcess(SpawnProcess):
def _exit_command_callback(self):
if self._registered:
# Let the process exit naturally, if possible.
- self.scheduler.schedule(self._reg_id, timeout=self._exit_timeout)
- if self._registered:
- # If it doesn't exit naturally in a reasonable amount
- # of time, kill it (solves bug #278895). We try to avoid
- # this when possible since it makes sandbox complain about
- # being killed by a signal.
- self.cancel()
+ self._exit_timeout_id = \
+ self.scheduler.timeout_add(self._exit_timeout,
+ self._exit_command_timeout_cb)
+
+ def _exit_command_timeout_cb(self):
+ if self._registered:
+ # If it doesn't exit naturally in a reasonable amount
+ # of time, kill it (solves bug #278895). We try to avoid
+ # this when possible since it makes sandbox complain about
+ # being killed by a signal.
+ self.cancel()
+ self._exit_timeout_id = \
+ self.scheduler.timeout_add(self._cancel_timeout,
+ self._cancel_timeout_cb)
+ else:
+ self._exit_timeout_id = None
+
+ return False # only run once
+
+ def _cancel_timeout_cb(self):
+ self._exit_timeout_id = None
+ self.wait()
+ return False # only run once
def _orphan_process_warn(self):
phase = self.phase
@@ -239,6 +269,10 @@ class AbstractEbuildProcess(SpawnProcess):
def _set_returncode(self, wait_retval):
SpawnProcess._set_returncode(self, wait_retval)
+ if self._exit_timeout_id is not None:
+ self.scheduler.source_remove(self._exit_timeout_id)
+ self._exit_timeout_id = None
+
if self._ipc_daemon is not None:
self._ipc_daemon.cancel()
if self._exit_command.exitcode is not None:
diff --git a/portage_with_autodep/pym/_emerge/AbstractEbuildProcess.pyo b/portage_with_autodep/pym/_emerge/AbstractEbuildProcess.pyo
new file mode 100644
index 0000000..b55f9c2
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/AbstractEbuildProcess.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/AbstractPollTask.py b/portage_with_autodep/pym/_emerge/AbstractPollTask.py
index f7f3a95..2c84709 100644
--- a/portage_with_autodep/pym/_emerge/AbstractPollTask.py
+++ b/portage_with_autodep/pym/_emerge/AbstractPollTask.py
@@ -1,44 +1,111 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import array
+import errno
import logging
+import os
from portage.util import writemsg_level
from _emerge.AsynchronousTask import AsynchronousTask
-from _emerge.PollConstants import PollConstants
+
class AbstractPollTask(AsynchronousTask):
__slots__ = ("scheduler",) + \
("_registered",)
_bufsize = 4096
- _exceptional_events = PollConstants.POLLERR | PollConstants.POLLNVAL
- _registered_events = PollConstants.POLLIN | PollConstants.POLLHUP | \
- _exceptional_events
+
+ @property
+ def _exceptional_events(self):
+ return self.scheduler.IO_ERR | self.scheduler.IO_NVAL
+
+ @property
+ def _registered_events(self):
+ return self.scheduler.IO_IN | self.scheduler.IO_HUP | \
+ self._exceptional_events
def isAlive(self):
return bool(self._registered)
- def _read_buf(self, f, event):
+ def _read_array(self, f, event):
"""
+ NOTE: array.fromfile() is used here only for testing purposes,
+ because it has bugs in all known versions of Python (including
+ Python 2.7 and Python 3.2). See PipeReaderArrayTestCase.
+
| POLLIN | RETURN
| BIT | VALUE
| ---------------------------------------------------
| 1 | Read self._bufsize into an instance of
- | | array.array('B') and return it, ignoring
+ | | array.array('B') and return it, handling
| | EOFError and IOError. An empty array
| | indicates EOF.
| ---------------------------------------------------
| 0 | None
"""
buf = None
- if event & PollConstants.POLLIN:
+ if event & self.scheduler.IO_IN:
buf = array.array('B')
try:
buf.fromfile(f, self._bufsize)
- except (EOFError, IOError):
+ except EOFError:
pass
+ except TypeError:
+ # Python 3.2:
+ # TypeError: read() didn't return bytes
+ pass
+ except IOError as e:
+ # EIO happens with pty on Linux after the
+ # slave end of the pty has been closed.
+ if e.errno == errno.EIO:
+ # EOF: return empty string of bytes
+ pass
+ elif e.errno == errno.EAGAIN:
+ # EAGAIN: return None
+ buf = None
+ else:
+ raise
+
+ if buf is not None:
+ try:
+ # Python >=3.2
+ buf = buf.tobytes()
+ except AttributeError:
+ buf = buf.tostring()
+
+ return buf
+
+ def _read_buf(self, fd, event):
+ """
+ | POLLIN | RETURN
+ | BIT | VALUE
+ | ---------------------------------------------------
+ | 1 | Read self._bufsize into a string of bytes,
+ | | handling EAGAIN and EIO. An empty string
+ | | of bytes indicates EOF.
+ | ---------------------------------------------------
+ | 0 | None
+ """
+ # NOTE: array.fromfile() is no longer used here because it has
+ # bugs in all known versions of Python (including Python 2.7
+ # and Python 3.2).
+ buf = None
+ if event & self.scheduler.IO_IN:
+ try:
+ buf = os.read(fd, self._bufsize)
+ except OSError as e:
+ # EIO happens with pty on Linux after the
+ # slave end of the pty has been closed.
+ if e.errno == errno.EIO:
+ # EOF: return empty string of bytes
+ buf = b''
+ elif e.errno == errno.EAGAIN:
+ # EAGAIN: return None
+ buf = None
+ else:
+ raise
+
return buf
def _unregister(self):
@@ -56,7 +123,32 @@ class AbstractPollTask(AsynchronousTask):
self._log_poll_exception(event)
self._unregister()
self.cancel()
- elif event & PollConstants.POLLHUP:
+ self.wait()
+ elif event & self.scheduler.IO_HUP:
self._unregister()
self.wait()
+ def _wait(self):
+ if self.returncode is not None:
+ return self.returncode
+ self._wait_loop()
+ return self.returncode
+
+ def _wait_loop(self, timeout=None):
+
+ if timeout is None:
+ while self._registered:
+ self.scheduler.iteration()
+ return
+
+ def timeout_cb():
+ timeout_cb.timed_out = True
+ return False
+ timeout_cb.timed_out = False
+ timeout_cb.timeout_id = self.scheduler.timeout_add(timeout, timeout_cb)
+
+ try:
+ while self._registered and not timeout_cb.timed_out:
+ self.scheduler.iteration()
+ finally:
+ self.scheduler.unregister(timeout_cb.timeout_id)
diff --git a/portage_with_autodep/pym/_emerge/AbstractPollTask.pyo b/portage_with_autodep/pym/_emerge/AbstractPollTask.pyo
new file mode 100644
index 0000000..06ef6b9
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/AbstractPollTask.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/AsynchronousLock.py b/portage_with_autodep/pym/_emerge/AsynchronousLock.py
index 637ba73..587aa46 100644
--- a/portage_with_autodep/pym/_emerge/AsynchronousLock.py
+++ b/portage_with_autodep/pym/_emerge/AsynchronousLock.py
@@ -1,15 +1,16 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import dummy_threading
import fcntl
+import errno
import logging
import sys
try:
import threading
except ImportError:
- import dummy_threading as threading
+ threading = dummy_threading
import portage
from portage import os
@@ -19,7 +20,6 @@ from portage.locks import lockfile, unlockfile
from portage.util import writemsg_level
from _emerge.AbstractPollTask import AbstractPollTask
from _emerge.AsynchronousTask import AsynchronousTask
-from _emerge.PollConstants import PollConstants
from _emerge.SpawnProcess import SpawnProcess
class AsynchronousLock(AsynchronousTask):
@@ -35,7 +35,7 @@ class AsynchronousLock(AsynchronousTask):
__slots__ = ('path', 'scheduler',) + \
('_imp', '_force_async', '_force_dummy', '_force_process', \
- '_force_thread', '_waiting')
+ '_force_thread')
_use_process_by_default = True
@@ -66,8 +66,7 @@ class AsynchronousLock(AsynchronousTask):
def _imp_exit(self, imp):
# call exit listeners
- if not self._waiting:
- self.wait()
+ self.wait()
def _cancel(self):
if isinstance(self._imp, AsynchronousTask):
@@ -81,9 +80,7 @@ class AsynchronousLock(AsynchronousTask):
def _wait(self):
if self.returncode is not None:
return self.returncode
- self._waiting = True
self.returncode = self._imp.wait()
- self._waiting = False
return self.returncode
def unlock(self):
@@ -114,13 +111,13 @@ class _LockThread(AbstractPollTask):
def _start(self):
pr, pw = os.pipe()
self._files = {}
- self._files['pipe_read'] = os.fdopen(pr, 'rb', 0)
- self._files['pipe_write'] = os.fdopen(pw, 'wb', 0)
- for k, f in self._files.items():
- fcntl.fcntl(f.fileno(), fcntl.F_SETFL,
- fcntl.fcntl(f.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
- self._reg_id = self.scheduler.register(self._files['pipe_read'].fileno(),
- PollConstants.POLLIN, self._output_handler)
+ self._files['pipe_read'] = pr
+ self._files['pipe_write'] = pw
+ for f in self._files.values():
+ fcntl.fcntl(f, fcntl.F_SETFL,
+ fcntl.fcntl(f, fcntl.F_GETFL) | os.O_NONBLOCK)
+ self._reg_id = self.scheduler.register(self._files['pipe_read'],
+ self.scheduler.IO_IN, self._output_handler)
self._registered = True
threading_mod = threading
if self._force_dummy:
@@ -130,26 +127,27 @@ class _LockThread(AbstractPollTask):
def _run_lock(self):
self._lock_obj = lockfile(self.path, wantnewlockfile=True)
- self._files['pipe_write'].write(b'\0')
+ os.write(self._files['pipe_write'], b'\0')
def _output_handler(self, f, event):
- buf = self._read_buf(self._files['pipe_read'], event)
+ buf = None
+ if event & self.scheduler.IO_IN:
+ try:
+ buf = os.read(self._files['pipe_read'], self._bufsize)
+ except OSError as e:
+ if e.errno not in (errno.EAGAIN,):
+ raise
if buf:
self._unregister()
self.returncode = os.EX_OK
self.wait()
+ return True
+
def _cancel(self):
# There's currently no way to force thread termination.
pass
- def _wait(self):
- if self.returncode is not None:
- return self.returncode
- if self._registered:
- self.scheduler.schedule(self._reg_id)
- return self.returncode
-
def unlock(self):
if self._lock_obj is None:
raise AssertionError('not locked')
@@ -171,7 +169,7 @@ class _LockThread(AbstractPollTask):
if self._files is not None:
for f in self._files.values():
- f.close()
+ os.close(f)
self._files = None
class _LockProcess(AbstractPollTask):
@@ -190,12 +188,12 @@ class _LockProcess(AbstractPollTask):
in_pr, in_pw = os.pipe()
out_pr, out_pw = os.pipe()
self._files = {}
- self._files['pipe_in'] = os.fdopen(in_pr, 'rb', 0)
- self._files['pipe_out'] = os.fdopen(out_pw, 'wb', 0)
+ self._files['pipe_in'] = in_pr
+ self._files['pipe_out'] = out_pw
fcntl.fcntl(in_pr, fcntl.F_SETFL,
fcntl.fcntl(in_pr, fcntl.F_GETFL) | os.O_NONBLOCK)
self._reg_id = self.scheduler.register(in_pr,
- PollConstants.POLLIN, self._output_handler)
+ self.scheduler.IO_IN, self._output_handler)
self._registered = True
self._proc = SpawnProcess(
args=[portage._python_interpreter,
@@ -209,9 +207,22 @@ class _LockProcess(AbstractPollTask):
os.close(in_pw)
def _proc_exit(self, proc):
+
+ if self._files is not None:
+ # Close pipe_out if it's still open, since it's useless
+ # after the process has exited. This helps to avoid
+ # "ResourceWarning: unclosed file" since Python 3.2.
+ try:
+ pipe_out = self._files.pop('pipe_out')
+ except KeyError:
+ pass
+ else:
+ os.close(pipe_out)
+
if proc.returncode != os.EX_OK:
# Typically, this will happen due to the
# process being killed by a signal.
+
if not self._acquired:
# If the lock hasn't been aquired yet, the
# caller can check the returncode and handle
@@ -242,21 +253,22 @@ class _LockProcess(AbstractPollTask):
self._proc.poll()
return self.returncode
- def _wait(self):
- if self.returncode is not None:
- return self.returncode
- if self._registered:
- self.scheduler.schedule(self._reg_id)
- return self.returncode
-
def _output_handler(self, f, event):
- buf = self._read_buf(self._files['pipe_in'], event)
+ buf = None
+ if event & self.scheduler.IO_IN:
+ try:
+ buf = os.read(self._files['pipe_in'], self._bufsize)
+ except OSError as e:
+ if e.errno not in (errno.EAGAIN,):
+ raise
if buf:
self._acquired = True
self._unregister()
self.returncode = os.EX_OK
self.wait()
+ return True
+
def _unregister(self):
self._registered = False
@@ -270,7 +282,7 @@ class _LockProcess(AbstractPollTask):
except KeyError:
pass
else:
- pipe_in.close()
+ os.close(pipe_in)
def unlock(self):
if self._proc is None:
@@ -281,8 +293,8 @@ class _LockProcess(AbstractPollTask):
raise AssertionError("lock process failed with returncode %s" \
% (self.returncode,))
self._unlocked = True
- self._files['pipe_out'].write(b'\0')
- self._files['pipe_out'].close()
+ os.write(self._files['pipe_out'], b'\0')
+ os.close(self._files['pipe_out'])
self._files = None
self._proc.wait()
self._proc = None
diff --git a/portage_with_autodep/pym/_emerge/AsynchronousLock.pyo b/portage_with_autodep/pym/_emerge/AsynchronousLock.pyo
new file mode 100644
index 0000000..5f3cfbb
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/AsynchronousLock.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/AsynchronousTask.py b/portage_with_autodep/pym/_emerge/AsynchronousTask.py
index 36522ca..7a193ce 100644
--- a/portage_with_autodep/pym/_emerge/AsynchronousTask.py
+++ b/portage_with_autodep/pym/_emerge/AsynchronousTask.py
@@ -1,8 +1,11 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import signal
+
from portage import os
-from _emerge.SlotObject import SlotObject
+from portage.util.SlotObject import SlotObject
+
class AsynchronousTask(SlotObject):
"""
Subclasses override _wait() and _poll() so that calls
@@ -14,7 +17,10 @@ class AsynchronousTask(SlotObject):
"""
__slots__ = ("background", "cancelled", "returncode") + \
- ("_exit_listeners", "_exit_listener_stack", "_start_listeners")
+ ("_exit_listeners", "_exit_listener_stack", "_start_listeners",
+ "_waiting")
+
+ _cancelled_returncode = - signal.SIGINT
def start(self):
"""
@@ -42,7 +48,12 @@ class AsynchronousTask(SlotObject):
def wait(self):
if self.returncode is None:
- self._wait()
+ if not self._waiting:
+ self._waiting = True
+ try:
+ self._wait()
+ finally:
+ self._waiting = False
self._wait_hook()
return self.returncode
@@ -50,10 +61,17 @@ class AsynchronousTask(SlotObject):
return self.returncode
def cancel(self):
+ """
+ Cancel the task, but do not wait for exit status. If asynchronous exit
+ notification is desired, then use addExitListener to add a listener
+ before calling this method.
+ NOTE: Synchronous waiting for status is not supported, since it would
+ be vulnerable to hitting the recursion limit when a large number of
+ tasks need to be terminated simultaneously, like in bug #402335.
+ """
if not self.cancelled:
self.cancelled = True
self._cancel()
- self.wait()
def _cancel(self):
"""
@@ -62,6 +80,17 @@ class AsynchronousTask(SlotObject):
"""
pass
+ def _was_cancelled(self):
+ """
+ If cancelled, set returncode if necessary and return True.
+ Otherwise, return False.
+ """
+ if self.cancelled:
+ if self.returncode is None:
+ self.returncode = self._cancelled_returncode
+ return True
+ return False
+
def addStartListener(self, f):
"""
The function will be called with one argument, a reference to self.
@@ -123,7 +152,11 @@ class AsynchronousTask(SlotObject):
self._exit_listener_stack = self._exit_listeners
self._exit_listeners = None
- self._exit_listener_stack.reverse()
+ # Execute exit listeners in reverse order, so that
+ # the last added listener is executed first. This
+ # allows SequentialTaskQueue to decrement its running
+ # task count as soon as one of its tasks exits, so that
+ # the value is accurate when other listeners execute.
while self._exit_listener_stack:
self._exit_listener_stack.pop()(self)
diff --git a/portage_with_autodep/pym/_emerge/AsynchronousTask.pyo b/portage_with_autodep/pym/_emerge/AsynchronousTask.pyo
new file mode 100644
index 0000000..b8d67ea
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/AsynchronousTask.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/AtomArg.pyo b/portage_with_autodep/pym/_emerge/AtomArg.pyo
new file mode 100644
index 0000000..b8f59cf
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/AtomArg.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/Binpkg.py b/portage_with_autodep/pym/_emerge/Binpkg.py
index bc6511e..ea8a1ad 100644
--- a/portage_with_autodep/pym/_emerge/Binpkg.py
+++ b/portage_with_autodep/pym/_emerge/Binpkg.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.EbuildPhase import EbuildPhase
@@ -9,15 +9,18 @@ from _emerge.CompositeTask import CompositeTask
from _emerge.BinpkgVerifier import BinpkgVerifier
from _emerge.EbuildMerge import EbuildMerge
from _emerge.EbuildBuildDir import EbuildBuildDir
+from _emerge.SpawnProcess import SpawnProcess
from portage.eapi import eapi_exports_replace_vars
-from portage.util import writemsg
+from portage.util import ensure_dirs, writemsg
import portage
from portage import os
+from portage import shutil
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
import io
import logging
+import textwrap
from portage.output import colorize
class Binpkg(CompositeTask):
@@ -25,7 +28,8 @@ class Binpkg(CompositeTask):
__slots__ = ("find_blockers",
"ldpath_mtimes", "logger", "opts",
"pkg", "pkg_count", "prefetcher", "settings", "world_atom") + \
- ("_bintree", "_build_dir", "_ebuild_path", "_fetched_pkg",
+ ("_bintree", "_build_dir", "_build_prefix",
+ "_ebuild_path", "_fetched_pkg",
"_image_dir", "_infloc", "_pkg_path", "_tree", "_verify")
def _writemsg_level(self, msg, level=0, noiselevel=0):
@@ -83,13 +87,12 @@ class Binpkg(CompositeTask):
waiting_msg = ("Fetching '%s' " + \
"in the background. " + \
- "To view fetch progress, run `tail -f " + \
+ "To view fetch progress, run `tail -f %s" + \
"/var/log/emerge-fetch.log` in another " + \
- "terminal.") % prefetcher.pkg_path
+ "terminal.") % (prefetcher.pkg_path, settings["EPREFIX"])
msg_prefix = colorize("GOOD", " * ")
- from textwrap import wrap
waiting_msg = "".join("%s%s\n" % (msg_prefix, line) \
- for line in wrap(waiting_msg, 65))
+ for line in textwrap.wrap(waiting_msg, 65))
if not self.background:
writemsg(waiting_msg, noiselevel=-1)
@@ -101,6 +104,10 @@ class Binpkg(CompositeTask):
def _prefetch_exit(self, prefetcher):
+ if self._was_cancelled():
+ self.wait()
+ return
+
pkg = self.pkg
pkg_count = self.pkg_count
if not (self.opts.pretend or self.opts.fetchonly):
@@ -299,10 +306,68 @@ class Binpkg(CompositeTask):
self._start_task(extractor, self._extractor_exit)
def _extractor_exit(self, extractor):
- if self._final_exit(extractor) != os.EX_OK:
+ if self._default_exit(extractor) != os.EX_OK:
self._unlock_builddir()
self._writemsg_level("!!! Error Extracting '%s'\n" % \
self._pkg_path, noiselevel=-1, level=logging.ERROR)
+ self.wait()
+ return
+
+ try:
+ with io.open(_unicode_encode(os.path.join(self._infloc, "EPREFIX"),
+ encoding=_encodings['fs'], errors='strict'), mode='r',
+ encoding=_encodings['repo.content'], errors='replace') as f:
+ self._build_prefix = f.read().rstrip('\n')
+ except IOError:
+ self._build_prefix = ""
+
+ if self._build_prefix == self.settings["EPREFIX"]:
+ ensure_dirs(self.settings["ED"])
+ self._current_task = None
+ self.returncode = os.EX_OK
+ self.wait()
+ return
+
+ chpathtool = SpawnProcess(
+ args=[portage._python_interpreter,
+ os.path.join(self.settings["PORTAGE_BIN_PATH"], "chpathtool.py"),
+ self.settings["D"], self._build_prefix, self.settings["EPREFIX"]],
+ background=self.background, env=self.settings.environ(),
+ scheduler=self.scheduler,
+ logfile=self.settings.get('PORTAGE_LOG_FILE'))
+ self._writemsg_level(">>> Adjusting Prefix to %s\n" % self.settings["EPREFIX"])
+ self._start_task(chpathtool, self._chpathtool_exit)
+
+ def _chpathtool_exit(self, chpathtool):
+ if self._final_exit(chpathtool) != os.EX_OK:
+ self._unlock_builddir()
+ self._writemsg_level("!!! Error Adjusting Prefix to %s" %
+ (self.settings["EPREFIX"],),
+ noiselevel=-1, level=logging.ERROR)
+ self.wait()
+ return
+
+ # We want to install in "our" prefix, not the binary one
+ with io.open(_unicode_encode(os.path.join(self._infloc, "EPREFIX"),
+ encoding=_encodings['fs'], errors='strict'), mode='w',
+ encoding=_encodings['repo.content'], errors='strict') as f:
+ f.write(self.settings["EPREFIX"] + "\n")
+
+ # Move the files to the correct location for merge.
+ image_tmp_dir = os.path.join(
+ self.settings["PORTAGE_BUILDDIR"], "image_tmp")
+ build_d = os.path.join(self.settings["D"],
+ self._build_prefix.lstrip(os.sep))
+ if not os.path.isdir(build_d):
+ # Assume this is a virtual package or something.
+ shutil.rmtree(self._image_dir)
+ ensure_dirs(self.settings["ED"])
+ else:
+ os.rename(build_d, image_tmp_dir)
+ shutil.rmtree(self._image_dir)
+ ensure_dirs(os.path.dirname(self.settings["ED"].rstrip(os.sep)))
+ os.rename(image_tmp_dir, self.settings["ED"])
+
self.wait()
def _unlock_builddir(self):
@@ -312,13 +377,13 @@ class Binpkg(CompositeTask):
self._build_dir.unlock()
def create_install_task(self):
- task = EbuildMerge(find_blockers=self.find_blockers,
+ task = EbuildMerge(exit_hook=self._install_exit,
+ find_blockers=self.find_blockers,
ldpath_mtimes=self.ldpath_mtimes, logger=self.logger,
pkg=self.pkg, pkg_count=self.pkg_count,
pkg_path=self._pkg_path, scheduler=self.scheduler,
settings=self.settings, tree=self._tree,
world_atom=self.world_atom)
- task.addExitListener(self._install_exit)
return task
def _install_exit(self, task):
diff --git a/portage_with_autodep/pym/_emerge/Binpkg.pyo b/portage_with_autodep/pym/_emerge/Binpkg.pyo
new file mode 100644
index 0000000..4499b9d
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/Binpkg.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.py b/portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.py
index f68971b..5ba1495 100644
--- a/portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.py
+++ b/portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import errno
@@ -38,7 +38,7 @@ class BinpkgEnvExtractor(CompositeTask):
background=self.background,
env=self.settings.environ(),
scheduler=self.scheduler,
- logfile=self.settings.get('PORTAGE_LOGFILE'))
+ logfile=self.settings.get('PORTAGE_LOG_FILE'))
self._start_task(extractor_proc, self._extractor_exit)
@@ -59,7 +59,7 @@ class BinpkgEnvExtractor(CompositeTask):
# This is a signal to ebuild.sh, so that it knows to filter
# out things like SANDBOX_{DENY,PREDICT,READ,WRITE} that
# would be preserved between normal phases.
- open(_unicode_encode(self._get_dest_env_path() + '.raw'), 'w')
+ open(_unicode_encode(self._get_dest_env_path() + '.raw'), 'wb').close()
self._current_task = None
self.returncode = os.EX_OK
diff --git a/portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.pyo b/portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.pyo
new file mode 100644
index 0000000..21c2e13
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.py b/portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.py
index d1630f2..f25cbf9 100644
--- a/portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.py
+++ b/portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.py
@@ -1,9 +1,8 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.SpawnProcess import SpawnProcess
import portage
-import os
import signal
class BinpkgExtractorAsync(SpawnProcess):
diff --git a/portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.pyo b/portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.pyo
new file mode 100644
index 0000000..f8498f7
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BinpkgFetcher.py b/portage_with_autodep/pym/_emerge/BinpkgFetcher.py
index baea4d6..f415e2e 100644
--- a/portage_with_autodep/pym/_emerge/BinpkgFetcher.py
+++ b/portage_with_autodep/pym/_emerge/BinpkgFetcher.py
@@ -28,9 +28,6 @@ class BinpkgFetcher(SpawnProcess):
def _start(self):
- if self.cancelled:
- return
-
pkg = self.pkg
pretend = self.pretend
bintree = pkg.root_config.trees["bintree"]
diff --git a/portage_with_autodep/pym/_emerge/BinpkgFetcher.pyo b/portage_with_autodep/pym/_emerge/BinpkgFetcher.pyo
new file mode 100644
index 0000000..482e55e
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BinpkgFetcher.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BinpkgPrefetcher.pyo b/portage_with_autodep/pym/_emerge/BinpkgPrefetcher.pyo
new file mode 100644
index 0000000..c890cac
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BinpkgPrefetcher.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BinpkgVerifier.pyo b/portage_with_autodep/pym/_emerge/BinpkgVerifier.pyo
new file mode 100644
index 0000000..21f770e
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BinpkgVerifier.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/Blocker.pyo b/portage_with_autodep/pym/_emerge/Blocker.pyo
new file mode 100644
index 0000000..b9e56bc
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/Blocker.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BlockerCache.py b/portage_with_autodep/pym/_emerge/BlockerCache.py
index 5c4f43e..fce81f8 100644
--- a/portage_with_autodep/pym/_emerge/BlockerCache.py
+++ b/portage_with_autodep/pym/_emerge/BlockerCache.py
@@ -1,6 +1,7 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import errno
import sys
from portage.util import writemsg
from portage.data import secpass
@@ -15,6 +16,9 @@ except ImportError:
if sys.hexversion >= 0x3000000:
basestring = str
long = int
+ _unicode = str
+else:
+ _unicode = unicode
class BlockerCache(portage.cache.mappings.MutableMapping):
"""This caches blockers of installed packages so that dep_check does not
@@ -58,8 +62,11 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
self._cache_data = mypickle.load()
f.close()
del f
- except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError) as e:
- if isinstance(e, pickle.UnpicklingError):
+ except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e:
+ if isinstance(e, EnvironmentError) and \
+ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES):
+ pass
+ else:
writemsg("!!! Error loading '%s': %s\n" % \
(self._cache_filename, str(e)), noiselevel=-1)
del e
@@ -141,7 +148,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
f.close()
portage.util.apply_secpass_permissions(
self._cache_filename, gid=portage.portage_gid, mode=0o644)
- except (IOError, OSError) as e:
+ except (IOError, OSError):
pass
self._modified.clear()
@@ -155,8 +162,8 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
@param blocker_data: An object with counter and atoms attributes.
@type blocker_data: BlockerData
"""
- self._cache_data["blockers"][cpv] = \
- (blocker_data.counter, tuple(str(x) for x in blocker_data.atoms))
+ self._cache_data["blockers"][_unicode(cpv)] = (blocker_data.counter,
+ tuple(_unicode(x) for x in blocker_data.atoms))
self._modified.add(cpv)
def __iter__(self):
@@ -176,7 +183,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
def __getitem__(self, cpv):
"""
@rtype: BlockerData
- @returns: An object with counter and atoms attributes.
+ @return: An object with counter and atoms attributes.
"""
return self.BlockerData(*self._cache_data["blockers"][cpv])
diff --git a/portage_with_autodep/pym/_emerge/BlockerCache.pyo b/portage_with_autodep/pym/_emerge/BlockerCache.pyo
new file mode 100644
index 0000000..41554e1
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BlockerCache.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BlockerDB.py b/portage_with_autodep/pym/_emerge/BlockerDB.py
index 4819749..459affd 100644
--- a/portage_with_autodep/pym/_emerge/BlockerDB.py
+++ b/portage_with_autodep/pym/_emerge/BlockerDB.py
@@ -25,7 +25,7 @@ class BlockerDB(object):
self._dep_check_trees = None
self._fake_vartree = fake_vartree
self._dep_check_trees = {
- self._vartree.root : {
+ self._vartree.settings["EROOT"] : {
"porttree" : fake_vartree,
"vartree" : fake_vartree,
}}
@@ -36,7 +36,8 @@ class BlockerDB(object):
new_pkg is planned to be installed. This ignores build-time
blockers, since new_pkg is assumed to be built already.
"""
- blocker_cache = BlockerCache(self._vartree.root, self._vartree.dbapi)
+ blocker_cache = BlockerCache(None,
+ self._vartree.dbapi)
dep_keys = ["RDEPEND", "PDEPEND"]
settings = self._vartree.settings
stale_cache = set(blocker_cache)
diff --git a/portage_with_autodep/pym/_emerge/BlockerDB.pyo b/portage_with_autodep/pym/_emerge/BlockerDB.pyo
new file mode 100644
index 0000000..dfab0aa
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BlockerDB.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/BlockerDepPriority.pyo b/portage_with_autodep/pym/_emerge/BlockerDepPriority.pyo
new file mode 100644
index 0000000..c3b554c
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/BlockerDepPriority.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/CompositeTask.py b/portage_with_autodep/pym/_emerge/CompositeTask.py
index 644a69b..3e43478 100644
--- a/portage_with_autodep/pym/_emerge/CompositeTask.py
+++ b/portage_with_autodep/pym/_emerge/CompositeTask.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.AsynchronousTask import AsynchronousTask
@@ -60,7 +60,8 @@ class CompositeTask(AsynchronousTask):
self._current_task = None
break
else:
- self.scheduler.schedule(condition=self._task_queued_wait)
+ while not self._task_queued_wait():
+ self.scheduler.iteration()
if self.returncode is not None:
break
elif self.cancelled:
@@ -103,7 +104,7 @@ class CompositeTask(AsynchronousTask):
Subclasses can use this as a generic task exit callback.
@rtype: int
- @returns: The task.returncode attribute.
+ @return: The task.returncode attribute.
"""
self._assert_current(task)
if task.returncode != os.EX_OK:
diff --git a/portage_with_autodep/pym/_emerge/CompositeTask.pyo b/portage_with_autodep/pym/_emerge/CompositeTask.pyo
new file mode 100644
index 0000000..adc8cae
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/CompositeTask.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/DepPriority.pyo b/portage_with_autodep/pym/_emerge/DepPriority.pyo
new file mode 100644
index 0000000..4028a36
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/DepPriority.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/DepPriorityNormalRange.pyo b/portage_with_autodep/pym/_emerge/DepPriorityNormalRange.pyo
new file mode 100644
index 0000000..5e0f710
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/DepPriorityNormalRange.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/DepPrioritySatisfiedRange.pyo b/portage_with_autodep/pym/_emerge/DepPrioritySatisfiedRange.pyo
new file mode 100644
index 0000000..5309bcd
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/DepPrioritySatisfiedRange.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/Dependency.py b/portage_with_autodep/pym/_emerge/Dependency.py
index 0f746b6..c2d36b2 100644
--- a/portage_with_autodep/pym/_emerge/Dependency.py
+++ b/portage_with_autodep/pym/_emerge/Dependency.py
@@ -1,8 +1,9 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+from portage.util.SlotObject import SlotObject
from _emerge.DepPriority import DepPriority
-from _emerge.SlotObject import SlotObject
+
class Dependency(SlotObject):
__slots__ = ("atom", "blocker", "child", "depth",
"parent", "onlydeps", "priority", "root",
diff --git a/portage_with_autodep/pym/_emerge/Dependency.pyo b/portage_with_autodep/pym/_emerge/Dependency.pyo
new file mode 100644
index 0000000..f53e0ed
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/Dependency.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/DependencyArg.pyo b/portage_with_autodep/pym/_emerge/DependencyArg.pyo
new file mode 100644
index 0000000..916a762
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/DependencyArg.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/EbuildBinpkg.py b/portage_with_autodep/pym/_emerge/EbuildBinpkg.py
index b7d43ba..34a6aef 100644
--- a/portage_with_autodep/pym/_emerge/EbuildBinpkg.py
+++ b/portage_with_autodep/pym/_emerge/EbuildBinpkg.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.CompositeTask import CompositeTask
@@ -34,6 +34,10 @@ class EbuildBinpkg(CompositeTask):
self.settings.pop("PORTAGE_BINPKG_TMPFILE", None)
if self._default_exit(package_phase) != os.EX_OK:
+ try:
+ os.unlink(self._binpkg_tmpfile)
+ except OSError:
+ pass
self.wait()
return
diff --git a/portage_with_autodep/pym/_emerge/EbuildBinpkg.pyo b/portage_with_autodep/pym/_emerge/EbuildBinpkg.pyo
new file mode 100644
index 0000000..2acfc87
--- /dev/null
+++ b/portage_with_autodep/pym/_emerge/EbuildBinpkg.pyo
Binary files differ
diff --git a/portage_with_autodep/pym/_emerge/EbuildBuild.py b/portage_with_autodep/pym/_emerge/EbuildBuild.py
index 1c423a3..5a48f8e 100644
--- a/portage_with_autodep/pym/_emerge/EbuildBuild.py
+++ b/portage_with_autodep/pym/_emerge/EbuildBuild.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.EbuildExecuter import EbuildExecuter
@@ -32,12 +32,13 @@ class EbuildBuild(CompositeTask):