From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qv6Lh-0006wm-Ig for garchives@archives.gentoo.org; Sun, 21 Aug 2011 11:40:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 74D3421C1E2; Sun, 21 Aug 2011 11:37:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B7C4A21C1E2 for ; Sun, 21 Aug 2011 11:37:39 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8ACBA1B4012 for ; Sun, 21 Aug 2011 11:37:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 8989280037 for ; Sun, 21 Aug 2011 11:37:36 +0000 (UTC) From: "Александр Берсенев" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Александр Берсенев" Message-ID: <91ffc6c50001d41fe1d16981baa32fb557463375.bay@gentoo> Subject: [gentoo-commits] proj/autodep:master commit in: portage_with_autodep/pym/portage/tests/news/, ... X-VCS-Repository: proj/autodep X-VCS-Files: portage_with_autodep/bin/archive-conf portage_with_autodep/bin/banned-helper portage_with_autodep/bin/binhost-snapshot portage_with_autodep/bin/check-implicit-pointer-usage.py portage_with_autodep/bin/clean_locks portage_with_autodep/bin/dispatch-conf portage_with_autodep/bin/dohtml.py portage_with_autodep/bin/ebuild portage_with_autodep/bin/ebuild-helpers/4/dodoc portage_with_autodep/bin/ebuild-helpers/4/dohard portage_with_autodep/bin/ebuild-helpers/4/dosed portage_with_autodep/bin/ebuild-helpers/4/prepalldocs portage_with_autodep/bin/ebuild-helpers/die portage_with_autodep/bin/ebuild-helpers/dobin portage_with_autodep/bin/ebuild-helpers/doconfd portage_with_autodep/bin/ebuild-helpers/dodir portage_with_autodep/bin/ebuild-helpers/dodoc portage_with_autodep/bin/ebuild-helpers/doenvd portage_with_autodep/bin/ebuild-helpers/doexe portage_with_autodep/bin/ebuild-helpers/dohard portage_with_autodep/bin/ebuild-helpers/dohtml portage_with_autodep/bin/ebuild-helpers/do info portage_with_autodep/bin/ebuild-helpers/doinitd portage_with_autodep/bin/ebuild-helpers/doins portage_with_autodep/bin/ebuild-helpers/dolib portage_with_autodep/bin/ebuild-helpers/dolib.a portage_with_autodep/bin/ebuild-helpers/dolib.so portage_with_autodep/bin/ebuild-helpers/doman portage_with_autodep/bin/ebuild-helpers/domo portage_with_autodep/bin/ebuild-helpers/dosbin portage_with_autodep/bin/ebuild-helpers/dosed portage_with_autodep/bin/ebuild-helpers/dosym portage_with_autodep/bin/ebuild-helpers/ecompress portage_with_autodep/bin/ebuild-helpers/ecompressdir portage_with_autodep/bin/ebuild-helpers/eerror portage_with_autodep/bin/ebuild-helpers/einfo portage_with_autodep/bin/ebuild-helpers/elog portage_with_autodep/bin/ebuild-helpers/emake portage_with_autodep/bin/ebuild-helpers/eqawarn portage_with_autodep/bin/ebuild-helpers/ewarn portage_with_autodep/bin/ebuild-helpers/fowners portage_with_autodep/bin/ebuild-helpers/fperms portage_with_autodep/bin/ebuild-helpers/n ewbin portage_with_autodep/bin/ebuild-helpers/newconfd portage_with_autodep/bin/ebuild-helpers/newdoc portage_with_autodep/bin/ebuild-helpers/newenvd portage_with_autodep/bin/ebuild-helpers/newexe portage_with_autodep/bin/ebuild-helpers/newinitd portage_with_autodep/bin/ebuild-helpers/newins portage_with_autodep/bin/ebuild-helpers/newlib.a portage_with_autodep/bin/ebuild-helpers/newlib.so portage_with_autodep/bin/ebuild-helpers/newman portage_with_autodep/bin/ebuild-helpers/newsbin portage_with_autodep/bin/ebuild-helpers/portageq portage_with_autodep/bin/ebuild-helpers/prepall portage_with_autodep/bin/ebuild-helpers/prepalldocs portage_with_autodep/bin/ebuild-helpers/prepallinfo portage_with_autodep/bin/ebuild-helpers/prepallman portage_with_autodep/bin/ebuild-helpers/prepallstrip portage_with_autodep/bin/ebuild-helpers/prepinfo portage_with_autodep/bin/ebuild-helpers/preplib portage_with_autodep/bin/ebuild-helpers/prepman portage_with_autodep/bin/ebuild-helpers/prepstrip po rtage_with_autodep/bin/ebuild-helpers/sed portage_with_autodep/bin/ebuild-ipc portage_with_autodep/bin/ebuild-ipc.py portage_with_autodep/bin/ebuild.sh portage_with_autodep/bin/egencache portage_with_autodep/bin/emaint portage_with_autodep/bin/emerge portage_with_autodep/bin/emerge-webrsync portage_with_autodep/bin/env-update portage_with_autodep/bin/etc-update portage_with_autodep/bin/filter-bash-environment.py portage_with_autodep/bin/fixpackages portage_with_autodep/bin/glsa-check portage_with_autodep/bin/isolated-functions.sh portage_with_autodep/bin/lock-helper.py portage_with_autodep/bin/misc-functions.sh portage_with_autodep/bin/portageq portage_with_autodep/bin/quickpkg portage_with_autodep/bin/regenworld portage_with_autodep/bin/repoman portage_with_autodep/bin/xpak-helper.py portage_with_autodep/pym/_emerge/AbstractDepPriority.py portage_with_autodep/pym/_emerge/AbstractEbuildProcess.py portage_with_autodep/pym/_emerge/AbstractPollTask.py portage_with_autodep/pym/_ emerge/AsynchronousLock.py portage_with_autodep/pym/_emerge/AsynchronousTask.py portage_with_autodep/pym/_emerge/AtomArg.py portage_with_autodep/pym/_emerge/Binpkg.py portage_with_autodep/pym/_emerge/BinpkgEnvExtractor.py portage_with_autodep/pym/_emerge/BinpkgExtractorAsync.py portage_with_autodep/pym/_emerge/BinpkgFetcher.py portage_with_autodep/pym/_emerge/BinpkgPrefetcher.py portage_with_autodep/pym/_emerge/BinpkgVerifier.py portage_with_autodep/pym/_emerge/Blocker.py portage_with_autodep/pym/_emerge/BlockerCache.py portage_with_autodep/pym/_emerge/BlockerDB.py portage_with_autodep/pym/_emerge/BlockerDepPriority.py portage_with_autodep/pym/_emerge/CompositeTask.py portage_with_autodep/pym/_emerge/DepPriority.py portage_with_autodep/pym/_emerge/DepPriorityNormalRange.py portage_with_autodep/pym/_emerge/DepPrioritySatisfiedRange.py portage_with_autodep/pym/_emerge/Dependency.py portage_with_autodep/pym/_emerge/DependencyArg.py portage_with_autodep/pym/_emerge/EbuildBinpkg. py portage_with_autodep/pym/_emerge/EbuildBuild.py portage_with_autodep/pym/_emerge/EbuildBuildDir.py portage_with_autodep/pym/_emerge/EbuildExecuter.py portage_with_autodep/pym/_emerge/EbuildFetcher.py portage_with_autodep/pym/_emerge/EbuildFetchonly.py portage_with_autodep/pym/_emerge/EbuildIpcDaemon.py portage_with_autodep/pym/_emerge/EbuildMerge.py portage_with_autodep/pym/_emerge/EbuildMetadataPhase.py portage_with_autodep/pym/_emerge/EbuildPhase.py portage_with_autodep/pym/_emerge/EbuildProcess.py portage_with_autodep/pym/_emerge/EbuildSpawnProcess.py portage_with_autodep/pym/_emerge/EventsAnalyser.py portage_with_autodep/pym/_emerge/EventsLogger.py portage_with_autodep/pym/_emerge/FakeVartree.py portage_with_autodep/pym/_emerge/FifoIpcDaemon.py portage_with_autodep/pym/_emerge/JobStatusDisplay.py portage_with_autodep/pym/_emerge/MergeListItem.py portage_with_autodep/pym/_emerge/MetadataRegen.py portage_with_autodep/pym/_emerge/MiscFunctionsProcess.py portage_with_auto dep/pym/_emerge/Package.py portage_with_autodep/pym/_emerge/PackageArg.py portage_with_autodep/pym/_emerge/PackageMerge.py portage_with_autodep/pym/_emerge/PackageUninstall.py portage_with_autodep/pym/_emerge/PackageVirtualDbapi.py portage_with_autodep/pym/_emerge/PipeReader.py portage_with_autodep/pym/_emerge/PollConstants.py portage_with_autodep/pym/_emerge/PollScheduler.py portage_with_autodep/pym/_emerge/PollSelectAdapter.py portage_with_autodep/pym/_emerge/ProgressHandler.py portage_with_autodep/pym/_emerge/QueueScheduler.py portage_with_autodep/pym/_emerge/RootConfig.py portage_with_autodep/pym/_emerge/Scheduler.py portage_with_autodep/pym/_emerge/SequentialTaskQueue.py portage_with_autodep/pym/_emerge/SetArg.py portage_with_autodep/pym/_emerge/SlotObject.py portage_with_autodep/pym/_emerge/SpawnProcess.py portage_with_autodep/pym/_emerge/SubProcess.py portage_with_autodep/pym/_emerge/Task.py portage_with_autodep/pym/_emerge/TaskScheduler.py portage_with_autodep/pym/_e merge/TaskSequence.py portage_with_autodep/pym/_emerge/UninstallFailure.py portage_with_autodep/pym/_emerge/UnmergeDepPriority.py portage_with_autodep/pym/_emerge/UseFlagDisplay.py portage_with_autodep/pym/_emerge/__init__.py portage_with_autodep/pym/_emerge/_find_deep_system_runtime_deps.py portage_with_autodep/pym/_emerge/_flush_elog_mod_echo.py portage_with_autodep/pym/_emerge/actions.py portage_with_autodep/pym/_emerge/clear_caches.py portage_with_autodep/pym/_emerge/countdown.py portage_with_autodep/pym/_emerge/create_depgraph_params.py portage_with_autodep/pym/_emerge/create_world_atom.py portage_with_autodep/pym/_emerge/depgraph.py portage_with_autodep/pym/_emerge/emergelog.py portage_with_autodep/pym/_emerge/getloadavg.py portage_with_autodep/pym/_emerge/help.py portage_with_autodep/pym/_emerge/is_valid_package_atom.py portage_with_autodep/pym/_emerge/main.py portage_with_autodep/pym/_emerge/resolver/__init__.py portage_with_autodep/pym/_emerge/resolver/backtracking. py portage_with_autodep/pym/_emerge/resolver/circular_dependency.py portage_with_autodep/pym/_emerge/resolver/output.py portage_with_autodep/pym/_emerge/resolver/output_helpers.py portage_with_autodep/pym/_emerge/resolver/slot_collision.py portage_with_autodep/pym/_emerge/search.py portage_with_autodep/pym/_emerge/show_invalid_depstring_notice.py portage_with_autodep/pym/_emerge/stdout_spinner.py portage_with_autodep/pym/_emerge/sync/__init__.py portage_with_autodep/pym/_emerge/sync/getaddrinfo_validate.py portage_with_autodep/pym/_emerge/sync/old_tree_timestamp.py portage_with_autodep/pym/_emerge/unmerge.py portage_with_autodep/pym/_emerge/userquery.py portage_with_autodep/pym/portage/__init__.py portage_with_autodep/pym/portage/_global_updates.py portage_with_autodep/pym/portage/_legacy_globals.py portage_with_autodep/pym/portage/_selinux.py portage_with_autodep/pym/portage/_sets/__init__.py portage_with_autodep/pym/portage/_sets/base.py portage_with_autodep/pym/portage/_s ets/dbapi.py portage_with_autodep/pym/portage/_sets/files.py portage_with_autodep/pym/portage/_sets/libs.py portage_with_autodep/pym/portage/_sets/profiles.py portage_with_autodep/pym/portage/_sets/security.py portage_with_autodep/pym/portage/_sets/shell.py portage_with_autodep/pym/portage/cache/__init__.py portage_with_autodep/pym/portage/cache/anydbm.py portage_with_autodep/pym/portage/cache/cache_errors.py portage_with_autodep/pym/portage/cache/ebuild_xattr.py portage_with_autodep/pym/portage/cache/flat_hash.py portage_with_autodep/pym/portage/cache/flat_list.py portage_with_autodep/pym/portage/cache/fs_template.py portage_with_autodep/pym/portage/cache/mappings.py portage_with_autodep/pym/portage/cache/metadata.py portage_with_autodep/pym/portage/cache/metadata_overlay.py portage_with_autodep/pym/portage/cache/sql_template.py portage_with_autodep/pym/portage/cache/sqlite.py portage_with_autodep/pym/portage/cache/template.py portage_with_autodep/pym/portage/cache/util.py portage_with_autodep/pym/portage/cache/volatile.py portage_with_autodep/pym/portage/checksum.py portage_with_autodep/pym/portage/const.py portage_with_autodep/pym/portage/cvstree.py portage_with_autodep/pym/portage/data.py portage_with_autodep/pym/portage/dbapi/_MergeProcess.py portage_with_autodep/pym/portage/dbapi/__init__.py portage_with_autodep/pym/portage/dbapi/_expand_new_virt.py portage_with_autodep/pym/portage/dbapi/bintree.py portage_with_autodep/pym/portage/dbapi/cpv_expand.py portage_with_autodep/pym/portage/dbapi/dep_expand.py portage_with_autodep/pym/portage/dbapi/porttree.py portage_with_autodep/pym/portage/dbapi/vartree.py portage_with_autodep/pym/portage/dbapi/virtual.py portage_with_autodep/pym/portage/debug.py portage_with_autodep/pym/portage/dep/__init__.py portage_with_autodep/pym/portage/dep/dep_check.py portage_with_autodep/pym/portage/dispatch_conf.py portage_with_autodep/pym/portage/eapi.py portage_with_autodep/pym/portage/eclass_cache.py portage_with _autodep/pym/portage/elog/__init__.py portage_with_autodep/pym/portage/elog/filtering.py portage_with_autodep/pym/portage/elog/messages.py portage_with_autodep/pym/portage/elog/mod_custom.py portage_with_autodep/pym/portage/elog/mod_echo.py portage_with_autodep/pym/portage/elog/mod_mail.py portage_with_autodep/pym/portage/elog/mod_mail_summary.py portage_with_autodep/pym/portage/elog/mod_save.py portage_with_autodep/pym/portage/elog/mod_save_summary.py portage_with_autodep/pym/portage/elog/mod_syslog.py portage_with_autodep/pym/portage/env/__init__.py portage_with_autodep/pym/portage/env/config.py portage_with_autodep/pym/portage/env/loaders.py portage_with_autodep/pym/portage/env/validators.py portage_with_autodep/pym/portage/exception.py portage_with_autodep/pym/portage/getbinpkg.py portage_with_autodep/pym/portage/glsa.py portage_with_autodep/pym/portage/localization.py portage_with_autodep/pym/portage/locks.py portage_with_autodep/pym/portage/mail.py portage_with_autodep /pym/portage/manifest.py portage_with_autodep/pym/portage/news.py portage_with_autodep/pym/portage/output.py portage_with_autodep/pym/portage/package/__init__.py portage_with_autodep/pym/portage/package/ebuild/__init__.py portage_with_autodep/pym/portage/package/ebuild/_config/KeywordsManager.py portage_with_autodep/pym/portage/package/ebuild/_config/LicenseManager.py portage_with_autodep/pym/portage/package/ebuild/_config/LocationsManager.py portage_with_autodep/pym/portage/package/ebuild/_config/MaskManager.py portage_with_autodep/pym/portage/package/ebuild/_config/UseManager.py portage_with_autodep/pym/portage/package/ebuild/_config/VirtualsManager.py portage_with_autodep/pym/portage/package/ebuild/_config/__init__.py portage_with_autodep/pym/portage/package/ebuild/_config/env_var_validation.py portage_with_autodep/pym/portage/package/ebuild/_config/features_set.py portage_with_autodep/pym/portage/package/ebuild/_config/helper.py portage_with_autodep/pym/portage/package/e build/_config/special_env_vars.py portage_with_autodep/pym/portage/package/ebuild/_ipc/ExitCommand.py portage_with_autodep/pym/portage/package/ebuild/_ipc/IpcCommand.py portage_with_autodep/pym/portage/package/ebuild/_ipc/QueryCommand.py portage_with_autodep/pym/portage/package/ebuild/_ipc/__init__.py portage_with_autodep/pym/portage/package/ebuild/_spawn_nofetch.py portage_with_autodep/pym/portage/package/ebuild/config.py portage_with_autodep/pym/portage/package/ebuild/deprecated_profile_check.py portage_with_autodep/pym/portage/package/ebuild/digestcheck.py portage_with_autodep/pym/portage/package/ebuild/digestgen.py portage_with_autodep/pym/portage/package/ebuild/doebuild.py portage_with_autodep/pym/portage/package/ebuild/fetch.py portage_with_autodep/pym/portage/package/ebuild/getmaskingreason.py portage_with_autodep/pym/portage/package/ebuild/getmaskingstatus.py portage_with_autodep/pym/portage/package/ebuild/prepare_build_dirs.py portage_with_autodep/pym/portage/proces s.py portage_with_autodep/pym/portage/proxy/__init__.py portage_with_autodep/pym/portage/proxy/lazyimport.py portage_with_autodep/pym/portage/proxy/objectproxy.py portage_with_autodep/pym/portage/repository/__init__.py portage_with_autodep/pym/portage/repository/config.py portage_with_autodep/pym/portage/tests/__init__.py portage_with_autodep/pym/portage/tests/bin/__init__.py portage_with_autodep/pym/portage/tests/bin/__test__ portage_with_autodep/pym/portage/tests/bin/setup_env.py portage_with_autodep/pym/portage/tests/bin/test_dobin.py portage_with_autodep/pym/portage/tests/bin/test_dodir.py portage_with_autodep/pym/portage/tests/dbapi/__init__.py portage_with_autodep/pym/portage/tests/dbapi/__test__ portage_with_autodep/pym/portage/tests/dbapi/test_fakedbapi.py portage_with_autodep/pym/portage/tests/dep/__init__.py portage_with_autodep/pym/portage/tests/dep/__test__ portage_with_autodep/pym/portage/tests/dep/testAtom.py portage_with_autodep/pym/portage/tests/dep/testCheck RequiredUse.py portage_with_autodep/pym/portage/tests/dep/testExtendedAtomDict.py portage_with_autodep/pym/portage/tests/dep/testExtractAffectingUSE.py portage_with_autodep/pym/portage/tests/dep/testStandalone.py portage_with_autodep/pym/portage/tests/dep/test_best_match_to_list.py portage_with_autodep/pym/portage/tests/dep/test_dep_getcpv.py portage_with_autodep/pym/portage/tests/dep/test_dep_getrepo.py portage_with_autodep/pym/portage/tests/dep/test_dep_getslot.py portage_with_autodep/pym/portage/tests/dep/test_dep_getusedeps.py portage_with_autodep/pym/portage/tests/dep/test_get_operator.py portage_with_autodep/pym/portage/tests/dep/test_get_required_use_flags.py portage_with_autodep/pym/portage/tests/dep/test_isjustname.py portage_with_autodep/pym/portage/tests/dep/test_isvalidatom.py portage_with_autodep/pym/portage/tests/dep/test_match_from_list.py portage_with_autodep/pym/portage/tests/dep/test_paren_reduce.py portage_with_autodep/pym/portage/tests/dep/test_use_reduce .py portage_with_autodep/pym/portage/tests/ebuild/__init__.py portage_with_autodep/pym/portage/tests/ebuild/__test__ portage_with_autodep/pym/portage/tests/ebuild/test_array_fromfile_eof.py portage_with_autodep/pym/portage/tests/ebuild/test_config.py portage_with_autodep/pym/portage/tests/ebuild/test_doebuild_spawn.py portage_with_autodep/pym/portage/tests/ebuild/test_ipc_daemon.py portage_with_autodep/pym/portage/tests/ebuild/test_pty_eof.py portage_with_autodep/pym/portage/tests/ebuild/test_spawn.py portage_with_autodep/pym/portage/tests/env/__init__.py portage_with_autodep/pym/portage/tests/env/__test__ portage_with_autodep/pym/portage/tests/env/config/__init__.py portage_with_autodep/pym/portage/tests/env/config/__test__ portage_with_autodep/pym/portage/tests/env/config/test_PackageKeywordsFile.py portage_with_autodep/pym/portage/tests/env/config/test_PackageMaskFile.py portage_with_autodep/pym/portage/tests/env/config/test_PackageUseFile.py portage_with_autodep/pym/port age/tests/env/config/test_PortageModulesFile.py portage_with_autodep/pym/portage/tests/lafilefixer/__init__.py portage_with_autodep/pym/portage/tests/lafilefixer/__test__ portage_with_autodep/pym/portage/tests/lafilefixer/test_lafilefixer.py portage_with_autodep/pym/portage/tests/lazyimport/__init__.py portage_with_autodep/pym/portage/tests/lazyimport/__test__ portage_with_autodep/pym/portage/tests/lazyimport/test_lazy_import_portage_baseline.py portage_with_autodep/pym/portage/tests/lazyimport/test_preload_portage_submodules.py portage_with_autodep/pym/portage/tests/lint/__init__.py portage_with_autodep/pym/portage/tests/lint/__test__ portage_with_autodep/pym/portage/tests/lint/test_bash_syntax.py portage_with_autodep/pym/portage/tests/lint/test_compile_modules.py portage_with_autodep/pym/portage/tests/lint/test_import_modules.py portage_with_autodep/pym/portage/tests/locks/__init__.py portage_with_autodep/pym/portage/tests/locks/__test__ portage_with_autodep/pym/portage/te sts/locks/test_asynchronous_lock.py portage_with_autodep/pym/portage/tests/locks/test_lock_nonblock.py portage_with_autodep/pym/portage/tests/news/__init__.py portage_with_autodep/pym/portage/tests/news/__test__ portage_with_autodep/pym/portage/tests/news/test_NewsItem.py portage_with_autodep/pym/portage/tests/process/__init__.py portage_with_autodep/pym/portage/tests/process/__test__ portage_with_autodep/pym/portage/tests/process/test_poll.py portage_with_autodep/pym/portage/tests/resolver/ResolverPlayground.py portage_with_autodep/pym/portage/tests/resolver/__init__.py portage_with_autodep/pym/portage/tests/resolver/__test__ portage_with_autodep/pym/portage/tests/resolver/test_autounmask.py portage_with_autodep/pym/portage/tests/resolver/test_backtracking.py portage_with_autodep/pym/portage/tests/resolver/test_circular_dependencies.py portage_with_autodep/pym/portage/tests/resolver/test_depclean.py portage_with_autodep/pym/portage/tests/resolver/test_depth.py portage_with_ autodep/pym/portage/tests/resolver/test_eapi.py portage_with_autodep/pym/portage/tests/resolver/test_merge_order.py portage_with_autodep/pym/portage/tests/resolver/test_missing_iuse_and_evaluated_atoms.py portage_with_autodep/pym/portage/tests/resolver/test_multirepo.py portage_with_autodep/pym/portage/tests/resolver/test_multislot.py portage_with_autodep/pym/portage/tests/resolver/test_old_dep_chain_display.py portage_with_autodep/pym/portage/tests/resolver/test_output.py portage_with_autodep/pym/portage/tests/resolver/test_rebuild.py portage_with_autodep/pym/portage/tests/resolver/test_required_use.py portage_with_autodep/pym/portage/tests/resolver/test_simple.py portage_with_autodep/pym/portage/tests/resolver/test_slot_collisions.py portage_with_autodep/pym/portage/tests/resolver/test_use_dep_defaults.py portage_with_autodep/pym/portage/tests/runTests portage_with_autodep/pym/portage/tests/sets/__init__.py portage_with_autodep/pym/portage/tests/sets/base/__init__.py porta ge_with_autodep/pym/portage/tests/sets/base/__test__ portage_with_autodep/pym/portage/tests/sets/base/testInternalPackageSet.py portage_with_autodep/pym/portage/tests/sets/files/__init__.py portage_with_autodep/pym/portage/tests/sets/files/__test__ portage_with_autodep/pym/portage/tests/sets/files/testConfigFileSet.py portage_with_autodep/pym/portage/tests/sets/files/testStaticFileSet.py portage_with_autodep/pym/portage/tests/sets/shell/__init__.py portage_with_autodep/pym/portage/tests/sets/shell/__test__ portage_with_autodep/pym/portage/tests/sets/shell/testShell.py portage_with_autodep/pym/portage/tests/unicode/__init__.py portage_with_autodep/pym/portage/tests/unicode/__test__ portage_with_autodep/pym/portage/tests/unicode/test_string_format.py portage_with_autodep/pym/portage/tests/util/__init__.py portage_with_autodep/pym/portage/tests/util/__test__ portage_with_autodep/pym/portage/tests/util/test_digraph.py portage_with_autodep/pym/portage/tests/util/test_getconfig.py portage_with_autodep/pym/portage/tests/util/test_grabdict.py portage_with_autodep/pym/portage/tests/util/test_normalizedPath.py portage_with_autodep/pym/portage/tests/util/test_stackDictList.py portage_with_autodep/pym/portage/tests/util/test_stackDicts.py portage_with_autodep/pym/portage/tests/util/test_stackLists.py portage_with_autodep/pym/portage/tests/util/test_uniqueArray.py portage_with_autodep/pym/portage/tests/util/test_varExpand.py portage_with_autodep/pym/portage/tests/versions/__init__.py portage_with_autodep/pym/portage/tests/versions/__test__ portage_with_autodep/pym/portage/tests/versions/test_cpv_sort_key.py portage_with_autodep/pym/portage/tests/versions/test_vercmp.py portage_with_autodep/pym/portage/tests/xpak/__init__.py portage_with_autodep/pym/portage/tests/xpak/__test__ portage_with_autodep/pym/portage/tests/xpak/test_decodeint.py portage_with_autodep/pym/portage/update.py portage_with_autodep/pym/portage/util/ExtractKernelVersion.py portage_with_auto dep/pym/portage/util/__init__.py portage_with_autodep/pym/portage/util/_dyn_libs/LinkageMapELF.py portage_with_autodep/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py portage_with_autodep/pym/portage/util/_dyn_libs/__init__.py portage_with_autodep/pym/portage/util/_pty.py portage_with_autodep/pym/portage/util/digraph.py portage_with_autodep/pym/portage/util/env_update.py portage_with_autodep/pym/portage/util/lafilefixer.py portage_with_autodep/pym/portage/util/listdir.py portage_with_autodep/pym/portage/util/movefile.py portage_with_autodep/pym/portage/util/mtimedb.py portage_with_autodep/pym/portage/versions.py portage_with_autodep/pym/portage/xml/__init__.py portage_with_autodep/pym/portage/xml/metadata.py portage_with_autodep/pym/portage/xpak.py portage_with_autodep/pym/repoman/__init__.py portage_with_autodep/pym/repoman/checks.py portage_with_autodep/pym/repoman/errors.py portage_with_autodep/pym/repoman/herdbase.py portage_with_autodep/pym/repoman/utilities.py X-VCS-Directories: portage_with_autodep/pym/portage/tests/news/ portage_with_autodep/pym/_emerge/sync/ portage_with_autodep/pym/portage/tests/lazyimport/ portage_with_autodep/pym/portage/tests/sets/shell/ portage_with_autodep/pym/portage/tests/resolver/ portage_with_autodep/pym/_emerge/ portage_with_autodep/pym/portage/util/ portage_with_autodep/pym/portage/tests/sets/files/ portage_with_autodep/pym/portage/tests/dbapi/ portage_with_autodep/pym/portage/proxy/ portage_with_autodep/pym/_emerge/resolver/ portage_with_autodep/pym/portage/tests/locks/ portage_with_autodep/pym/portage/package/ebuild/_config/ portage_with_autodep/pym/portage/env/ portage_with_autodep/pym/portage/xml/ portage_with_autodep/pym/portage/repository/ portage_with_autodep/pym/portage/package/ebuild/ portage_with_autodep/pym/portage/_sets/ portage_with_autodep/pym/portage/tests/ebuild/ portage_with_autodep/pym/portage/tests/ portage_with_autodep/pym/portage/elog/ portage_with_autodep/pym/portage/tests/env/c onfig/ portage_with_autodep/bin/ebuild-helpers/4/ portage_with_autodep/pym/portage/tests/dep/ portage_with_autodep/bin/ portage_with_autodep/pym/portage/tests/util/ portage_with_autodep/pym/portage/cache/ portage_with_autodep/pym/portage/package/ebuild/_ipc/ portage_with_autodep/pym/portage/tests/xpak/ portage_with_autodep/pym/portage/tests/versions/ portage_with_autodep/pym/repoman/ portage_with_autodep/pym/portage/tests/lint/ portage_with_autodep/pym/portage/tests/unicode/ portage_with_autodep/pym/portage/tests/bin/ portage_with_autodep/pym/portage/tests/sets/base/ portage_with_autodep/bin/ebuild-helpers/ portage_with_autodep/pym/portage/util/_dyn_libs/ portage_with_autodep/pym/portage/tests/sets/ portage_with_autodep/pym/portage/tests/process/ portage_with_autodep/pym/portage/package/ portage_with_autodep/pym/portage/dep/ portage_with_autodep/pym/portage/ portage_with_autodep/pym/portage/tests/lafilefixer/ portage_with_autodep/pym/portage/dbapi/ portage_with_autodep/pym/p ortage/tests/env/ X-VCS-Committer: bay X-VCS-Committer-Name: Александр Берсенев X-VCS-Revision: 91ffc6c50001d41fe1d16981baa32fb557463375 Date: Sun, 21 Aug 2011 11:37:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 71e44054eb6e0b227f1f7f915008d704 commit: 91ffc6c50001d41fe1d16981baa32fb557463375 Author: Alexander Bersenev hackerdom ru> AuthorDate: Sun Aug 21 17:35:50 2011 +0000 Commit: =D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80 =D0=91= =D0=B5=D1=80=D1=81=D0=B5=D0=BD=D0=B5=D0=B2 hackerdom ru> CommitDate: Sun Aug 21 17:35:50 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/autodep.git;a= =3Dcommit;h=3D91ffc6c5 add a patched version of portage --- portage_with_autodep/bin/archive-conf | 111 + portage_with_autodep/bin/banned-helper | 6 + portage_with_autodep/bin/binhost-snapshot | 142 + .../bin/check-implicit-pointer-usage.py | 84 + portage_with_autodep/bin/clean_locks | 47 + portage_with_autodep/bin/dispatch-conf | 434 ++ portage_with_autodep/bin/dohtml.py | 191 + portage_with_autodep/bin/ebuild | 346 + portage_with_autodep/bin/ebuild-helpers/4/dodoc | 1 + portage_with_autodep/bin/ebuild-helpers/4/dohard | 1 + portage_with_autodep/bin/ebuild-helpers/4/dosed | 1 + .../bin/ebuild-helpers/4/prepalldocs | 1 + portage_with_autodep/bin/ebuild-helpers/die | 7 + portage_with_autodep/bin/ebuild-helpers/dobin | 29 + portage_with_autodep/bin/ebuild-helpers/doconfd | 14 + portage_with_autodep/bin/ebuild-helpers/dodir | 10 + portage_with_autodep/bin/ebuild-helpers/dodoc | 31 + portage_with_autodep/bin/ebuild-helpers/doenvd | 14 + portage_with_autodep/bin/ebuild-helpers/doexe | 43 + portage_with_autodep/bin/ebuild-helpers/dohard | 13 + portage_with_autodep/bin/ebuild-helpers/dohtml | 14 + portage_with_autodep/bin/ebuild-helpers/doinfo | 24 + portage_with_autodep/bin/ebuild-helpers/doinitd | 14 + portage_with_autodep/bin/ebuild-helpers/doins | 155 + portage_with_autodep/bin/ebuild-helpers/dolib | 43 + portage_with_autodep/bin/ebuild-helpers/dolib.a | 6 + portage_with_autodep/bin/ebuild-helpers/dolib.so | 6 + portage_with_autodep/bin/ebuild-helpers/doman | 64 + portage_with_autodep/bin/ebuild-helpers/domo | 34 + portage_with_autodep/bin/ebuild-helpers/dosbin | 29 + portage_with_autodep/bin/ebuild-helpers/dosed | 35 + portage_with_autodep/bin/ebuild-helpers/dosym | 18 + portage_with_autodep/bin/ebuild-helpers/ecompress | 161 + .../bin/ebuild-helpers/ecompressdir | 143 + portage_with_autodep/bin/ebuild-helpers/eerror | 1 + portage_with_autodep/bin/ebuild-helpers/einfo | 1 + portage_with_autodep/bin/ebuild-helpers/elog | 7 + portage_with_autodep/bin/ebuild-helpers/emake | 28 + portage_with_autodep/bin/ebuild-helpers/eqawarn | 1 + portage_with_autodep/bin/ebuild-helpers/ewarn | 1 + portage_with_autodep/bin/ebuild-helpers/fowners | 13 + portage_with_autodep/bin/ebuild-helpers/fperms | 13 + portage_with_autodep/bin/ebuild-helpers/newbin | 19 + portage_with_autodep/bin/ebuild-helpers/newconfd | 19 + portage_with_autodep/bin/ebuild-helpers/newdoc | 19 + portage_with_autodep/bin/ebuild-helpers/newenvd | 19 + portage_with_autodep/bin/ebuild-helpers/newexe | 19 + portage_with_autodep/bin/ebuild-helpers/newinitd | 19 + portage_with_autodep/bin/ebuild-helpers/newins | 35 + portage_with_autodep/bin/ebuild-helpers/newlib.a | 19 + portage_with_autodep/bin/ebuild-helpers/newlib.so | 19 + portage_with_autodep/bin/ebuild-helpers/newman | 19 + portage_with_autodep/bin/ebuild-helpers/newsbin | 19 + portage_with_autodep/bin/ebuild-helpers/portageq | 8 + portage_with_autodep/bin/ebuild-helpers/prepall | 23 + .../bin/ebuild-helpers/prepalldocs | 15 + .../bin/ebuild-helpers/prepallinfo | 9 + portage_with_autodep/bin/ebuild-helpers/prepallman | 19 + .../bin/ebuild-helpers/prepallstrip | 5 + portage_with_autodep/bin/ebuild-helpers/prepinfo | 34 + portage_with_autodep/bin/ebuild-helpers/preplib | 28 + portage_with_autodep/bin/ebuild-helpers/prepman | 32 + portage_with_autodep/bin/ebuild-helpers/prepstrip | 193 + portage_with_autodep/bin/ebuild-helpers/sed | 27 + portage_with_autodep/bin/ebuild-ipc | 8 + portage_with_autodep/bin/ebuild-ipc.py | 276 + portage_with_autodep/bin/ebuild.sh | 2424 +++++++ portage_with_autodep/bin/egencache | 851 +++ portage_with_autodep/bin/emaint | 654 ++ portage_with_autodep/bin/emerge | 66 + portage_with_autodep/bin/emerge-webrsync | 457 ++ portage_with_autodep/bin/env-update | 41 + portage_with_autodep/bin/etc-update | 616 ++ .../bin/filter-bash-environment.py | 150 + portage_with_autodep/bin/fixpackages | 45 + portage_with_autodep/bin/glsa-check | 316 + portage_with_autodep/bin/isolated-functions.sh | 630 ++ portage_with_autodep/bin/lock-helper.py | 28 + portage_with_autodep/bin/misc-functions.sh | 1002 +++ portage_with_autodep/bin/portageq | 822 +++ portage_with_autodep/bin/quickpkg | 291 + portage_with_autodep/bin/regenworld | 144 + portage_with_autodep/bin/repoman | 2672 ++++++++ portage_with_autodep/bin/xpak-helper.py | 68 + .../pym/_emerge/AbstractDepPriority.py | 29 + .../pym/_emerge/AbstractEbuildProcess.py | 266 + .../pym/_emerge/AbstractPollTask.py | 62 + .../pym/_emerge/AsynchronousLock.py | 288 + .../pym/_emerge/AsynchronousTask.py | 129 + portage_with_autodep/pym/_emerge/AtomArg.py | 11 + portage_with_autodep/pym/_emerge/Binpkg.py | 333 + .../pym/_emerge/BinpkgEnvExtractor.py | 66 + .../pym/_emerge/BinpkgExtractorAsync.py | 31 + portage_with_autodep/pym/_emerge/BinpkgFetcher.py | 181 + .../pym/_emerge/BinpkgPrefetcher.py | 43 + portage_with_autodep/pym/_emerge/BinpkgVerifier.py | 75 + portage_with_autodep/pym/_emerge/Blocker.py | 15 + portage_with_autodep/pym/_emerge/BlockerCache.py | 182 + portage_with_autodep/pym/_emerge/BlockerDB.py | 124 + .../pym/_emerge/BlockerDepPriority.py | 13 + portage_with_autodep/pym/_emerge/CompositeTask.py | 157 + portage_with_autodep/pym/_emerge/DepPriority.py | 49 + .../pym/_emerge/DepPriorityNormalRange.py | 47 + .../pym/_emerge/DepPrioritySatisfiedRange.py | 85 + portage_with_autodep/pym/_emerge/Dependency.py | 20 + portage_with_autodep/pym/_emerge/DependencyArg.py | 33 + portage_with_autodep/pym/_emerge/EbuildBinpkg.py | 46 + portage_with_autodep/pym/_emerge/EbuildBuild.py | 426 ++ portage_with_autodep/pym/_emerge/EbuildBuildDir.py | 109 + portage_with_autodep/pym/_emerge/EbuildExecuter.py | 99 + portage_with_autodep/pym/_emerge/EbuildFetcher.py | 302 + .../pym/_emerge/EbuildFetchonly.py | 32 + .../pym/_emerge/EbuildIpcDaemon.py | 108 + portage_with_autodep/pym/_emerge/EbuildMerge.py | 56 + .../pym/_emerge/EbuildMetadataPhase.py | 133 + portage_with_autodep/pym/_emerge/EbuildPhase.py | 350 + portage_with_autodep/pym/_emerge/EbuildProcess.py | 21 + .../pym/_emerge/EbuildSpawnProcess.py | 16 + portage_with_autodep/pym/_emerge/EventsAnalyser.py | 511 ++ portage_with_autodep/pym/_emerge/EventsLogger.py | 180 + portage_with_autodep/pym/_emerge/FakeVartree.py | 265 + portage_with_autodep/pym/_emerge/FifoIpcDaemon.py | 81 + .../pym/_emerge/JobStatusDisplay.py | 292 + portage_with_autodep/pym/_emerge/MergeListItem.py | 135 + portage_with_autodep/pym/_emerge/MetadataRegen.py | 184 + .../pym/_emerge/MiscFunctionsProcess.py | 33 + portage_with_autodep/pym/_emerge/Package.py | 700 ++ portage_with_autodep/pym/_emerge/PackageArg.py | 19 + portage_with_autodep/pym/_emerge/PackageMerge.py | 40 + .../pym/_emerge/PackageUninstall.py | 110 + .../pym/_emerge/PackageVirtualDbapi.py | 145 + portage_with_autodep/pym/_emerge/PipeReader.py | 96 + portage_with_autodep/pym/_emerge/PollConstants.py | 18 + portage_with_autodep/pym/_emerge/PollScheduler.py | 398 ++ .../pym/_emerge/PollSelectAdapter.py | 73 + .../pym/_emerge/ProgressHandler.py | 22 + portage_with_autodep/pym/_emerge/QueueScheduler.py | 116 + portage_with_autodep/pym/_emerge/RootConfig.py | 34 + portage_with_autodep/pym/_emerge/Scheduler.py | 1975 ++++++ .../pym/_emerge/SequentialTaskQueue.py | 89 + portage_with_autodep/pym/_emerge/SetArg.py | 11 + portage_with_autodep/pym/_emerge/SlotObject.py | 42 + portage_with_autodep/pym/_emerge/SpawnProcess.py | 235 + portage_with_autodep/pym/_emerge/SubProcess.py | 141 + portage_with_autodep/pym/_emerge/Task.py | 42 + portage_with_autodep/pym/_emerge/TaskScheduler.py | 25 + portage_with_autodep/pym/_emerge/TaskSequence.py | 44 + .../pym/_emerge/UninstallFailure.py | 15 + .../pym/_emerge/UnmergeDepPriority.py | 41 + portage_with_autodep/pym/_emerge/UseFlagDisplay.py | 122 + portage_with_autodep/pym/_emerge/__init__.py | 2 + .../pym/_emerge/_find_deep_system_runtime_deps.py | 38 + .../pym/_emerge/_flush_elog_mod_echo.py | 15 + portage_with_autodep/pym/_emerge/actions.py | 3123 +++++++++ portage_with_autodep/pym/_emerge/clear_caches.py | 19 + portage_with_autodep/pym/_emerge/countdown.py | 22 + .../pym/_emerge/create_depgraph_params.py | 72 + .../pym/_emerge/create_world_atom.py | 92 + portage_with_autodep/pym/_emerge/depgraph.py | 7029 ++++++++++++++= ++++++ portage_with_autodep/pym/_emerge/emergelog.py | 63 + portage_with_autodep/pym/_emerge/getloadavg.py | 27 + portage_with_autodep/pym/_emerge/help.py | 815 +++ .../pym/_emerge/is_valid_package_atom.py | 21 + portage_with_autodep/pym/_emerge/main.py | 1910 ++++++ .../pym/_emerge/resolver/__init__.py | 2 + .../pym/_emerge/resolver/backtracking.py | 197 + .../pym/_emerge/resolver/circular_dependency.py | 267 + .../pym/_emerge/resolver/output.py | 888 +++ .../pym/_emerge/resolver/output_helpers.py | 576 ++ .../pym/_emerge/resolver/slot_collision.py | 978 +++ portage_with_autodep/pym/_emerge/search.py | 385 ++ .../pym/_emerge/show_invalid_depstring_notice.py | 35 + portage_with_autodep/pym/_emerge/stdout_spinner.py | 83 + portage_with_autodep/pym/_emerge/sync/__init__.py | 2 + .../pym/_emerge/sync/getaddrinfo_validate.py | 29 + .../pym/_emerge/sync/old_tree_timestamp.py | 98 + portage_with_autodep/pym/_emerge/unmerge.py | 578 ++ portage_with_autodep/pym/_emerge/userquery.py | 55 + portage_with_autodep/pym/portage/__init__.py | 610 ++ .../pym/portage/_global_updates.py | 250 + .../pym/portage/_legacy_globals.py | 81 + portage_with_autodep/pym/portage/_selinux.py | 129 + portage_with_autodep/pym/portage/_sets/__init__.py | 245 + portage_with_autodep/pym/portage/_sets/base.py | 264 + portage_with_autodep/pym/portage/_sets/dbapi.py | 383 ++ portage_with_autodep/pym/portage/_sets/files.py | 341 + portage_with_autodep/pym/portage/_sets/libs.py | 98 + portage_with_autodep/pym/portage/_sets/profiles.py | 53 + portage_with_autodep/pym/portage/_sets/security.py | 86 + portage_with_autodep/pym/portage/_sets/shell.py | 44 + portage_with_autodep/pym/portage/cache/__init__.py | 4 + portage_with_autodep/pym/portage/cache/anydbm.py | 113 + .../pym/portage/cache/cache_errors.py | 62 + .../pym/portage/cache/ebuild_xattr.py | 171 + .../pym/portage/cache/flat_hash.py | 155 + .../pym/portage/cache/flat_list.py | 134 + .../pym/portage/cache/fs_template.py | 90 + portage_with_autodep/pym/portage/cache/mappings.py | 485 ++ portage_with_autodep/pym/portage/cache/metadata.py | 154 + .../pym/portage/cache/metadata_overlay.py | 105 + .../pym/portage/cache/sql_template.py | 301 + portage_with_autodep/pym/portage/cache/sqlite.py | 245 + portage_with_autodep/pym/portage/cache/template.py | 236 + portage_with_autodep/pym/portage/cache/util.py | 170 + portage_with_autodep/pym/portage/cache/volatile.py | 25 + portage_with_autodep/pym/portage/checksum.py | 291 + portage_with_autodep/pym/portage/const.py | 143 + portage_with_autodep/pym/portage/cvstree.py | 293 + portage_with_autodep/pym/portage/data.py | 122 + .../pym/portage/dbapi/_MergeProcess.py | 282 + portage_with_autodep/pym/portage/dbapi/__init__.py | 302 + .../pym/portage/dbapi/_expand_new_virt.py | 72 + portage_with_autodep/pym/portage/dbapi/bintree.py | 1366 ++++ .../pym/portage/dbapi/cpv_expand.py | 106 + .../pym/portage/dbapi/dep_expand.py | 56 + portage_with_autodep/pym/portage/dbapi/porttree.py | 1168 ++++ portage_with_autodep/pym/portage/dbapi/vartree.py | 4527 +++++++++++++ portage_with_autodep/pym/portage/dbapi/virtual.py | 131 + portage_with_autodep/pym/portage/debug.py | 120 + portage_with_autodep/pym/portage/dep/__init__.py | 2432 +++++++ portage_with_autodep/pym/portage/dep/dep_check.py | 679 ++ portage_with_autodep/pym/portage/dispatch_conf.py | 188 + portage_with_autodep/pym/portage/eapi.py | 50 + portage_with_autodep/pym/portage/eclass_cache.py | 123 + portage_with_autodep/pym/portage/elog/__init__.py | 182 + portage_with_autodep/pym/portage/elog/filtering.py | 15 + portage_with_autodep/pym/portage/elog/messages.py | 172 + .../pym/portage/elog/mod_custom.py | 19 + portage_with_autodep/pym/portage/elog/mod_echo.py | 46 + portage_with_autodep/pym/portage/elog/mod_mail.py | 43 + .../pym/portage/elog/mod_mail_summary.py | 89 + portage_with_autodep/pym/portage/elog/mod_save.py | 51 + .../pym/portage/elog/mod_save_summary.py | 59 + .../pym/portage/elog/mod_syslog.py | 32 + portage_with_autodep/pym/portage/env/__init__.py | 3 + portage_with_autodep/pym/portage/env/config.py | 105 + portage_with_autodep/pym/portage/env/loaders.py | 319 + portage_with_autodep/pym/portage/env/validators.py | 20 + portage_with_autodep/pym/portage/exception.py | 186 + portage_with_autodep/pym/portage/getbinpkg.py | 861 +++ portage_with_autodep/pym/portage/glsa.py | 699 ++ portage_with_autodep/pym/portage/localization.py | 20 + portage_with_autodep/pym/portage/locks.py | 395 ++ portage_with_autodep/pym/portage/mail.py | 177 + portage_with_autodep/pym/portage/manifest.py | 538 ++ portage_with_autodep/pym/portage/news.py | 351 + portage_with_autodep/pym/portage/output.py | 794 +++ .../pym/portage/package/__init__.py | 2 + .../pym/portage/package/ebuild/__init__.py | 2 + .../package/ebuild/_config/KeywordsManager.py | 284 + .../package/ebuild/_config/LicenseManager.py | 236 + .../package/ebuild/_config/LocationsManager.py | 182 + .../portage/package/ebuild/_config/MaskManager.py | 189 + .../portage/package/ebuild/_config/UseManager.py | 235 + .../package/ebuild/_config/VirtualsManager.py | 233 + .../pym/portage/package/ebuild/_config/__init__.py | 2 + .../package/ebuild/_config/env_var_validation.py | 23 + .../portage/package/ebuild/_config/features_set.py | 128 + .../pym/portage/package/ebuild/_config/helper.py | 64 + .../package/ebuild/_config/special_env_vars.py | 185 + .../pym/portage/package/ebuild/_ipc/ExitCommand.py | 27 + .../pym/portage/package/ebuild/_ipc/IpcCommand.py | 9 + .../portage/package/ebuild/_ipc/QueryCommand.py | 98 + .../pym/portage/package/ebuild/_ipc/__init__.py | 2 + .../pym/portage/package/ebuild/_spawn_nofetch.py | 82 + .../pym/portage/package/ebuild/config.py | 2224 +++++++ .../package/ebuild/deprecated_profile_check.py | 42 + .../pym/portage/package/ebuild/digestcheck.py | 167 + .../pym/portage/package/ebuild/digestgen.py | 202 + .../pym/portage/package/ebuild/doebuild.py | 1791 +++++ .../pym/portage/package/ebuild/fetch.py | 1129 ++++ .../pym/portage/package/ebuild/getmaskingreason.py | 124 + .../pym/portage/package/ebuild/getmaskingstatus.py | 174 + .../portage/package/ebuild/prepare_build_dirs.py | 370 + portage_with_autodep/pym/portage/process.py | 427 ++ portage_with_autodep/pym/portage/proxy/__init__.py | 2 + .../pym/portage/proxy/lazyimport.py | 212 + .../pym/portage/proxy/objectproxy.py | 91 + .../pym/portage/repository/__init__.py | 2 + .../pym/portage/repository/config.py | 504 ++ portage_with_autodep/pym/portage/tests/__init__.py | 244 + .../pym/portage/tests/bin/setup_env.py | 85 + .../pym/portage/tests/bin/test_dobin.py | 16 + .../pym/portage/tests/bin/test_dodir.py | 16 + .../pym/portage/tests/dbapi/__init__.py | 2 + .../pym/portage/tests/dbapi/test_fakedbapi.py | 58 + .../pym/portage/tests/dep/__init__.py | 3 + .../pym/portage/tests/dep/testAtom.py | 315 + .../pym/portage/tests/dep/testCheckRequiredUse.py | 219 + .../pym/portage/tests/dep/testExtendedAtomDict.py | 18 + .../portage/tests/dep/testExtractAffectingUSE.py | 75 + .../pym/portage/tests/dep/testStandalone.py | 36 + .../portage/tests/dep/test_best_match_to_list.py | 43 + .../pym/portage/tests/dep/test_dep_getcpv.py | 35 + .../pym/portage/tests/dep/test_dep_getrepo.py | 29 + .../pym/portage/tests/dep/test_dep_getslot.py | 28 + .../pym/portage/tests/dep/test_dep_getusedeps.py | 35 + .../pym/portage/tests/dep/test_get_operator.py | 33 + .../tests/dep/test_get_required_use_flags.py | 42 + .../pym/portage/tests/dep/test_isjustname.py | 24 + .../pym/portage/tests/dep/test_isvalidatom.py | 146 + .../pym/portage/tests/dep/test_match_from_list.py | 108 + .../pym/portage/tests/dep/test_paren_reduce.py | 66 + .../pym/portage/tests/dep/test_use_reduce.py | 627 ++ .../pym/portage/tests/ebuild/__init__.py | 2 + .../tests/ebuild/test_array_fromfile_eof.py | 43 + .../pym/portage/tests/ebuild/test_config.py | 198 + .../portage/tests/ebuild/test_doebuild_spawn.py | 82 + .../pym/portage/tests/ebuild/test_ipc_daemon.py | 124 + .../pym/portage/tests/ebuild/test_pty_eof.py | 32 + .../pym/portage/tests/ebuild/test_spawn.py | 52 + .../pym/portage/tests/env/__init__.py | 4 + .../pym/portage/tests/env/config/__init__.py | 4 + .../tests/env/config/test_PackageKeywordsFile.py | 40 + .../tests/env/config/test_PackageMaskFile.py | 29 + .../tests/env/config/test_PackageUseFile.py | 37 + .../tests/env/config/test_PortageModulesFile.py | 39 + .../portage/tests/lafilefixer/test_lafilefixer.py | 145 + .../test_lazy_import_portage_baseline.py | 81 + .../lazyimport/test_preload_portage_submodules.py | 16 + .../pym/portage/tests/lint/test_bash_syntax.py | 42 + .../pym/portage/tests/lint/test_compile_modules.py | 46 + .../pym/portage/tests/lint/test_import_modules.py | 40 + .../pym/portage/tests/locks/__init__.py | 2 + .../portage/tests/locks/test_asynchronous_lock.py | 124 + .../pym/portage/tests/locks/test_lock_nonblock.py | 46 + .../pym/portage/tests/news/__init__.py | 3 + .../pym/portage/tests/news/test_NewsItem.py | 95 + .../pym/portage/tests/process/__init__.py | 2 + .../pym/portage/tests/process/test_poll.py | 39 + .../portage/tests/resolver/ResolverPlayground.py | 690 ++ .../pym/portage/tests/resolver/__init__.py | 2 + .../pym/portage/tests/resolver/test_autounmask.py | 326 + .../portage/tests/resolver/test_backtracking.py | 169 + .../tests/resolver/test_circular_dependencies.py | 84 + .../pym/portage/tests/resolver/test_depclean.py | 285 + .../pym/portage/tests/resolver/test_depth.py | 252 + .../pym/portage/tests/resolver/test_eapi.py | 115 + .../pym/portage/tests/resolver/test_merge_order.py | 453 ++ .../test_missing_iuse_and_evaluated_atoms.py | 31 + .../pym/portage/tests/resolver/test_multirepo.py | 318 + .../pym/portage/tests/resolver/test_multislot.py | 40 + .../tests/resolver/test_old_dep_chain_display.py | 35 + .../pym/portage/tests/resolver/test_output.py | 88 + .../pym/portage/tests/resolver/test_rebuild.py | 138 + .../portage/tests/resolver/test_required_use.py | 114 + .../pym/portage/tests/resolver/test_simple.py | 57 + .../portage/tests/resolver/test_slot_collisions.py | 143 + .../tests/resolver/test_use_dep_defaults.py | 40 + portage_with_autodep/pym/portage/tests/runTests | 46 + .../tests/sets/base/testInternalPackageSet.py | 61 + .../portage/tests/sets/files/testConfigFileSet.py | 32 + .../portage/tests/sets/files/testStaticFileSet.py | 27 + .../pym/portage/tests/sets/shell/testShell.py | 28 + .../pym/portage/tests/unicode/__init__.py | 2 + .../portage/tests/unicode/test_string_format.py | 108 + .../pym/portage/tests/util/__init__.py | 4 + .../pym/portage/tests/util/test_digraph.py | 201 + .../pym/portage/tests/util/test_getconfig.py | 29 + .../pym/portage/tests/util/test_grabdict.py | 11 + .../pym/portage/tests/util/test_normalizedPath.py | 14 + .../pym/portage/tests/util/test_stackDictList.py | 17 + .../pym/portage/tests/util/test_stackDicts.py | 36 + .../pym/portage/tests/util/test_stackLists.py | 19 + .../pym/portage/tests/util/test_uniqueArray.py | 24 + .../pym/portage/tests/util/test_varExpand.py | 92 + .../pym/portage/tests/versions/__init__.py | 3 + .../portage/tests/versions/test_cpv_sort_key.py | 16 + .../pym/portage/tests/versions/test_vercmp.py | 80 + .../pym/portage/tests/xpak/__init__.py | 3 + .../pym/portage/tests/xpak/test_decodeint.py | 16 + portage_with_autodep/pym/portage/update.py | 320 + .../pym/portage/util/ExtractKernelVersion.py | 76 + portage_with_autodep/pym/portage/util/__init__.py | 1602 +++++ .../pym/portage/util/_dyn_libs/LinkageMapELF.py | 805 +++ .../util/_dyn_libs/PreservedLibsRegistry.py | 172 + .../pym/portage/util/_dyn_libs/__init__.py | 2 + portage_with_autodep/pym/portage/util/_pty.py | 212 + portage_with_autodep/pym/portage/util/digraph.py | 342 + .../pym/portage/util/env_update.py | 293 + .../pym/portage/util/lafilefixer.py | 185 + portage_with_autodep/pym/portage/util/listdir.py | 151 + portage_with_autodep/pym/portage/util/movefile.py | 242 + portage_with_autodep/pym/portage/util/mtimedb.py | 81 + portage_with_autodep/pym/portage/versions.py | 403 ++ portage_with_autodep/pym/portage/xml/__init__.py | 2 + portage_with_autodep/pym/portage/xml/metadata.py | 376 ++ portage_with_autodep/pym/portage/xpak.py | 497 ++ portage_with_autodep/pym/repoman/checks.py | 707 ++ portage_with_autodep/pym/repoman/errors.py | 26 + portage_with_autodep/pym/repoman/herdbase.py | 110 + portage_with_autodep/pym/repoman/utilities.py | 511 ++ 392 files changed, 89247 insertions(+), 0 deletions(-) diff --git a/portage_with_autodep/bin/archive-conf b/portage_with_autodep= /bin/archive-conf new file mode 100755 index 0000000..5a03b85 --- /dev/null +++ b/portage_with_autodep/bin/archive-conf @@ -0,0 +1,111 @@ +#!/usr/bin/python +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# +# archive-conf -- save off a config file in the dispatch-conf archive di= r +# +# Written by Wayne Davison with code snagged from +# Jeremy Wohl's dispatch-conf script and the portage chkcontents script= . +# + +from __future__ import print_function + +import sys +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__f= ile__))), "pym")) + import portage + +from portage import os +import dispatch_conf + +FIND_EXTANT_CONTENTS =3D "find %s -name CONTENTS" + +MANDATORY_OPTS =3D [ 'archive-dir' ] + +try: + import fchksum + def perform_checksum(filename): return fchksum.fmd5t(filename) +except ImportError: + import md5 + def md5_to_hex(md5sum): + hexform =3D "" + for ix in range(len(md5sum)): + hexform =3D hexform + "%02x" % ord(md5sum[ix]) + return hexform.lower() + =20 + def perform_checksum(filename): + f =3D open(filename, 'rb') + blocksize=3D32768 + data =3D f.read(blocksize) + size =3D 0 + sum =3D md5.new() + while data: + sum.update(data) + size =3D size + len(data) + data =3D f.read(blocksize) + return (md5_to_hex(sum.digest()),size) + +def archive_conf(): + args =3D [] + content_files =3D [] + md5_match_hash =3D {} + + options =3D portage.dispatch_conf.read_config(MANDATORY_OPTS) + + for conf in sys.argv[1:]: + if not os.path.isabs(conf): + conf =3D os.path.abspath(conf) + args +=3D [ conf ] + md5_match_hash[conf] =3D '' + + # Find all the CONTENT files in VDB_PATH. + content_files +=3D os.popen(FIND_EXTANT_CONTENTS % + (os.path.join(portage.settings['EROOT'], portage.VDB_PATH))).readline= s() + + # Search for the saved md5 checksum of all the specified config file= s + # and see if the current file is unmodified or not. + try: + todo_cnt =3D len(args) + for file in content_files: + file =3D file.rstrip() + try: + contents =3D open(file, "r") + except IOError as e: + print('archive-conf: Unable to open %s: %s' % (file, e),= file=3Dsys.stderr) + sys.exit(1) + lines =3D contents.readlines() + for line in lines: + items =3D line.split() + if items[0] =3D=3D 'obj': + for conf in args: + if items[1] =3D=3D conf: + stored =3D items[2].lower() + real =3D perform_checksum(conf)[0].lower() + if stored =3D=3D real: + md5_match_hash[conf] =3D conf + todo_cnt -=3D 1 + if todo_cnt =3D=3D 0: + raise StopIteration() + except StopIteration: + pass + + for conf in args: + archive =3D os.path.join(options['archive-dir'], conf.lstrip('/'= )) + if options['use-rcs'] =3D=3D 'yes': + portage.dispatch_conf.rcs_archive(archive, conf, md5_match_h= ash[conf], '') + if md5_match_hash[conf]: + portage.dispatch_conf.rcs_archive_post_process(archive) + else: + portage.dispatch_conf.file_archive(archive, conf, md5_match_= hash[conf], '') + if md5_match_hash[conf]: + portage.dispatch_conf.file_archive_post_process(archive) + +# run +if len(sys.argv) > 1: + archive_conf() +else: + print('Usage: archive-conf /CONFIG/FILE [/CONFIG/FILE...]', file=3Ds= ys.stderr) diff --git a/portage_with_autodep/bin/banned-helper b/portage_with_autode= p/bin/banned-helper new file mode 100755 index 0000000..17ea991 --- /dev/null +++ b/portage_with_autodep/bin/banned-helper @@ -0,0 +1,6 @@ +#!/bin/bash +# Copyright 2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +die "'${0##*/}' has been banned for EAPI '$EAPI'" +exit 1 diff --git a/portage_with_autodep/bin/binhost-snapshot b/portage_with_aut= odep/bin/binhost-snapshot new file mode 100755 index 0000000..9d2697d --- /dev/null +++ b/portage_with_autodep/bin/binhost-snapshot @@ -0,0 +1,142 @@ +#!/usr/bin/python +# Copyright 2010-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +import io +import optparse +import os +import sys +import textwrap + +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse + +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname( + osp.realpath(__file__))), "pym")) + import portage + +def parse_args(argv): + prog_name =3D os.path.basename(argv[0]) + usage =3D prog_name + ' [options] ' + \ + ' ' + + prog_desc =3D "This program will copy src_pkg_dir to snapshot_dir " + \ + "and inside binhost_dir it will create a Packages index file " + \ + "which refers to snapshot_uri. This is intended to solve race " + \ + "conditions on binhosts as described at http://crosbug.com/3225." + + usage +=3D "\n\n" + for line in textwrap.wrap(prog_desc, 70): + usage +=3D line + "\n"=20 + + usage +=3D "\n" + usage +=3D "Required Arguments:\n\n" + usage +=3D " src_pkg_dir - the source $PKGDIR\n" + usage +=3D " snapshot_dir - destination snapshot " + \ + "directory (must not exist)\n" + usage +=3D " snapshot_uri - URI which refers to " + \ + "snapshot_dir from the\n" + \ + " client side\n" + usage +=3D " binhost_dir - directory in which to " + \ + "write Packages index with\n" + \ + " snapshot_uri" + + parser =3D optparse.OptionParser(usage=3Dusage) + parser.add_option('--hardlinks', help=3D'create hardlinks (y or n, defa= ult is y)', + choices=3D('y', 'n')) + parser.set_defaults(hardlinks=3D'y') + options, args =3D parser.parse_args(argv[1:]) + + if len(args) !=3D 4: + parser.error("Required 4 arguments, got %d" % (len(args),)) + + return parser, options, args + +def main(argv): + parser, options, args =3D parse_args(argv) + + src_pkg_dir, snapshot_dir, snapshot_uri, binhost_dir =3D args + src_pkgs_index =3D os.path.join(src_pkg_dir, 'Packages') + + if not os.path.isdir(src_pkg_dir): + parser.error("src_pkg_dir is not a directory: '%s'" % (src_pkg_dir,)) + + if not os.path.isfile(src_pkgs_index): + parser.error("src_pkg_dir does not contain a " + \ + "'Packages' index: '%s'" % (src_pkg_dir,)) + + parse_result =3D urlparse(snapshot_uri) + if not (parse_result.scheme and parse_result.netloc and parse_result.pa= th): + parser.error("snapshot_uri is not a valid URI: '%s'" % (snapshot_uri,)= ) + + if os.path.isdir(snapshot_dir): + parser.error("snapshot_dir already exists: '%s'" % snapshot_dir) + + try: + os.makedirs(os.path.dirname(snapshot_dir)) + except OSError: + pass + if not os.path.isdir(os.path.dirname(snapshot_dir)): + parser.error("snapshot_dir parent could not be created: '%s'" % \ + os.path.dirname(snapshot_dir)) + + try: + os.makedirs(binhost_dir) + except OSError: + pass + if not os.path.isdir(binhost_dir): + parser.error("binhost_dir could not be created: '%s'" % binhost_dir) + + cp_opts =3D 'RP' + if options.hardlinks =3D=3D 'n': + cp_opts +=3D 'p' + else: + cp_opts +=3D 'l' + + cp_cmd =3D 'cp -%s %s %s' % ( + cp_opts, + portage._shell_quote(src_pkg_dir), + portage._shell_quote(snapshot_dir) + ) + + ret =3D os.system(cp_cmd) + if not (os.WIFEXITED(ret) and os.WEXITSTATUS(ret) =3D=3D os.EX_OK): + return 1 + + infile =3D io.open(portage._unicode_encode(src_pkgs_index, + encoding=3Dportage._encodings['fs'], errors=3D'strict'), + mode=3D'r', encoding=3Dportage._encodings['repo.content'], + errors=3D'strict') + + outfile =3D portage.util.atomic_ofstream( + os.path.join(binhost_dir, "Packages"), + encoding=3Dportage._encodings['repo.content'], + errors=3D'strict') + + for line in infile: + if line[:4] =3D=3D 'URI:': + # skip existing URI line + pass + else: + if not line.strip(): + # end of header + outfile.write("URI: %s\n\n" % snapshot_uri) + break + outfile.write(line) + + for line in infile: + outfile.write(line) + + infile.close() + outfile.close() + + return os.EX_OK + +if __name__ =3D=3D "__main__": + sys.exit(main(sys.argv)) diff --git a/portage_with_autodep/bin/check-implicit-pointer-usage.py b/p= ortage_with_autodep/bin/check-implicit-pointer-usage.py new file mode 100755 index 0000000..8822c45 --- /dev/null +++ b/portage_with_autodep/bin/check-implicit-pointer-usage.py @@ -0,0 +1,84 @@ +#!/usr/bin/python + +# Ripped from HP and updated from Debian +# Update by Gentoo to support unicode output + +# +# Copyright (c) 2004 Hewlett-Packard Development Company, L.P. +# David Mosberger +# +# Scan standard input for GCC warning messages that are likely to +# source of real 64-bit problems. In particular, see whether there +# are any implicitly declared functions whose return values are later +# interpreted as pointers. Those are almost guaranteed to cause +# crashes. +# + +from __future__ import print_function + +import re +import sys + +implicit_pattern =3D re.compile("([^:]*):(\d+): warning: implicit declar= ation " + + "of function [`']([^']*)'") +pointer_pattern =3D ( + "([^:]*):(\d+): warning: " + + "(" + + "(assignment" + + "|initialization" + + "|return" + + "|passing arg \d+ of `[^']*'" + + "|passing arg \d+ of pointer to function" + + ") makes pointer from integer without a cast" + + "|" + + "cast to pointer from integer of different size)") + +if sys.hexversion < 0x3000000: + # Use encoded byte strings in python-2.x, since the python ebuilds a= re + # known to remove the encodings module when USE=3Dbuild is enabled (= thus + # disabling unicode decoding/encoding). The portage module has a + # workaround for this, but currently we don't import that here since= we + # don't want to trigger potential sandbox violations due to stale py= c + # files for the portage module. + unicode_quote_open =3D '\xE2\x80\x98' + unicode_quote_close =3D '\xE2\x80\x99' + def write(msg): + sys.stdout.write(msg) +else: + unicode_quote_open =3D '\u2018' + unicode_quote_close =3D '\u2019' + def write(msg): + sys.stdout.buffer.write(msg.encode('utf_8', 'backslashreplace')) + +pointer_pattern =3D re.compile(pointer_pattern) + +last_implicit_filename =3D "" +last_implicit_linenum =3D -1 +last_implicit_func =3D "" + +while True: + if sys.hexversion >=3D 0x3000000: + line =3D sys.stdin.buffer.readline().decode('utf_8', 'replace') + else: + line =3D sys.stdin.readline() + if not line: + break + # translate unicode open/close quotes to ascii ones + line =3D line.replace(unicode_quote_open, "`") + line =3D line.replace(unicode_quote_close, "'") + m =3D implicit_pattern.match(line) + if m: + last_implicit_filename =3D m.group(1) + last_implicit_linenum =3D int(m.group(2)) + last_implicit_func =3D m.group(3) + else: + m =3D pointer_pattern.match(line) + if m: + pointer_filename =3D m.group(1) + pointer_linenum =3D int(m.group(2)) + if (last_implicit_filename =3D=3D pointer_filename + and last_implicit_linenum =3D=3D pointer_linenum): + write("Function `%s' implicitly converted to pointer at = " \ + "%s:%d\n" % (last_implicit_func, + last_implicit_filename, + last_implicit_linenum)) diff --git a/portage_with_autodep/bin/clean_locks b/portage_with_autodep/= bin/clean_locks new file mode 100755 index 0000000..8c4299c --- /dev/null +++ b/portage_with_autodep/bin/clean_locks @@ -0,0 +1,47 @@ +#!/usr/bin/python -O +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from __future__ import print_function + +import sys, errno +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + import portage + +from portage import os + +if not sys.argv[1:] or "--help" in sys.argv or "-h" in sys.argv: + import portage + print() + print("You must specify directories with hardlink-locks to clean.") + print("You may optionally specify --force, which will remove all") + print("of the locks, even if we can't establish if they are in use.") + print("Please attempt cleaning without force first.") + print() + print("%s %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"])) + print("%s --force %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"= ])) + print() + sys.exit(1) +=09 +force =3D False +if "--force" in sys.argv[1:]: + force=3DTrue +=09 +for x in sys.argv[1:]: + if x =3D=3D "--force": + continue + try: + for y in portage.locks.hardlock_cleanup(x, remove_all_locks=3Dforce): + print(y) + print() + =09 + except OSError as e: + if e.errno in (errno.ENOENT, errno.ENOTDIR): + print("!!! %s is not a directory or does not exist" % x) + else: + raise + sys.exit(e.errno) diff --git a/portage_with_autodep/bin/dispatch-conf b/portage_with_autode= p/bin/dispatch-conf new file mode 100755 index 0000000..1e21a52 --- /dev/null +++ b/portage_with_autodep/bin/dispatch-conf @@ -0,0 +1,434 @@ +#!/usr/bin/python -O +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# +# dispatch-conf -- Integrate modified configs, post-emerge +# +# Jeremy Wohl (http://igmus.org) +# +# TODO +# dialog menus +# + +from __future__ import print_function + +from stat import ST_GID, ST_MODE, ST_UID +from random import random +import atexit, re, shutil, stat, sys + +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__f= ile__))), "pym")) + import portage + +from portage import os +from portage import dispatch_conf +from portage import _unicode_decode +from portage.dispatch_conf import diffstatusoutput_len +from portage.process import find_binary + +FIND_EXTANT_CONFIGS =3D "find '%s' %s -name '._cfg????_%s' ! -name '.*~= ' ! -iname '.*.bak' -print" +DIFF_CONTENTS =3D "diff -Nu '%s' '%s'" +DIFF_CVS_INTERP =3D "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep = -v '# .Header:.*'" +DIFF_WSCOMMENTS =3D "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep = -v '^[-+]#' | grep -v '^[-+][:space:]*$'" + +# We need a secure scratch dir and python does silly verbose errors on t= he use of tempnam +oldmask =3D os.umask(0o077) +SCRATCH_DIR =3D None +while SCRATCH_DIR is None: + try: + mydir =3D "/tmp/dispatch-conf." + for x in range(0,8): + if int(random() * 3) =3D=3D 0: + mydir +=3D chr(int(65+random()*26.0)) + elif int(random() * 2) =3D=3D 0: + mydir +=3D chr(int(97+random()*26.0)) + else: + mydir +=3D chr(int(48+random()*10.0)) + if os.path.exists(mydir): + continue + os.mkdir(mydir) + SCRATCH_DIR =3D mydir + except OSError as e: + if e.errno !=3D 17: + raise +os.umask(oldmask) + +# Ensure the scratch dir is deleted +def cleanup(mydir=3DSCRATCH_DIR): + shutil.rmtree(mydir) +atexit.register(cleanup) + +MANDATORY_OPTS =3D [ 'archive-dir', 'diff', 'replace-cvs', 'replace-wsc= omments', 'merge' ] + +class dispatch: + options =3D {} + + def grind (self, config_paths): + confs =3D [] + count =3D 0 + + config_root =3D '/' + self.options =3D portage.dispatch_conf.read_config(MANDATORY_OPT= S) + + if "log-file" in self.options: + if os.path.isfile(self.options["log-file"]): + shutil.copy(self.options["log-file"], self.options["log-= file"] + '.old') + if os.path.isfile(self.options["log-file"]) \ + or not os.path.exists(self.options["log-file"]): + open(self.options["log-file"], 'w').close() # Truncate i= t + os.chmod(self.options["log-file"], 0o600) + else: + self.options["log-file"] =3D "/dev/null" + + # + # Build list of extant configs + # + + for path in config_paths: + path =3D portage.normalize_path(path) + try: + mymode =3D os.stat(path).st_mode + except OSError: + continue + basename =3D "*" + find_opts =3D "-name '.*' -type d -prune -o" + if not stat.S_ISDIR(mymode): + path, basename =3D os.path.split(path) + find_opts =3D "-maxdepth 1" + + confs +=3D self.massage(os.popen(FIND_EXTANT_CONFIGS % (path= , find_opts, basename)).readlines()) + + if self.options['use-rcs'] =3D=3D 'yes': + for rcs_util in ("rcs", "ci", "co", "rcsmerge"): + if not find_binary(rcs_util): + print('dispatch-conf: Error finding all RCS utils an= d " + \ + "use-rcs=3Dyes in config; fatal', file=3Dsys.std= err) + return False + + + # config file freezing support + frozen_files =3D set(self.options.get("frozen-files", "").split(= )) + auto_zapped =3D [] + protect_obj =3D portage.util.ConfigProtect( + config_root, config_paths, + portage.util.shlex_split( + portage.settings.get('CONFIG_PROTECT_MASK', ''))) + + # + # Remove new configs identical to current + # and + # Auto-replace configs a) whose differences are simply CVS inter= polations, + # or b) whose differences are simply ws or com= ments, + # or c) in paths now unprotected by CONFIG_PRO= TECT_MASK, + # + + def f (conf): + mrgconf =3D re.sub(r'\._cfg', '._mrg', conf['new']) + archive =3D os.path.join(self.options['archive-dir'], conf['= current'].lstrip('/')) + if self.options['use-rcs'] =3D=3D 'yes': + mrgfail =3D portage.dispatch_conf.rcs_archive(archive, c= onf['current'], conf['new'], mrgconf) + else: + mrgfail =3D portage.dispatch_conf.file_archive(archive, = conf['current'], conf['new'], mrgconf) + if os.path.exists(archive + '.dist'): + unmodified =3D diffstatusoutput_len(DIFF_CONTENTS % (con= f['current'], archive + '.dist'))[1] =3D=3D 0 + else: + unmodified =3D 0 + if os.path.exists(mrgconf): + if mrgfail or diffstatusoutput_len(DIFF_CONTENTS % (conf= ['new'], mrgconf))[1] =3D=3D 0: + os.unlink(mrgconf) + newconf =3D conf['new'] + else: + newconf =3D mrgconf + else: + newconf =3D conf['new'] + + if newconf =3D=3D mrgconf and \ + self.options.get('ignore-previously-merged') !=3D 'yes' = and \ + os.path.exists(archive+'.dist') and \ + diffstatusoutput_len(DIFF_CONTENTS % (archive+'.dist', c= onf['new']))[1] =3D=3D 0: + # The current update is identical to the archived .dist + # version that has previously been merged. + os.unlink(mrgconf) + newconf =3D conf['new'] + + mystatus, myoutput_len =3D diffstatusoutput_len( + DIFF_CONTENTS % (conf ['current'], newconf)) + same_file =3D 0 =3D=3D myoutput_len + if mystatus >> 8 =3D=3D 2: + # Binary files differ + same_cvs =3D False + same_wsc =3D False + else: + same_cvs =3D 0 =3D=3D diffstatusoutput_len( + DIFF_CVS_INTERP % (conf ['current'], newconf))[1] + same_wsc =3D 0 =3D=3D diffstatusoutput_len( + DIFF_WSCOMMENTS % (conf ['current'], newconf))[1] + + # Do options permit? + same_cvs =3D same_cvs and self.options['replace-cvs'] =3D=3D= 'yes' + same_wsc =3D same_wsc and self.options['replace-wscomments']= =3D=3D 'yes' + unmodified =3D unmodified and self.options['replace-unmodifi= ed'] =3D=3D 'yes' + + if same_file: + os.unlink (conf ['new']) + self.post_process(conf['current']) + if os.path.exists(mrgconf): + os.unlink(mrgconf) + return False + elif conf['current'] in frozen_files: + """Frozen files are automatically zapped. The new config= has + already been archived with a .new suffix. When zapped, = it is + left with the .new suffix (post_process is skipped), sin= ce it + hasn't been merged into the current config.""" + auto_zapped.append(conf['current']) + os.unlink(conf['new']) + try: + os.unlink(mrgconf) + except OSError: + pass + return False + elif unmodified or same_cvs or same_wsc or \ + not protect_obj.isprotected(conf['current']): + self.replace(newconf, conf['current']) + self.post_process(conf['current']) + if newconf =3D=3D mrgconf: + os.unlink(conf['new']) + elif os.path.exists(mrgconf): + os.unlink(mrgconf) + return False + else: + return True + + confs =3D [x for x in confs if f(x)] + + # + # Interactively process remaining + # + + valid_input =3D "qhtnmlezu" + + for conf in confs: + count =3D count + 1 + + newconf =3D conf['new'] + mrgconf =3D re.sub(r'\._cfg', '._mrg', newconf) + if os.path.exists(mrgconf): + newconf =3D mrgconf + show_new_diff =3D 0 + + while 1: + clear_screen() + if show_new_diff: + cmd =3D self.options['diff'] % (conf['new'], mrgconf= ) + spawn_shell(cmd) + show_new_diff =3D 0 + else: + cmd =3D self.options['diff'] % (conf['current'], new= conf) + spawn_shell(cmd) + + print() + print('>> (%i of %i) -- %s' % (count, len(confs), conf [= 'current'])) + print('>> q quit, h help, n next, e edit-new, z zap-new,= u use-new\n m merge, t toggle-merge, l look-merge: ', end=3D' ') + + # In some cases getch() will return some spurious charac= ters + # that do not represent valid input. If we don't validat= e the + # input then the spurious characters can cause us to jum= p + # back into the above "diff" command immediatly after th= e user + # has exited it (which can be quite confusing and gives = an + # "out of control" feeling). + while True: + c =3D getch() + if c in valid_input: + sys.stdout.write('\n') + sys.stdout.flush() + break + + if c =3D=3D 'q': + sys.exit (0) + if c =3D=3D 'h': + self.do_help () + continue + elif c =3D=3D 't': + if newconf =3D=3D mrgconf: + newconf =3D conf['new'] + elif os.path.exists(mrgconf): + newconf =3D mrgconf + continue + elif c =3D=3D 'n': + break + elif c =3D=3D 'm': + merged =3D SCRATCH_DIR+"/"+os.path.basename(conf['cu= rrent']) + print() + ret =3D os.system (self.options['merge'] % (merged, = conf ['current'], newconf)) + ret =3D os.WEXITSTATUS(ret) + if ret < 2: + ret =3D 0 + if ret: + print("Failure running 'merge' command") + continue + shutil.copyfile(merged, mrgconf) + os.remove(merged) + mystat =3D os.lstat(conf['new']) + os.chmod(mrgconf, mystat[ST_MODE]) + os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID]) + newconf =3D mrgconf + continue + elif c =3D=3D 'l': + show_new_diff =3D 1 + continue + elif c =3D=3D 'e': + if 'EDITOR' not in os.environ: + os.environ['EDITOR']=3D'nano' + os.system(os.environ['EDITOR'] + ' ' + newconf) + continue + elif c =3D=3D 'z': + os.unlink(conf['new']) + if os.path.exists(mrgconf): + os.unlink(mrgconf) + break + elif c =3D=3D 'u': + self.replace(newconf, conf ['current']) + self.post_process(conf['current']) + if newconf =3D=3D mrgconf: + os.unlink(conf['new']) + elif os.path.exists(mrgconf): + os.unlink(mrgconf) + break + else: + raise AssertionError("Invalid Input: %s" % c) + + if auto_zapped: + print() + print(" One or more updates are frozen and have been automat= ically zapped:") + print() + for frozen in auto_zapped: + print(" * '%s'" % frozen) + print() + + def replace (self, newconf, curconf): + """Replace current config with the new/merged version. Also log= s + the diff of what changed into the configured log file.""" + os.system((DIFF_CONTENTS % (curconf, newconf)) + '>>' + self.opt= ions["log-file"]) + try: + os.rename(newconf, curconf) + except (IOError, os.error) as why: + print('dispatch-conf: Error renaming %s to %s: %s; fatal' % = \ + (newconf, curconf, str(why)), file=3Dsys.stderr) + + + def post_process(self, curconf): + archive =3D os.path.join(self.options['archive-dir'], curconf.ls= trip('/')) + if self.options['use-rcs'] =3D=3D 'yes': + portage.dispatch_conf.rcs_archive_post_process(archive) + else: + portage.dispatch_conf.file_archive_post_process(archive) + + + def massage (self, newconfigs): + """Sort, rstrip, remove old versions, break into triad hash. + + Triad is dictionary of current (/etc/make.conf), new (/etc/._cfg= 0003_make.conf) + and dir (/etc). + + We keep ._cfg0002_conf over ._cfg0001_conf and ._cfg0000_conf. + """ + h =3D {} + configs =3D [] + newconfigs.sort () + + for nconf in newconfigs: + nconf =3D nconf.rstrip () + conf =3D re.sub (r'\._cfg\d+_', '', nconf) + dirname =3D os.path.dirname(nconf) + conf_map =3D { + 'current' : conf, + 'dir' : dirname, + 'new' : nconf, + } + + if conf in h: + mrgconf =3D re.sub(r'\._cfg', '._mrg', h[conf]['new']) + if os.path.exists(mrgconf): + os.unlink(mrgconf) + os.unlink(h[conf]['new']) + h[conf].update(conf_map) + else: + h[conf] =3D conf_map + configs.append(conf_map) + + return configs + + + def do_help (self): + print(); print + + print(' u -- update current config with new config and continue= ') + print(' z -- zap (delete) new config and continue') + print(' n -- skip to next config, leave all intact') + print(' e -- edit new config') + print(' m -- interactively merge current and new configs') + print(' l -- look at diff between pre-merged and merged configs= ') + print(' t -- toggle new config between merged and pre-merged st= ate') + print(' h -- this screen') + print(' q -- quit') + + print(); print('press any key to return to diff...', end=3D' ') + + getch () + + +def getch (): + # from ASPN - Danny Yoo + # + import sys, tty, termios + + fd =3D sys.stdin.fileno() + old_settings =3D termios.tcgetattr(fd) + try: + tty.setraw(sys.stdin.fileno()) + ch =3D sys.stdin.read(1) + finally: + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) + return ch + +def clear_screen(): + try: + import curses + try: + curses.setupterm() + sys.stdout.write(_unicode_decode(curses.tigetstr("clear"))) + sys.stdout.flush() + return + except curses.error: + pass + except ImportError: + pass + os.system("clear 2>/dev/null") + +from portage.process import find_binary, spawn +shell =3D os.environ.get("SHELL") +if not shell or not os.access(shell, os.EX_OK): + shell =3D find_binary("sh") + +def spawn_shell(cmd): + if shell: + spawn([shell, "-c", cmd], env=3Dos.environ, + fd_pipes =3D { 0 : sys.stdin.fileno(), + 1 : sys.stdout.fileno(), + 2 : sys.stderr.fileno()}) + else: + os.system(cmd) + +# run +d =3D dispatch () + +if len(sys.argv) > 1: + # for testing + d.grind(sys.argv[1:]) +else: + d.grind(portage.util.shlex_split( + portage.settings.get('CONFIG_PROTECT', ''))) diff --git a/portage_with_autodep/bin/dohtml.py b/portage_with_autodep/bi= n/dohtml.py new file mode 100755 index 0000000..00258ec --- /dev/null +++ b/portage_with_autodep/bin/dohtml.py @@ -0,0 +1,191 @@ +#!/usr/bin/python +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# +# Typical usage: +# dohtml -r docs/* +# - put all files and directories in docs into /usr/share/doc/${PF}/htm= l +# dohtml foo.html +# - put foo.html into /usr/share/doc/${PF}/html +# +# +# Detailed usage: +# dohtml =20 +# - will install the files in the list of files (space-separated list) = into=20 +# /usr/share/doc/${PF}/html, provided the file ends in .htm, .html, .= css, +# .js, ,gif, .jpeg, .jpg, or .png. +# dohtml -r +# - will do as 'dohtml', but recurse into all directories, as long as t= he=20 +# directory name is not CVS +# dohtml -A jpe,java [-r] +# - will do as 'dohtml' but add .jpe,.java (default filter list is +# added to your list) +# dohtml -a png,gif,html,htm [-r] +# - will do as 'dohtml' but filter on .png,.gif,.html,.htm (default fil= ter=20 +# list is ignored) +# dohtml -x CVS,SCCS,RCS -r +# - will do as 'dohtml -r', but ignore directories named CVS, SCCS, RCS +# + +from __future__ import print_function + +import os +import sys + +def dodir(path): + os.spawnlp(os.P_WAIT, "install", "install", "-d", path) + +def dofile(src,dst): + os.spawnlp(os.P_WAIT, "install", "install", "-m0644", src, dst) + +def eqawarn(lines): + cmd =3D "source '%s/isolated-functions.sh' ; " % \ + os.environ["PORTAGE_BIN_PATH"] + for line in lines: + cmd +=3D "eqawarn \"%s\" ; " % line + os.spawnlp(os.P_WAIT, "bash", "bash", "-c", cmd) + +skipped_directories =3D [] + +def install(basename, dirname, options, prefix=3D""): + fullpath =3D basename + if prefix: + fullpath =3D prefix + "/" + fullpath + if dirname: + fullpath =3D dirname + "/" + fullpath + + if options.DOCDESTTREE: + destdir =3D options.D + "usr/share/doc/" + options.PF + "/" + options.= DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix + else: + destdir =3D options.D + "usr/share/doc/" + options.PF + "/html/" + opt= ions.doc_prefix + "/" + prefix + + if not os.path.exists(fullpath): + sys.stderr.write("!!! dohtml: %s does not exist\n" % fullpath) + return False + elif os.path.isfile(fullpath): + ext =3D os.path.splitext(basename)[1] + if (len(ext) and ext[1:] in options.allowed_exts) or basename in optio= ns.allowed_files: + dodir(destdir) + dofile(fullpath, destdir + "/" + basename) + elif options.recurse and os.path.isdir(fullpath) and \ + basename not in options.disallowed_dirs: + for i in os.listdir(fullpath): + pfx =3D basename + if prefix: pfx =3D prefix + "/" + pfx + install(i, dirname, options, pfx) + elif not options.recurse and os.path.isdir(fullpath): + global skipped_directories + skipped_directories.append(fullpath) + return False + else: + return False + return True + + +class OptionsClass: + def __init__(self): + self.PF =3D "" + self.D =3D "" + self.DOCDESTTREE =3D "" + =09 + if "PF" in os.environ: + self.PF =3D os.environ["PF"] + if "D" in os.environ: + self.D =3D os.environ["D"] + if "_E_DOCDESTTREE_" in os.environ: + self.DOCDESTTREE =3D os.environ["_E_DOCDESTTREE_"] + =09 + self.allowed_exts =3D [ 'htm', 'html', 'css', 'js', + 'gif', 'jpeg', 'jpg', 'png' ] + self.allowed_files =3D [] + self.disallowed_dirs =3D [ 'CVS' ] + self.recurse =3D False + self.verbose =3D False + self.doc_prefix =3D "" + +def print_help(): + opts =3D OptionsClass() + + print("dohtml [-a .foo,.bar] [-A .foo,.bar] [-f foo,bar] [-x foo,bar]") + print(" [-r] [-V] [file ...]") + print() + print(" -a Set the list of allowed to those that are specified.") + print(" Default:", ",".join(opts.allowed_exts)) + print(" -A Extend the list of allowed file types.") + print(" -f Set list of allowed extensionless file names.") + print(" -x Set directories to be excluded from recursion.") + print(" Default:", ",".join(opts.disallowed_dirs)) + print(" -p Set a document prefix for installed files (empty by defaul= t).") + print(" -r Install files and directories recursively.") + print(" -V Be verbose.") + print() + +def parse_args(): + options =3D OptionsClass() + args =3D [] +=09 + x =3D 1 + while x < len(sys.argv): + arg =3D sys.argv[x] + if arg in ["-h","-r","-V"]: + if arg =3D=3D "-h": + print_help() + sys.exit(0) + elif arg =3D=3D "-r": + options.recurse =3D True + elif arg =3D=3D "-V": + options.verbose =3D True + elif sys.argv[x] in ["-A","-a","-f","-x","-p"]: + x +=3D 1 + if x =3D=3D len(sys.argv): + print_help() + sys.exit(0) + elif arg =3D=3D "-p": + options.doc_prefix =3D sys.argv[x] + else: + values =3D sys.argv[x].split(",") + if arg =3D=3D "-A": + options.allowed_exts.extend(values) + elif arg =3D=3D "-a": + options.allowed_exts =3D values + elif arg =3D=3D "-f": + options.allowed_files =3D values + elif arg =3D=3D "-x": + options.disallowed_dirs =3D values + else: + args.append(sys.argv[x]) + x +=3D 1 +=09 + return (options, args) + +def main(): + + (options, args) =3D parse_args() + + if options.verbose: + print("Allowed extensions:", options.allowed_exts) + print("Document prefix : '" + options.doc_prefix + "'") + print("Allowed files :", options.allowed_files) + + success =3D False +=09 + for x in args: + basename =3D os.path.basename(x) + dirname =3D os.path.dirname(x) + success |=3D install(basename, dirname, options) + + global skipped_directories + for x in skipped_directories: + eqawarn(["QA Notice: dohtml on directory " + \ + "'%s' without recursion option" % x]) + + if success: + retcode =3D 0 + else: + retcode =3D 1 + + sys.exit(retcode) + +if __name__ =3D=3D "__main__": + main() diff --git a/portage_with_autodep/bin/ebuild b/portage_with_autodep/bin/e= build new file mode 100755 index 0000000..f8b6d79 --- /dev/null +++ b/portage_with_autodep/bin/ebuild @@ -0,0 +1,346 @@ +#!/usr/bin/python -O +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from __future__ import print_function + +import signal +import sys +# This block ensures that ^C interrupts are handled quietly. +try: + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + sys.exit(128 + signum) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + # Prevent "[Errno 32] Broken pipe" exceptions when + # writing to a pipe. + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + +except KeyboardInterrupt: + sys.exit(128 + signal.SIGINT) + +def debug_signal(signum, frame): + import pdb + pdb.set_trace() +signal.signal(signal.SIGUSR1, debug_signal) + +import imp +import optparse +import os + +description =3D "See the ebuild(1) man page for more info" +usage =3D "Usage: ebuild [command] ..." +parser =3D optparse.OptionParser(description=3Ddescription, usage=3Dusag= e) + +force_help =3D "When used together with the digest or manifest " + \ + "command, this option forces regeneration of digests for all " + \ + "distfiles associated with the current ebuild. Any distfiles " + \ + "that do not already exist in ${DISTDIR} will be automatically fetched.= " + +parser.add_option("--force", help=3Dforce_help, action=3D"store_true", d= est=3D"force") +parser.add_option("--color", help=3D"enable or disable color output", + type=3D"choice", choices=3D("y", "n")) +parser.add_option("--debug", help=3D"show debug output", + action=3D"store_true", dest=3D"debug") +parser.add_option("--ignore-default-opts", + action=3D"store_true", + help=3D"do not use the EBUILD_DEFAULT_OPTS environment variable") +parser.add_option("--skip-manifest", help=3D"skip all manifest checks", + action=3D"store_true", dest=3D"skip_manifest") + +opts, pargs =3D parser.parse_args(args=3Dsys.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"] =3D os.environ.get("FEATURES", "") + " -noauto" + +os.environ["PORTAGE_CALLER"]=3D"ebuild" +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + import portage + +portage.dep._internal_warnings =3D True +from portage import os +from portage import _encodings +from portage import _shell_quote +from portage import _unicode_decode +from portage import _unicode_encode +from portage.const import VDB_PATH +from _emerge.Package import Package +from _emerge.RootConfig import RootConfig + +if not opts.ignore_default_opts: + default_opts =3D portage.settings.get("EBUILD_DEFAULT_OPTS", "").split(= ) + opts, pargs =3D parser.parse_args(default_opts + sys.argv[1:]) + +debug =3D opts.debug +force =3D opts.force + +import portage.util, portage.const + +# do this _after_ 'import portage' to prevent unnecessary tracing +if debug and "python-trace" in portage.features: + import portage.debug + portage.debug.set_trace(True) + +if not opts.color =3D=3D 'y' and \ + (opts.color =3D=3D 'n' or \ + portage.settings.get('NOCOLOR') in ('yes', 'true') or \ + portage.settings.get('TERM') =3D=3D 'dumb' or \ + not sys.stdout.isatty()): + portage.output.nocolor() + portage.settings.unlock() + portage.settings['NOCOLOR'] =3D 'true' + portage.settings.lock() + +ebuild =3D pargs.pop(0) + +pf =3D None +if ebuild.endswith(".ebuild"): + pf =3D os.path.basename(ebuild)[:-7] + +if pf is None: + portage.writemsg("'%s' does not end with '.ebuild'.\n" % \ + (ebuild,), noiselevel=3D-1) + sys.exit(1) + +if not os.path.isabs(ebuild): + mycwd =3D os.getcwd() + # Try to get the non-canonical path from the PWD evironment variable, s= ince + # the canonical path returned from os.getcwd() may may be unusable in + # cases where the directory stucture is built from symlinks. + pwd =3D os.environ.get('PWD', '') + if sys.hexversion < 0x3000000: + pwd =3D _unicode_decode(pwd, encoding=3D_encodings['content'], + errors=3D'strict') + if pwd and pwd !=3D mycwd and \ + os.path.realpath(pwd) =3D=3D mycwd: + mycwd =3D portage.normalize_path(pwd) + ebuild =3D os.path.join(mycwd, ebuild) +ebuild =3D portage.normalize_path(ebuild) +# portdbapi uses the canonical path for the base of the portage tree, bu= t +# subdirectories of the base can be built from symlinks (like crossdev d= oes). +ebuild_portdir =3D os.path.realpath( + os.path.dirname(os.path.dirname(os.path.dirname(ebuild)))) +ebuild =3D os.path.join(ebuild_portdir, *ebuild.split(os.path.sep)[-3:]) +vdb_path =3D os.path.realpath(os.path.join(portage.settings['EROOT'], VD= B_PATH)) + +# Make sure that portdb.findname() returns the correct ebuild. +if ebuild_portdir !=3D vdb_path and \ + ebuild_portdir not in portage.portdb.porttrees: + if sys.hexversion >=3D 0x3000000: + os.environ["PORTDIR_OVERLAY"] =3D \ + os.environ.get("PORTDIR_OVERLAY","") + \ + " " + _shell_quote(ebuild_portdir) + else: + os.environ["PORTDIR_OVERLAY"] =3D \ + os.environ.get("PORTDIR_OVERLAY","") + \ + " " + _unicode_encode(_shell_quote(ebuild_portdir), + encoding=3D_encodings['content'], errors=3D'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 =3D None +if ebuild_portdir !=3D vdb_path: + myrepo =3D portage.portdb.getRepositoryName(ebuild_portdir) + repo_info =3D portage.portdb._repo_info[ebuild_portdir] + portage.portdb.porttrees =3D list(repo_info.eclass_db.porttrees) + +if not os.path.exists(ebuild): + print("'%s' does not exist." % ebuild) + sys.exit(1) + +ebuild_split =3D ebuild.split("/") +cpv =3D "%s/%s" % (ebuild_split[-3], pf) + +if not portage.catpkgsplit(cpv): + print("!!! %s does not follow correct package syntax." % (cpv)) + sys.exit(1) + +if ebuild.startswith(vdb_path): + mytree =3D "vartree" + pkg_type =3D "installed" + + portage_ebuild =3D portage.db[portage.root][mytree].dbapi.findname(cpv,= myrepo=3Dmyrepo) + + if os.path.realpath(portage_ebuild) !=3D ebuild: + print("!!! Portage seems to think that %s is at %s" % (cpv, portage_eb= uild)) + sys.exit(1) + +else: + mytree =3D "porttree" + pkg_type =3D "ebuild" + + portage_ebuild =3D portage.portdb.findname(cpv, myrepo=3Dmyrepo) + + if not portage_ebuild or portage_ebuild !=3D ebuild: + print("!!! %s does not seem to have a valid PORTDIR structure." % ebui= ld) + sys.exit(1) + +if len(pargs) > 1 and "config" in pargs: + print("config must be called on it's own, not combined with any other p= hase") + sys.exit(1) + +def discard_digests(myebuild, mysettings, mydbapi): + """Discard all distfiles digests for the given ebuild. This is useful = when + upstream has changed the identity of the distfiles and the user would + otherwise have to manually remove the Manifest and files/digest-* files= in + order to ensure correct results.""" + try: + portage._doebuild_manifest_exempt_depend +=3D 1 + pkgdir =3D os.path.dirname(myebuild) + fetchlist_dict =3D portage.FetchlistDict(pkgdir, mysettings, mydbapi) + from portage.manifest import Manifest + mf =3D Manifest(pkgdir, mysettings["DISTDIR"], + fetchlist_dict=3Dfetchlist_dict, manifest1_compat=3DFalse) + mf.create(requiredDistfiles=3DNone, + assumeDistHashesSometimes=3DTrue, assumeDistHashesAlways=3DTrue) + distfiles =3D fetchlist_dict[cpv] + for myfile in distfiles: + try: + del mf.fhashdict["DIST"][myfile] + except KeyError: + pass + mf.write() + finally: + portage._doebuild_manifest_exempt_depend -=3D 1 + +portage.settings.validate() # generate warning messages if necessary + +build_dir_phases =3D set(["setup", "unpack", "prepare", "configure", "co= mpile", + "test", "install", "package", "rpm", "merge", "qmerge"]) + +# If the current metadata is invalid then force the ebuild to be +# sourced again even if $T/environment already exists. +ebuild_changed =3D False +if mytree =3D=3D "porttree" and build_dir_phases.intersection(pargs): + metadata, st, emtime =3D \ + portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir) + if metadata is None: + ebuild_changed =3D True + +tmpsettings =3D portage.config(clone=3Dportage.settings) +tmpsettings["PORTAGE_VERBOSE"] =3D "1" +tmpsettings.backup_changes("PORTAGE_VERBOSE") + +if opts.skip_manifest: + tmpsettings["EBUILD_SKIP_MANIFEST"] =3D "1" + tmpsettings.backup_changes("EBUILD_SKIP_MANIFEST") + +if opts.skip_manifest or \ + "digest" in tmpsettings.features or \ + "digest" in pargs or \ + "manifest" in pargs: + portage._doebuild_manifest_exempt_depend +=3D 1 + +if "test" in pargs: + # This variable is a signal to config.regenerate() to + # indicate that the test phase should be enabled regardless + # of problems such as masked "test" USE flag. + tmpsettings["EBUILD_FORCE_TEST"] =3D "1" + tmpsettings.backup_changes("EBUILD_FORCE_TEST") + tmpsettings.features.add("test") + +tmpsettings.features.discard("fail-clean") + +try: + metadata =3D dict(zip(Package.metadata_keys, + portage.db[portage.settings["ROOT"]][mytree].dbapi.aux_get( + cpv, Package.metadata_keys, myrepo=3Dmyrepo))) +except KeyError: + # aux_get failure, message should have been shown on stderr. + sys.exit(1) + +root_config =3D RootConfig(portage.settings, + portage.db[portage.settings["ROOT"]], None) + +pkg =3D Package(built=3D(pkg_type !=3D "ebuild"), cpv=3Dcpv, + installed=3D(pkg_type=3D=3D"installed"), + metadata=3Dmetadata, root_config=3Droot_config, + type_name=3Dpkg_type) + +# 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. +tmpsettings.setcpv(pkg) + +def stale_env_warning(): + if "clean" not in pargs and \ + "noauto" not in tmpsettings.features and \ + build_dir_phases.intersection(pargs): + portage.doebuild_environment(ebuild, "setup", portage.root, + tmpsettings, debug, 1, portage.portdb) + env_filename =3D os.path.join(tmpsettings["T"], "environment") + if os.path.exists(env_filename): + msg =3D ("Existing ${T}/environment for '%s' will be sourced. " + \ + "Run 'clean' to start with a fresh environment.") % \ + (tmpsettings["PF"], ) + from textwrap import wrap + msg =3D wrap(msg, 70) + for x in msg: + portage.writemsg(">>> %s\n" % x) + + if ebuild_changed: + open(os.path.join(tmpsettings['PORTAGE_BUILDDIR'], + '.ebuild_changed'), 'w') + +from portage.exception import PermissionDenied, \ + PortagePackageException, UnsupportedAPIException + +if 'digest' in tmpsettings.features and \ + not set(["digest", "manifest"]).intersection(pargs): + pargs =3D ['digest'] + pargs + +checked_for_stale_env =3D False + +for arg in pargs: + try: + if not checked_for_stale_env and arg not in ("digest","manifest"): + # This has to go after manifest generation since otherwise + # aux_get() might fail due to invalid ebuild digests. + stale_env_warning() + checked_for_stale_env =3D True + + if arg in ("digest", "manifest") and force: + discard_digests(ebuild, tmpsettings, portage.portdb) + a =3D portage.doebuild(ebuild, arg, portage.root, tmpsettings, + debug=3Ddebug, tree=3Dmytree, + vartree=3Dportage.db[portage.root]['vartree']) + except KeyboardInterrupt: + print("Interrupted.") + a =3D 1 + except KeyError: + # aux_get error + a =3D 1 + except UnsupportedAPIException as e: + from textwrap import wrap + msg =3D wrap(str(e), 70) + del e + for x in msg: + portage.writemsg("!!! %s\n" % x, noiselevel=3D-1) + a =3D 1 + except PortagePackageException as e: + portage.writemsg("!!! %s\n" % (e,), noiselevel=3D-1) + a =3D 1 + except PermissionDenied as e: + portage.writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=3D-1= ) + a =3D 1 + if a =3D=3D None: + print("Could not run the required binary?") + a =3D 127 + if a: + sys.exit(a) diff --git a/portage_with_autodep/bin/ebuild-helpers/4/dodoc b/portage_wi= th_autodep/bin/ebuild-helpers/4/dodoc new file mode 120000 index 0000000..35080ad --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/4/dodoc @@ -0,0 +1 @@ +../doins \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/4/dohard b/portage_w= ith_autodep/bin/ebuild-helpers/4/dohard new file mode 120000 index 0000000..1a6b57a --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/4/dohard @@ -0,0 +1 @@ +../../banned-helper \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/4/dosed b/portage_wi= th_autodep/bin/ebuild-helpers/4/dosed new file mode 120000 index 0000000..1a6b57a --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/4/dosed @@ -0,0 +1 @@ +../../banned-helper \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/4/prepalldocs b/port= age_with_autodep/bin/ebuild-helpers/4/prepalldocs new file mode 120000 index 0000000..1a6b57a --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/4/prepalldocs @@ -0,0 +1 @@ +../../banned-helper \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/die b/portage_with_a= utodep/bin/ebuild-helpers/die new file mode 100755 index 0000000..9869141 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/die @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright 2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +die "$@" +exit 1 diff --git a/portage_with_autodep/bin/ebuild-helpers/dobin b/portage_with= _autodep/bin/ebuild-helpers/dobin new file mode 100755 index 0000000..e385455 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dobin @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ $# -lt 1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + 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; } +fi + +ret=3D0 + +for x in "$@" ; do + if [[ -e ${x} ]] ; then + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${= x}" "${D}${DESTTREE}/bin" + else + echo "!!! ${0##*/}: $x does not exist" 1>&2 + false + fi + ((ret|=3D$?)) +done + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit ${ret} diff --git a/portage_with_autodep/bin/ebuild-helpers/doconfd b/portage_wi= th_autodep/bin/ebuild-helpers/doconfd new file mode 100755 index 0000000..e146000 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/doconfd @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +if [[ $# -lt 1 ]] ; then + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +exec \ +env \ +INSDESTTREE=3D"/etc/conf.d/" \ +doins "$@" diff --git a/portage_with_autodep/bin/ebuild-helpers/dodir b/portage_with= _autodep/bin/ebuild-helpers/dodir new file mode 100755 index 0000000..f40bee7 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dodir @@ -0,0 +1,10 @@ +#!/bin/bash +# Copyright 1999-2010 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}/}" +ret=3D$? +[[ $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 new file mode 100755 index 0000000..65713db --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dodoc @@ -0,0 +1,31 @@ +#!/bin/bash +# 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 + +if [ $# -lt 1 ] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 =09 +fi + +dir=3D"${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" +if [ ! -d "${dir}" ] ; then + install -d "${dir}" +fi + +ret=3D0 +for x in "$@" ; do + if [ -d "${x}" ] ; then + eqawarn "QA Notice: dodoc argument '${x}' is a directory" + elif [ -s "${x}" ] ; then + install -m0644 "${x}" "${dir}" || { ((ret|=3D1)); continue; } + ecompress --queue "${dir}/${x##*/}" + elif [ ! -e "${x}" ] ; then + echo "!!! ${0##*/}: $x does not exist" 1>&2 + ((ret|=3D1)) + fi +done + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit ${ret} diff --git a/portage_with_autodep/bin/ebuild-helpers/doenvd b/portage_wit= h_autodep/bin/ebuild-helpers/doenvd new file mode 100755 index 0000000..28ab5d2 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/doenvd @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +if [[ $# -lt 1 ]] ; then + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +exec \ +env \ +INSDESTTREE=3D"/etc/env.d/" \ +doins "$@" diff --git a/portage_with_autodep/bin/ebuild-helpers/doexe b/portage_with= _autodep/bin/ebuild-helpers/doexe new file mode 100755 index 0000000..360800e --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/doexe @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ $# -lt 1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then + install -d "${D}${_E_EXEDESTTREE_}" +fi + +TMP=3D$T/.doexe_tmp +mkdir "$TMP" + +ret=3D0 + +for x in "$@" ; do + if [ -L "${x}" ] ; then + cp "$x" "$TMP" + mysrc=3D$TMP/${x##*/} + elif [ -d "${x}" ] ; then + vecho "doexe: warning, skipping directory ${x}" + continue + else + mysrc=3D"${x}" + fi + if [ -e "$mysrc" ] ; then + install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_" + else + echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 + false + fi + ((ret|=3D$?)) +done + +rm -rf "$TMP" + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/dohard b/portage_wit= h_autodep/bin/ebuild-helpers/dohard new file mode 100755 index 0000000..2270487 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dohard @@ -0,0 +1,13 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +if [[ $# -ne 2 ]] ; then + echo "$0: two arguments needed" 1>&2 + exit 1 +fi + +destdir=3D${2%/*} +[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" + +exec ln -f "${D}$1" "${D}$2" diff --git a/portage_with_autodep/bin/ebuild-helpers/dohtml b/portage_wit= h_autodep/bin/ebuild-helpers/dohtml new file mode 100755 index 0000000..630629a --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dohtml @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 2009-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +PORTAGE_BIN_PATH=3D${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} +PORTAGE_PYM_PATH=3D${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} +PYTHONPATH=3D$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ + "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/dohtml.py" "$@" + +ret=3D$? +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/doinfo b/portage_wit= h_autodep/bin/ebuild-helpers/doinfo new file mode 100755 index 0000000..54fb8da --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/doinfo @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z $1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 =09 +fi + +if [[ ! -d ${D}usr/share/info ]] ; then + install -d "${D}usr/share/info" || { helpers_die "${0##*/}: failed to i= nstall ${D}usr/share/info"; exit 1; } +fi + +install -m0644 "$@" "${D}usr/share/info" +rval=3D$? +if [ $rval -ne 0 ] ; then + for x in "$@" ; do + [ -e "$x" ] || echo "!!! ${0##*/}: $x does not exist" 1>&2 + done + helpers_die "${0##*/} failed" +fi +exit $rval diff --git a/portage_with_autodep/bin/ebuild-helpers/doinitd b/portage_wi= th_autodep/bin/ebuild-helpers/doinitd new file mode 100755 index 0000000..b711e19 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/doinitd @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +if [[ $# -lt 1 ]] ; then + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +exec \ +env \ +_E_EXEDESTTREE_=3D"/etc/init.d/" \ +doexe "$@" diff --git a/portage_with_autodep/bin/ebuild-helpers/doins b/portage_with= _autodep/bin/ebuild-helpers/doins new file mode 100755 index 0000000..7dec146 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/doins @@ -0,0 +1,155 @@ +#!/bin/bash +# 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 + +if [[ ${0##*/} =3D=3D dodoc ]] ; then + if [ $# -eq 0 ] ; then + # default_src_install may call dodoc with no arguments + # when DOC is defined but empty, so simply return + # sucessfully in this case. + exit 0 + fi + export INSOPTIONS=3D-m0644 + export INSDESTTREE=3Dusr/share/doc/${PF}/${_E_DOCDESTTREE_} +fi + +if [ $# -lt 1 ] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +if [[ "$1" =3D=3D "-r" ]] ; then + DOINSRECUR=3Dy + shift +else + DOINSRECUR=3Dn +fi + +if [[ ${INSDESTTREE#${D}} !=3D "${INSDESTTREE}" ]]; then + vecho "-------------------------------------------------------" 1>&2 + vecho "You should not use \${D} with helpers." 1>&2 + vecho " --> ${INSDESTTREE}" 1>&2 + vecho "-------------------------------------------------------" 1>&2 + helpers_die "${0##*/} used with \${D}" + exit 1 +fi + +case "$EAPI" in + 0|1|2|3|3_pre2) + PRESERVE_SYMLINKS=3Dn + ;; + *) + PRESERVE_SYMLINKS=3Dy + ;; +esac + +export TMP=3D$T/.doins_tmp +# Use separate directories to avoid potential name collisions. +mkdir -p "$TMP"/{1,2} + +[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}" + +_doins() { + local mysrc=3D"$1" mydir=3D"$2" cleanup=3D"" rval + + if [ -L "$mysrc" ] ; then + # Our fake $DISTDIR contains symlinks that should + # not be reproduced inside $D. In order to ensure + # that things like dodoc "$DISTDIR"/foo.pdf work + # as expected, we dereference symlinked files that + # refer to absolute paths inside + # $PORTAGE_ACTUAL_DISTDIR/. + if [ $PRESERVE_SYMLINKS =3D y ] && \ + ! [[ $(readlink "$mysrc") =3D=3D "$PORTAGE_ACTUAL_DISTDIR"/* ]] ; the= n + rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $? + cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}" + return $? + else + cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $? + mysrc=3D"$TMP/2/${mysrc##*/}" + cleanup=3D$mysrc + fi + fi + + install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}" + rval=3D$? + [[ -n ${cleanup} ]] && rm -f "${cleanup}" + [ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 + return $rval +} + +_xdoins() { + local -i failed=3D0 + while read -r -d $'\0' x ; do + _doins "$x" "${x%/*}" + ((failed|=3D$?)) + done + return $failed +} + +success=3D0 +failed=3D0 + +for x in "$@" ; do + if [[ $PRESERVE_SYMLINKS =3D n && -d $x ]] || \ + [[ $PRESERVE_SYMLINKS =3D y && -d $x && ! -L $x ]] ; then + if [ "${DOINSRECUR}" =3D=3D "n" ] ; then + if [[ ${0##*/} =3D=3D dodoc ]] ; then + echo "!!! ${0##*/}: $x is a directory" 1>&2 + ((failed|=3D1)) + fi + continue + fi + + while [ "$x" !=3D "${x%/}" ] ; do + x=3D${x%/} + done + if [ "$x" =3D "${x%/*}" ] ; then + pushd "$PWD" >/dev/null + else + pushd "${x%/*}" >/dev/null + fi + x=3D${x##*/} + x_orig=3D$x + # Follow any symlinks recursively until we've got + # a normal directory for 'find' to traverse. The + # name of the symlink will be used for the name + # of the installed directory, as discussed in + # bug #239529. + while [ -L "$x" ] ; do + pushd "$(readlink "$x")" >/dev/null + x=3D${PWD##*/} + pushd "${PWD%/*}" >/dev/null + done + if [[ $x !=3D $x_orig ]] ; then + mv "$x" "$TMP/1/$x_orig" + pushd "$TMP/1" >/dev/null + fi + find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; + find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins + if [[ ${PIPESTATUS[1]} -eq 0 ]] ; then + # NOTE: Even if only an empty directory is installed here, it + # still counts as success, since an empty directory given as + # an argument to doins -r should not trigger failure. + ((success|=3D1)) + else + ((failed|=3D1)) + fi + if [[ $x !=3D $x_orig ]] ; then + popd >/dev/null + mv "$TMP/1/$x_orig" "$x" + fi + while popd >/dev/null 2>&1 ; do true ; done + else + _doins "${x}" + if [[ $? -eq 0 ]] ; then + ((success|=3D1)) + else + ((failed|=3D1)) + fi + fi +done +rm -rf "$TMP" +[[ $failed -ne 0 || $success -eq 0 ]] && { helpers_die "${0##*/} failed"= ; exit 1; } || exit 0 diff --git a/portage_with_autodep/bin/ebuild-helpers/dolib b/portage_with= _autodep/bin/ebuild-helpers/dolib new file mode 100755 index 0000000..87ade42 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dolib @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +# Setup ABI cruft +LIBDIR_VAR=3D"LIBDIR_${ABI}" +if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then + CONF_LIBDIR=3D${!LIBDIR_VAR} +fi +unset LIBDIR_VAR +# we need this to default to lib so that things dont break +CONF_LIBDIR=3D${CONF_LIBDIR:-lib} +libdir=3D"${D}${DESTTREE}/${CONF_LIBDIR}" + + +if [[ $# -lt 1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi +if [[ ! -d ${libdir} ]] ; then + install -d "${libdir}" || { helpers_die "${0##*/}: failed to install ${= libdir}"; exit 1; } +fi + +ret=3D0 + +for x in "$@" ; do + if [[ -e ${x} ]] ; then + if [[ ! -L ${x} ]] ; then + install ${LIBOPTIONS} "${x}" "${libdir}" + else + ln -s "$(readlink "${x}")" "${libdir}/${x##*/}" + fi + else + echo "!!! ${0##*/}: ${x} does not exist" 1>&2 + false + fi + ((ret|=3D$?)) +done + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit ${ret} diff --git a/portage_with_autodep/bin/ebuild-helpers/dolib.a b/portage_wi= th_autodep/bin/ebuild-helpers/dolib.a new file mode 100755 index 0000000..d2279dc --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dolib.a @@ -0,0 +1,6 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +exec env LIBOPTIONS=3D"-m0644" \ + dolib "$@" diff --git a/portage_with_autodep/bin/ebuild-helpers/dolib.so b/portage_w= ith_autodep/bin/ebuild-helpers/dolib.so new file mode 100755 index 0000000..4bdbfab --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dolib.so @@ -0,0 +1,6 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +exec env LIBOPTIONS=3D"-m0755" \ + dolib "$@" diff --git a/portage_with_autodep/bin/ebuild-helpers/doman b/portage_with= _autodep/bin/ebuild-helpers/doman new file mode 100755 index 0000000..4561bef --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/doman @@ -0,0 +1,64 @@ +#!/bin/bash +# 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 + +if [[ $# -lt 1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +i18n=3D"" + +ret=3D0 + +for x in "$@" ; do + if [[ ${x:0:6} =3D=3D "-i18n=3D" ]] ; then + i18n=3D${x:6}/ + continue + fi + if [[ ${x:0:6} =3D=3D ".keep_" ]] ; then + continue + fi + + suffix=3D${x##*.} + + # These will be automatically decompressed by ecompressdir. + if has ${suffix} Z gz bz2 ; then + realname=3D${x%.*} + suffix=3D${realname##*.} + fi + + if has "${EAPI:-0}" 2 3 || [[ -z ${i18n} ]] \ + && ! has "${EAPI:-0}" 0 1 \ + && [[ $x =3D~ (.*)\.([a-z][a-z](_[A-Z][A-Z])?)\.(.*) ]] + then + name=3D${BASH_REMATCH[1]##*/}.${BASH_REMATCH[4]} + mandir=3D${BASH_REMATCH[2]}/man${suffix:0:1} + else + name=3D${x##*/} + mandir=3D${i18n#/}man${suffix:0:1} + fi + + + if [[ ${mandir} =3D=3D *man[0-9n] ]] ; then + if [[ -s ${x} ]] ; then + if [[ ! -d ${D}/usr/share/man/${mandir} ]] ; then + install -d "${D}/usr/share/man/${mandir}" + fi + + install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}" + ((ret|=3D$?)) + elif [[ ! -e ${x} ]] ; then + echo "!!! ${0##*/}: $x does not exist" 1>&2 + ((ret|=3D1)) + fi + else + vecho "doman: '${x}' is probably not a man page; skipping" 1>&2 + ((ret|=3D1)) + fi +done + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit ${ret} diff --git a/portage_with_autodep/bin/ebuild-helpers/domo b/portage_with_= autodep/bin/ebuild-helpers/domo new file mode 100755 index 0000000..4737f44 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/domo @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +mynum=3D${#} +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/" +fi + +ret=3D0 + +for x in "$@" ; do + if [ -e "${x}" ] ; then + mytiny=3D"${x##*/}" + mydir=3D"${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES" + if [ ! -d "${mydir}" ] ; then + install -d "${mydir}" + fi + install -m0644 "${x}" "${mydir}/${MOPREFIX}.mo" + else + echo "!!! ${0##*/}: $x does not exist" 1>&2 + false + fi + ((ret|=3D$?)) +done + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/dosbin b/portage_wit= h_autodep/bin/ebuild-helpers/dosbin new file mode 100755 index 0000000..87a3091 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dosbin @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ $# -lt 1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + 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; } +fi + +ret=3D0 + +for x in "$@" ; do + if [[ -e ${x} ]] ; then + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${= x}" "${D}${DESTTREE}/sbin" + else + echo "!!! ${0##*/}: ${x} does not exist" 1>&2 + false + fi + ((ret|=3D$?)) +done + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit ${ret} diff --git a/portage_with_autodep/bin/ebuild-helpers/dosed b/portage_with= _autodep/bin/ebuild-helpers/dosed new file mode 100755 index 0000000..afc949b --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dosed @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +if [[ $# -lt 1 ]] ; then + echo "!!! ${0##*/}: at least one argument needed" >&2 + exit 1 +fi + +ret=3D0 +file_found=3D0 +mysed=3D"s:${D}::g" + +for x in "$@" ; do + y=3D$D${x#/} + if [ -e "${y}" ] ; then + if [ -f "${y}" ] ; then + file_found=3D1 + sed -i -e "${mysed}" "${y}" + else + echo "${y} is not a regular file!" >&2 + false + fi + ((ret|=3D$?)) + else + mysed=3D"${x}" + fi +done + +if [ $file_found =3D 0 ] ; then + echo "!!! ${0##*/}: $y does not exist" 1>&2 + ((ret|=3D1)) +fi + +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/dosym b/portage_with= _autodep/bin/ebuild-helpers/dosym new file mode 100755 index 0000000..500dad0 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/dosym @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ $# -ne 2 ]] ; then + helpers_die "${0##*/}: two arguments needed" + exit 1 +fi + +destdir=3D${2%/*} +[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" + +ln -snf "$1" "${D}$2" +ret=3D$? +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/ecompress b/portage_= with_autodep/bin/ebuild-helpers/ecompress new file mode 100755 index 0000000..b61421b --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/ecompress @@ -0,0 +1,161 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z $1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +# setup compression stuff +PORTAGE_COMPRESS=3D${PORTAGE_COMPRESS-bzip2} +[[ -z ${PORTAGE_COMPRESS} ]] && exit 0 + +if [[ ${PORTAGE_COMPRESS_FLAGS+set} !=3D "set" ]] ; then + case ${PORTAGE_COMPRESS} in + bzip2|gzip) PORTAGE_COMPRESS_FLAGS=3D"-9";; + esac +fi + +# decompress_args(suffix, binary) +# - suffix: the compression suffix to work with +# - binary: the program to execute that'll compress/decompress +# new_args: global array used to return revised arguments +decompress_args() { + local suffix=3D$1 binary=3D$2 + shift 2 + + # Initialize the global new_args array. + new_args=3D() + declare -a decompress_args=3D() + local x i=3D0 decompress_count=3D0 + for x in "$@" ; do + if [[ ${x%$suffix} =3D $x ]] ; then + new_args[$i]=3D$x + else + new_args[$i]=3D${x%$suffix} + decompress_args[$decompress_count]=3D$x + ((decompress_count++)) + fi + ((i++)) + done + + if [ $decompress_count -gt 0 ] ; then + ${binary} "${decompress_args[@]}" + if [ $? -ne 0 ] ; then + # Apparently decompression failed for one or more files, so + # drop those since we don't want to compress them twice. + new_args=3D() + local x i=3D0 + for x in "$@" ; do + if [[ ${x%$suffix} =3D $x ]] ; then + new_args[$i]=3D$x + ((i++)) + elif [[ -f ${x%$suffix} ]] ; then + new_args[$i]=3D${x%$suffix} + ((i++)) + else + # Apparently decompression failed for this one, so drop + # it since we don't want to compress it twice. + true + fi + done + fi + fi +} + +case $1 in + --suffix) + [[ -n $2 ]] && vecho "${0##*/}: --suffix takes no additional arguments= " 1>&2 + + if [[ ! -e ${T}/.ecompress.suffix ]] ; then + set -e + tmpdir=3D"${T}"/.ecompress$$.${RANDOM} + mkdir "${tmpdir}" + cd "${tmpdir}" + # we have to fill the file enough so that there is something + # to compress as some programs will refuse to do compression + # if it cannot actually compress the file + echo {0..1000} > compressme + ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme > /dev/null + # If PORTAGE_COMPRESS_FLAGS contains -k then we need to avoid + # having our glob match the uncompressed file here. + suffix=3D$(echo compressme.*) + [[ -z $suffix || "$suffix" =3D=3D "compressme.*" ]] && \ + suffix=3D$(echo compressme*) + suffix=3D${suffix#compressme} + cd / + rm -rf "${tmpdir}" + echo "${suffix}" > "${T}/.ecompress.suffix" + fi + cat "${T}/.ecompress.suffix" + ;; + --bin) + [[ -n $2 ]] && vecho "${0##*/}: --bin takes no additional arguments" 1= >&2 + + echo "${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}" + ;; + --queue) + shift + ret=3D0 + for x in "${@/%/.ecompress.file}" ; do + >> "$x" + ((ret|=3D$?)) + done + [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" + exit $ret + ;; + --dequeue) + [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional argument= s" 1>&2 + find "${D}" -name '*.ecompress.file' -print0 \ + | sed -e 's:\.ecompress\.file::g' \ + | ${XARGS} -0 ecompress + find "${D}" -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f + ;; + --*) + helpers_die "${0##*/}: unknown arguments '$*'" + exit 1 + ;; + *) + # Since dodoc calls ecompress on files that are already compressed, + # perform decompression here (similar to ecompressdir behavior). + decompress_args ".Z" "gunzip -f" "$@" + set -- "${new_args[@]}" + decompress_args ".gz" "gunzip -f" "$@" + set -- "${new_args[@]}" + decompress_args ".bz2" "bunzip2 -f" "$@" + set -- "${new_args[@]}" + + mask_ext_re=3D"" + set -f + for x in $PORTAGE_COMPRESS_EXCLUDE_SUFFIXES ; do + mask_ext_re+=3D"|$x" + done + set +f + mask_ext_re=3D"^(${mask_ext_re:1})\$" + declare -a filtered_args=3D() + i=3D0 + for x in "$@" ; do + [[ ${x##*.} =3D~ $mask_ext_re ]] && continue + [[ -s ${x} ]] || continue + filtered_args[$i]=3D$x + ((i++)) + done + [ $i -eq 0 ] && exit 0 + set -- "${filtered_args[@]}" + + # If a compressed version of the file already exists, simply + # delete it so that the compressor doesn't whine (bzip2 will + # complain and skip, gzip will prompt for input) + suffix=3D$(ecompress --suffix) + [[ -n ${suffix} ]] && echo -n "${@/%/${suffix}$'\001'}" | \ + tr '\001' '\000' | ${XARGS} -0 rm -f + # Finally, let's actually do some real work + "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@" + ret=3D$? + [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" + exit $ret + ;; +esac diff --git a/portage_with_autodep/bin/ebuild-helpers/ecompressdir b/porta= ge_with_autodep/bin/ebuild-helpers/ecompressdir new file mode 100755 index 0000000..7a95120 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/ecompressdir @@ -0,0 +1,143 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z $1 ]] ; then + helpers_die "${0##*/}: at least one argument needed" + exit 1 +fi + +case $1 in + --ignore) + shift + for skip in "$@" ; do + [[ -d ${D}${skip} || -f ${D}${skip} ]] \ + && >> "${D}${skip}.ecompress.skip" + done + exit 0 + ;; + --queue) + shift + set -- "${@/%/.ecompress.dir}" + set -- "${@/#/${D}}" + ret=3D0 + for x in "$@" ; do + >> "$x" + ((ret|=3D$?)) + done + [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" + exit $ret + ;; + --dequeue) + [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional argument= s" 1>&2 + find "${D}" -name '*.ecompress.dir' -print0 \ + | sed -e 's:\.ecompress\.dir::g' -e "s:${D}:/:g" \ + | ${XARGS} -0 ecompressdir + find "${D}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f + exit 0 + ;; + --*) + helpers_die "${0##*/}: unknown arguments '$*'" + exit 1 + ;; +esac + +# figure out the new suffix +suffix=3D$(ecompress --suffix) + +# funk_up_dir(action, suffix, binary) +# - action: compress or decompress +# - suffix: the compression suffix to work with +# - binary: the program to execute that'll compress/decompress +# The directory we act on is implied in the ${dir} variable +funk_up_dir() { + local act=3D$1 suffix=3D$2 binary=3D$3 + + local negate=3D"" + [[ ${act} =3D=3D "compress" ]] && negate=3D"!" + + # first we act on all the files + find "${dir}" -type f ${negate} -iname '*'${suffix} -print0 | ${XARGS} = -0 ${binary} + ((ret|=3D$?)) + + find "${dir}" -type l -print0 | \ + while read -r -d $'\0' brokenlink ; do + [[ -e ${brokenlink} ]] && continue + olddest=3D$(readlink "${brokenlink}") + [[ ${act} =3D=3D "compress" ]] \ + && newdest=3D"${olddest}${suffix}" \ + || newdest=3D"${olddest%${suffix}}" + rm -f "${brokenlink}" + [[ ${act} =3D=3D "compress" ]] \ + && ln -snf "${newdest}" "${brokenlink}${suffix}" \ + || ln -snf "${newdest}" "${brokenlink%${suffix}}" + ((ret|=3D$?)) + done +} + +# _relocate_skip_dirs(srctree, dsttree) +# Move all files and directories we want to skip running compression +# on from srctree to dsttree. +_relocate_skip_dirs() { + local srctree=3D"$1" dsttree=3D"$2" + + [[ -d ${srctree} ]] || return 0 + + find "${srctree}" -name '*.ecompress.skip' -print0 | \ + while read -r -d $'\0' src ; do + src=3D${src%.ecompress.skip} + dst=3D"${dsttree}${src#${srctree}}" + parent=3D${dst%/*} + mkdir -p "${parent}" + mv "${src}" "${dst}" + 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}" = ; } + +ret=3D0 + +rm -rf "${T}"/ecompress-skip + +for dir in "$@" ; do + dir=3D${dir#/} + dir=3D"${D}${dir}" + if [[ ! -d ${dir} ]] ; then + vecho "${0##*/}: /${dir#${D}} does not exist!" + continue + fi + cd "${dir}" + actual_dir=3D${dir} + dir=3D. # use relative path to avoid 'Argument list too long' errors + + # hide all the stuff we want to skip + hide_skip_dirs "${dir}" + + # since we've been requested to compress the whole dir, + # delete any individual queued requests + rm -f "${actual_dir}.ecompress.dir" + 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" + + # forcibly break all hard links as some compressors whine about it + find "${dir}" -type f -links +1 -exec env file=3D"{}" sh -c \ + 'cp -p "${file}" "${file}.ecompress.break" ; mv -f "${file}.ecompress.= break" "${file}"' \; + + # now lets do our work + [[ -z ${suffix} ]] && continue + vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}" + funk_up_dir "compress" "${suffix}" "ecompress" + + # finally, restore the skipped stuff + restore_skip_dirs +done + +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit ${ret} diff --git a/portage_with_autodep/bin/ebuild-helpers/eerror b/portage_wit= h_autodep/bin/ebuild-helpers/eerror new file mode 120000 index 0000000..a403c75 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/eerror @@ -0,0 +1 @@ +elog \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/einfo b/portage_with= _autodep/bin/ebuild-helpers/einfo new file mode 120000 index 0000000..a403c75 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/einfo @@ -0,0 +1 @@ +elog \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/elog b/portage_with_= autodep/bin/ebuild-helpers/elog new file mode 100755 index 0000000..a2303af --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/elog @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +${0##*/} "$@" diff --git a/portage_with_autodep/bin/ebuild-helpers/emake b/portage_with= _autodep/bin/ebuild-helpers/emake new file mode 100755 index 0000000..d842781 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/emake @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# +# emake: Supplies some default parameters to GNU make. At the moment the +# only parameter supplied is -jN, where N is a number of +# parallel processes that should be ideal for the running host +# (e.g. on a single-CPU machine, N=3D2). The MAKEOPTS variable +# is set in make.globals. We don't source make.globals +# here because emake is only called from an ebuild. + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +if [[ $PORTAGE_QUIET !=3D 1 ]] ; then + ( + for arg in ${MAKE:-make} $MAKEOPTS $EXTRA_EMAKE "$@" ; do + [[ ${arg} =3D=3D *" "* ]] \ + && printf "'%s' " "${arg}" \ + || printf "%s " "${arg}" + done + printf "\n" + ) >&2 +fi + +${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" +ret=3D$? +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/eqawarn b/portage_wi= th_autodep/bin/ebuild-helpers/eqawarn new file mode 120000 index 0000000..a403c75 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/eqawarn @@ -0,0 +1 @@ +elog \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/ewarn b/portage_with= _autodep/bin/ebuild-helpers/ewarn new file mode 120000 index 0000000..a403c75 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/ewarn @@ -0,0 +1 @@ +elog \ No newline at end of file diff --git a/portage_with_autodep/bin/ebuild-helpers/fowners b/portage_wi= th_autodep/bin/ebuild-helpers/fowners new file mode 100755 index 0000000..4cc6bfa --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/fowners @@ -0,0 +1,13 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +# we can't prefix all arguments because +# chown takes random options +slash=3D"/" +chown "${@/#${slash}/${D}${slash}}" +ret=3D$? +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/fperms b/portage_wit= h_autodep/bin/ebuild-helpers/fperms new file mode 100755 index 0000000..0260bdc --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/fperms @@ -0,0 +1,13 @@ +#!/bin/bash +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + +# we can't prefix all arguments because +# chmod takes random options +slash=3D"/" +chmod "${@/#${slash}/${D}${slash}}" +ret=3D$? +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/newbin b/portage_wit= h_autodep/bin/ebuild-helpers/newbin new file mode 100755 index 0000000..30f19b0 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newbin @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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_w= ith_autodep/bin/ebuild-helpers/newconfd new file mode 100755 index 0000000..5752cfa --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newconfd @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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_wit= h_autodep/bin/ebuild-helpers/newdoc new file mode 100755 index 0000000..f97ce0d --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newdoc @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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_wi= th_autodep/bin/ebuild-helpers/newenvd new file mode 100755 index 0000000..83c556e --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newenvd @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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_wit= h_autodep/bin/ebuild-helpers/newexe new file mode 100755 index 0000000..92dbe9f --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newexe @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec doexe "${T}/${2}" diff --git a/portage_with_autodep/bin/ebuild-helpers/newinitd b/portage_w= ith_autodep/bin/ebuild-helpers/newinitd new file mode 100755 index 0000000..fc6003a --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newinitd @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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_wit= h_autodep/bin/ebuild-helpers/newins new file mode 100755 index 0000000..065477f --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newins @@ -0,0 +1,35 @@ +#!/bin/bash +# 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 + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +rm -rf "${T}/${2}" || exit $? +case "$EAPI" in + 0|1|2|3|3_pre2) + cp "$1" "$T/$2" || exit $? + ;; + *) + cp -P "$1" "$T/$2" + ret=3D$? + if [[ $ret -ne 0 ]] ; then + helpers_die "${0##*/} failed" + exit $ret + fi + ;; +esac +doins "${T}/${2}" +ret=3D$? +rm -rf "${T}/${2}" +[[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" +exit $ret diff --git a/portage_with_autodep/bin/ebuild-helpers/newlib.a b/portage_w= ith_autodep/bin/ebuild-helpers/newlib.a new file mode 100755 index 0000000..eef4104 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newlib.a @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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 new file mode 100755 index 0000000..c8696f3 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newlib.so @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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_wit= h_autodep/bin/ebuild-helpers/newman new file mode 100755 index 0000000..ffb8a2d --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newman @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +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_wi= th_autodep/bin/ebuild-helpers/newsbin new file mode 100755 index 0000000..82242aa --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/newsbin @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -z ${T} ]] || [[ -z ${2} ]] ; then + helpers_die "${0##*/}: Need two arguments, old file and new file" + exit 1 +fi + +if [ ! -e "$1" ] ; then + helpers_die "!!! ${0##*/}: $1 does not exist" + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec dosbin "${T}/${2}" diff --git a/portage_with_autodep/bin/ebuild-helpers/portageq b/portage_w= ith_autodep/bin/ebuild-helpers/portageq new file mode 100755 index 0000000..ec30b66 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/portageq @@ -0,0 +1,8 @@ +#!/bin/bash +# Copyright 2009-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +PORTAGE_BIN_PATH=3D${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} +PORTAGE_PYM_PATH=3D${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} +PYTHONPATH=3D$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ + exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/portageq" = "$@" diff --git a/portage_with_autodep/bin/ebuild-helpers/prepall b/portage_wi= th_autodep/bin/ebuild-helpers/prepall new file mode 100755 index 0000000..701ecba --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepall @@ -0,0 +1,23 @@ +#!/bin/bash +# 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 + +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" + # 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 +fi + +prepallman +prepallinfo + +prepallstrip + +if has chflags $FEATURES ; then + # Restore all the file flags that were saved at the beginning of prepal= l. + mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null +fi diff --git a/portage_with_autodep/bin/ebuild-helpers/prepalldocs b/portag= e_with_autodep/bin/ebuild-helpers/prepalldocs new file mode 100755 index 0000000..fdc735d --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepalldocs @@ -0,0 +1,15 @@ +#!/bin/bash +# Copyright 1999-2010 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 [[ -n $1 ]] ; then + vecho "${0##*/}: invalid usage; takes no arguments" 1>&2 +fi + +cd "${D}" +[[ -d 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/portag= e_with_autodep/bin/ebuild-helpers/prepallinfo new file mode 100755 index 0000000..0d97803 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepallinfo @@ -0,0 +1,9 @@ +#!/bin/bash +# Copyright 1999-2006 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 + +exec prepinfo diff --git a/portage_with_autodep/bin/ebuild-helpers/prepallman b/portage= _with_autodep/bin/ebuild-helpers/prepallman new file mode 100755 index 0000000..e50de6d --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepallman @@ -0,0 +1,19 @@ +#!/bin/bash +# 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 + +# replaced by controllable compression in EAPI 4 +has "${EAPI}" 0 1 2 3 || exit 0 + +ret=3D0 + +find "${D}" -type d -name man > "${T}"/prepallman.filelist +while read -r mandir ; do + mandir=3D${mandir#${D}} + prepman "${mandir%/man}" + ((ret|=3D$?)) +done < "${T}"/prepallman.filelist + +exit ${ret} diff --git a/portage_with_autodep/bin/ebuild-helpers/prepallstrip b/porta= ge_with_autodep/bin/ebuild-helpers/prepallstrip new file mode 100755 index 0000000..ec12ce6 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepallstrip @@ -0,0 +1,5 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +exec prepstrip "${D}" diff --git a/portage_with_autodep/bin/ebuild-helpers/prepinfo b/portage_w= ith_autodep/bin/ebuild-helpers/prepinfo new file mode 100755 index 0000000..691fd13 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepinfo @@ -0,0 +1,34 @@ +#!/bin/bash +# 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 + +if [[ -z $1 ]] ; then + infodir=3D"/usr/share/info" +else + if [[ -d ${D}$1/share/info ]] ; then + infodir=3D"$1/share/info" + else + infodir=3D"$1/info" + fi +fi + +if [[ ! -d ${D}${infodir} ]] ; then + if [[ -n $1 ]] ; then + vecho "${0##*/}: '${infodir}' does not exist!" + exit 1 + else + exit 0 + fi +fi + +find "${D}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do + for f in "${x}"/.keepinfodir*; do + [[ -e ${f} ]] && continue 2 + done + rm -f "${x}"/dir{,.info}{,.gz,.bz2} +done + +has "${EAPI}" 0 1 2 3 || exit 0 +exec ecompressdir --queue "${infodir}" diff --git a/portage_with_autodep/bin/ebuild-helpers/preplib b/portage_wi= th_autodep/bin/ebuild-helpers/preplib new file mode 100755 index 0000000..76aabe6 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/preplib @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 1999-2006 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'" + +LIBDIR_VAR=3D"LIBDIR_${ABI}" +if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then + CONF_LIBDIR=3D"${!LIBDIR_VAR}" +fi +unset LIBDIR_VAR + +if [ -z "${CONF_LIBDIR}" ]; then + # we need this to default to lib so that things dont break + CONF_LIBDIR=3D"lib" +fi + +if [ -z "$1" ] ; then + z=3D"${D}usr/${CONF_LIBDIR}" +else + z=3D"${D}$1/${CONF_LIBDIR}" +fi + +if [ -d "${z}" ] ; then + ldconfig -n -N "${z}" +fi diff --git a/portage_with_autodep/bin/ebuild-helpers/prepman b/portage_wi= th_autodep/bin/ebuild-helpers/prepman new file mode 100755 index 0000000..c9add8a --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepman @@ -0,0 +1,32 @@ +#!/bin/bash +# 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 + +if [[ -z $1 ]] ; then=20 + mandir=3D"${D}usr/share/man" +else + mandir=3D"${D}$1/man" +fi + +if [[ ! -d ${mandir} ]] ; then + eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}= }'" + exit 0 +fi + +# replaced by controllable compression in EAPI 4 +has "${EAPI}" 0 1 2 3 || exit 0 + +shopt -s nullglob + +really_is_mandir=3D0 + +# use some heuristics to test if this is a real mandir +for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do + [[ -d ${subdir} ]] && really_is_mandir=3D1 && break +done + +[[ ${really_is_mandir} =3D=3D 1 ]] && exec ecompressdir --queue "${mandi= r#${D}}" + +exit 0 diff --git a/portage_with_autodep/bin/ebuild-helpers/prepstrip b/portage_= with_autodep/bin/ebuild-helpers/prepstrip new file mode 100755 index 0000000..d25259d --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/prepstrip @@ -0,0 +1,193 @@ +#!/bin/bash +# 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 + +banner=3Dfalse +SKIP_STRIP=3Dfalse +if has nostrip ${FEATURES} || \ + has strip ${RESTRICT} +then + SKIP_STRIP=3Dtrue + banner=3Dtrue + has installsources ${FEATURES} || exit 0 +fi + +STRIP=3D${STRIP:-${CHOST}-strip} +type -P -- ${STRIP} > /dev/null || STRIP=3Dstrip +OBJCOPY=3D${OBJCOPY:-${CHOST}-objcopy} +type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=3Dobjcopy + +# 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=3D"--strip-unneeded" +export PORTAGE_STRIP_FLAGS=3D${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -= R .comment} +prepstrip_sources_dir=3D/usr/src/debug/${CATEGORY}/${PF} + +if has installsources ${FEATURES} && ! type -P debugedit >/dev/null ; th= en + ewarn "FEATURES=3Dinstallsources is enabled but the debugedit binary co= uld not" + ewarn "be found. This feature will not work unless debugedit is install= ed!" +fi + +unset ${!INODE_*} + +inode_var_name() { + if [[ $USERLAND =3D BSD ]] ; then + stat -f 'INODE_%d_%i' "$1" + else + stat -c 'INODE_%d_%i' "$1" + fi +} + +save_elf_sources() { + has installsources ${FEATURES} || return 0 + has installsources ${RESTRICT} && return 0 + type -P debugedit >/dev/null || return 0 + + local x=3D$1 + local inode=3D$(inode_var_name "$x") + [[ -n ${!inode} ]] && return 0 + debugedit -b "${WORKDIR}" -d "${prepstrip_sources_dir}" \ + -l "${T}"/debug.sources "${x}" +} + +save_elf_debug() { + has splitdebug ${FEATURES} || return 0 + + local x=3D$1 + local y=3D"${D}usr/lib/debug/${x:${#D}}.debug" + + # dont save debug info twice + [[ ${x} =3D=3D *".debug" ]] && return 0 + + # this will recompute the build-id, but for now that's ok + local buildid=3D"$( type -P debugedit >/dev/null && debugedit -i "${x}"= )" + + mkdir -p $(dirname "${y}") + + local inode=3D$(inode_var_name "$x") + if [[ -n ${!inode} ]] ; then + ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y" + else + eval $inode=3D\$x + ${OBJCOPY} --only-keep-debug "${x}" "${y}" + ${OBJCOPY} --add-gnu-debuglink=3D"${y}" "${x}" + [[ -g ${x} ]] && chmod go-r "${y}" + [[ -u ${x} ]] && chmod go-r "${y}" + chmod a-x,o-w "${y}" + fi + + if [[ -n ${buildid} ]] ; then + local buildid_dir=3D"${D}usr/lib/debug/.build-id/${buildid:0:2}" + local buildid_file=3D"${buildid_dir}/${buildid:2}" + mkdir -p "${buildid_dir}" + ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug" + ln -s "/${x:${#D}}" "${buildid_file}" + fi +} + +# The existance of the section .symtab tells us that a binary is strippe= d. +# We want to log already stripped binaries, as this may be a QA violatio= n. +# They prevent us from getting the splitdebug data. +if ! has binchecks ${RESTRICT} && \ + ! has strip ${RESTRICT} ; then + log=3D$T/scanelf-already-stripped.log + qa_var=3D"QA_PRESTRIPPED_${ARCH/-/_}" + [[ -n ${!qa_var} ]] && QA_PRESTRIPPED=3D"${!qa_var}" + scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^$D##" > "$log" + if [[ -n $QA_PRESTRIPPED && -s $log && \ + ${QA_STRICT_PRESTRIPPED-unset} =3D unset ]] ; then + shopts=3D$- + set -o noglob + for x in $QA_PRESTRIPPED ; do + sed -e "s#^${x#/}\$##" -i "$log" + done + set +o noglob + set -$shopts + fi + sed -e "/^\$/d" -e "s#^#/#" -i "$log" + if [[ -s $log ]] ; then + vecho -e "\n" + eqawarn "QA Notice: Pre-stripped files found:" + eqawarn "$(<"$log")" + else + rm -f "$log" + fi +fi + +# Now we look for unstripped binaries. +for x in \ + $(scanelf -yqRBF '#k%F' -k '.symtab' "$@") \ + $(find "$@" -type f -name '*.a') +do + if ! ${banner} ; then + vecho "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}" + banner=3Dtrue + fi + + f=3D$(file "${x}") || continue + [[ -z ${f} ]] && continue + + if ! ${SKIP_STRIP} ; then + # The noglob funk is to support STRIP_MASK=3D"/*/booga" and to keep + # the for loop from expanding the globs. + # The eval echo is to support STRIP_MASK=3D"/*/{booga,bar}" sex. + set -o noglob + strip_this=3Dtrue + for m in $(eval echo ${STRIP_MASK}) ; do + [[ /${x#${D}} =3D=3D ${m} ]] && strip_this=3Dfalse && break + done + set +o noglob + else + strip_this=3Dfalse + 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. + + if [[ ${f} =3D=3D *"current ar archive"* ]] ; then + vecho " ${x:${#D}}" + if ${strip_this} ; then + # hmm, can we split debug/sources for .a ? + ${STRIP} -g "${x}" + fi + elif [[ ${f} =3D=3D *"SB executable"* || ${f} =3D=3D *"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 + elif [[ ${f} =3D=3D *"SB relocatable"* ]] ; then + vecho " ${x:${#D}}" + save_elf_sources "${x}" + if ${strip_this} ; then + [[ ${x} =3D=3D *.ko ]] && save_elf_debug "${x}" + ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" + fi + fi +done + +if [[ -s ${T}/debug.sources ]] && \ + has installsources ${FEATURES} && \ + ! has installsources ${RESTRICT} && \ + type -P debugedit >/dev/null +then + vecho "installsources: rsyncing source files" + [[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sour= ces_dir}" + grep -zv '/<[^/>]*>$' "${T}"/debug.sources | \ + (cd "${WORKDIR}"; LANG=3DC sort -z -u | \ + rsync -tL0 --files-from=3D- "${WORKDIR}/" "${D}${prepstrip_sources_dir= }/" ) + + # Preserve directory structure. + # Needed after running save_elf_sources. + # https://bugzilla.redhat.com/show_bug.cgi?id=3D444310 + while read -r -d $'\0' emptydir + do + >> "$emptydir"/.keepdir + done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0) +fi diff --git a/portage_with_autodep/bin/ebuild-helpers/sed b/portage_with_a= utodep/bin/ebuild-helpers/sed new file mode 100755 index 0000000..b21e856 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-helpers/sed @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright 2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +scriptpath=3D${BASH_SOURCE[0]} +scriptname=3D${scriptpath##*/} + +if [[ sed =3D=3D ${scriptname} ]] && [[ -n ${ESED} ]]; then + exec ${ESED} "$@" +elif type -P g${scriptname} > /dev/null ; then + exec g${scriptname} "$@" +else + old_IFS=3D"${IFS}" + IFS=3D":" +=20 + for path in $PATH; do + [[ ${path}/${scriptname} =3D=3D ${scriptpath} ]] && continue + if [[ -x ${path}/${scriptname} ]]; then + exec ${path}/${scriptname} "$@" + exit 0 + fi + done +=09 + IFS=3D"${old_IFS}" +fi +=20 +exit 1 diff --git a/portage_with_autodep/bin/ebuild-ipc b/portage_with_autodep/b= in/ebuild-ipc new file mode 100755 index 0000000..43e4a02 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-ipc @@ -0,0 +1,8 @@ +#!/bin/bash +# Copyright 2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +PORTAGE_BIN_PATH=3D${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} +PORTAGE_PYM_PATH=3D${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} +PYTHONPATH=3D$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ + exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/ebuild-ipc= .py" "$@" diff --git a/portage_with_autodep/bin/ebuild-ipc.py b/portage_with_autode= p/bin/ebuild-ipc.py new file mode 100755 index 0000000..68ad985 --- /dev/null +++ b/portage_with_autodep/bin/ebuild-ipc.py @@ -0,0 +1,276 @@ +#!/usr/bin/python +# Copyright 2010-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# +# This is a helper which ebuild processes can use +# to communicate with portage's main python process. + +import errno +import logging +import os +import pickle +import select +import signal +import sys +import time + +def debug_signal(signum, frame): + import pdb + pdb.set_trace() +signal.signal(signal.SIGUSR1, debug_signal) + +# Avoid sandbox violations after python upgrade. +pym_path =3D os.path.join(os.path.dirname( + os.path.dirname(os.path.realpath(__file__))), "pym") +if os.environ.get("SANDBOX_ON") =3D=3D "1": + sandbox_write =3D os.environ.get("SANDBOX_WRITE", "").split(":") + if pym_path not in sandbox_write: + sandbox_write.append(pym_path) + os.environ["SANDBOX_WRITE"] =3D \ + ":".join(filter(None, sandbox_write)) + +import portage +portage._disable_legacy_globals() + +class EbuildIpc(object): + + # Timeout for each individual communication attempt (we retry + # as long as the daemon process appears to be alive). + _COMMUNICATE_RETRY_TIMEOUT_SECONDS =3D 15 + _BUFSIZE =3D 4096 + + def __init__(self): + self.fifo_dir =3D os.environ['PORTAGE_BUILDDIR'] + self.ipc_in_fifo =3D os.path.join(self.fifo_dir, '.ipc_in') + self.ipc_out_fifo =3D os.path.join(self.fifo_dir, '.ipc_out') + self.ipc_lock_file =3D os.path.join(self.fifo_dir, '.ipc_lock') + + def _daemon_is_alive(self): + try: + builddir_lock =3D portage.locks.lockfile(self.fifo_dir, + wantnewlockfile=3DTrue, flags=3Dos.O_NONBLOCK) + except portage.exception.TryAgain: + return True + else: + portage.locks.unlockfile(builddir_lock) + return False + + def communicate(self, args): + + # Make locks quiet since unintended locking messages displayed on + # stdout could corrupt the intended output of this program. + portage.locks._quiet =3D True + lock_obj =3D portage.locks.lockfile(self.ipc_lock_file, unlinkfile=3DT= rue) + + try: + return self._communicate(args) + finally: + portage.locks.unlockfile(lock_obj) + + def _timeout_retry_msg(self, start_time, when): + time_elapsed =3D time.time() - start_time + portage.util.writemsg_level( + portage.localization._( + 'ebuild-ipc timed out %s after %d seconds,' + \ + ' retrying...\n') % (when, time_elapsed), + level=3Dlogging.ERROR, noiselevel=3D-1) + + def _no_daemon_msg(self): + portage.util.writemsg_level( + portage.localization._( + 'ebuild-ipc: daemon process not detected\n'), + level=3Dlogging.ERROR, noiselevel=3D-1) + + def _wait(self, pid, pr, msg): + """ + Wait on pid and return an appropriate exit code. This + may return unsuccessfully due to timeout if the daemon + process does not appear to be alive. + """ + + start_time =3D time.time() + + while True: + try: + events =3D select.select([pr], [], [], + self._COMMUNICATE_RETRY_TIMEOUT_SECONDS) + except select.error as e: + portage.util.writemsg_level( + "ebuild-ipc: %s: %s\n" % \ + (portage.localization._('during select'), e), + level=3Dlogging.ERROR, noiselevel=3D-1) + continue + + if events[0]: + break + + if self._daemon_is_alive(): + self._timeout_retry_msg(start_time, msg) + else: + self._no_daemon_msg() + try: + os.kill(pid, signal.SIGKILL) + os.waitpid(pid, 0) + except OSError as e: + portage.util.writemsg_level( + "ebuild-ipc: %s\n" % (e,), + level=3Dlogging.ERROR, noiselevel=3D-1) + return 2 + + try: + wait_retval =3D os.waitpid(pid, 0) + except OSError as e: + portage.util.writemsg_level( + "ebuild-ipc: %s: %s\n" % (msg, e), + level=3Dlogging.ERROR, noiselevel=3D-1) + return 2 + + if not os.WIFEXITED(wait_retval[1]): + portage.util.writemsg_level( + "ebuild-ipc: %s: %s\n" % (msg, + portage.localization._('subprocess failure: %s') % \ + wait_retval[1]), + level=3Dlogging.ERROR, noiselevel=3D-1) + return 2 + + return os.WEXITSTATUS(wait_retval[1]) + + def _receive_reply(self, input_fd): + + # Timeouts are handled by the parent process, so just + # block until input is available. For maximum portability, + # use a single atomic read. + buf =3D None + while True: + try: + events =3D select.select([input_fd], [], []) + except select.error as e: + portage.util.writemsg_level( + "ebuild-ipc: %s: %s\n" % \ + (portage.localization._('during select for read'), e), + level=3Dlogging.ERROR, noiselevel=3D-1) + continue + + if events[0]: + # For maximum portability, use os.read() here since + # array.fromfile() and file.read() are both known to + # erroneously return an empty string from this + # non-blocking fifo stream on FreeBSD (bug #337465). + try: + buf =3D os.read(input_fd, self._BUFSIZE) + except OSError as e: + if e.errno !=3D errno.EAGAIN: + portage.util.writemsg_level( + "ebuild-ipc: %s: %s\n" % \ + (portage.localization._('read error'), e), + level=3Dlogging.ERROR, noiselevel=3D-1) + break + # Assume that another event will be generated + # if there's any relevant data. + continue + + # Only one (atomic) read should be necessary. + if buf: + break + + retval =3D 2 + + if not buf: + + portage.util.writemsg_level( + "ebuild-ipc: %s\n" % \ + (portage.localization._('read failed'),), + level=3Dlogging.ERROR, noiselevel=3D-1) + + else: + + try: + reply =3D pickle.loads(buf) + except SystemExit: + raise + except Exception as e: + # The pickle module can raise practically + # any exception when given corrupt data. + portage.util.writemsg_level( + "ebuild-ipc: %s\n" % (e,), + level=3Dlogging.ERROR, noiselevel=3D-1) + + else: + + (out, err, retval) =3D reply + + if out: + portage.util.writemsg_stdout(out, noiselevel=3D-1) + + if err: + portage.util.writemsg(err, noiselevel=3D-1) + + return retval + + def _communicate(self, args): + + if not self._daemon_is_alive(): + self._no_daemon_msg() + return 2 + + # Open the input fifo before the output fifo, in order to make it + # possible for the daemon to send a reply without blocking. This + # improves performance, and also makes it possible for the daemon + # to do a non-blocking write without a race condition. + input_fd =3D os.open(self.ipc_out_fifo, + os.O_RDONLY|os.O_NONBLOCK) + + # Use forks so that the child process can handle blocking IO + # un-interrupted, while the parent handles all timeout + # considerations. This helps to avoid possible race conditions + # from interference between timeouts and blocking IO operations. + pr, pw =3D os.pipe() + pid =3D os.fork() + + if pid =3D=3D 0: + os.close(pr) + + # File streams are in unbuffered mode since we do atomic + # read and write of whole pickles. + output_file =3D open(self.ipc_in_fifo, 'wb', 0) + output_file.write(pickle.dumps(args)) + output_file.close() + os._exit(os.EX_OK) + + os.close(pw) + + msg =3D portage.localization._('during write') + retval =3D self._wait(pid, pr, msg) + os.close(pr) + + if retval !=3D os.EX_OK: + portage.util.writemsg_level( + "ebuild-ipc: %s: %s\n" % (msg, + portage.localization._('subprocess failure: %s') % \ + retval), level=3Dlogging.ERROR, noiselevel=3D-1) + return retval + + if not self._daemon_is_alive(): + self._no_daemon_msg() + return 2 + + pr, pw =3D os.pipe() + pid =3D os.fork() + + if pid =3D=3D 0: + os.close(pr) + retval =3D self._receive_reply(input_fd) + os._exit(retval) + + os.close(pw) + retval =3D self._wait(pid, pr, portage.localization._('during read')) + os.close(pr) + os.close(input_fd) + return retval + +def ebuild_ipc_main(args): + ebuild_ipc =3D EbuildIpc() + return ebuild_ipc.communicate(args) + +if __name__ =3D=3D '__main__': + sys.exit(ebuild_ipc_main(sys.argv[1:])) diff --git a/portage_with_autodep/bin/ebuild.sh b/portage_with_autodep/bi= n/ebuild.sh new file mode 100755 index 0000000..d68e54b --- /dev/null +++ b/portage_with_autodep/bin/ebuild.sh @@ -0,0 +1,2424 @@ +#!/bin/bash +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +PORTAGE_BIN_PATH=3D"${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" +PORTAGE_PYM_PATH=3D"${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=3D"${SANDBOX_WRITE:+${SANDBOX_WRITE}:}/dev/stdout:= /dev/stderr" + export SANDBOX_READ=3D"${SANDBOX_READ:+${SANDBOX_READ}:}/dev/stdin" +fi + +# Don't use sandbox's BASH_ENV for new shells because it does +# 'source /etc/profile' which can interfere with the build +# environment by modifying our PATH. +unset BASH_ENV + +ROOTPATH=3D${ROOTPATH##:} +ROOTPATH=3D${ROOTPATH%%:} +PREROOTPATH=3D${PREROOTPATH##:} +PREROOTPATH=3D${PREROOTPATH%%:} +PATH=3D$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/us= r/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$R= OOTPATH +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 +# ebuild.sh during the upgrade. +export PORTAGE_BZIP2_COMMAND=3D${PORTAGE_BZIP2_COMMAND:-bzip2}=20 + +# These two functions wrap sourcing and calling respectively. At presen= t they +# perform a qa check to make sure eclasses and ebuilds and profiles don'= t mess +# with shell opts (shopts). Ebuilds/eclasses changing shopts should res= et them=20 +# when they are done. + +qa_source() { + local shopts=3D$(shopt) OLDIFS=3D"$IFS" + local retval + source "$@" + retval=3D$? + set +e + [[ $shopts !=3D $(shopt) ]] && + eqawarn "QA Notice: Global shell options changed and were not restored= while sourcing '$*'" + [[ "$IFS" !=3D "$OLDIFS" ]] && + eqawarn "QA Notice: Global IFS changed and was not restored while sour= cing '$*'" + return $retval +} + +qa_call() { + local shopts=3D$(shopt) OLDIFS=3D"$IFS" + local retval + "$@" + retval=3D$? + set +e + [[ $shopts !=3D $(shopt) ]] && + eqawarn "QA Notice: Global shell options changed and were not restored= while calling '$*'" + [[ "$IFS" !=3D "$OLDIFS" ]] && + eqawarn "QA Notice: Global IFS changed and was not restored while call= ing '$*'" + return $retval +} + +EBUILD_SH_ARGS=3D"$*" + +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 !=3D "" ]] && export PORTAGE_QUIET + +# sandbox support functions; defined prior to profile.bashrc srcing, sin= ce the profile might need to add a default exception (/usr/lib64/conftest= fex) +_sb_append_var() { + local _v=3D$1 ; shift + local var=3D"SANDBOX_${_v}" + [[ -z $1 || -n $2 ]] && die "Usage: add$(echo ${_v} | \ + LC_ALL=3DC tr [:upper:] [:lower:]) " + export ${var}=3D"${!var:+${!var}:}$1" +} +# bash-4 version: +# local var=3D"SANDBOX_${1^^}" +# addread() { _sb_append_var ${0#add} "$@" ; } +addread() { _sb_append_var READ "$@" ; } +addwrite() { _sb_append_var WRITE "$@" ; } +adddeny() { _sb_append_var DENY "$@" ; } +addpredict() { _sb_append_var PREDICT "$@" ; } + +addwrite "${PORTAGE_TMPDIR}" +addread "/:${PORTAGE_TMPDIR}" +[[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}" + +# Avoid sandbox violations in temporary directories. +if [[ -w $T ]] ; then + export TEMP=3D$T + export TMP=3D$T + export TMPDIR=3D$T +elif [[ $SANDBOX_ON =3D 1 ]] ; then + for x in TEMP TMP TMPDIR ; do + [[ -n ${!x} ]] && addwrite "${!x}" + done + unset x +fi + +# the sandbox is disabled by default except when overridden in the relev= ant stages +export SANDBOX_ON=3D0 + +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=3D$1 + local found=3D0 + + # if we got something like '!flag', then invert the return value + if [[ ${u:0:1} =3D=3D "!" ]] ; then + u=3D${u:1} + found=3D1 + fi + + if [[ $EBUILD_PHASE =3D 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 =3D~ $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}" =3D=3D "depend" ]; then + die "portageq calls (has_version calls portageq) are not allowed in th= e global scope" + fi + + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" + else + PYTHONPATH=3D${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ + "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" ha= s_version "${ROOT}" "$1" + fi + local retval=3D$? + case "${retval}" in + 0|1) + return ${retval} + ;; + *) + die "unexpected portageq exit code: ${retval}" + ;; + esac +} + +portageq() { + if [ "${EBUILD_PHASE}" =3D=3D "depend" ]; then + die "portageq calls are not allowed in the global scope" + fi + + PYTHONPATH=3D${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}" =3D=3D "depend" ]; then + die "portageq calls (best_version calls portageq) are not allowed in t= he global scope" + fi + + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" + else + PYTHONPATH=3D${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ + "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" 'b= est_version' "${ROOT}" "$1" + fi + local retval=3D$? + 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 [ [value]]" >&2 + return 1 + fi + + if ! has "${EAPI:-0}" 0 1 2 3 ; then + local UW_SUFFIX=3D${3+=3D$3} + else + local UW_SUFFIX=3D${3:+=3D$3} + fi + local UWORD=3D${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 [ [value]]" >&2 + return 1 + fi + + if ! has "${EAPI:-0}" 0 1 2 3 ; then + local UE_SUFFIX=3D${3+=3D$3} + else + local UE_SUFFIX=3D${3:+=3D$3} + fi + local UWORD=3D${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=3D"$EBUILD_DEATH_HOOKS $x" + done +} + +register_success_hook() { + local x + for x in $* ; do + has $x $EBUILD_SUCCESS_HOOKS || \ + export EBUILD_SUCCESS_HOOKS=3D"$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. +if ! has "$EBUILD_PHASE" clean cleanrm depend help ; then + cd "$PORTAGE_BUILDDIR" || \ + die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'" +fi + +#if no perms are specified, dirs/files will have decent defaults +#(not secretive, but not stupid) +umask 022 +export DESTTREE=3D/usr +export INSDESTTREE=3D"" +export _E_EXEDESTTREE_=3D"" +export _E_DOCDESTTREE_=3D"" +export INSOPTIONS=3D"-m0644" +export EXEOPTIONS=3D"-m0755" +export LIBOPTIONS=3D"-m0644" +export DIROPTIONS=3D"-m0755" +export MOPREFIX=3D${PN} +declare -a PORTAGE_DOCOMPRESS=3D( /usr/share/{doc,info,man} ) +declare -a PORTAGE_DOCOMPRESS_SKIP=3D( /usr/share/doc/${PF}/html ) + +# adds ".keep" files so that dirs aren't auto-cleaned +keepdir() { + dodir "$@" + local x + if [ "$1" =3D=3D "-R" ] || [ "$1" =3D=3D "-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=3D${EAPI:-0} + [ -z "$*" ] && die "Nothing passed to the 'unpack' command" + + for x in "$@"; do + vecho ">>> Unpacking ${x} to ${PWD}" + y=3D${x%.*} + y=3D${y##*.} + + if [[ ${x} =3D=3D "./"* ]] ; then + srcdir=3D"" + elif [[ ${x} =3D=3D ${DISTDIR%/}/* ]] ; then + die "Arguments to unpack() cannot begin with \${DISTDIR}." + elif [[ ${x} =3D=3D "/"* ]] ; then + die "Arguments to unpack() cannot be absolute" + else + srcdir=3D"${DISTDIR}/" + fi + [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" + + _unpack_tar() { + if [ "${y}" =3D=3D "tar" ]; then + $1 -c -- "$srcdir$x" | tar xof - + assert_sigpipe_ok "$myfail" + else + local cwd_dest=3D${x##*/} + cwd_dest=3D${cwd_dest%.*} + $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail" + fi + } + + myfail=3D"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 -- "$srcd= ir$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=3D"$(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=3D${x##*/} + local created_symlink=3D0 + 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=3D1 + fi + deb2targz "$y" || die "$myfail" + if [ $created_symlink =3D 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_M= ODE + # 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=3D$1 + while [[ ${removed} =3D=3D *//* ]] ; do + removed=3D${removed//\/\///} + done + echo ${removed} + fi +} + +hasg() { + local x s=3D$1 + shift + for x ; do [[ ${x} =3D=3D ${s} ]] && echo "${x}" && return 0 ; done + return 1 +} +hasgq() { hasg "$@" >/dev/null ; } +econf() { + local x + + local phase_func=3D$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE") + if [[ -n $phase_func ]] ; then + if has "$EAPI" 0 1 ; then + [[ $phase_func !=3D src_compile ]] && \ + eqawarn "QA Notice: econf called in" \ + "$phase_func instead of src_compile" + else + [[ $phase_func !=3D src_configure ]] && \ + eqawarn "QA Notice: econf called in" \ + "$phase_func instead of src_configure" + fi + fi + + : ${ECONF_SOURCE:=3D.} + if [ -x "${ECONF_SOURCE}/configure" ]; then + if [[ -n $CONFIG_SHELL && \ + "$(head -n1 "$ECONF_SOURCE/configure")" =3D~ ^'#!'[[: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/gnuconfi= g/${x##*/}" + cp -f /usr/share/gnuconfig/"${x##*/}" "${x}" + done + fi + + # EAPI=3D4 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 defa= ult, pass it on. + # if the ebuild passes in --libdir, they're responsible for the conf_l= ibdir fun. + local CONF_LIBDIR LIBDIR_VAR=3D"LIBDIR_${ABI}" + if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then + CONF_LIBDIR=3D${!LIBDIR_VAR} + fi + if [[ -n ${CONF_LIBDIR} ]] && ! hasgq --libdir=3D\* "$@" ; then + export CONF_PREFIX=3D$(hasg --exec-prefix=3D\* "$@") + [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=3D$(hasg --prefix=3D\* "$@") + : ${CONF_PREFIX:=3D/usr} + CONF_PREFIX=3D${CONF_PREFIX#*=3D} + [[ ${CONF_PREFIX} !=3D /* ]] && CONF_PREFIX=3D"/${CONF_PREFIX}" + [[ ${CONF_LIBDIR} !=3D /* ]] && CONF_LIBDIR=3D"/${CONF_LIBDIR}" + set -- --libdir=3D"$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIB= DIR})" "$@" + fi + + set -- \ + --prefix=3D/usr \ + ${CBUILD:+--build=3D${CBUILD}} \ + --host=3D${CHOST} \ + ${CTARGET:+--target=3D${CTARGET}} \ + --mandir=3D/usr/share/man \ + --infodir=3D/usr/share/info \ + --datadir=3D/usr/share \ + --sysconfdir=3D/etc \ + --localstatedir=3D/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=3D"${EXTRA_EINSTALL}" + LIBDIR_VAR=3D"LIBDIR_${ABI}" + if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then + CONF_LIBDIR=3D"${!LIBDIR_VAR}" + fi + unset LIBDIR_VAR + if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" =3D set ]; then + EI_DESTLIBDIR=3D"${D}/${CONF_PREFIX}/${CONF_LIBDIR}" + EI_DESTLIBDIR=3D"$(strip_duplicate_slashes ${EI_DESTLIBDIR})" + LOCAL_EXTRA_EINSTALL=3D"libdir=3D${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTA= LL}" + unset EI_DESTLIBDIR + fi + + if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then + if [ "${PORTAGE_DEBUG}" =3D=3D "1" ]; then + ${MAKE:-make} -n prefix=3D"${D}usr" \ + datadir=3D"${D}usr/share" \ + infodir=3D"${D}usr/share/info" \ + localstatedir=3D"${D}var/lib" \ + mandir=3D"${D}usr/share/man" \ + sysconfdir=3D"${D}etc" \ + ${LOCAL_EXTRA_EINSTALL} \ + ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \ + "$@" install + fi + ${MAKE:-make} prefix=3D"${D}usr" \ + datadir=3D"${D}usr/share" \ + infodir=3D"${D}usr/share/info" \ + localstatedir=3D"${D}var/lib" \ + mandir=3D"${D}usr/share/man" \ + sysconfdir=3D"${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=3D"${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 detail= s." + 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=3D"${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) =3D=3D "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=3D${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=3D"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=3D"yes" + break + fi + done + if [ ! -f "${PORTAGE_BUILDDIR}/.unpacked" ] ; then + vecho ">>> Not marked as unpacked; recreating WORKDIR..." + newstuff=3D"yes" + fi + fi + if [ "${newstuff}" =3D=3D "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" =3D=3D "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 =3D binary ]] || \ + ! has keeptemp $FEATURES && ! has keepwork $FEATURES ; then + rm -rf "${T}" + fi + + if [[ $EMERGE_FROM =3D binary ]] || ! has keepwork $FEATURES; then + rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,pretended,setuped,unp= acked,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, a= nd 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" =3D=3D "/" ]; then + export DESTTREE=3D"" + else + export DESTTREE=3D$1 + if [ ! -d "${D}${DESTTREE}" ]; then + install -d "${D}${DESTTREE}" + local ret=3D$? + if [[ $ret -ne 0 ]] ; then + helpers_die "${FUNCNAME[0]} failed" + return $ret + fi + fi + fi +} + +insinto() { + if [ "$1" =3D=3D "/" ]; then + export INSDESTTREE=3D"" + else + export INSDESTTREE=3D$1 + if [ ! -d "${D}${INSDESTTREE}" ]; then + install -d "${D}${INSDESTTREE}" + local ret=3D$? + if [[ $ret -ne 0 ]] ; then + helpers_die "${FUNCNAME[0]} failed" + return $ret + fi + fi + fi +} + +exeinto() { + if [ "$1" =3D=3D "/" ]; then + export _E_EXEDESTTREE_=3D"" + else + export _E_EXEDESTTREE_=3D"$1" + if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then + install -d "${D}${_E_EXEDESTTREE_}" + local ret=3D$? + if [[ $ret -ne 0 ]] ; then + helpers_die "${FUNCNAME[0]} failed" + return $ret + fi + fi + fi +} + +docinto() { + if [ "$1" =3D=3D "/" ]; then + export _E_DOCDESTTREE_=3D"" + else + export _E_DOCDESTTREE_=3D"$1" + if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then + install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" + local ret=3D$? + if [[ $ret -ne 0 ]] ; then + helpers_die "${FUNCNAME[0]} failed" + return $ret + fi + fi + fi +} + +insopts() { + export INSOPTIONS=3D"$@" + + # `install` should never be called with '-s' ... + has -s ${INSOPTIONS} && die "Never call insopts() with -s" +} + +diropts() { + export DIROPTIONS=3D"$@" +} + +exeopts() { + export EXEOPTIONS=3D"$@" + + # `install` should never be called with '-s' ... + has -s ${EXEOPTIONS} && die "Never call exeopts() with -s" +} + +libopts() { + export LIBOPTIONS=3D"$@" + + # `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 =3D "-x" ]]; then + shift + for f; do + f=3D$(strip_duplicate_slashes "${f}"); f=3D${f%/} + [[ ${f:0:1} =3D / ]] || f=3D"/${f}" + for g in "${PORTAGE_DOCOMPRESS_SKIP[@]}"; do + [[ ${f} =3D "${g}" ]] && continue 2 + done + PORTAGE_DOCOMPRESS_SKIP[${#PORTAGE_DOCOMPRESS_SKIP[@]}]=3D${f} + done + else + for f; do + f=3D$(strip_duplicate_slashes "${f}"); f=3D${f%/} + [[ ${f:0:1} =3D / ]] || f=3D"/${f}" + for g in "${PORTAGE_DOCOMPRESS[@]}"; do + [[ ${f} =3D "${g}" ]] && continue 2 + done + PORTAGE_DOCOMPRESS[${#PORTAGE_DOCOMPRESS[@]}]=3D${f} + done + fi +} + +abort_handler() { + local msg + if [ "$2" !=3D "fail" ]; then + msg=3D"${EBUILD}: ${1} aborted; exiting." + else + msg=3D"${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} =3D=3D $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 configurati= on." + 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}" =3D=3D "1" ] ; then + # If USE came from ${T}/environment then it might not have USE=3Dtest + # like it's supposed to here. + ! has test ${USE} && export USE=3D"${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}" !=3D "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=3D${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=3D${save_sp} + fi + + trap - SIGINT SIGQUIT +} + +dyn_install() { + [ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is uns= et" + 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=3D/usr + export INSDESTTREE=3D"" + export _E_EXEDESTTREE_=3D"" + export _E_DOCDESTTREE_=3D"" + + 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=3D$' \t\n\r' + for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE REQUIRED_USE \ + PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do + x=3D$(echo -n ${!f}) + [[ -n $x ]] && echo "$x" > $f + done + if [[ $CATEGORY !=3D virtual ]] ; then + for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ + CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ + LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do + x=3D$(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}" > reposit= ory + 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 m= ore" + 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 n= eeded)" + 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 dire= ctory" + 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 b= e enabled:" + echo + echo " ${USE}" + fi + echo +} + +# debug-print() gets called from many places with verbose status informa= tion useful +# for tracking down problems. The output is in $T/eclass-debug.log. +# You can set ECLASS_DEBUG_OUTPUT to redirect the output somewhere else = as well. +# The special "on" setting echoes the information, mixing it with the re= st of the +# emerge output. +# You can override the setting by exporting a new one from the console, = or you can +# set a new default in make.*. Here the default is "" or unset. + +# in the future might use e* from /etc/init.d/functions.sh if i feel lik= e it +debug-print() { + # if $T isn't defined, we're in dep calculation mode and + # shouldn't do anything + [[ $EBUILD_PHASE =3D depend || ! -d ${T} || ${#} -eq 0 ]] && return 0 + + if [[ ${ECLASS_DEBUG_OUTPUT} =3D=3D on ]]; then + printf 'debug: %s\n' "${@}" >&2 + elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then + printf 'debug: %s\n' "${@}" >> "${ECLASS_DEBUG_OUTPUT}" + fi + + if [[ -w $T ]] ; then + # default target + printf '%s\n' "${@}" >> "${T}/eclass-debug.log" + # let the portage user own/write to this file + chgrp portage "${T}/eclass-debug.log" &>/dev/null + chmod g+w "${T}/eclass-debug.log" &>/dev/null + fi +} + +# The following 2 functions are debug-print() wrappers + +debug-print-function() { + debug-print "${1}: entering function, parameters: ${*:2}" +} + +debug-print-section() { + debug-print "now in section ${*}" +} + +# Sources all eclasses in parameters +declare -ix ECLASS_DEPTH=3D0 +inherit() { + ECLASS_DEPTH=3D$(($ECLASS_DEPTH + 1)) + if [[ ${ECLASS_DEPTH} > 1 ]]; then + debug-print "*** Multiple Inheritence (Level: ${ECLASS_DEPTH})" + fi + + if [[ -n $ECLASS && -n ${!__export_funcs_var} ]] ; then + echo "QA Notice: EXPORT_FUNCTIONS is called before inherit in" \ + "$ECLASS.eclass. For compatibility with <=3Dportage-2.1.6.7," \ + "only call EXPORT_FUNCTIONS after inherit(s)." \ + | fmt -w 75 | while read -r ; do eqawarn "$REPLY" ; done + fi + + local location + local olocation + local x + + # These variables must be restored before returning. + local PECLASS=3D$ECLASS + local prev_export_funcs_var=3D$__export_funcs_var + + local B_IUSE + local B_REQUIRED_USE + local B_DEPEND + local B_RDEPEND + local B_PDEPEND + while [ "$1" ]; do + location=3D"${ECLASSDIR}/${1}.eclass" + olocation=3D"" + + export ECLASS=3D"$1" + __export_funcs_var=3D__export_functions_$ECLASS_DEPTH + unset $__export_funcs_var + + if [ "${EBUILD_PHASE}" !=3D "depend" ] && \ + [[ ${EBUILD_PHASE} !=3D *rm ]] && \ + [[ ${EMERGE_FROM} !=3D "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. + if ! has $ECLASS $INHERITED $__INHERITED_QA_CACHE ; then + eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGOR= Y/$PF $EBUILD_PHASE" + fi + fi + + # any future resolution code goes here + if [ -n "$PORTDIR_OVERLAY" ]; then + local overlay + for overlay in ${PORTDIR_OVERLAY}; do + olocation=3D"${overlay}/eclass/${1}.eclass" + if [ -e "$olocation" ]; then + location=3D"${olocation}" + debug-print " eclass exists: ${location}" + fi + done + fi + debug-print "inherit: $1 -> $location" + [ ! -e "$location" ] && die "${1}.eclass could not be found by inherit= ()" + + if [ "${location}" =3D=3D "${olocation}" ] && \ + ! has "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then + EBUILD_OVERLAY_ECLASSES=3D"${EBUILD_OVERLAY_ECLASSES} ${location}" + fi + + #We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_= RDEPEND + #(if set).. and then restore them after the inherit call. + + #turn off glob expansion + set -f + + # Retain the old data and restore it later. + unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND + [ "${IUSE+set}" =3D set ] && B_IUSE=3D"${IUSE}" + [ "${REQUIRED_USE+set}" =3D set ] && B_REQUIRED_USE=3D"${REQUIRED_USE}= " + [ "${DEPEND+set}" =3D set ] && B_DEPEND=3D"${DEPEND}" + [ "${RDEPEND+set}" =3D set ] && B_RDEPEND=3D"${RDEPEND}" + [ "${PDEPEND+set}" =3D set ] && B_PDEPEND=3D"${PDEPEND}" + unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND + #turn on glob expansion + set +f + + qa_source "$location" || die "died sourcing $location in inherit()" + =09 + #turn off glob expansion + set -f + + # 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}" =3D set ] && export E_IUSE=3D"${E_IUSE} ${IUSE}" + [ "${REQUIRED_USE+set}" =3D set ] && export E_REQUIRED_USE=3D"${= E_REQUIRED_USE} ${REQUIRED_USE}" + [ "${DEPEND+set}" =3D set ] && export E_DEPEND=3D"${E_DEPEND} ${DE= PEND}" + [ "${RDEPEND+set}" =3D set ] && export E_RDEPEND=3D"${E_RDEPEND} ${= RDEPEND}" + [ "${PDEPEND+set}" =3D set ] && export E_PDEPEND=3D"${E_PDEPEND} ${= PDEPEND}" + + [ "${B_IUSE+set}" =3D set ] && IUSE=3D"${B_IUSE}" + [ "${B_IUSE+set}" =3D set ] || unset IUSE + =09 + [ "${B_REQUIRED_USE+set}" =3D set ] && REQUIRED_USE=3D"${B_REQUIRE= D_USE}" + [ "${B_REQUIRED_USE+set}" =3D set ] || unset REQUIRED_USE + + [ "${B_DEPEND+set}" =3D set ] && DEPEND=3D"${B_DEPEND}" + [ "${B_DEPEND+set}" =3D set ] || unset DEPEND + + [ "${B_RDEPEND+set}" =3D set ] && RDEPEND=3D"${B_RDEPEND}" + [ "${B_RDEPEND+set}" =3D set ] || unset RDEPEND + + [ "${B_PDEPEND+set}" =3D set ] && PDEPEND=3D"${B_PDEPEND}" + [ "${B_PDEPEND+set}" =3D set ] || unset PDEPEND + + #turn on glob expansion + set +f + + if [[ -n ${!__export_funcs_var} ]] ; then + for x in ${!__export_funcs_var} ; do + debug-print "EXPORT_FUNCTIONS: $x -> ${ECLASS}_$x" + declare -F "${ECLASS}_$x" >/dev/null || \ + die "EXPORT_FUNCTIONS: ${ECLASS}_$x is not defined" + eval "$x() { ${ECLASS}_$x \"\$@\" ; }" > /dev/null + done + fi + unset $__export_funcs_var + + has $1 $INHERITED || export INHERITED=3D"$INHERITED $1" + + shift + done + ((--ECLASS_DEPTH)) # Returns 1 when ECLASS_DEPTH reaches 0. + if (( ECLASS_DEPTH > 0 )) ; then + export ECLASS=3D$PECLASS + __export_funcs_var=3D$prev_export_funcs_var + else + unset ECLASS __export_funcs_var + fi + return 0 +} + +# Exports stub functions that call the eclass's functions, thereby makin= g them default. +# For example, if ECLASS=3D"base" and you call "EXPORT_FUNCTIONS src_unp= ack", the following +# code will be eval'd: +# src_unpack() { base_src_unpack; } +EXPORT_FUNCTIONS() { + if [ -z "$ECLASS" ]; then + die "EXPORT_FUNCTIONS without a defined ECLASS" + fi + eval $__export_funcs_var+=3D\" $*\" +} + +# this is a function for removing any directory matching a passed in pat= tern from +# PATH +remove_path_entry() { + save_IFS + IFS=3D":" + stripped_path=3D"${PATH}" + while [ -n "$1" ]; do + cur_path=3D"" + for p in ${stripped_path}; do + if [ "${p/${1}}" =3D=3D "${p}" ]; then + cur_path=3D"${cur_path}:${p}" + fi + done + stripped_path=3D"${cur_path#:*}" + shift + done + restore_IFS + PATH=3D"${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=3D$1 + local arg=3D$2 + local phase_func=3D"" + + case "$arg" in + pretend) + ! has $eapi 0 1 2 3 3_pre2 && \ + phase_func=3Dpkg_pretend + ;; + setup) + phase_func=3Dpkg_setup + ;; + nofetch) + phase_func=3Dpkg_nofetch + ;; + unpack) + phase_func=3Dsrc_unpack + ;; + prepare) + ! has $eapi 0 1 && \ + phase_func=3Dsrc_prepare + ;; + configure) + ! has $eapi 0 1 && \ + phase_func=3Dsrc_configure + ;; + compile) + phase_func=3Dsrc_compile + ;; + test) + phase_func=3Dsrc_test + ;; + install) + phase_func=3Dsrc_install + ;; + preinst) + phase_func=3Dpkg_preinst + ;; + postinst) + phase_func=3Dpkg_postinst + ;; + prerm) + phase_func=3Dpkg_prerm + ;; + postrm) + phase_func=3Dpkg_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=3D$1 + local phase_func=3D$2 + local default_phases=3D"pkg_nofetch src_unpack src_prepare src_configur= e + src_compile src_install src_test" + local x y default_func=3D"" + + 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=3D'$eapi' during phas= e $phase_func\" + }" + done + + eval "default() { + die \"default() is not supported with EAPI=3D'$eapi' during phase $p= hase_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 =3D 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=3D'$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=3DVALUE" + fi + + local argument value variable + for argument in "$@"; do + if [[ ${argument} !=3D *=3D* ]]; then + die "${FUNCNAME}(): Argument '${argument}' has incorrect syntax" + fi + variable=3D"${argument%%=3D*}" + value=3D"${argument#*=3D}" + if eval "[[ \${${variable}} =3D=3D \$(env -u ${variable} portageq envv= ar ${variable}) ]]"; then + eval "${variable}=3D\"\${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}} =3D=3D \$(env -u ${variable} portageq envv= ar ${variable}) ]]"; then + unset ${variable} + fi + done +} + +PORTAGE_BASHRCS_SOURCED=3D0 + +# @FUNCTION: source_all_bashrcs +# @DESCRIPTION: +# Source a relevant bashrc files and perform other miscellaneous +# environment initialization when appropriate. +# +# If EAPI is set then define functions provided by the current EAPI: +# +# * default_* aliases for the current EAPI phase functions +# * A "default" function which is an alias for the default phase +# function for the current phase. +# +source_all_bashrcs() { + [[ $PORTAGE_BASHRCS_SOURCED =3D 1 ]] && return 0 + PORTAGE_BASHRCS_SOURCED=3D1 + local x + + local OCC=3D"${CC}" OCXX=3D"${CXX}" + + if [[ $EBUILD_PHASE !=3D depend ]] ; then + # source the existing profile.bashrcs. + save_IFS + IFS=3D$'\n' + local path_array=3D($PROFILE_PATHS) + restore_IFS + for x in "${path_array[@]}" ; do + [ -f "$x/profile.bashrc" ] && qa_source "$x/profile.bashrc" + 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 so= me + # reason. We preserve it's state so as not to interfere. + if [ "$PORTAGE_DEBUG" !=3D "1" ] || [ "${-/x/}" !=3D "$-" ]; then + source "${x}" + else + set -x + source "${x}" + set +x + fi + fi + done + + [ ! -z "${OCC}" ] && export CC=3D"${OCC}" + [ ! -z "${OCXX}" ] && export CXX=3D"${OCXX}" +} + +# Hardcoded bash lists are needed for backward compatibility with +# > "$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=3D1 + 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=3D0 + + # 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=3D$? + else + retval=3D1 + fi + rm -f "${T}"/environment.{filtered,raw,success} + return ${retval} +} + +# =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D = =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D= =3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D +# =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D functions end, main = part begins =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D +# =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D functions end, main = part begins =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D +# =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D functions end, main = part begins =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D +# =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D = =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D =3D= =3D=3D =3D=3D=3D =3D=3D=3D =3D=3D=3D + +export SANDBOX_ON=3D"1" +export S=3D${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 mat= ched. +shopt -u extglob + +if [[ ${EBUILD_PHASE} =3D=3D depend ]] ; then + QA_INTERCEPTORS=3D"awk bash cc egrep equery fgrep g++ + gawk gcc grep javac java-config nawk perl + pkg-config python python-config sed" +elif [[ ${EBUILD_PHASE} =3D=3D clean* ]] ; then + unset QA_INTERCEPTORS +else + QA_INTERCEPTORS=3D"autoconf automake aclocal libtoolize" +fi +# level the QA interceptors if we're in depend +if [[ -n ${QA_INTERCEPTORS} ]] ; then + for BIN in ${QA_INTERCEPTORS}; do + BIN_PATH=3D$(type -Pf ${BIN}) + if [ "$?" !=3D "0" ]; then + BODY=3D"echo \"*** missing command: ${BIN}\" >&2; return 127" + else + BODY=3D"${BIN_PATH} \"\$@\"; return \$?" + fi + if [[ ${EBUILD_PHASE} =3D=3D depend ]] ; then + FUNC_SRC=3D"${BIN}() { + if [ \$ECLASS_DEPTH -gt 0 ]; then + eqawarn \"QA Notice: '${BIN}' called in global scope: eclass \${ECL= ASS}\" + else + eqawarn \"QA Notice: '${BIN}' called in global scope: \${CATEGORY}/= \${PF}\" + fi + ${BODY} + }" + elif has ${BIN} autoconf automake aclocal libtoolize ; then + FUNC_SRC=3D"${BIN}() { + if ! has \${FUNCNAME[1]} eautoreconf eaclocal _elibtoolize \\ + eautoheader eautoconf eautomake autotools_run_tool \\ + autotools_check_macro autotools_get_subdirs \\ + autotools_get_auxdir ; then + eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGOR= Y}/\${PF}\" + eqawarn \"Use autotools.eclass instead of calling '${BIN}' directly= .\" + fi + ${BODY} + }" + else + FUNC_SRC=3D"${BIN}() { + eqawarn \"QA Notice: '${BIN}' called by \${FUNCNAME[1]}: \${CATEGORY= }/\${PF}\" + ${BODY} + }" + fi + eval "$FUNC_SRC" || echo "error creating QA interceptor ${BIN}" >&2 + done + unset BIN_PATH BIN BODY FUNC_SRC +fi + +# Subshell/helper die support (must export for the die helper). +export EBUILD_MASTER_PID=3D$BASHPID +trap 'exit 1' SIGTERM + +if ! has "$EBUILD_PHASE" clean cleanrm depend && \ + [ -f "${T}"/environment ] ; then + # 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. + 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}=3D${!x} + done + PORTAGE_SANDBOX_ON=3D${SANDBOX_ON} + export SANDBOX_ON=3D1 + source "${T}"/environment || \ + die "error sourcing environment" + # 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=3D0 + for x in SANDBOX_DENY SANDBOX_PREDICT SANDBOX_READ SANDBOX_WRITE ; do + y=3D"PORTAGE_${x}" + if [ -z "${!x}" ] ; then + export ${x}=3D${!y} + elif [ -n "${!y}" ] && [ "${!y}" !=3D "${!x}" ] ; then + # filter out dupes + export ${x}=3D$(printf "${!y}:${!x}" | tr ":" "\0" | \ + sort -z -u | tr "\0" ":") + fi + export ${x}=3D${!x%:} + unset PORTAGE_${x} + done + unset x y + export SANDBOX_ON=3D${PORTAGE_SANDBOX_ON} + unset PORTAGE_SANDBOX_ON + [[ -n $EAPI ]] || EAPI=3D0 +fi + +if ! has "$EBUILD_PHASE" clean cleanrm ; then + if [[ $EBUILD_PHASE =3D depend || ! -f $T/environment || \ + -f $PORTAGE_BUILDDIR/.ebuild_changed ]] || \ + has noauto $FEATURES ; then + # The bashrcs get an opportunity here to set aliases that will be expa= nded + # during sourcing of ebuilds and eclasses. + source_all_bashrcs + + # When EBUILD_PHASE !=3D depend, INHERITED comes pre-initialized + # from cache. In order to make INHERITED content independent of + # EBUILD_PHASE during inherit() calls, we unset INHERITED after + # we make a backup copy for QA checks. + __INHERITED_QA_CACHE=3D$INHERITED + + # *DEPEND and IUSE will be set during the sourcing of the ebuild. + # 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 \ + ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND + + if [[ $PORTAGE_DEBUG !=3D 1 || ${-/x/} !=3D $- ]] ; then + source "$EBUILD" || die "error sourcing ebuild" + else + set -x + source "$EBUILD" || die "error sourcing ebuild" + set +x + fi + + if [[ "${EBUILD_PHASE}" !=3D "depend" ]] ; then + RESTRICT=3D${PORTAGE_RESTRICT} + [[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \ + rm "$PORTAGE_BUILDDIR/.ebuild_changed" + fi + + [[ -n $EAPI ]] || EAPI=3D0 + + if has "$EAPI" 0 1 2 3 3_pre2 ; then + export RDEPEND=3D${RDEPEND-${DEPEND}} + debug-print "RDEPEND: not set... Setting to: ${DEPEND}" + fi + + # add in dependency info from eclasses + IUSE=3D"${IUSE} ${E_IUSE}" + DEPEND=3D"${DEPEND} ${E_DEPEND}" + RDEPEND=3D"${RDEPEND} ${E_RDEPEND}" + PDEPEND=3D"${PDEPEND} ${E_PDEPEND}" + REQUIRED_USE=3D"${REQUIRED_USE} ${E_REQUIRED_USE}" + =09 + unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND \ + __INHERITED_QA_CACHE + + # alphabetically ordered by $EBUILD_PHASE value + case "$EAPI" in + 0|1) + _valid_phases=3D"src_compile pkg_config pkg_info src_install + pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm + pkg_setup src_test src_unpack" + ;; + 2|3|3_pre2) + _valid_phases=3D"src_compile pkg_config src_configure pkg_info + src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst + src_prepare pkg_prerm pkg_setup src_test src_unpack" + ;; + *) + _valid_phases=3D"src_compile pkg_config src_configure pkg_info + src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst + src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack" + ;; + esac + + DEFINED_PHASES=3D + for _f in $_valid_phases ; do + if declare -F $_f >/dev/null ; then + _f=3D${_f#pkg_} + DEFINED_PHASES+=3D" ${_f#src_}" + fi + done + [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=3D- + + unset _f _valid_phases + + if [[ $EBUILD_PHASE !=3D depend ]] ; then + + case "$EAPI" in + 0|1|2|3) + _ebuild_helpers_path=3D"$PORTAGE_BIN_PATH/ebuild-helpers" + ;; + *) + _ebuild_helpers_path=3D"$PORTAGE_BIN_PATH/ebuild-helpers/4:$PORTAGE= _BIN_PATH/ebuild-helpers" + ;; + esac + + PATH=3D$_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=3DLIBDIR_${DEFAULT_ABI} + [[ -n $DEFAULT_ABI && -n ${!x} ]] && x=3D${!x} || x=3Dlib + + if has distcc $FEATURES ; then + PATH=3D"/usr/$x/distcc/bin:$PATH" + [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}" + fi + + if has ccache $FEATURES ; then + PATH=3D"/usr/$x/ccache/bin:$PATH" + + if [[ -n $CCACHE_DIR ]] ; then + addread "$CCACHE_DIR" + addwrite "$CCACHE_DIR" + fi + + [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null + fi + + unset x + + if [[ -n $QA_PREBUILT ]] ; then + + # these ones support fnmatch patterns + QA_EXECSTACK+=3D" $QA_PREBUILT" + QA_TEXTRELS+=3D" $QA_PREBUILT" + QA_WX_LOAD+=3D" $QA_PREBUILT" + + # 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 + if [[ $(declare -p $x 2>/dev/null) =3D declare\ -a* ]] ; then + eval "$x=3D(\"\${$x[@]}\" ${QA_PREBUILT//\*/.*})" + else + eval "$x+=3D\" ${QA_PREBUILT//\*/.*}\"" + fi + done + + unset x + fi + + # This needs to be exported since prepstrip is a separate shell scrip= t. + [[ -n $QA_PRESTRIPPED ]] && export QA_PRESTRIPPED + eval "[[ -n \$QA_PRESTRIPPED_${ARCH/-/_} ]] && \ + export QA_PRESTRIPPED_${ARCH/-/_}" + fi + fi +fi + +# unset USE_EXPAND variables that contain only the special "*" token +for x in ${USE_EXPAND} ; do + [ "${!x}" =3D=3D "*" ] && unset ${x} +done +unset x + +if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} +then + export DEBUGBUILD=3D1 +fi + +#a reasonable default for $S +[[ -z ${S} ]] && export S=3D${WORKDIR}/${P} + +# Note: readonly variables interfere with preprocess_ebuild_env(), so +# declare them only after it has already run. +if [ "${EBUILD_PHASE}" !=3D "depend" ] ; then + declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS + case "$EAPI" in + 0|1|2) + ;; + *) + 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=3D$BASHPID + trap 'exit 1' SIGTERM + + if [[ $EBUILD_PHASE !=3D depend ]] ; then + # Force configure scripts that automatically detect ccache to + # respect FEATURES=3D"-ccache". + has ccache $FEATURES || export CCACHE_DISABLE=3D1 + + local phase_func=3D$(_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=3D"0" + if [ "${PORTAGE_DEBUG}" !=3D "1" ] || [ "${-/x/}" !=3D "$-" ]; 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 =3D=3D 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} =3D 0 ]] ; then + export SANDBOX_ON=3D"1" + else + export SANDBOX_ON=3D"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} =3D set ]] && export $x + done + unset x + + has distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \ + [[ ${SANDBOX_WRITE/$DISTCC_DIR} =3D $SANDBOX_WRITE ]] && \ + addwrite "$DISTCC_DIR" + + x=3DLIBDIR_$ABI + [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \ + export PKG_CONFIG_PATH=3D/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=3Dnoauto 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=3DC 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}" !=3D "1" ] || [ "${-/x/}" !=3D "$-" ]; then + dyn_${EBUILD_SH_ARGS} + else + set -x + dyn_${EBUILD_SH_ARGS} + set +x + fi + export SANDBOX_ON=3D"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 eb= uilds break. + export SANDBOX_ON=3D"0" + if [ "${PORTAGE_DEBUG}" !=3D "1" ] || [ "${-/x/}" !=3D "$-" ]; then + dyn_${EBUILD_SH_ARGS} + else + set -x + dyn_${EBUILD_SH_ARGS} + set +x + fi + ;; + depend) + export SANDBOX_ON=3D"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=3D=3D664 + umask 002 + fi + + auxdbkeys=3D"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=3D0 + + 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 + ;; + _internal_test) + ;; + *) + export SANDBOX_ON=3D"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=3D + if [[ -n SANDBOX_ON ]] ; then + x=3D$SANDBOX_ON + export SANDBOX_ON=3D0 + fi + + rm -f "$SANDBOX_LOG" || \ + die "failed to remove stale sandbox log: '$SANDBOX_LOG'" + + if [[ -n $x ]] ; then + export SANDBOX_ON=3D$x + fi + unset x +fi + +if [[ $EBUILD_PHASE =3D 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. +true diff --git a/portage_with_autodep/bin/egencache b/portage_with_autodep/bi= n/egencache new file mode 100755 index 0000000..1b4265d --- /dev/null +++ b/portage_with_autodep/bin/egencache @@ -0,0 +1,851 @@ +#!/usr/bin/python +# Copyright 2009-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from __future__ import print_function + +import signal +import sys +# This block ensures that ^C interrupts are handled quietly. +try: + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + sys.exit(128 + signum) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + +except KeyboardInterrupt: + sys.exit(128 + signal.SIGINT) + +import io +import logging +import optparse +import subprocess +import time +import textwrap +import re + +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + import portage + +from portage import os, _encodings, _unicode_encode, _unicode_decode +from _emerge.MetadataRegen import MetadataRegen +from portage.cache.cache_errors import CacheError, StatCollision +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 + +try: + from xml.etree import ElementTree +except ImportError: + pass +else: + try: + from xml.parsers.expat import ExpatError + except ImportError: + pass + else: + from repoman.utilities import parse_metadata_use + +from repoman.utilities import FindVCS + +if sys.hexversion >=3D 0x3000000: + long =3D int + +def parse_args(args): + usage =3D "egencache [options] ... [atom] ..." + parser =3D optparse.OptionParser(usage=3Dusage) + + actions =3D optparse.OptionGroup(parser, 'Actions') + actions.add_option("--update", + action=3D"store_true", + help=3D"update metadata/cache/ (generate as necessary)") + actions.add_option("--update-use-local-desc", + action=3D"store_true", + help=3D"update the use.local.desc file from metadata.xml") + actions.add_option("--update-changelogs", + action=3D"store_true", + help=3D"update the ChangeLog files from SCM logs") + parser.add_option_group(actions) + + common =3D optparse.OptionGroup(parser, 'Common options') + common.add_option("--repo", + action=3D"store", + help=3D"name of repo to operate on (default repo is located at $PORTDI= R)") + common.add_option("--config-root", + help=3D"location of portage config files", + dest=3D"portage_configroot") + common.add_option("--portdir", + help=3D"override the portage tree location", + dest=3D"portdir") + common.add_option("--tolerant", + action=3D"store_true", + help=3D"exit successfully if only minor errors occurred") + common.add_option("--ignore-default-opts", + action=3D"store_true", + help=3D"do not use the EGENCACHE_DEFAULT_OPTS environment variable") + parser.add_option_group(common) + + update =3D optparse.OptionGroup(parser, '--update options') + update.add_option("--cache-dir", + help=3D"location of the metadata cache", + dest=3D"cache_dir") + update.add_option("--jobs", + action=3D"store", + help=3D"max ebuild processes to spawn") + update.add_option("--load-average", + action=3D"store", + help=3D"max load allowed when spawning multiple jobs", + dest=3D"load_average") + update.add_option("--rsync", + action=3D"store_true", + help=3D"enable rsync stat collision workaround " + \ + "for bug 139134 (use with --update)") + parser.add_option_group(update) + + uld =3D optparse.OptionGroup(parser, '--update-use-local-desc options') + uld.add_option("--preserve-comments", + action=3D"store_true", + help=3D"preserve the comments from the existing use.local.desc file") + uld.add_option("--use-local-desc-output", + help=3D"output file for use.local.desc data (or '-' for stdout)", + dest=3D"uld_output") + parser.add_option_group(uld) + + options, args =3D parser.parse_args(args) + + if options.jobs: + jobs =3D None + try: + jobs =3D int(options.jobs) + except ValueError: + jobs =3D -1 + + if jobs < 1: + parser.error("Invalid: --jobs=3D'%s'" % \ + (options.jobs,)) + + options.jobs =3D jobs + + else: + options.jobs =3D None + + if options.load_average: + try: + load_average =3D float(options.load_average) + except ValueError: + load_average =3D 0.0 + + if load_average <=3D 0.0: + parser.error("Invalid: --load-average=3D'%s'" % \ + (options.load_average,)) + + options.load_average =3D load_average + + else: + options.load_average =3D None + + options.config_root =3D options.portage_configroot + if options.config_root is not None and \ + not os.path.isdir(options.config_root): + parser.error("Not a directory: --config-root=3D'%s'" % \ + (options.config_root,)) + + if options.cache_dir is not None and not os.path.isdir(options.cache_di= r): + parser.error("Not a directory: --cache-dir=3D'%s'" % \ + (options.cache_dir,)) + + for atom in args: + try: + atom =3D portage.dep.Atom(atom) + except portage.exception.InvalidAtom: + parser.error('Invalid atom: %s' % (atom,)) + + if not isjustname(atom): + parser.error('Atom is too specific: %s' % (atom,)) + + if options.update_use_local_desc: + try: + ElementTree + ExpatError + except NameError: + parser.error('--update-use-local-desc requires python with USE=3Dxml!= ') + + if options.uld_output =3D=3D '-' and options.preserve_comments: + parser.error('--preserve-comments can not be used when outputting to s= tdout') + + return parser, options, args + +class GenCache(object): + def __init__(self, portdb, cp_iter=3DNone, max_jobs=3DNone, max_load=3D= None, + rsync=3DFalse): + self._portdb =3D portdb + # We can globally cleanse stale cache only if we + # iterate over every single cp. + self._global_cleanse =3D cp_iter is None + if cp_iter is not None: + self._cp_set =3D set(cp_iter) + cp_iter =3D iter(self._cp_set) + self._cp_missing =3D self._cp_set.copy() + else: + self._cp_set =3D None + self._cp_missing =3D set() + self._regen =3D MetadataRegen(portdb, cp_iter=3Dcp_iter, + consumer=3Dself._metadata_callback, + max_jobs=3Dmax_jobs, max_load=3Dmax_load) + self.returncode =3D os.EX_OK + metadbmodule =3D portdb.settings.load_best_module("portdbapi.metadbmod= ule") + self._trg_cache =3D metadbmodule(portdb.porttrees[0], + "metadata/cache", portage.auxdbkeys[:]) + if rsync: + self._trg_cache.raise_stat_collision =3D True + try: + self._trg_cache.ec =3D \ + portdb._repo_info[portdb.porttrees[0]].eclass_db + except AttributeError: + pass + self._existing_nodes =3D set() + + def _metadata_callback(self, cpv, ebuild_path, repo_path, metadata): + self._existing_nodes.add(cpv) + self._cp_missing.discard(cpv_getkey(cpv)) + if metadata is not None: + if metadata.get('EAPI') =3D=3D '0': + del metadata['EAPI'] + try: + try: + self._trg_cache[cpv] =3D 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 + # detecting changes. Cache backends may raise this + # 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. + max_mtime =3D sc.mtime + for ec, (loc, ec_mtime) in metadata['_eclasses_'].items(): + if max_mtime < ec_mtime: + max_mtime =3D ec_mtime + if max_mtime =3D=3D sc.mtime: + max_mtime +=3D 1 + max_mtime =3D long(max_mtime) + try: + os.utime(ebuild_path, (max_mtime, max_mtime)) + except OSError as e: + self.returncode |=3D 1 + writemsg_level( + "%s writing target: %s\n" % (cpv, e), + level=3Dlogging.ERROR, noiselevel=3D-1) + else: + metadata['_mtime_'] =3D max_mtime + self._trg_cache[cpv] =3D metadata + self._portdb.auxdb[repo_path][cpv] =3D metadata + + except CacheError as ce: + self.returncode |=3D 1 + writemsg_level( + "%s writing target: %s\n" % (cpv, ce), + level=3Dlogging.ERROR, noiselevel=3D-1) + + def run(self): + + received_signal =3D [] + + def sighandler(signum, frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + self._regen.terminate() + received_signal.append(128 + signum) + + earlier_sigint_handler =3D signal.signal(signal.SIGINT, sighandler) + earlier_sigterm_handler =3D signal.signal(signal.SIGTERM, sighandler) + + try: + self._regen.run() + finally: + # Restore previous handlers + if earlier_sigint_handler is not None: + signal.signal(signal.SIGINT, earlier_sigint_handler) + else: + signal.signal(signal.SIGINT, signal.SIG_DFL) + if earlier_sigterm_handler is not None: + signal.signal(signal.SIGTERM, earlier_sigterm_handler) + else: + signal.signal(signal.SIGTERM, signal.SIG_DFL) + + if received_signal: + sys.exit(received_signal[0]) + + self.returncode |=3D self._regen.returncode + cp_missing =3D self._cp_missing + + trg_cache =3D self._trg_cache + dead_nodes =3D set() + if self._global_cleanse: + try: + for cpv in trg_cache: + cp =3D cpv_getkey(cpv) + if cp is None: + self.returncode |=3D 1 + writemsg_level( + "Unable to parse cp for '%s'\n" % (cpv,), + level=3Dlogging.ERROR, noiselevel=3D-1) + else: + dead_nodes.add(cpv) + except CacheError as ce: + self.returncode |=3D 1 + writemsg_level( + "Error listing cache entries for " + \ + "'%s/metadata/cache': %s, continuing...\n" % \ + (self._portdb.porttree_root, ce), + level=3Dlogging.ERROR, noiselevel=3D-1) + + else: + cp_set =3D self._cp_set + try: + for cpv in trg_cache: + cp =3D cpv_getkey(cpv) + if cp is None: + self.returncode |=3D 1 + writemsg_level( + "Unable to parse cp for '%s'\n" % (cpv,), + level=3Dlogging.ERROR, noiselevel=3D-1) + else: + cp_missing.discard(cp) + if cp in cp_set: + dead_nodes.add(cpv) + except CacheError as ce: + self.returncode |=3D 1 + writemsg_level( + "Error listing cache entries for " + \ + "'%s/metadata/cache': %s, continuing...\n" % \ + (self._portdb.porttree_root, ce), + level=3Dlogging.ERROR, noiselevel=3D-1) + + if cp_missing: + self.returncode |=3D 1 + for cp in sorted(cp_missing): + writemsg_level( + "No ebuilds or cache entries found for '%s'\n" % (cp,), + level=3Dlogging.ERROR, noiselevel=3D-1) + + if dead_nodes: + dead_nodes.difference_update(self._existing_nodes) + for k in dead_nodes: + try: + del trg_cache[k] + except KeyError: + pass + except CacheError as ce: + self.returncode |=3D 1 + writemsg_level( + "%s deleting stale cache: %s\n" % (k, ce), + level=3Dlogging.ERROR, noiselevel=3D-1) + + if not trg_cache.autocommits: + try: + trg_cache.commit() + except CacheError as ce: + self.returncode |=3D 1 + writemsg_level( + "committing target: %s\n" % (ce,), + level=3Dlogging.ERROR, noiselevel=3D-1) + +class GenUseLocalDesc(object): + def __init__(self, portdb, output=3DNone, + preserve_comments=3DFalse): + self.returncode =3D os.EX_OK + self._portdb =3D portdb + self._output =3D output + self._preserve_comments =3D preserve_comments +=09 + def run(self): + repo_path =3D self._portdb.porttrees[0] + ops =3D {'<':0, '<=3D':1, '=3D':2, '>=3D':3, '>':4} + + if self._output is None or self._output !=3D '-': + if self._output is None: + prof_path =3D os.path.join(repo_path, 'profiles') + desc_path =3D os.path.join(prof_path, 'use.local.desc') + try: + os.mkdir(prof_path) + except OSError: + pass + else: + desc_path =3D self._output + + try: + if self._preserve_comments: + # Probe in binary mode, in order to avoid + # potential character encoding issues. + output =3D open(_unicode_encode(desc_path, + encoding=3D_encodings['fs'], errors=3D'strict'), 'r+b') + else: + output =3D io.open(_unicode_encode(desc_path, + encoding=3D_encodings['fs'], errors=3D'strict'), + mode=3D'w', encoding=3D_encodings['repo.content'], + errors=3D'backslashreplace') + except IOError as e: + if not self._preserve_comments or \ + os.path.isfile(desc_path): + writemsg_level( + "ERROR: failed to open output file %s: %s\n" \ + % (desc_path, e), level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 2 + return + + # Open in r+b mode failed because the file doesn't + # exist yet. We can probably recover if we disable + # preserve_comments mode now. + writemsg_level( + "WARNING: --preserve-comments enabled, but " + \ + "output file not found: %s\n" % (desc_path,), + level=3Dlogging.WARNING, noiselevel=3D-1) + self._preserve_comments =3D False + try: + output =3D io.open(_unicode_encode(desc_path, + encoding=3D_encodings['fs'], errors=3D'strict'), + mode=3D'w', encoding=3D_encodings['repo.content'], + errors=3D'backslashreplace') + except IOError as e: + writemsg_level( + "ERROR: failed to open output file %s: %s\n" \ + % (desc_path, e), level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 2 + return + else: + output =3D sys.stdout + + if self._preserve_comments: + while True: + pos =3D output.tell() + if not output.readline().startswith(b'#'): + break + output.seek(pos) + output.truncate() + output.close() + + # Finished probing comments in binary mode, now append + # in text mode. + output =3D io.open(_unicode_encode(desc_path, + encoding=3D_encodings['fs'], errors=3D'strict'), + mode=3D'a', encoding=3D_encodings['repo.content'], + errors=3D'backslashreplace') + output.write(_unicode_decode('\n')) + else: + output.write(_unicode_decode(''' +# This file is deprecated as per GLEP 56 in favor of metadata.xml. Pleas= e 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 + # since we don't want any confusion given that we never + # want to rely on the builtin cmp function. + def cmp_func(a, b): + if a is None or b is None: + # None can't be compared with other types in python3. + if a is None and b is None: + return 0 + elif a is None: + return -1 + else: + return 1 + return (a > b) - (a < b) + + for cp in self._portdb.cp_all(): + metadata_path =3D os.path.join(repo_path, cp, 'metadata.xml') + try: + metadata =3D ElementTree.parse(metadata_path) + except IOError: + pass + except (ExpatError, EnvironmentError) as e: + writemsg_level( + "ERROR: failed parsing %s/metadata.xml: %s\n" % (cp, e), + level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 1 + else: + try: + usedict =3D parse_metadata_use(metadata) + except portage.exception.ParseError as e: + writemsg_level( + "ERROR: failed parsing %s/metadata.xml: %s\n" % (cp, e), + level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 1 + else: + for flag in sorted(usedict): + def atomcmp(atoma, atomb): + # None is better than an atom, that's why we reverse the args + if atoma is None or atomb is None: + return cmp_func(atomb, atoma) + # Same for plain PNs (.operator is None then) + elif atoma.operator is None or atomb.operator is None: + return cmp_func(atomb.operator, atoma.operator) + # Version matching + elif atoma.cpv !=3D atomb.cpv: + return pkgcmp(pkgsplit(atoma.cpv), pkgsplit(atomb.cpv)) + # Versions match, let's fallback to operator matching + else: + return cmp_func(ops.get(atoma.operator, -1), + ops.get(atomb.operator, -1)) + + def _Atom(key): + if key is not None: + return Atom(key) + return None + + resdict =3D usedict[flag] + if len(resdict) =3D=3D 1: + resdesc =3D next(iter(resdict.items()))[1] + else: + try: + reskeys =3D dict((_Atom(k), k) for k in resdict) + except portage.exception.InvalidAtom as e: + writemsg_level( + "ERROR: failed parsing %s/metadata.xml: %s\n" % (cp, e), + level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 1 + resdesc =3D next(iter(resdict.items()))[1] + else: + resatoms =3D sorted(reskeys, key=3Dcmp_sort_key(atomcmp)) + resdesc =3D resdict[reskeys[resatoms[-1]]] + + output.write(_unicode_decode( + '%s:%s - %s\n' % (cp, flag, resdesc))) + + output.close() + +if sys.hexversion < 0x3000000: + _filename_base =3D unicode +else: + _filename_base =3D str + +class _special_filename(_filename_base): + """ + Helps to sort file names by file type and other criteria. + """ + def __new__(cls, status_change, file_name): + return _filename_base.__new__(cls, status_change + file_name) + + def __init__(self, status_change, file_name): + _filename_base.__init__(status_change + file_name) + self.status_change =3D status_change + self.file_name =3D file_name + self.file_type =3D guessManifestFileType(file_name) + + def file_type_lt(self, a, b): + """ + Defines an ordering between file types. + """ + first =3D a.file_type + second =3D b.file_type + if first =3D=3D second: + return False + + if first =3D=3D "EBUILD": + return True + elif first =3D=3D "MISC": + return second in ("EBUILD",) + elif first =3D=3D "AUX": + return second in ("EBUILD", "MISC") + elif first =3D=3D "DIST": + return second in ("EBUILD", "MISC", "AUX") + elif first is None: + return False + else: + raise ValueError("Unknown file type '%s'" % first) + + def __lt__(self, other): + """ + Compare different file names, first by file type and then + for ebuilds by version and lexicographically for others. + EBUILD < MISC < AUX < DIST < None + """ + if self.__class__ !=3D other.__class__: + raise NotImplementedError + + # Sort by file type as defined by file_type_lt(). + if self.file_type_lt(self, other): + return True + elif self.file_type_lt(other, self): + return False + + # Files have the same type. + if self.file_type =3D=3D "EBUILD": + # Sort by version. Lowest first. + ver =3D "-".join(pkgsplit(self.file_name[:-7])[1:3]) + other_ver =3D "-".join(pkgsplit(other.file_name[:-7])[1:3]) + return vercmp(ver, other_ver) < 0 + else: + # Sort lexicographically. + return self.file_name < other.file_name + +class GenChangeLogs(object): + def __init__(self, portdb): + self.returncode =3D os.EX_OK + self._portdb =3D portdb + self._wrapper =3D textwrap.TextWrapper( + width =3D 78, + initial_indent =3D ' ', + subsequent_indent =3D ' ' + ) + + @staticmethod + def grab(cmd): + p =3D subprocess.Popen(cmd, stdout=3Dsubprocess.PIPE) + return _unicode_decode(p.communicate()[0], + encoding=3D_encodings['stdio'], errors=3D'strict') + + def generate_changelog(self, cp): + try: + output =3D io.open('ChangeLog', + mode=3D'w', encoding=3D_encodings['repo.content'], + errors=3D'backslashreplace') + except IOError as e: + writemsg_level( + "ERROR: failed to open ChangeLog for %s: %s\n" % (cp,e,), + level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 2 + return + + output.write(_unicode_decode(''' +# ChangeLog for %s +# Copyright 1999-%s Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +''' % (cp, time.strftime('%Y'))).lstrip()) + + # now grab all the commits + commits =3D self.grab(['git', 'rev-list', 'HEAD', '--', '.']).split() + + for c in commits: + # Explaining the arguments: + # --name-status to get a list of added/removed files + # --no-renames to avoid getting more complex records on the list + # --format to get the timestamp, author and commit description + # --root to make it work fine even with the initial commit + # --relative to get paths relative to ebuilddir + # -r (recursive) to get per-file changes + # then the commit-id and path. + + cinfo =3D self.grab(['git', 'diff-tree', '--name-status', '--no-renam= es', + '--format=3D%ct %cN <%cE>%n%B', '--root', '--relative', '-r', + c, '--', '.']).rstrip('\n').split('\n') + + # Expected output: + # timestamp Author Name + # commit message l1 + # ... + # commit message ln + # + # status1 filename1 + # ... + # statusn filenamen + + changed =3D [] + for n, l in enumerate(reversed(cinfo)): + if not l: + body =3D cinfo[1:-n-1] + break + else: + f =3D l.split() + if f[1] =3D=3D 'Manifest': + pass # XXX: remanifest commits? + elif f[1] =3D=3D 'ChangeLog': + pass + elif f[0].startswith('A'): + changed.append(_special_filename("+", f[1])) + elif f[0].startswith('D'): + changed.append(_special_filename("-", f[1])) + elif f[0].startswith('M'): + changed.append(_special_filename("", f[1])) + else: + writemsg_level( + "ERROR: unexpected git file status for %s: %s\n" % (cp,f,), + level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 1 + + if not changed: + continue + + (ts, author) =3D cinfo[0].split(' ', 1) + date =3D time.strftime('%d %b %Y', time.gmtime(float(ts))) + + changed =3D [str(x) for x in sorted(changed)] + + wroteheader =3D False + # Reverse the sort order for headers. + for c in reversed(changed): + if c.startswith('+') and c.endswith('.ebuild'): + output.write(_unicode_decode( + '*%s (%s)\n' % (c[1:-7], date))) + wroteheader =3D True + if wroteheader: + output.write(_unicode_decode('\n')) + + # strip ': ', '[] ', and similar + body[0] =3D re.sub(r'^\W*' + re.escape(cp) + r'\W+', '', body[0]) + # strip trailing newline + if not body[-1]: + body =3D body[:-1] + # strip git-svn id + if body[-1].startswith('git-svn-id:') and not body[-2]: + body =3D body[:-2] + # strip the repoman version/manifest note + if body[-1] =3D=3D ' (Signed Manifest commit)' or body[-1] =3D=3D ' (= Unsigned Manifest commit)': + body =3D body[:-1] + if body[-1].startswith('(Portage version:') and body[-1].endswith(')'= ): + body =3D body[:-1] + if not body[-1]: + body =3D body[:-1] + + # don't break filenames on hyphens + self._wrapper.break_on_hyphens =3D False + output.write(_unicode_decode( + self._wrapper.fill( + '%s; %s %s:' % (date, author, ', '.join(changed))))) + # but feel free to break commit messages there + self._wrapper.break_on_hyphens =3D True + output.write(_unicode_decode( + '\n%s\n\n' % '\n'.join(self._wrapper.fill(x) for x in body))) + + output.close() + + def run(self): + repo_path =3D self._portdb.porttrees[0] + os.chdir(repo_path) + + if 'git' not in FindVCS(): + writemsg_level( + "ERROR: --update-changelogs supported only in git repos\n", + level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode =3D 127 + return + + for cp in self._portdb.cp_all(): + os.chdir(os.path.join(repo_path, cp)) + # Determine whether ChangeLog is up-to-date by comparing + # the newest commit timestamp with the ChangeLog timestamp. + lmod =3D self.grab(['git', 'log', '--format=3D%ct', '-1', '.']) + if not lmod: + # This cp has not been added to the repo. + continue + + try: + cmod =3D os.stat('ChangeLog').st_mtime + except OSError: + cmod =3D 0 + + if float(cmod) < float(lmod): + self.generate_changelog(cp) + +def egencache_main(args): + parser, options, atoms =3D parse_args(args) + + config_root =3D options.config_root + if config_root is None: + config_root =3D '/' + + # The calling environment is ignored, so the program is + # completely controlled by commandline arguments. + env =3D {} + + if options.repo is None: + env['PORTDIR_OVERLAY'] =3D '' + + if options.cache_dir is not None: + env['PORTAGE_DEPCACHEDIR'] =3D options.cache_dir + + if options.portdir is not None: + env['PORTDIR'] =3D options.portdir + + settings =3D portage.config(config_root=3Dconfig_root, + target_root=3D'/', local_config=3DFalse, env=3Denv) + + default_opts =3D None + if not options.ignore_default_opts: + default_opts =3D settings.get('EGENCACHE_DEFAULT_OPTS', '').split() + + if default_opts: + parser, options, args =3D parse_args(default_opts + args) + + if options.config_root is not None: + config_root =3D options.config_root + + if options.cache_dir is not None: + env['PORTAGE_DEPCACHEDIR'] =3D options.cache_dir + + settings =3D portage.config(config_root=3Dconfig_root, + target_root=3D'/', local_config=3DFalse, env=3Denv) + + if not options.update and not options.update_use_local_desc \ + and not options.update_changelogs: + parser.error('No action specified') + return 1 + + if options.update and 'metadata-transfer' not in settings.features: + writemsg_level("ecachegen: warning: " + \ + "automatically enabling FEATURES=3Dmetadata-transfer\n", + level=3Dlogging.WARNING, noiselevel=3D-1) + settings.features.add('metadata-transfer') + + settings.lock() + + portdb =3D portage.portdbapi(mysettings=3Dsettings) + if options.repo is not None: + repo_path =3D portdb.getRepositoryPath(options.repo) + if repo_path is None: + parser.error("Unable to locate repository named '%s'" % \ + (options.repo,)) + return 1 + + # Limit ebuilds to the specified repo. + portdb.porttrees =3D [repo_path] + + ret =3D [os.EX_OK] + + if options.update: + cp_iter =3D None + if atoms: + cp_iter =3D iter(atoms) + + gen_cache =3D GenCache(portdb, cp_iter=3Dcp_iter, + max_jobs=3Doptions.jobs, + max_load=3Doptions.load_average, + rsync=3Doptions.rsync) + gen_cache.run() + if options.tolerant: + ret.append(os.EX_OK) + else: + ret.append(gen_cache.returncode) + + if options.update_use_local_desc: + gen_desc =3D GenUseLocalDesc(portdb, + output=3Doptions.uld_output, + preserve_comments=3Doptions.preserve_comments) + gen_desc.run() + ret.append(gen_desc.returncode) + + if options.update_changelogs: + gen_clogs =3D GenChangeLogs(portdb) + gen_clogs.run() + ret.append(gen_clogs.returncode) + + return max(ret) + +if __name__ =3D=3D "__main__": + portage._disable_legacy_globals() + portage.util.noiselimit =3D -1 + sys.exit(egencache_main(sys.argv[1:])) diff --git a/portage_with_autodep/bin/emaint b/portage_with_autodep/bin/e= maint new file mode 100755 index 0000000..fdd01ed --- /dev/null +++ b/portage_with_autodep/bin/emaint @@ -0,0 +1,654 @@ +#!/usr/bin/python -O +# vim: noet : + +from __future__ import print_function + +import errno +import re +import signal +import stat +import sys +import textwrap +import time +from optparse import OptionParser, OptionValueError + +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + import portage + +from portage import os +from portage.util import writemsg + +if sys.hexversion >=3D 0x3000000: + long =3D int + +class WorldHandler(object): + + short_desc =3D "Fix problems in the world file" + + def name(): + return "world" + name =3D staticmethod(name) + + def __init__(self): + self.invalid =3D [] + self.not_installed =3D [] + self.invalid_category =3D [] + self.okay =3D [] + from portage._sets import load_default_config + setconfig =3D load_default_config(portage.settings, + portage.db[portage.settings["ROOT"]]) + self._sets =3D setconfig.getSets() + + def _check_world(self, onProgress): + categories =3D set(portage.settings.categories) + myroot =3D portage.settings["ROOT"] + self.world_file =3D os.path.join(portage.settings["EROOT"], portage.co= nst.WORLD_FILE) + self.found =3D os.access(self.world_file, os.R_OK) + vardb =3D portage.db[myroot]["vartree"].dbapi + + from portage._sets import SETPREFIX + sets =3D self._sets + world_atoms =3D list(sets["selected"]) + maxval =3D len(world_atoms) + if onProgress: + onProgress(maxval, 0) + for i, atom in enumerate(world_atoms): + if not isinstance(atom, portage.dep.Atom): + if atom.startswith(SETPREFIX): + s =3D atom[len(SETPREFIX):] + if s in sets: + self.okay.append(atom) + else: + self.not_installed.append(atom) + else: + self.invalid.append(atom) + if onProgress: + onProgress(maxval, i+1) + continue + okay =3D True + if not vardb.match(atom): + self.not_installed.append(atom) + okay =3D False + if portage.catsplit(atom.cp)[0] not in categories: + self.invalid_category.append(atom) + okay =3D False + if okay: + self.okay.append(atom) + if onProgress: + onProgress(maxval, i+1) + + def check(self, onProgress=3DNone): + self._check_world(onProgress) + errors =3D [] + if self.found: + errors +=3D ["'%s' is not a valid atom" % x for x in self.invalid] + errors +=3D ["'%s' is not installed" % x for x in self.not_installed] + errors +=3D ["'%s' has a category that is not listed in /etc/portage/= categories" % x for x in self.invalid_category] + else: + errors.append(self.world_file + " could not be opened for reading") + return errors + + def fix(self, onProgress=3DNone): + world_set =3D self._sets["selected"] + world_set.lock() + try: + world_set.load() # maybe it's changed on disk + before =3D set(world_set) + self._check_world(onProgress) + after =3D set(self.okay) + errors =3D [] + if before !=3D after: + try: + world_set.replace(self.okay) + except portage.exception.PortageException: + errors.append("%s could not be opened for writing" % \ + self.world_file) + return errors + finally: + world_set.unlock() + +class BinhostHandler(object): + + short_desc =3D "Generate a metadata index for binary packages" + + def name(): + return "binhost" + name =3D staticmethod(name) + + def __init__(self): + myroot =3D portage.settings["ROOT"] + self._bintree =3D portage.db[myroot]["bintree"] + self._bintree.populate() + self._pkgindex_file =3D self._bintree._pkgindex_file + self._pkgindex =3D self._bintree._load_pkgindex() + + def _need_update(self, cpv, data): + + if "MD5" not in data: + return True + + size =3D data.get("SIZE") + if size is None: + return True + + mtime =3D data.get("MTIME") + if mtime is None: + return True + + pkg_path =3D self._bintree.getname(cpv) + try: + s =3D os.lstat(pkg_path) + except OSError as e: + if e.errno not in (errno.ENOENT, errno.ESTALE): + raise + # We can't update the index for this one because + # it disappeared. + return False + + try: + if long(mtime) !=3D s[stat.ST_MTIME]: + return True + if long(size) !=3D long(s.st_size): + return True + except ValueError: + return True + + return False + + def check(self, onProgress=3DNone): + missing =3D [] + cpv_all =3D self._bintree.dbapi.cpv_all() + cpv_all.sort() + maxval =3D len(cpv_all) + if onProgress: + onProgress(maxval, 0) + pkgindex =3D self._pkgindex + missing =3D [] + metadata =3D {} + for d in pkgindex.packages: + metadata[d["CPV"]] =3D d + for i, cpv in enumerate(cpv_all): + d =3D metadata.get(cpv) + if not d or self._need_update(cpv, d): + missing.append(cpv) + if onProgress: + onProgress(maxval, i+1) + errors =3D ["'%s' is not in Packages" % cpv for cpv in missing] + stale =3D set(metadata).difference(cpv_all) + for cpv in stale: + errors.append("'%s' is not in the repository" % cpv) + return errors + + def fix(self, onProgress=3DNone): + bintree =3D self._bintree + cpv_all =3D self._bintree.dbapi.cpv_all() + cpv_all.sort() + missing =3D [] + maxval =3D 0 + if onProgress: + onProgress(maxval, 0) + pkgindex =3D self._pkgindex + missing =3D [] + metadata =3D {} + for d in pkgindex.packages: + metadata[d["CPV"]] =3D d + + for i, cpv in enumerate(cpv_all): + d =3D metadata.get(cpv) + if not d or self._need_update(cpv, d): + missing.append(cpv) + + stale =3D set(metadata).difference(cpv_all) + if missing or stale: + from portage import locks + pkgindex_lock =3D locks.lockfile( + self._pkgindex_file, wantnewlockfile=3D1) + try: + # Repopulate with lock held. + bintree._populate() + cpv_all =3D self._bintree.dbapi.cpv_all() + cpv_all.sort() + + pkgindex =3D bintree._load_pkgindex() + self._pkgindex =3D pkgindex + + metadata =3D {} + for d in pkgindex.packages: + metadata[d["CPV"]] =3D d + + # Recount missing packages, with lock held. + del missing[:] + for i, cpv in enumerate(cpv_all): + d =3D metadata.get(cpv) + if not d or self._need_update(cpv, d): + missing.append(cpv) + + maxval =3D len(missing) + for i, cpv in enumerate(missing): + try: + metadata[cpv] =3D bintree._pkgindex_entry(cpv) + except portage.exception.InvalidDependString: + writemsg("!!! Invalid binary package: '%s'\n" % \ + bintree.getname(cpv), noiselevel=3D-1) + + if onProgress: + onProgress(maxval, i+1) + + for cpv in set(metadata).difference( + self._bintree.dbapi.cpv_all()): + del metadata[cpv] + + # We've updated the pkgindex, so set it to + # repopulate when necessary. + bintree.populated =3D False + + del pkgindex.packages[:] + pkgindex.packages.extend(metadata.values()) + from portage.util import atomic_ofstream + f =3D atomic_ofstream(self._pkgindex_file) + try: + self._pkgindex.write(f) + finally: + f.close() + finally: + locks.unlockfile(pkgindex_lock) + + if onProgress: + if maxval =3D=3D 0: + maxval =3D 1 + onProgress(maxval, maxval) + return None + +class MoveHandler(object): + + def __init__(self, tree, porttree): + self._tree =3D tree + self._portdb =3D porttree.dbapi + self._update_keys =3D ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE"] + self._master_repo =3D \ + self._portdb.getRepositoryName(self._portdb.porttree_root) + + def _grab_global_updates(self): + from portage.update import grab_updates, parse_updates + retupdates =3D {} + errors =3D [] + + for repo_name in self._portdb.getRepositories(): + repo =3D self._portdb.getRepositoryPath(repo_name) + updpath =3D os.path.join(repo, "profiles", "updates") + if not os.path.isdir(updpath): + continue + + try: + rawupdates =3D grab_updates(updpath) + except portage.exception.DirectoryNotFound: + rawupdates =3D [] + upd_commands =3D [] + for mykey, mystat, mycontent in rawupdates: + commands, errors =3D parse_updates(mycontent) + upd_commands.extend(commands) + errors.extend(errors) + retupdates[repo_name] =3D upd_commands + + if self._master_repo in retupdates: + retupdates['DEFAULT'] =3D retupdates[self._master_repo] + + return retupdates, errors + + def check(self, onProgress=3DNone): + allupdates, errors =3D self._grab_global_updates() + # Matching packages and moving them is relatively fast, so the + # progress bar is updated in indeterminate mode. + match =3D self._tree.dbapi.match + aux_get =3D self._tree.dbapi.aux_get + if onProgress: + onProgress(0, 0) + for repo, updates in allupdates.items(): + if repo =3D=3D 'DEFAULT': + continue + if not updates: + continue + + def repo_match(repository): + return repository =3D=3D repo or \ + (repo =3D=3D self._master_repo and \ + repository not in allupdates) + + for i, update_cmd in enumerate(updates): + if update_cmd[0] =3D=3D "move": + origcp, newcp =3D update_cmd[1:] + for cpv in match(origcp): + if repo_match(aux_get(cpv, ["repository"])[0]): + errors.append("'%s' moved to '%s'" % (cpv, newcp)) + elif update_cmd[0] =3D=3D "slotmove": + pkg, origslot, newslot =3D update_cmd[1:] + for cpv in match(pkg): + slot, prepo =3D aux_get(cpv, ["SLOT", "repository"]) + if slot =3D=3D origslot and repo_match(prepo): + errors.append("'%s' slot moved from '%s' to '%s'" % \ + (cpv, origslot, newslot)) + if onProgress: + onProgress(0, 0) + + # Searching for updates in all the metadata is relatively slow, so thi= s + # is where the progress bar comes out of indeterminate mode. + cpv_all =3D self._tree.dbapi.cpv_all() + cpv_all.sort() + maxval =3D len(cpv_all) + aux_update =3D self._tree.dbapi.aux_update + meta_keys =3D self._update_keys + ['repository'] + from portage.update import update_dbentries + if onProgress: + onProgress(maxval, 0) + for i, cpv in enumerate(cpv_all): + metadata =3D dict(zip(meta_keys, aux_get(cpv, meta_keys))) + repository =3D metadata.pop('repository') + try: + updates =3D allupdates[repository] + except KeyError: + try: + updates =3D allupdates['DEFAULT'] + except KeyError: + continue + if not updates: + continue + metadata_updates =3D update_dbentries(updates, metadata) + if metadata_updates: + errors.append("'%s' has outdated metadata" % cpv) + if onProgress: + onProgress(maxval, i+1) + return errors + + def fix(self, onProgress=3DNone): + allupdates, errors =3D self._grab_global_updates() + # Matching packages and moving them is relatively fast, so the + # progress bar is updated in indeterminate mode. + move =3D self._tree.dbapi.move_ent + slotmove =3D self._tree.dbapi.move_slot_ent + if onProgress: + onProgress(0, 0) + for repo, updates in allupdates.items(): + if repo =3D=3D 'DEFAULT': + continue + if not updates: + continue + + def repo_match(repository): + return repository =3D=3D repo or \ + (repo =3D=3D self._master_repo and \ + repository not in allupdates) + + for i, update_cmd in enumerate(updates): + if update_cmd[0] =3D=3D "move": + move(update_cmd, repo_match=3Drepo_match) + elif update_cmd[0] =3D=3D "slotmove": + slotmove(update_cmd, repo_match=3Drepo_match) + if onProgress: + onProgress(0, 0) + + # Searching for updates in all the metadata is relatively slow, so thi= s + # is where the progress bar comes out of indeterminate mode. + self._tree.dbapi.update_ents(allupdates, onProgress=3DonProgress) + return errors + +class MoveInstalled(MoveHandler): + + short_desc =3D "Perform package move updates for installed packages" + + def name(): + return "moveinst" + name =3D staticmethod(name) + def __init__(self): + myroot =3D portage.settings["ROOT"] + MoveHandler.__init__(self, portage.db[myroot]["vartree"], portage.db[m= yroot]["porttree"]) + +class MoveBinary(MoveHandler): + + short_desc =3D "Perform package move updates for binary packages" + + def name(): + return "movebin" + name =3D staticmethod(name) + def __init__(self): + myroot =3D portage.settings["ROOT"] + MoveHandler.__init__(self, portage.db[myroot]["bintree"], portage.db[m= yroot]["porttree"]) + +class VdbKeyHandler(object): + def name(): + return "vdbkeys" + name =3D staticmethod(name) + + def __init__(self): + self.list =3D portage.db["/"]["vartree"].dbapi.cpv_all() + self.missing =3D [] + self.keys =3D ["HOMEPAGE", "SRC_URI", "KEYWORDS", "DESCRIPTION"] + =09 + for p in self.list: + mydir =3D os.path.join(portage.settings["EROOT"], portage.const.VDB_P= ATH, p)+os.sep + ismissing =3D True + for k in self.keys: + if os.path.exists(mydir+k): + ismissing =3D False + break + if ismissing: + self.missing.append(p) + =09 + def check(self): + return ["%s has missing keys" % x for x in self.missing] +=09 + def fix(self): +=09 + errors =3D [] +=09 + for p in self.missing: + mydir =3D os.path.join(portage.settings["EROOT"], portage.const.VDB_P= ATH, p)+os.sep + if not os.access(mydir+"environment.bz2", os.R_OK): + errors.append("Can't access %s" % (mydir+"environment.bz2")) + elif not os.access(mydir, os.W_OK): + errors.append("Can't create files in %s" % mydir) + else: + env =3D os.popen("bzip2 -dcq "+mydir+"environment.bz2", "r") + envlines =3D env.read().split("\n") + env.close() + for k in self.keys: + s =3D [l for l in envlines if l.startswith(k+"=3D")] + if len(s) > 1: + errors.append("multiple matches for %s found in %senvironment.bz2"= % (k, mydir)) + elif len(s) =3D=3D 0: + s =3D "" + else: + s =3D s[0].split("=3D",1)[1] + s =3D s.lstrip("$").strip("\'\"") + s =3D re.sub("(\\\\[nrt])+", " ", s) + s =3D " ".join(s.split()).strip() + if s !=3D "": + try: + keyfile =3D open(mydir+os.sep+k, "w") + keyfile.write(s+"\n") + keyfile.close() + except (IOError, OSError) as e: + errors.append("Could not write %s, reason was: %s" % (mydir+k, e= )) + =09 + return errors + +class ProgressHandler(object): + def __init__(self): + self.curval =3D 0 + self.maxval =3D 0 + self.last_update =3D 0 + self.min_display_latency =3D 0.2 + + def onProgress(self, maxval, curval): + self.maxval =3D maxval + self.curval =3D curval + cur_time =3D time.time() + if cur_time - self.last_update >=3D self.min_display_latency: + self.last_update =3D cur_time + self.display() + + def display(self): + raise NotImplementedError(self) + +class CleanResume(object): + + short_desc =3D "Discard emerge --resume merge lists" + + def name(): + return "cleanresume" + name =3D staticmethod(name) + + def check(self, onProgress=3DNone): + messages =3D [] + mtimedb =3D portage.mtimedb + resume_keys =3D ("resume", "resume_backup") + maxval =3D len(resume_keys) + if onProgress: + onProgress(maxval, 0) + for i, k in enumerate(resume_keys): + try: + d =3D mtimedb.get(k) + if d is None: + continue + if not isinstance(d, dict): + messages.append("unrecognized resume list: '%s'" % k) + continue + mergelist =3D d.get("mergelist") + if mergelist is None or not hasattr(mergelist, "__len__"): + messages.append("unrecognized resume list: '%s'" % k) + continue + messages.append("resume list '%s' contains %d packages" % \ + (k, len(mergelist))) + finally: + if onProgress: + onProgress(maxval, i+1) + return messages + + def fix(self, onProgress=3DNone): + delete_count =3D 0 + mtimedb =3D portage.mtimedb + resume_keys =3D ("resume", "resume_backup") + maxval =3D len(resume_keys) + if onProgress: + onProgress(maxval, 0) + for i, k in enumerate(resume_keys): + try: + if mtimedb.pop(k, None) is not None: + delete_count +=3D 1 + finally: + if onProgress: + onProgress(maxval, i+1) + if delete_count: + mtimedb.commit() + +def emaint_main(myargv): + + # Similar to emerge, emaint needs a default umask so that created + # files (such as the world file) have sane permissions. + os.umask(0o22) + + # TODO: Create a system that allows external modules to be added withou= t + # the need for hard coding. + modules =3D { + "world" : WorldHandler, + "binhost":BinhostHandler, + "moveinst":MoveInstalled, + "movebin":MoveBinary, + "cleanresume":CleanResume + } + + module_names =3D list(modules) + module_names.sort() + module_names.insert(0, "all") + + def exclusive(option, *args, **kw): + var =3D kw.get("var", None) + if var is None: + raise ValueError("var not specified to exclusive()") + if getattr(parser, var, ""): + raise OptionValueError("%s and %s are exclusive options" % (getattr(p= arser, var), option)) + setattr(parser, var, str(option)) + + + usage =3D "usage: emaint [options] COMMAND" + + desc =3D "The emaint program provides an interface to system health " += \ + "checks and maintenance. See the emaint(1) man page " + \ + "for additional information about the following commands:" + + usage +=3D "\n\n" + for line in textwrap.wrap(desc, 65): + usage +=3D "%s\n" % line + usage +=3D "\n" + usage +=3D " %s" % "all".ljust(15) + \ + "Perform all supported commands\n" + for m in module_names[1:]: + usage +=3D " %s%s\n" % (m.ljust(15), modules[m].short_desc) + + parser =3D OptionParser(usage=3Dusage, version=3Dportage.VERSION) + parser.add_option("-c", "--check", help=3D"check for problems", + action=3D"callback", callback=3Dexclusive, callback_kwargs=3D{"var":"a= ction"}) + parser.add_option("-f", "--fix", help=3D"attempt to fix problems", + action=3D"callback", callback=3Dexclusive, callback_kwargs=3D{"var":"a= ction"}) + parser.action =3D None + + + (options, args) =3D parser.parse_args(args=3Dmyargv) + if len(args) !=3D 1: + parser.error("Incorrect number of arguments") + if args[0] not in module_names: + parser.error("%s target is not a known target" % args[0]) + + if parser.action: + action =3D parser.action + else: + print("Defaulting to --check") + action =3D "-c/--check" + + if args[0] =3D=3D "all": + tasks =3D modules.values() + else: + tasks =3D [modules[args[0]]] + + + if action =3D=3D "-c/--check": + status =3D "Checking %s for problems" + func =3D "check" + else: + status =3D "Attempting to fix %s" + func =3D "fix" + + isatty =3D os.environ.get('TERM') !=3D 'dumb' and sys.stdout.isatty() + for task in tasks: + print(status % task.name()) + inst =3D task() + onProgress =3D None + if isatty: + progressBar =3D portage.output.TermProgressBar() + progressHandler =3D ProgressHandler() + onProgress =3D progressHandler.onProgress + def display(): + progressBar.set(progressHandler.curval, progressHandler.maxval) + progressHandler.display =3D display + def sigwinch_handler(signum, frame): + lines, progressBar.term_columns =3D \ + portage.output.get_term_size() + signal.signal(signal.SIGWINCH, sigwinch_handler) + result =3D getattr(inst, func)(onProgress=3DonProgress) + if isatty: + # make sure the final progress is displayed + progressHandler.display() + print() + signal.signal(signal.SIGWINCH, signal.SIG_DFL) + if result: + print() + print("\n".join(result)) + print("\n") + + print("Finished") + +if __name__ =3D=3D "__main__": + emaint_main(sys.argv[1:]) diff --git a/portage_with_autodep/bin/emerge b/portage_with_autodep/bin/e= merge new file mode 100755 index 0000000..6f69244 --- /dev/null +++ b/portage_with_autodep/bin/emerge @@ -0,0 +1,66 @@ +#!/usr/bin/python +# Copyright 2006-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from __future__ import print_function + +import signal +import sys +# This block ensures that ^C interrupts are handled quietly. +try: + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + sys.exit(128 + signum) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + # Prevent "[Errno 32] Broken pipe" exceptions when + # writing to a pipe. + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + +except KeyboardInterrupt: + sys.exit(128 + signal.SIGINT) + +def debug_signal(signum, frame): + import pdb + pdb.set_trace() +signal.signal(signal.SIGUSR1, debug_signal) + +try: + from _emerge.main import emerge_main +except ImportError: + from os import path as osp + import sys + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + from _emerge.main import emerge_main + +if __name__ =3D=3D "__main__": + import sys + from portage.exception import ParseError, PermissionDenied + try: + retval =3D emerge_main() + except PermissionDenied as e: + sys.stderr.write("Permission denied: '%s'\n" % str(e)) + sys.exit(e.errno) + except ParseError as e: + sys.stderr.write("%s\n" % str(e)) + sys.exit(1) + except SystemExit: + raise + except Exception: + # If an unexpected exception occurs then we don't want the mod_echo + # output to obscure the traceback, so dump the mod_echo output before + # showing the traceback. + import traceback + tb_str =3D traceback.format_exc() + try: + from portage.elog import mod_echo + except ImportError: + pass + else: + mod_echo.finalize() + sys.stderr.write(tb_str) + sys.exit(1) + sys.exit(retval) diff --git a/portage_with_autodep/bin/emerge-webrsync b/portage_with_auto= dep/bin/emerge-webrsync new file mode 100755 index 0000000..d933871 --- /dev/null +++ b/portage_with_autodep/bin/emerge-webrsync @@ -0,0 +1,457 @@ +#!/bin/bash +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# Author: Karl Trygve Kalleberg +# Rewritten from the old, Perl-based emerge-webrsync script +# Author: Alon Bar-Lev +# Major rewrite from Karl's scripts. + +# TODO: +# - all output should prob be converted to e* funcs +# - add support for ROOT + +# +# gpg key import +# KEY_ID=3D0x239C75C4 +# gpg --homedir /etc/portage/gnupg --keyserver subkeys.pgp.net --recv-ke= ys $KEY_ID +# gpg --homedir /etc/portage/gnupg --edit-key $KEY_ID trust +# + +# Only echo if in verbose mode +vvecho() { [[ ${do_verbose} -eq 1 ]] && echo "$@" ; } +# Only echo if not in verbose mode +nvecho() { [[ ${do_verbose} -eq 0 ]] && echo "$@" ; } +# warning echos +wecho() { echo "${argv0}: warning: $*" 1>&2 ; } +# error echos +eecho() { echo "${argv0}: error: $*" 1>&2 ; } + +argv0=3D$0 +if ! type -P portageq > /dev/null ; then + eecho "could not find 'portageq'; aborting" + exit 1 +fi +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) +DISTDIR=3D"${PORTAGE_TMPDIR}/emerge-webrsync" +export http_proxy ftp_proxy + +# If PORTAGE_NICENESS is overriden via the env then it will +# still pass through the portageq call and override properly. +if [ -n "${PORTAGE_NICENESS}" ]; then + renice $PORTAGE_NICENESS $$ > /dev/null +fi + +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 + +do_verbose=3D0 +do_debug=3D0 + +if has webrsync-gpg ${FEATURES} ; then + WEBSYNC_VERIFY_SIGNATURE=3D1 +else + WEBSYNC_VERIFY_SIGNATURE=3D0 +fi +if [ ${WEBSYNC_VERIFY_SIGNATURE} !=3D 0 -a -z "${PORTAGE_GPG_DIR}" ]; th= en + eecho "please set PORTAGE_GPG_DIR in make.conf" + exit 1 +fi + +do_tar() { + local file=3D$1; shift + local decompressor + case ${file} in + *.xz) decompressor=3D"xzcat" ;; + *.bz2) decompressor=3D"bzcat" ;; + *.gz) decompressor=3D"zcat" ;; + *) decompressor=3D"cat" ;; + esac + ${decompressor} "${file}" | tar "$@" + _pipestatus=3D${PIPESTATUS[*]} + [[ ${_pipestatus// /} -eq 0 ]] +} + +get_utc_date_in_seconds() { + date -u +"%s" +} + +get_date_part() { + local utc_time_in_secs=3D"$1" + local part=3D"$2" + + if [[ ${USERLAND} =3D=3D BSD ]] ; then + date -r ${utc_time_in_secs} -u +"${part}" + else + date -d @${utc_time_in_secs} -u +"${part}" + fi +} + +get_utc_second_from_string() { + local s=3D"$1" + if [[ ${USERLAND} =3D=3D BSD ]] ; then + date -juf "%Y%m%d" "$s" +"%s" + else + date -d "${s:0:4}-${s:4:2}-${s:6:2}" -u +"%s" + fi +} + +get_portage_timestamp() { + local portage_current_timestamp=3D0 + + if [ -f "${PORTDIR}/metadata/timestamp.x" ]; then + portage_current_timestamp=3D$(cut -f 1 -d " " "${PORTDIR}/metadata/tim= estamp.x" ) + fi + + echo "${portage_current_timestamp}" +} + +fetch_file() { + local URI=3D"$1" + local FILE=3D"$2" + local opts + + if [ "${FETCHCOMMAND/wget/}" !=3D "${FETCHCOMMAND}" ]; then + opts=3D"--continue $(nvecho -q)" + elif [ "${FETCHCOMMAND/curl/}" !=3D "${FETCHCOMMAND}" ]; then + opts=3D"--continue-at - $(nvecho -s -f)" + else + rm -f "${FILE}" + fi + + vecho "Fetching file ${FILE} ..." + # already set DISTDIR=3D + eval "${FETCHCOMMAND}" ${opts} + [ -s "${FILE}" ] +} + +check_file_digest() { + local digest=3D"$1" + local file=3D"$2" + local r=3D1 + + vecho "Checking digest ..." + + if type -P md5sum > /dev/null; then + md5sum -c $digest && r=3D0 + elif type -P md5 > /dev/null; then + [ "$(md5 -q "${file}")" =3D=3D "$(cut -d ' ' -f 1 "${digest}")" ] && r= =3D0 + else + eecho "cannot check digest: no suitable md5/md5sum binaries found" + fi + + return "${r}" +} + +check_file_signature() { + local signature=3D"$1" + local file=3D"$2" + local r=3D1 + + if [ ${WEBSYNC_VERIFY_SIGNATURE} !=3D 0 ]; then + + vecho "Checking signature ..." + + if type -P gpg > /dev/null; then + gpg --homedir "${PORTAGE_GPG_DIR}" --verify "$signature" "$file" && r= =3D0 + else + eecho "cannot check signature: gpg binary not found" + fi + else + r=3D0 + fi + + return "${r}" +} + +get_snapshot_timestamp() { + local file=3D"$1" + + do_tar "${file}" --to-stdout -xf - portage/metadata/timestamp.x | cut -= f 1 -d " " +} + +sync_local() { + local file=3D"$1" + + vecho "Syncing local tree ..." + + if type -P tarsync > /dev/null ; then + local chown_opts=3D"-o portage -g portage" + chown portage:portage portage > /dev/null 2>&1 || chown_opts=3D"" + if ! tarsync $(vvecho -v) -s 1 ${chown_opts} \ + -e /distfiles -e /packages -e /local "${file}" "${PORTDIR}"; then + eecho "tarsync failed; tarball is corrupt? (${file})" + return 1 + fi + else + if ! do_tar "${file}" xf -; then + eecho "tar failed to extract the image. tarball is corrupt? (${file})= " + rm -fr portage + return 1 + fi + + # Free disk space + rm -f "${file}" + + chown portage:portage portage > /dev/null 2>&1 && \ + chown -R portage:portage portage + cd portage + rsync -av --progress --stats --delete --delete-after \ + --exclude=3D'/distfiles' --exclude=3D'/packages' \ + --exclude=3D'/local' ${PORTAGE_RSYNC_EXTRA_OPTS} . "${PORTDIR%%/}" + cd .. + + vecho "Cleaning up ..." + rm -fr portage + fi + + if has metadata-transfer ${FEATURES} ; then + vecho "Updating cache ..." + emerge --metadata + fi + [ -x /etc/portage/bin/post_sync ] && /etc/portage/bin/post_sync + return 0 +} + +do_snapshot() { + local ignore_timestamp=3D"$1" + local date=3D"$2" + + local r=3D1 + + local base_file=3D"portage-${date}.tar" + + local have_files=3D0 + local mirror + + local compressions=3D"" + # xz is not supported in app-arch/tarsync, so use + # bz2 format if we have tarsync. + if ! type -P tarsync > /dev/null ; then + type -P xzcat > /dev/null && compressions=3D"${compressions} xz" + fi + type -P bzcat > /dev/null && compressions=3D"${compressions} bz2" + type -P zcat > /dev/null && compressions=3D"${compressions} gz" + if [[ -z ${compressions} ]] ; then + eecho "unable to locate any decompressors (xzcat or bzcat or zcat)" + exit 1 + fi + + for mirror in ${GENTOO_MIRRORS} ; do + + vecho "Trying to retrieve ${date} snapshot from ${mirror} ..." + + for compression in ${compressions} ; do + local file=3D"portage-${date}.tar.${compression}" + local digest=3D"${file}.md5sum" + local signature=3D"${file}.gpgsig" + + if [ -s "${file}" -a -s "${digest}" -a -s "${signature}" ] ; then + check_file_digest "${DISTDIR}/${digest}" "${DISTDIR}/${file}" && \ + check_file_signature "${DISTDIR}/${signature}" "${DISTDIR}/${file}" = && \ + have_files=3D1 + fi + + if [ ${have_files} -eq 0 ] ; then + fetch_file "${mirror}/snapshots/${digest}" "${digest}" && \ + fetch_file "${mirror}/snapshots/${signature}" "${signature}" && \ + fetch_file "${mirror}/snapshots/${file}" "${file}" && \ + check_file_digest "${DISTDIR}/${digest}" "${DISTDIR}/${file}" && \ + check_file_signature "${DISTDIR}/${signature}" "${DISTDIR}/${file}" = && \ + have_files=3D1 + fi + + # + # If timestamp is invalid + # we want to try and retrieve + # from a different mirror + # + if [ ${have_files} -eq 1 ]; then + + vecho "Getting snapshot timestamp ..." + local snapshot_timestamp=3D$(get_snapshot_timestamp "${file}") + + if [ ${ignore_timestamp} =3D=3D 0 ]; then + if [ ${snapshot_timestamp} -lt $(get_portage_timestamp) ]; then + wecho "portage is newer than snapshot" + have_files=3D0 + fi + else + local utc_seconds=3D$(get_utc_second_from_string "${date}") + + # + # Check that this snapshot + # is what it claims to be ... + # + if [ ${snapshot_timestamp} -lt ${utc_seconds} ] || \ + [ ${snapshot_timestamp} -gt $((${utc_seconds}+ 2*86400)) ]; then + + wecho "snapshot timestamp is not in acceptable period" + have_files=3D0 + fi + fi + fi + + if [ ${have_files} -eq 1 ]; then + break + else + # + # Remove files and use a different mirror + # + rm -f "${file}" "${digest}" "${signature}" + fi + done + + [ ${have_files} -eq 1 ] && break + done + + if [ ${have_files} -eq 1 ]; then + sync_local "${file}" && r=3D0 + else + vecho "${date} snapshot was not found" + fi +=09 + rm -f "${file}" "${digest}" "${signature}" + return "${r}" +} + +do_latest_snapshot() { + local attempts=3D0 + local r=3D1 + + vecho "Fetching most recent snapshot ..." + + # The snapshot for a given day is generated at 01:45 UTC on the followi= ng + # day, so the current day's snapshot (going by UTC time) hasn't been + # generated yet. Therefore, always start by looking for the previous d= ay's + # snapshot (for attempts=3D1, subtract 1 day from the current UTC time)= . + + # Timestamps that differ by less than 2 hours + # are considered to be approximately equal. + local min_time_diff=3D$(( 2 * 60 * 60 )) + + local existing_timestamp=3D$(get_portage_timestamp) + local timestamp_difference + local timestamp_problem + local approx_snapshot_time + local start_time=3D$(get_utc_date_in_seconds) + local start_hour=3D$(get_date_part ${start_time} "%H") + + # Daily snapshots are created at 1:45 AM and are not + # available until after 2 AM. Don't waste time trying + # to fetch a snapshot before it's been created. + if [ ${start_hour} -lt 2 ] ; then + (( start_time -=3D 86400 )) + fi + local snapshot_date=3D$(get_date_part ${start_time} "%Y%m%d") + local snapshot_date_seconds=3D$(get_utc_second_from_string ${snapshot_d= ate}) + + while (( ${attempts} < 40 )) ; do + (( attempts++ )) + (( snapshot_date_seconds -=3D 86400 )) + # snapshots are created at 1:45 AM + (( approx_snapshot_time =3D snapshot_date_seconds + 86400 + 6300 )) + (( timestamp_difference =3D existing_timestamp - approx_snapshot_time = )) + [ ${timestamp_difference} -lt 0 ] && (( timestamp_difference =3D -1 * = timestamp_difference )) + snapshot_date=3D$(get_date_part ${snapshot_date_seconds} "%Y%m%d") + + timestamp_problem=3D"" + if [ ${timestamp_difference} -eq 0 ]; then + timestamp_problem=3D"is identical to" + elif [ ${timestamp_difference} -lt ${min_time_diff} ]; then + timestamp_problem=3D"is possibly identical to" + elif [ ${approx_snapshot_time} -lt ${existing_timestamp} ] ; then + timestamp_problem=3D"is newer than" + fi + + if [ -n "${timestamp_problem}" ]; then + ewarn "Latest snapshot date: ${snapshot_date}" + ewarn + ewarn "Approximate snapshot timestamp: ${approx_snapshot_time}" + ewarn " Current local timestamp: ${existing_timestamp}" + ewarn + echo -e "The current local timestamp" \ + "${timestamp_problem} the" \ + "timestamp of the latest" \ + "snapshot. In order to force sync," \ + "use the --revert option or remove" \ + "the timestamp file located at" \ + "'${PORTDIR}/metadata/timestamp.x'." | fmt -w 70 | \ + while read -r line ; do + ewarn "${line}" + done + r=3D0 + break + fi + + if do_snapshot 0 "${snapshot_date}"; then + r=3D0 + break; + fi + done + + return "${r}" +} + +usage() { + cat <<-EOF + Usage: $0 [options] +=09 + Options: + --revert=3Dyyyymmdd Revert to snapshot + -q, --quiet Only output errors + -v, --verbose Enable verbose output + -x, --debug Enable debug output + -h, --help This help screen (duh!) + EOF + if [[ -n $* ]] ; then + printf "\nError: %s\n" "$*" 1>&2 + exit 1 + else + exit 0 + fi +} + +main() { + local arg + local revert_date +=09 + [ ! -d "${DISTDIR}" ] && mkdir -p "${DISTDIR}" + cd "${DISTDIR}" + + for arg in "$@" ; do + local v=3D${arg#*=3D} + case ${arg} in + -h|--help) usage ;; + -q|--quiet) PORTAGE_QUIET=3D1 ;; + -v|--verbose) do_verbose=3D1 ;; + -x|--debug) do_debug=3D1 ;; + --revert=3D*) revert_date=3D${v} ;; + *) usage "Invalid option '${arg}'" ;; + esac + done + + # This is a sanity check to help prevent people like funtoo users + # from accidentally wiping out their git tree. + if [[ -n $SYNC && ${SYNC#rsync:} =3D $SYNC ]] ; then + echo "The current SYNC variable setting does not refer to an rsync URI= :" >&2 + echo >&2 + echo " SYNC=3D$SYNC" >&2 + echo >&2 + echo "If you intend to use emerge-webrsync then please" >&2 + echo "adjust SYNC to refer to an rsync URI." >&2 + echo "emerge-webrsync exiting due to abnormal SYNC setting." >&2 + exit 1 + fi + + [[ ${do_debug} -eq 1 ]] && set -x + + if [[ -n ${revert_date} ]] ; then + do_snapshot 1 "${revert_date}" + else + do_latest_snapshot + fi +} + +main "$@" diff --git a/portage_with_autodep/bin/env-update b/portage_with_autodep/b= in/env-update new file mode 100755 index 0000000..8a69f2b --- /dev/null +++ b/portage_with_autodep/bin/env-update @@ -0,0 +1,41 @@ +#!/usr/bin/python -O +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from __future__ import print_function + +import errno +import sys + +def usage(status): + print("Usage: env-update [--no-ldconfig]") + print("") + print("See the env-update(1) man page for more info") + sys.exit(status) + +if "-h" in sys.argv or "--help" in sys.argv: + usage(0) + +makelinks=3D1 +if "--no-ldconfig" in sys.argv: + makelinks=3D0 + sys.argv.pop(sys.argv.index("--no-ldconfig")) + +if len(sys.argv) > 1: + print("!!! Invalid command line options!\n") + usage(1) + +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + import portage +try: + portage.env_update(makelinks) +except IOError as e: + if e.errno =3D=3D errno.EACCES: + print("env-update: Need superuser access") + sys.exit(1) + else: + raise diff --git a/portage_with_autodep/bin/etc-update b/portage_with_autodep/b= in/etc-update new file mode 100755 index 0000000..42518ad --- /dev/null +++ b/portage_with_autodep/bin/etc-update @@ -0,0 +1,616 @@ +#!/bin/bash +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# Author Brandon Low +# +# Previous version (from which I've borrowed a few bits) by: +# Jochem Kossen +# Leo Lipelis +# Karl Trygve Kalleberg + +cd / + +if type -P gsed >/dev/null ; then + sed() { gsed "$@"; } +fi + +get_config() { + # the sed here does: + # - strip off comments + # - match lines that set item in question + # - delete the "item =3D" part + # - store the actual value into the hold space + # - on the last line, restore the hold space and print it + # 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=3D$1 + eval echo $(sed -n \ + -e 's:[[:space:]]*#.*$::' \ + -e "/^[[:space:]]*$item[[:space:]]*=3D/{s:[^=3D]*=3D[[:space:]]*\([\"'= ]\{0,1\}\)\(.*\)\1:\2:;h}" \ + -e '${g;p}' \ + "${PORTAGE_CONFIGROOT}"etc/etc-update.conf) +} + +diff_command() { + local cmd=3D${diff_command//%file1/$1} + ${cmd//%file2/$2} +} + +scan() { + echo "Scanning Configuration files..." + rm -rf ${TMP}/files > /dev/null 2>&1 + mkdir ${TMP}/files || die "Failed mkdir command!" 1 + count=3D0 + input=3D0 + local find_opts + local my_basename + + for path in ${CONFIG_PROTECT} ; do + path=3D"${ROOT}${path}" + # Do not traverse hidden directories such as .svn or .git. + find_opts=3D"-name .* -type d -prune -o -name ._cfg????_*" + if [ ! -d "${path}" ]; then + [ ! -f "${path}" ] && continue + my_basename=3D"${path##*/}" + path=3D"${path%/*}" + find_opts=3D"-maxdepth 1 -name ._cfg????_${my_basename}" + fi + + ofile=3D"" + # The below set -f turns off file name globbing in the ${find_opts} ex= pansion. + 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=3DPOSIX LC_ALL=3DPOSIX cut -f1= -d'%'); do + + rpath=3D$(echo "${file/\/\///}" | sed -e "s:/[^/]*$::") + rfile=3D$(echo "${file/\/\///}" | sed -e "s:^.*/::") + for mpath in ${CONFIG_PROTECT_MASK}; do + mpath=3D"${ROOT}${mpath}" + mpath=3D$(echo "${mpath/\/\///}") + if [[ "${rpath}" =3D=3D "${mpath}"* ]]; then + mv ${rpath}/${rfile} ${rpath}/${rfile:10} + break + fi + done + if [[ ! -f ${file} ]] ; then + echo "Skipping non-file ${file} ..." + continue + fi + + if [[ "${ofile:10}" !=3D "${rfile:10}" ]] || + [[ ${opath} !=3D ${rpath} ]]; then + MATCHES=3D0 + if [[ "${EU_AUTOMERGE}" =3D=3D "yes" ]]; then + if [ ! -e "${rpath}/${rfile}" ] || [ ! -e "${rpath}/${rfile:10}" ];= then + MATCHES=3D0 + else + diff -Bbua ${rpath}/${rfile} ${rpath}/${rfile:10} | egrep '^[+-]' = | egrep -v '^[+-][\t ]*#|^--- |^\+\+\+ ' | egrep -qv '^[-+][\t ]*$' + MATCHES=3D$? + fi + elif [[ -z $(diff -Nua ${rpath}/${rfile} ${rpath}/${rfile:10}| + grep "^[+-][^+-]"|grep -v '# .Header:.*') ]]; then + MATCHES=3D1 + fi + if [[ "${MATCHES}" =3D=3D "1" ]]; then + echo "Automerging trivial changes in: ${rpath}/${rfile:10}" + mv ${rpath}/${rfile} ${rpath}/${rfile:10} + continue + else + count=3D${count}+1 + echo "${rpath}/${rfile:10}" > ${TMP}/files/${count} + echo "${rpath}/${rfile}" >> ${TMP}/files/${count} + ofile=3D"${rfile}" + opath=3D"${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} + ofile=3D"${rfile}" + opath=3D"${rpath}" + fi + done + done + +} + +sel_file() { + local -i isfirst=3D0 + until [[ -f ${TMP}/files/${input} ]] || \ + [[ ${input} =3D=3D -1 ]] || \ + [[ ${input} =3D=3D -3 ]] + do + local numfiles=3D$(ls ${TMP}/files|wc -l) + local numwidth=3D${#numfiles} + for file in $(ls ${TMP}/files|sort -n); do + if [[ ${isfirst} =3D=3D 0 ]] ; then + isfirst=3D${file} + fi + numshow=3D$(printf "%${numwidth}i${PAR} " ${file}) + numupdates=3D$(( $(wc -l <${TMP}/files/${file}) - 1 )) + echo -n "${numshow}" + if [[ ${mode} =3D=3D 0 ]] ; then + echo "$(head -n1 ${TMP}/files/${file}) (${numupdates})" + else + head -n1 ${TMP}/files/${file} + fi + done > ${TMP}/menuitems + + if [ "${OVERWRITE_ALL}" =3D=3D "yes" ]; then + input=3D0 + elif [ "${DELETE_ALL}" =3D=3D "yes" ]; then + input=3D0 + else + [[ $CLEAR_TERM =3D=3D yes ]] && clear + if [[ ${mode} =3D=3D 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=3D"Please select a file to update" + fi + + if [[ ${mode} =3D=3D 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 'm= v -i')" + echo " (-7 to discard all updates)" + echo -n " (-9 to discard all updates AND n= ot use 'rm -i'): " + input=3D$(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=3D$(<${TMP}/input) + fi + if [[ ${input} =3D=3D -9 ]]; then + read -p "Are you sure that you want to delete all updates (type YES)= :" reply + if [[ ${reply} !=3D "YES" ]]; then + continue + else + input=3D-7 + export rm_opts=3D"" + fi + fi + if [[ ${input} =3D=3D -7 ]]; then + input=3D0 + export DELETE_ALL=3D"yes" + fi + if [[ ${input} =3D=3D -5 ]] ; then + input=3D-3 + export mv_opts=3D" ${mv_opts} " + mv_opts=3D"${mv_opts// -i / }" + fi + if [[ ${input} =3D=3D -3 ]] ; then + input=3D0 + export OVERWRITE_ALL=3D"yes" + fi + fi # -3 automerge + if [[ -z ${input} ]] || [[ ${input} =3D=3D 0 ]] ; then + input=3D${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" + return 1 + fi + while read -r pat; do + echo ${1} | grep "${pat}" > /dev/null && return 0 + done < ${PORTAGE_CONFIGROOT}etc/etc-update.special + fi + return 1 +} + +read_int() { + # Read an integer from stdin. Continously loops until a valid integer = is + # 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 + 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 + done + echo ${my_input} +} + +do_file() { + interactive_echo() { [ "${OVERWRITE_ALL}" !=3D "yes" ] && [ "${DELETE_A= LL}" !=3D "yes" ] && echo; } + interactive_echo + local -i my_input + local -i fcount=3D0 + until (( $(wc -l < ${TMP}/files/${input}) < 2 )); do + my_input=3D0 + if (( $(wc -l < ${TMP}/files/${input}) =3D=3D 2 )); then + my_input=3D1 + fi + until (( ${my_input} > 0 )) && (( ${my_input} < $(wc -l < ${TMP}/files= /${input}) )); do + fcount=3D0 + + if [ "${OVERWRITE_ALL}" =3D=3D "yes" ]; then + my_input=3D0 + elif [ "${DELETE_ALL}" =3D=3D "yes" ]; then + my_input=3D0 + else + for line in $(<${TMP}/files/${input}); do + if (( ${fcount} > 0 )); then + echo -n "${fcount}${PAR} " + echo "${line}" + else + if [[ ${mode} =3D=3D 0 ]] ; then + echo "Below are the new config files for ${line}:" + else + local my_title=3D"Please select a file to process for ${line}" + fi + fi + fcount=3D${fcount}+1 + done > ${TMP}/menuitems + + if [[ ${mode} =3D=3D 0 ]] ; then + cat ${TMP}/menuitems + echo -n "Please select a file to process (-1 to exit this file): " + my_input=3D$(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=3D$(<${TMP}/input) + fi + fi # OVERWRITE_ALL + + if [[ ${my_input} =3D=3D 0 ]] ; then + my_input=3D1 + elif [[ ${my_input} =3D=3D -1 ]] ; then + input=3D0 + return + elif [[ ${my_input} =3D=3D ${fcount} ]] ; then + break + fi + done + if [[ ${my_input} =3D=3D ${fcount} ]] ; then + break + fi + + fcount=3D${my_input}+1 + + file=3D$(sed -e "${fcount}p;d" ${TMP}/files/${input}) + ofile=3D$(head -n1 ${TMP}/files/${input}) + + do_cfg "${file}" "${ofile}" + + sed -e "${fcount}!p;d" ${TMP}/files/${input} > ${TMP}/files/sed + mv ${TMP}/files/sed ${TMP}/files/${input} + + if [[ ${my_input} =3D=3D -1 ]] ; then + break + fi + done + interactive_echo + rm ${TMP}/files/${input} + count=3D${count}-1 +} + +do_cfg() { + + local file=3D"${1}" + local ofile=3D"${2}" + local -i my_input=3D0 + + until (( ${my_input} =3D=3D -1 )) || [ ! -f ${file} ]; do + if [[ "${OVERWRITE_ALL}" =3D=3D "yes" ]] && ! user_special "${ofile}";= then + my_input=3D1 + elif [[ "${DELETE_ALL}" =3D=3D "yes" ]] && ! user_special "${ofile}"; = then + my_input=3D2 + else + [[ $CLEAR_TERM =3D=3D yes ]] && clear + if [ "${using_editor}" =3D=3D 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 + 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): " + my_input=3D$(read_int) + fi + + case ${my_input} in + 1) echo "Replacing ${ofile} with ${file}" + mv ${mv_opts} ${file} ${ofile} + [ -n "${OVERWRITE_ALL}" ] && my_input=3D-1 + continue + ;; + 2) echo "Deleting ${file}" + rm ${rm_opts} ${file} + [ -n "${DELETE_ALL}" ] && my_input=3D-1 + continue + ;; + 3) do_merge "${file}" "${ofile}" + my_input=3D${?} +# [ ${my_input} =3D=3D 255 ] && my_input=3D-1 + continue + ;; + 4) continue + ;; + 5) do_distconf "${file}" "${ofile}" + ;; + *) continue + ;; + esac + done +} + +do_merge() { + # make sure we keep the merged file in the secure tempdir + # so we dont leak any information contained in said file + # (think of case where the file has 0600 perms; during the + # merging process, the temp file gets umask perms!) + + local file=3D"${1}" + local ofile=3D"${2}" + local mfile=3D"${TMP}/${2}.merged" + local -i my_input=3D0 + echo "${file} ${ofile} ${mfile}" + + if [[ -e ${mfile} ]] ; then + echo "A previous version of the merged file exists, cleaning..." + rm ${rm_opts} "${mfile}" + fi + + # since mfile will be like $TMP/path/to/original-file.merged, we + # need to make sure the full /path/to/ exists ahead of time + mkdir -p "${mfile%/*}" + + until (( ${my_input} =3D=3D -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} =3D=3D -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): " + my_input=3D$(read_int) + case ${my_input} in + 1) echo "Replacing ${ofile} with ${mfile}" + if [[ ${USERLAND} =3D=3D BSD ]] ; then + chown "$(stat -f %Su:%Sg "${ofile}")" "${mfile}" + chmod $(stat -f %Mp%Lp "${ofile}") "${mfile}" + else + chown --reference=3D"${ofile}" "${mfile}" + chmod --reference=3D"${ofile}" "${mfile}" + fi + mv ${mv_opts} "${mfile}" "${ofile}" + rm ${rm_opts} "${file}" + return 255 + ;; + 2) + [[ $CLEAR_TERM =3D=3D yes ]] && clear + if [ "${using_editor}" =3D=3D 0 ]; then + ( + echo "Showing differences between ${ofile} and ${mfile}" + diff_command "${ofile}" "${mfile}" + ) | ${pager} + else + echo "Beginning of differences between ${ofile} and ${mfile}" + diff_command "${ofile}" "${mfile}" + echo "End of differences between ${ofile} and ${mfile}" + fi + continue + ;; + 3) break + ;; + 4) ${EDITOR:-nano -w} "${mfile}" + continue + ;; + 5) rm ${rm_opts} "${mfile}" + return 0 + ;; + *) continue + ;; + esac + done + done + rm ${rm_opts} "${mfile}" + return 255 +} + +do_distconf() { + # search for any previously saved distribution config + # files and number the current one accordingly + + local file=3D"${1}" + local ofile=3D"${2}" + local -i count + local -i fill + local suffix + local efile + + for ((count =3D 0; count <=3D 9999; count++)); do + suffix=3D".dist_" + for ((fill =3D 4 - ${#count}; fill > 0; fill--)); do + suffix+=3D"0" + done + suffix+=3D"${count}" + efile=3D"${ofile}${suffix}" + if [[ ! -f ${efile} ]]; then + mv ${mv_opts} "${file}" "${efile}" + break + elif diff_command "${file}" "${efile}" &> /dev/null; then + # replace identical copy + mv "${file}" "${efile}" + break + fi + done +} + +die() { + trap SIGTERM + trap SIGINT + + if [ "$2" -eq 0 ]; then + echo "Exiting: ${1}" + scan > /dev/null + [ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining" + else + echo "ERROR: ${1}" + fi + + rm -rf "${TMP}" + exit ${2} +} + +usage() { + cat <<-EOF + etc-update: Handle configuration file updates + + Usage: etc-update [options] + + Options: + -d, --debug Enable shell debugging + -h, --help Show help and run away + -V, --version Show version and trundle away + EOF + + [[ -n ${*:2} ]] && printf "\nError: %s\n" "${*:2}" 1>&2 + + exit ${1:-0} +} + +# +# Run the script +# + +SET_X=3Dfalse +while [[ -n $1 ]] ; do + case $1 in + -d|--debug) SET_X=3Dtrue;; + -h|--help) usage;; + -V|--version) emerge --version ; exit 0;; + *) usage 1 "Invalid option '$1'";; + 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) +export PORTAGE_TMPDIR + +TMP=3D"${PORTAGE_TMPDIR}/etc-update-$$" +trap "die terminated 1" SIGTERM +trap "die interrupted 1" SIGINT + +[ -w ${PORTAGE_CONFIGROOT}etc ] || die "Need write access to ${PORTAGE_C= ONFIGROOT}etc" 1 +#echo $PORTAGE_TMPDIR +#echo $CONFIG_PROTECT +#echo $CONFIG_PROTECT_MASK +#export PORTAGE_TMPDIR=3D$(/usr/lib/portage/bin/portageq envvar PORTAGE_= TMPDIR) + +rm -rf "${TMP}" 2> /dev/null +mkdir "${TMP}" || die "failed to create temp dir" 1 +# 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 te= mp dir" 1 + +# I need the CONFIG_PROTECT value +#CONFIG_PROTECT=3D$(/usr/lib/portage/bin/portageq envvar CONFIG_PROTECT) +#CONFIG_PROTECT_MASK=3D$(/usr/lib/portage/bin/portageq envvar CONFIG_PRO= TECT_MASK) + +# load etc-config's configuration +CLEAR_TERM=3D$(get_config clear_term) +EU_AUTOMERGE=3D$(get_config eu_automerge) +rm_opts=3D$(get_config rm_opts) +mv_opts=3D$(get_config mv_opts) +cp_opts=3D$(get_config cp_opts) +pager=3D$(get_config pager) +diff_command=3D$(get_config diff_command) +using_editor=3D$(get_config using_editor) +merge_command=3D$(get_config merge_command) +declare -i mode=3D$(get_config mode) +[[ -z ${mode} ]] && mode=3D0 +[[ -z ${pager} ]] && pager=3D"cat" + +if [ "${using_editor}" =3D=3D 0 ]; then + # Sanity check to make sure diff exists and works + echo > "${TMP}"/.diff-test-1 + echo > "${TMP}"/.diff-test-2 +=09 + if ! diff_command "${TMP}"/.diff-test-1 "${TMP}"/.diff-test-2 ; then + die "'${diff_command}' does not seem to work, aborting" 1 + fi +else + if ! type ${diff_command%% *} >/dev/null; then + die "'${diff_command}' does not seem to work, aborting" 1 + fi +fi + +if [[ ${mode} =3D=3D "1" ]] ; then + if ! type dialog >/dev/null || ! dialog --help >/dev/null ; then + die "mode=3D1 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} =3D=3D 0 )); then + PAR=3D")" +else + PAR=3D"" +fi + +declare -i count=3D0 +declare input=3D0 +declare title=3D"Gentoo's etc-update tool!" + +scan + +until (( ${input} =3D=3D -1 )); do + if (( ${count} =3D=3D 0 )); then + die "Nothing left to do; exiting. :)" 0 + fi + sel_file + if (( ${input} !=3D -1 )); then + do_file + fi +done + +die "User termination!" 0 diff --git a/portage_with_autodep/bin/filter-bash-environment.py b/portag= e_with_autodep/bin/filter-bash-environment.py new file mode 100755 index 0000000..b9aec96 --- /dev/null +++ b/portage_with_autodep/bin/filter-bash-environment.py @@ -0,0 +1,150 @@ +#!/usr/bin/python +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +import codecs +import io +import optparse +import os +import re +import sys + +here_doc_re =3D re.compile(r'.*\s<<[-]?(\w+)$') +func_start_re =3D re.compile(r'^[-\w]+\s*\(\)\s*$') +func_end_re =3D re.compile(r'^\}$') + +var_assign_re =3D re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export= \s+)([^=3D\s]+)=3D("|\')?.*$') +close_quote_re =3D re.compile(r'(\\"|"|\')\s*$') +readonly_re =3D re.compile(r'^declare\s+-(\S*)r(\S*)\s+') +# declare without assignment +var_declare_re =3D re.compile(r'^declare(\s+-\S+)?\s+([^=3D\s]+)\s*$') + +def have_end_quote(quote, line): + """ + Check if the line has an end quote (useful for handling multi-line + quotes). This handles escaped double quotes that may occur at the + end of a line. The posix spec does not allow escaping of single + quotes inside of single quotes, so that case is not handled. + """ + close_quote_match =3D close_quote_re.search(line) + return close_quote_match is not None and \ + close_quote_match.group(1) =3D=3D quote + +def filter_declare_readonly_opt(line): + readonly_match =3D readonly_re.match(line) + if readonly_match is not None: + declare_opts =3D '' + for i in (1, 2): + group =3D readonly_match.group(i) + if group is not None: + declare_opts +=3D group + if declare_opts: + line =3D 'declare -%s %s' % \ + (declare_opts, line[readonly_match.end():]) + else: + line =3D 'declare ' + line[readonly_match.end():] + return line + +def filter_bash_environment(pattern, file_in, file_out): + # Filter out any instances of the \1 character from variable values + # since this character multiplies each time that the environment + # is saved (strange bash behavior). This can eventually result in + # mysterious 'Argument list too long' errors from programs that have + # huge strings of \1 characters in their environment. See bug #222091. + here_doc_delim =3D None + in_func =3D None + multi_line_quote =3D None + multi_line_quote_filter =3D None + for line in file_in: + if multi_line_quote is not None: + if not multi_line_quote_filter: + file_out.write(line.replace("\1", "")) + if have_end_quote(multi_line_quote, line): + multi_line_quote =3D None + multi_line_quote_filter =3D None + continue + if here_doc_delim is None and in_func is None: + var_assign_match =3D var_assign_re.match(line) + if var_assign_match is not None: + quote =3D var_assign_match.group(3) + filter_this =3D pattern.match(var_assign_match.group(2)) \ + is not None + # Exclude the start quote when searching for the end quote, + # to ensure that the start quote is not misidentified as the + # end quote (happens if there is a newline immediately after + # the start quote). + if quote is not None and not \ + have_end_quote(quote, line[var_assign_match.end(2)+2:]): + multi_line_quote =3D quote + multi_line_quote_filter =3D filter_this + if not filter_this: + line =3D filter_declare_readonly_opt(line) + file_out.write(line.replace("\1", "")) + continue + else: + declare_match =3D var_declare_re.match(line) + if declare_match is not None: + # declare without assignment + filter_this =3D pattern.match(declare_match.group(2)) \ + is not None + if not filter_this: + line =3D filter_declare_readonly_opt(line) + file_out.write(line) + continue + + if here_doc_delim is not None: + if here_doc_delim.match(line): + here_doc_delim =3D None + file_out.write(line) + continue + here_doc =3D here_doc_re.match(line) + if here_doc is not None: + here_doc_delim =3D re.compile("^%s$" % here_doc.group(1)) + file_out.write(line) + continue + # Note: here-documents are handled before functions since otherwise + # it would be possible for the content of a here-document to be + # mistaken as the end of a function. + if in_func: + if func_end_re.match(line) is not None: + in_func =3D None + file_out.write(line) + continue + in_func =3D func_start_re.match(line) + if in_func is not None: + file_out.write(line) + continue + # This line is not recognized as part of a variable assignment, + # function definition, or here document, so just allow it to + # pass through. + file_out.write(line) + +if __name__ =3D=3D "__main__": + description =3D "Filter out variable assignments for variable " + \ + "names matching a given PATTERN " + \ + "while leaving bash function definitions and here-documents " + \ + "intact. The PATTERN is a space separated list of variable names" + \ + " and it supports python regular expression syntax." + usage =3D "usage: %s PATTERN" % os.path.basename(sys.argv[0]) + parser =3D optparse.OptionParser(description=3Ddescription, usage=3Dusa= ge) + options, args =3D parser.parse_args(sys.argv[1:]) + if len(args) !=3D 1: + parser.error("Missing required PATTERN argument.") + file_in =3D sys.stdin + file_out =3D sys.stdout + if sys.hexversion >=3D 0x3000000: + file_in =3D codecs.iterdecode(sys.stdin.buffer.raw, + 'utf_8', errors=3D'replace') + file_out =3D io.TextIOWrapper(sys.stdout.buffer, + 'utf_8', errors=3D'backslashreplace') + + var_pattern =3D args[0].split() + + # Filter invalid variable names that are not supported by bash. + var_pattern.append(r'\d.*') + var_pattern.append(r'.*\W.*') + + var_pattern =3D "^(%s)$" % "|".join(var_pattern) + filter_bash_environment( + re.compile(var_pattern), file_in, file_out) + file_out.flush() diff --git a/portage_with_autodep/bin/fixpackages b/portage_with_autodep/= bin/fixpackages new file mode 100755 index 0000000..5e1df70 --- /dev/null +++ b/portage_with_autodep/bin/fixpackages @@ -0,0 +1,45 @@ +#!/usr/bin/python +# Copyright 1999-2006 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"]=3D"fixpackages" +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + import portage + +from portage import os +from portage.output import EOutput +from textwrap import wrap +from portage._global_updates import _global_updates +mysettings =3D portage.settings +mytrees =3D portage.db +mtimedb =3D portage.mtimedb + +if mysettings['ROOT'] !=3D "/": + out =3D EOutput() + msg =3D "The fixpackages program is not intended for use with " + \ + "ROOT !=3D \"/\". Instead use `emaint --fix movebin` and/or " + \ + "`emaint --fix moveinst." + for line in wrap(msg, 72): + out.eerror(line) + sys.exit(1) + +try: + os.nice(int(mysettings.get("PORTAGE_NICENESS", "0"))) +except (OSError, ValueError) as e: + portage.writemsg("!!! Failed to change nice value to '%s'\n" % \ + mysettings["PORTAGE_NICENESS"]) + portage.writemsg("!!! %s\n" % str(e)) + del e + +_global_updates(mytrees, mtimedb["updates"]) + +print() +print("Done.") +print() diff --git a/portage_with_autodep/bin/glsa-check b/portage_with_autodep/b= in/glsa-check new file mode 100755 index 0000000..2f2d555 --- /dev/null +++ b/portage_with_autodep/bin/glsa-check @@ -0,0 +1,316 @@ +#!/usr/bin/python +# Copyright 2008-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +from __future__ import print_function + +import sys + +try: + import portage +except ImportError: + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file= __))), "pym")) + import portage + +from portage import os +from portage.output import * + +from optparse import OptionGroup, OptionParser + +__program__ =3D "glsa-check" +__author__ =3D "Marius Mauch " +__version__ =3D "1.0" + +def cb_version(*args, **kwargs): + """Callback for --version""" + sys.stderr.write("\n"+ __program__ + ", version " + __version__ + "\n") + sys.stderr.write("Author: " + __author__ + "\n") + sys.stderr.write("This program is licensed under the GPL, version 2\n\n= ") + sys.exit(0) + +# option parsing +parser =3D OptionParser(usage=3D"%prog