diff options
author | 2006-05-01 11:49:33 +0000 | |
---|---|---|
committer | 2006-05-01 11:49:33 +0000 | |
commit | ddf0f6e72d96b2ba0c1bc2c718d2099c6d7fa379 (patch) | |
tree | bf612e0d338c459cd12e0aa451997a2f83e951df | |
parent | 3d4057eb5706995a3de384cdab4426876089ce6c (diff) | |
download | paludis-ddf0f6e72d96b2ba0c1bc2c718d2099c6d7fa379.tar.gz paludis-ddf0f6e72d96b2ba0c1bc2c718d2099c6d7fa379.tar.xz |
Tag release 0.2.00.2.0
432 files changed, 52957 insertions, 0 deletions
diff --git a/0.2.0/AUTHORS b/0.2.0/AUTHORS new file mode 100644 index 000000000..7b03e705b --- /dev/null +++ b/0.2.0/AUTHORS @@ -0,0 +1,20 @@ +Authors of Paludis +================== + +Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + Main code + +Stephen P. Bennett <spb@gentoo.org> + Contributor + +Mark Loeser <halcy0n@gentoo.org> + Contributor + +John N. Laliberte <allanonjl@gentoo.org> + Contributor to Qualudis + +Stephen Klimaszewski <steev@gentoo.org> + Contributor + +Danny van Dyk <kugelfang@gentoo.org> + Contributor diff --git a/0.2.0/ChangeLog b/0.2.0/ChangeLog new file mode 100644 index 000000000..023977019 --- /dev/null +++ b/0.2.0/ChangeLog @@ -0,0 +1,580 @@ +ChangeLog for Paludis +===================== + +2006-05-01 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + + Release: 0.2.0 + +2006-05-01 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * src/install.cc: Don't add to world if --fetch is specified. + +2006-05-01 Stephen Bennett <spb@gentoo.org> + + * NEWS, configure.ac: Paludis 0.2.0. + +2006-04-30 Stephen Bennett <spb@gentoo.org> + + * ebuild/build_functions.bash: Killed some overzealous quoting in + einstall that was breaking some packages. + +2006-04-30 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/utils/Makefile.am, ebuild/utils/dolib.a, + ebuild/utils/dolib.so, ebuild/utils/newlib.a, ebuild/utils/newlib.so, + ebuild/utils/dolib.a.in, ebuild/utils/dolib.so.in, + ebuild/utils/newlib.a.in, ebuild/utils/newlib.so.in: Try to work + around svn ignoring things. + +2006-04-30 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * hooks/Makefile.am.m4: Fix EXTRA_DIST for distribution tarballs. + +2006-04-30 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/digests/Makefile.am: Fix include path. + +2006-04-30 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/Makefile.am, doc/doxygen.conf.in, doc/footer.html, + doc/header.html, doc/paludis.css: Replace the icky default Doxygen + style with a marginally less icky style stolen from libebt. + +2006-04-30 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * autogen.bash, ebuild/utils/dobin_TEST.bash, hooks/Makefile.am -> + hooks/Makefile.am.m4: Restructure hooks Makefile and dobin tests to + avoid breaking distcheck. + + + Fixes: Berlios#7328. + + Fixes: Berlios#7326. + +2006-04-30 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/syncer.cc: Make the local directory when syncing via rsync. + +2006-04-30 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/util/fs_entry.cc, paludis/util/fs_entry.hh, + paludis/util/fs_entry_TEST.cc: Add a mkdir method to FSEntry. + +2006-04-29 Stephen Bennett <spb@gentoo.org> + + * ebuild/build_functions.bash: Make einstall pass libdir= to make. + + + Fixes: Berlios#7305. + +2006-04-29 Danny van Dyk <kugelfang@gentoo.org> + + * paludis/config_file.cc, paludis/config_file.hh, + paludis/portage_repository.cc, paludis/portage_repository.hh: + Rework of the built-in security set. + +2006-04-28 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_main.doxygen, paludis/contents.cc, paludis/contents.hh, + paludis/fake_repository.cc, paludis/fake_repository.hh, + paludis/files.m4, paludis/package_database.cc, + paludis/package_database.hh, paludis/portage_repository.cc, + paludis/portage_repository.hh, paludis/repository.hh, + paludis/vdb_repository.cc, paludis/vdb_repository.hh: Provide a way of + querying the contents of a package. + + * src/Makefile.am, src/colour.hh, src/command_line.cc, + src/command_line.hh, src/contents.cc, src/contents.hh, src/owner.cc, + src/owner.hh, src/paludis.cc: Add --owner and --contents actions. + +2006-04-27 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/version_spec.cc, paludis/version_spec_TEST.cc: Allow scm-rX + on unversioned packages. + +2006-04-27 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/unpack_functions.bash: Make unpack know how to extract .ar + and .deb files. + +2006-04-27 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_bootstrap_howto.doxygen: Add gettext to the suggested test + blacklist. + +2006-04-26 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * src/Makefile.am, src/install.cc, src/licence.cc, src/licence.hh, + src/query.cc: Use the fancy licence displayer for --query as well as + --install. + +2006-04-26 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/vdb_repository.cc: Load HOMEPAGE, DESCRIPTION. + + * src/query.cc: Prefer installed packages over uninstalled packages, + even if there are newer versions of uninstalled packages, when + displaying query output. + +2006-04-26 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/environment.cc: Handle || ( ) in LICENSE properly. + +2006-04-26 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/digests/Makefile.am, ebuild/digests/dormd160, + ebuild/digests/dormd160.cc, ebuild/digests/dormd160_TEST.cc, + ebuild/digests/rmd160.cc, ebuild/digests/rmd160.hh: Implement our own + RMD160 too, to avoid an OpenSSL dependency. + +2006-04-26 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * src/install.cc: Display keywords for masked packages, like we do for + licences. + +2006-04-26 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * src/paludis.cc: Show whether sandbox is enabled with --version. + +2006-04-25 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/Makefile.am: Don't tinker with Doxygen niceness. + + * doc/doc_bootstrap_howto.doxygen: Update with information about + avoiding sandbox and test issues with Python, avoiding test issues + with various packages, apr's pickiness and various wording and + formatting tweaks. + + * configure.ac, ebuild/Makefile.am, ebuild/builtin_fetch.bash, + ebuild/builtin_init.bash, ebuild/builtin_merge.bash, + ebuild/builtin_strip.bash, ebuild/builtin_unmerge.bash, + ebuild/ebuild.bash, ebuild/pkg_postinst.bash, ebuild/pkg_postrm.bash, + ebuild/pkg_preinst.bash, ebuild/pkg_prerm.bash, + ebuild/sandbox_stubs.bash, ebuild/utils/doconfd, ebuild/utils/doenvd, + ebuild/utils/doinitd, ebuild/utils/doins, ebuild/utils/dolib.a, + ebuild/utils/dolib.so, ebuild/utils/donewins, ebuild/utils/newbin, + ebuild/utils/newconfd, ebuild/utils/newdoc, ebuild/utils/newenvd, + ebuild/utils/newexe, ebuild/utils/newinitd, ebuild/utils/newins, + ebuild/utils/newlib.a, ebuild/utils/newlib.so, ebuild/utils/newman, + ebuild/utils/newsbin, paludis/ebuild.cc, paludis/ebuild.hh, + paludis/util/system.cc, paludis/util/system.hh, ebuild/sandbox.bash: + Support sandbox. + +2006-04-25 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_bootstrap_howto.doxygen: Our list of required licences was + slightly too short. Extend it. + +2006-04-24 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * Makefile.am, configure.ac, ebuild/Makefile.am, + ebuild/builtin_merge.bash, ebuild/builtin_updateenv.bash, + ebuild/depend.bash, ebuild/ebuild.bash, hooks, hooks/Makefile.am, + hooks/eselect_env_update.bash, hooks/find_config_updates.bash, + hooks/gnu_info_index.bash, paludis/Makefile.am.m4, + paludis/default_config.cc, paludis/default_config.hh, + paludis/default_environment.cc, paludis/default_environment.hh, + paludis/ebuild.cc, paludis/environment.hh, + paludis/test_environment.hh, src/install.cc, src/sync.cc, + src/uninstall.cc, ebuild/builtin_metadata.bash: Rename depend ebuild + action to metadata and remove updateenv action. Add a hooks framework. + Use hooks for running eselect env update, updating GNU info + directories and checking for configuration files. + + * ebuild/echo_functions.bash: Fix log output when redirected. + + * doc/doc_portage_differences: We have hooks. + +2006-04-24 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/util/fs_entry_TEST.cc, paludis/util/fs_entry_TEST_setup.sh: + Add further symlink behaviour checks. + + * paludis/util/is_file_with_extension.cc: Also allow symlinks to + files. + +2006-04-24 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/utils/merge: Name CONFIG_PROTECTed files in the same way + Portage does. + +2006-04-24 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_references.doxygen, doc/doxygen.conf.in, + paludis/util/files.m4, paludis/util/random.cc, paludis/util/random.hh, + paludis/util/random_TEST.cc: Don't use the c random number functions + that have global state, use our own instead. + +2006-04-23 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/Makefile.am, doc/doc_mainpage.doxygen, + doc/doc_portage_differences.doxygen: Extend documentation to include how + we differ from Portage. + +2006-04-23 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/default_environment.cc, paludis/dep_atom.cc, + paludis/dep_atom.hh, paludis/dep_atom_TEST.cc, paludis/dep_list_TEST.cc, + paludis/match_package.cc, paludis/portage_repository.cc: Enable [use] + dependencies (library only, no nice user interface to them at present). + Enhance priority of use.mask. Add circular detection for per package use + masking when [use] deps are used, to avoid infinite recursion. + +2006-04-23 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * configure.ac: Don't enable QA ever, for now. + +2006-04-23 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * configure.ac, ebuild/Makefile.am, ebuild/builtin_fetch.bash, + ebuild/digests, ebuild/digests/Makefile.am, ebuild/digests/domd5, + ebuild/digests/dormd160, ebuild/digests/dosha256.cc, + ebuild/digests/dosha256_TEST.cc, ebuild/digests/sha256.cc, + ebuild/digests/sha256.hh: Split out digest checks into separate + programs, to make ferringb happy. Add our own SHA-256 implementation + to avoid pulling in nasty dependencies. + +2006-04-23 Stephen Bennett <spb@gentoo.org> + + * paludis/repository.hh, paludis/portage_repository.hh, + paludis/fake_repository.hh, paludis/vdb_repository.hh, + paludis/portage_repository.cc, paludis/portage_repository_TEST.cc, + paludis/portage_repository_TEST_setup.sh, paludis/fake_repository.cc, + paludis/vdb_repository.cc, src_install.cc: Per-package USE masking + support. + +2006-04-21 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/default_environment.cc, paludis/dep_list.cc, + paludis/match_package.cc, paludis/match_package.hh, + paludis/package_database.cc, paludis/package_database.hh, + paludis/package_database_TEST.cc, paludis/portage_repository.cc, + paludis/test_environment.cc: Switch match_package to take Environment + rather than PackageDatabase as its first argument, since we're not + using multiple DBs per environment any more. + +2006-04-20 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/version_spec.cc: Don't do silly things when given "0" as a + version. + +2006-04-20 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/util/smart_record.hh.m4: Intel's compiler handles partial + specialisation slightly differently. Make the char * to string type + conversion work. + +2006-04-20 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/version_spec.cc: Fix STL usage issues that can cause + segfaults with Intel's compiler. + +2006-04-20 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_main.doxygen, paludis/args/args.cc, paludis/args/args.hh, + paludis/args/args_TEST.cc, paludis/args/args_dumper.cc, + paludis/args/args_dumper.hh, paludis/args/args_error.cc, + paludis/args/args_error.hh, paludis/args/args_group.cc, + paludis/args/args_group.hh, paludis/args/args_handler.cc, + paludis/args/args_handler.hh, paludis/args/args_option.cc, + paludis/args/args_option.hh, paludis/args/args_visitor.cc, + paludis/args/args_visitor.hh, paludis/dep_atom.hh, + paludis/dep_atom_flattener.hh, paludis/dep_list.hh, + paludis/dep_parser.cc, paludis/dep_tag.hh, paludis/ebuild.hh, + paludis/environment.cc, paludis/fake_repository.hh, + paludis/hashed_containers.cc, paludis/portage_repository.cc, + paludis/repository.hh, paludis/syncer.hh, paludis/test_extras.cc, + paludis/version_operator.hh, src/command_line.hh, src/install.cc, + src/paludis.cc: Last batch of code docs changes for now. + +2006-04-20 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_main.doxygen, paludis/util/attributes.hh, + paludis/util/collection.hh, paludis/util/compare.hh, + paludis/util/composite_pattern.hh, paludis/util/container_entry.hh, + paludis/util/counted_ptr.hh, paludis/util/counted_ptr_TEST.cc, + paludis/util/deleter.cc, paludis/util/deleter.hh, + paludis/util/deleter_TEST.cc, paludis/util/destringify.cc, + paludis/util/destringify.hh, paludis/util/destringify_TEST.cc, + paludis/util/dir_iterator.cc, paludis/util/dir_iterator.hh, + paludis/util/dir_iterator_TEST.cc, paludis/util/exception.cc, + paludis/util/exception.hh, paludis/util/files.m4, + paludis/util/fs_entry.cc, paludis/util/fs_entry.hh, + paludis/util/fs_entry_TEST.cc, paludis/util/instantiation_policy.cc, + paludis/util/instantiation_policy.hh, + paludis/util/instantiation_policy_TEST.cc, paludis/util/is_const.cc, + paludis/util/is_const.hh, paludis/util/is_const_TEST.cc, + paludis/util/is_file_with_extension.cc, + paludis/util/is_file_with_extension.hh, + paludis/util/is_file_with_extension_TEST.cc, paludis/util/iterator.hh, + paludis/util/iterator_TEST.cc, paludis/util/join.cc, + paludis/util/join.hh, paludis/util/join_TEST.cc, paludis/util/log.cc, + paludis/util/log.hh, paludis/util/log_TEST.cc, + paludis/util/match_sequence.cc, paludis/util/match_sequence.hh, + paludis/util/match_sequence_TEST.cc, + paludis/util/private_implementation_pattern.cc, + paludis/util/private_implementation_pattern.hh, + paludis/util/pstream.cc, paludis/util/pstream.hh, + paludis/util/pstream_TEST.cc, paludis/util/random.cc, + paludis/util/random.hh, paludis/util/save.cc, paludis/util/save.hh, + paludis/util/save_TEST.cc, paludis/util/smart_record.hh.m4, + paludis/util/smart_record_TEST.cc, paludis/util/stringify.hh, + paludis/util/stringify_TEST.cc, paludis/util/strip.cc, + paludis/util/strip.hh, paludis/util/strip_TEST.cc, + paludis/util/system.cc, paludis/util/system.hh, + paludis/util/system_TEST.cc, paludis/util/test_extras.cc, + paludis/util/tokeniser.hh, paludis/util/tokeniser_TEST.cc, + paludis/util/validated.hh, paludis/util/validated_TEST.cc, + paludis/util/virtual_constructor.hh, + paludis/util/virtual_constructor_TEST.cc, paludis/util/visitor.hh, + paludis/util/visitor_TEST.cc: Fix up docs for paludis/util/ . + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_main.doxygen, paludis/package_database.cc, + paludis/package_database.hh, paludis/package_database_TEST.cc, + paludis/portage_repository.cc, paludis/portage_repository.hh, + paludis/portage_repository_TEST.cc, paludis/repository.cc, + paludis/repository.hh, paludis/syncer.cc, paludis/syncer.hh, + paludis/test_environment.cc, paludis/test_environment.hh, + paludis/test_extras.cc, paludis/vdb_repository.cc, + paludis/vdb_repository.hh, paludis/vdb_repository_TEST.cc, + paludis/version_metadata.cc, paludis/version_metadata.hh, + paludis/version_operator.cc, paludis/version_operator.hh, + paludis/version_operator_TEST.cc, paludis/version_spec.cc, + paludis/version_spec.hh, paludis/version_spec_TEST.cc: And the rest of + the docs for paludis/. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/utils/merge_TEST.bash, ebuild/utils/unmerge_TEST.bash: + Support autotools "build somewhere else" mode. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * src/install.cc, src/sync.cc, src/uninstall.cc: Stop relying upon + namespaces being pulled in magically. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_main.doxygen, paludis/ebuild.cc, paludis/ebuild.hh, + paludis/environment.cc, paludis/environment.hh, + paludis/fake_repository.cc, paludis/fake_repository.hh, + paludis/hashed_containers.cc, paludis/hashed_containers.hh.in, + paludis/hashed_containers_TEST.cc, paludis/mask_reasons.cc, + paludis/mask_reasons.hh, paludis/match_package.cc, + paludis/match_package.hh, paludis/name.cc, paludis/name.hh, + paludis/name_TEST.cc: Some more progress on the documentation rework. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/ebuild.bash, ebuild/echo_functions.bash, paludis/util/log.cc, + paludis/util/log.hh, src/paludis.cc: Add program name and time to log + messages. + + * paludis/vdb_repository.cc: Add debug messages for operations that + are expected to be slow. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_main.doxygen, doc/doc_namespaces.doxygen, + paludis/about.hh.in, paludis/about_TEST.cc, paludis/config_file.cc, + paludis/config_file.hh, paludis/config_file_TEST.cc, + paludis/default_config.cc, paludis/default_config.hh, + paludis/dep_atom.cc, paludis/dep_atom.hh, paludis/dep_atom_TEST.cc, + paludis/dep_atom_dumper.cc, paludis/dep_atom_dumper.hh, + paludis/dep_atom_dumper_TEST.cc, paludis/dep_atom_flattener.cc, + paludis/dep_atom_flattener.hh, paludis/dep_atom_pretty_printer.cc, + paludis/dep_atom_pretty_printer.hh, paludis/dep_lexer.cc, + paludis/dep_lexer.hh, paludis/dep_lexer_TEST.cc, + paludis/dep_parser.cc, paludis/dep_parser.hh, + paludis/dep_parser_TEST.cc, paludis/dep_tag.cc, paludis/dep_tag.hh: + First part of the documentation rework, plus minor formatting and code + style fixes. More to come. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * src/Makefile.am, src/applets.cc, src/applets.hh, + src/command_line.cc, src/command_line.hh, src/paludis.cc: Add + --list-dep-tag-categories and related test. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/doc_mainpage.doxygen, doc/HOWTO.rst, doc/doc_changelog.doxygen, + doc/Makefile.am, doc/doc_bootstrap_howto.doxygen, Makefile.am, + README: Rework the documentation. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/version_spec_TEST.cc, paludis/version_spec.cc, + paludis/version_spec.hh: Add support for -scm versions. Rework + version spec internals to be substantially cleaner. Make the tests a + lot more extensive. + +2006-04-19 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/util/compare.hh, paludis/util/smart_record_TEST.cc: Make + CompareByAll comparisons work correctly. + +2006-04-18 Stephen Bennett <spb@gentoo.org> + + * paludis/portage_repository.cc: Fix compiler warning. + +2006-04-18 Stephen Bennett <spb@gentoo.org> + + * paludis/fake_repository.cc, paludis/vdb_repository.cc, + paludis/default_environment.cc, paludis/fake_repository.hh, + paludis/vdb_repository.hh, paludis/repository.hh, + paludis/portage_repository.cc, paludis/vdb_repository_TEST.cc, + paludis/vdb_repository_TEST_setup.sh, paludis/package_database.hh, + paludis/portage_repository.hh, paludis/package_database_entry.hh: + Support querying of USE from VDBRepository. + +2006-04-18 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/portage_repository_TEST.cc, paludis/portage_repository.cc, + paludis/portage_repository_TEST_setup.sh: Ignore any weird version specs + with a warning, rather than bombing out. + +2006-04-18 Stephen Bennett <spb@gentoo.org> + + * ebuild/build_functions.bash: Replace non-existant ${PREFIX} with /usr. + +2006-04-18 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * src/install.cc: Fix (5 of 4) style counts caused by incrementing the + package counter when cleaning. + +2006-04-18 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/vdb_repository.hh: Explicitly include fs_entry, rather than + relying upon magic. + + * paludis/files.m4, paludis/vdb_repository_TEST_cleanup.sh, + paludis/vdb_repository_TEST_setup.sh, paludis/vdb_repository_TEST.cc: + Some very crude VDB repo tests. + +2006-04-18 Stephen Bennett <spb@gentoo.org> + + * ebuild/ebuild.bash: Export variables set in make.defaults. + +2006-04-18 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/ebuild.hh, paludis/portage_repository.cc, paludis/ebuild.cc: + Provide A during the ebuild build phase. + +2006-04-18 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * doc/HOWTO.rst: Add a note about the backslashes being for cat. + +2006-04-18 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/portage_repository.cc: Fix SLOT being set to an empty string + for some non-default virtual providers. + +2006-04-18 Danny van Dyk <kugelfang@gentoo.org> + + * paludis/config_file.cc, paludis/config_file.hh: Fix typo. + * paludis/portage_repository.cc: Fix return value for an empty + security package set. Fix whitespaces. + +2006-04-17 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/dep_tag.cc, paludis/dep_list.cc, paludis/vdb_repository.cc, + paludis/files.m4, paludis/dep_atom.hh, paludis/dep_list.hh, + paludis/dep_tag.hh, paludis/portage_repository.cc, paludis/dep_atom.cc: + Turn dep tags into a proper class. Associate some basic GLSA information + with GLSA tags (future expansion expected). + + * src/install.cc: Display new style dep tags. + +2006-04-17 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/util/iterator.hh: Add convenience indirect_iterator generation + function. + +2006-04-17 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/ebuild.cc, paludis/ebuild.hh, paludis/files.m4, + paludis/portage_repository.cc, paludis/repository.cc, + paludis/repository.hh, paludis/vdb_repository.cc: Split ebuild + execution code out into its own EbuildCommand classes. + +2006-04-17 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/config_file.cc: Typo fix. + +2006-04-17 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/util/fs_entry.hh, paludis/util/fs_entry.cc, + paludis/util/fs_entry_TEST.cc: Remove automatic cast from FSEntry to + std::string, since all it does is lead to silly bugs going undetected + at compile time. + + * paludis/vdb_repository.cc, paludis/portage_repository.cc: Don't rely + upon automatic casts from FSEntry to std::string. + + * paludis/config_file.cc, paludis/config_file.hh, + paludis/config_file_TEST.cc: Provide overloaded constructors that take + an FSEntry rather than a std::string. + +2006-04-17 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/portage_repository.hh: Sync is a string, not a filesystem + entry. + +2005-04-17 Danny van Dyk <kugelfang@gentoo.org> + + * paludis/config_file.cc, paludis/config_file.hh, + paludis/dep_parser.cc, paludis/dep_parser.hh, + paludis/portage_repository.cc, paludis/portage_repository.hh: + Implement built-in 'security' package set. + +2006-04-17 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/vdb_repository.cc: Fix VDBEntry's operator< to return false + rather than an undefined value on equality. + +2006-04-16 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/vdb_repository.cc, paludis/vdb_repository.hh, + paludis/portage_repository.cc, paludis/portage_repository.hh: Use a + smart record for the constructor, allowing named parameters to be + provided, rather than passing around huge parameter lists containing + lots of things of the same type + +2006-04-16 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/util/smart_record.hh.m4, paludis/util/smart_record_TEST.cc: + Add support for named parameters to smart records. + +2006-04-16 Stephen Bennett <spb@gentoo.org> + + * paludis/portage_repository.cc, ebuild/ebuild.bash: Support multiple + inheritance in profiles. + +2006-04-16 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * ebuild/builtin_fetch.bash: After a failed fetch, wget has a tendency + to leave zero byte files lying around. When checking for existing + files in DISTDIR in builtin_fetch, if the file is zero bytes in size + then delete and refetch it. + + + Fixes: Berlios#7163. + +2006-04-16 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/portage_repository.cc: Remove iostream include, it was only + there for early debugging code and adds overhead (see TC++SL 13.2.3). + +2006-04-16 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/portage_repository.cc, ebuild/builtin_tidyup.bash, + ebuild/ebuild.bash, ebuild/builtin_updateenv.bash, ebuild/Makefile.am: + Split out the eselect env update call from builtin_tidyup into a new + builtin_updateenv, making SKIP_FUNCTIONS="tidyup" a lot more sensible. + +2006-04-16 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + + * paludis/portage_repository.cc: Expand mirror:// components that have + a path before the filename correctly. + + + Fixes: Berlios#7161. + diff --git a/0.2.0/Makefile.am b/0.2.0/Makefile.am new file mode 100644 index 000000000..765f19e6c --- /dev/null +++ b/0.2.0/Makefile.am @@ -0,0 +1,24 @@ +CLEANFILES = *~ done-check gmon.out *.gcov *.gcno *.gcda +MAINTAINERCLEANFILES = Makefile.in configure config/* aclocal.m4 \ + config.h config.h.in INSTALL COPYING +AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip std-options +EXTRA_DIST = autogen.bash +SUBDIRS = misc test paludis ebuild src doc hooks + +doxygen : + $(MAKE) -C doc doxygen + +upload-homepage : + $(MAKE) -C doc upload-homepage + +check-local : + touch $(top_builddir)/done-check + +install-data-local : + @[ -f $(top_builddir)/done-check ] || echo || true + @[ -f $(top_builddir)/done-check ] || echo "**************************************" || true + @[ -f $(top_builddir)/done-check ] || echo "Looks like you didn't run 'make check'" || true + @[ -f $(top_builddir)/done-check ] || echo " No cookies for you today. " || true + @[ -f $(top_builddir)/done-check ] || echo "**************************************" || true + @[ -f $(top_builddir)/done-check ] || echo || true + diff --git a/0.2.0/NEWS b/0.2.0/NEWS new file mode 100644 index 000000000..135306073 --- /dev/null +++ b/0.2.0/NEWS @@ -0,0 +1,5 @@ +News for Paludis +================ + +0.2.0: + Initial public release. diff --git a/0.2.0/README b/0.2.0/README new file mode 100644 index 000000000..740368de1 --- /dev/null +++ b/0.2.0/README @@ -0,0 +1,18 @@ +README for Paludis +================== + +Paludis is in the really early prototype not intended for real use stage. If you +aren't comfortable with C++, ebuild internals and Gentoo in general then you +shouldn't be touching it. + +Developer documentation is available via 'make doxygen' (you need Doxygen +installed, and having GraphViz will help too). It will be created under +'doc/html/'. User documentation is kept in the bottom of a locked filing cabinet +stuck in a disused lavatory with a sign on the door saying 'Beware of the +Leopard'. + +If you don't feel like building your own docs, see: + + http://paludis.berlios.de/ + +.. vim: set spell spelllang=en tw=80 : .. diff --git a/0.2.0/autogen.bash b/0.2.0/autogen.bash new file mode 100755 index 000000000..22ed878ca --- /dev/null +++ b/0.2.0/autogen.bash @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# vim: set sw=4 sts=4 et tw=80 : + +if test "xyes" = x"${BASH_VERSION}" ; then + echo "This is not bash!" + exit 127 +fi + +trap 'echo "exiting." ; exit 250' 15 +KILL_PID=$$ + +run() { + echo ">>> $@" 1>&2 + if ! $@ ; then + echo "oops!" 1>&2 + exit 127 + fi +} + +get() { + type ${1}-${2} &>/dev/null && echo ${1}-${2} && return + type ${1}${2//.} &>/dev/null && echo ${1}${2//.} && return + type ${1} &>/dev/null && echo ${1} && return + echo "Could not find ${1} ${2}" 1>&2 + kill $KILL_PID +} + +misc/do_m4.bash paludis/Makefile.am || exit $? +misc/do_m4.bash paludis/paludis.hh || exit $? +misc/do_m4.bash paludis/qa/Makefile.am || exit $? +misc/do_m4.bash paludis/qa/qa.hh || exit $? +misc/do_m4.bash paludis/util/util.hh || exit $? +misc/do_m4.bash paludis/util/Makefile.am || exit $? +misc/do_m4.bash paludis/util/smart_record.hh || exit $? +misc/do_m4.bash paludis/util/comparison_policy.hh || exit $? +misc/do_m4.bash hooks/Makefile.am || exit $? +run mkdir -p config +run $(get libtoolize 1.5 ) --copy --force --automake +rm -f config.cache +run $(get aclocal 1.9 ) +run $(get autoheader 2.59 ) +run $(get autoconf 2.59 ) +run $(get automake 1.9 ) -a --copy + diff --git a/0.2.0/configure.ac b/0.2.0/configure.ac new file mode 100644 index 000000000..8cdbe3d49 --- /dev/null +++ b/0.2.0/configure.ac @@ -0,0 +1,375 @@ +dnl vim: set sw=4 sts=4 ts=4 noet ft=config foldmethod=marker foldmarker={{{,}}} : + +dnl {{{ program, version +AC_PREREQ(2.59) +AC_INIT([paludis/paludis.hh]) +AC_CONFIG_AUX_DIR(config) + +VERSION_MAJOR=0 +VERSION_MINOR=2 +VERSION_MICRO=0 +VERSION_FULL="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_MICRO" +VERSION="$VERSION_FULL" + +AC_SUBST([VERSION_MAJOR]) +AC_SUBST([VERSION_MINOR]) +AC_SUBST([VERSION_MICRO]) +AC_SUBST([VERSION_FULL]) + +AM_INIT_AUTOMAKE(paludis, [$VERSION_FULL]) +dnl }}} + +dnl {{{ basic toolchain checks +AC_LANG([C++]) +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_RANLIB +AC_PROG_MAKE_SET +dnl }}} + +dnl {{{ check for partial specialisation of template classes +AC_MSG_CHECKING([for compiler support for partial specialisation of template classes]) +AC_COMPILE_IFELSE([ +template <typename T_> +struct S +{ + static const int s = 0; +}; + +template <typename T_> +struct S<const T_> +{ +}; + +template <typename T_> +struct S<const T_ &> +{ + static const int t = 0; +}; + +int main(int, char *[]) +{ + return S<int &>::s + S<const int &>::t; +} +], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Your C++ compiler doesn't compile C++ code]) + ]) +dnl }}} + +dnl {{{ check for basic_string and string::find_last_not_of +AC_MSG_CHECKING([for a sufficiently standard std::basic_string<>]) +AC_COMPILE_IFELSE([ +#include <string> +int main(int, char **) +{ + std::string s("test"); + std::basic_string<int> t; + return std::string::npos != s.find_last_not_of("abcde") ? 0 : 1; +} +], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([I need a less broken std::basic_string<> implementation]) + ]) +dnl }}} + +dnl {{{ check for limits +AC_MSG_CHECKING([for a usable std::numeric_limits]) +AC_COMPILE_IFELSE([ +#include <limits> +int main(int, char **) +{ + return std::numeric_limits<unsigned>::digits >> 3; +} +], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Your std::numeric_limits either doesn't exist or hates me]) + ]) +dnl }}} + +dnl {{{ check for broken std::set<>::const_reverse_iterator +AC_MSG_CHECKING([for a usable std::set<>::const_reverse_iterator]) +AC_COMPILE_IFELSE([ +#include <set> +int main(int, char **) +{ + std::set<int> s; + s.insert(1); + std::set<int>::const_reverse_iterator i; + return *i; +} +], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Your std::set<>::const_reverse_iterator is h0rked]) + ]) +dnl }}} + +dnl {{{ check for broken std::deque<NoDefaultConstructor> +AC_MSG_CHECKING([for a usable std::deque<NoDefaultConstructor>]) +AC_COMPILE_IFELSE([ +#include <deque> +struct NoDefaultConstructor +{ + NoDefaultConstructor(int); +}; +int main(int, char **) +{ + std::deque<NoDefaultConstructor> d, e; + d = e; +} +], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Your std::deque doesn't work]) + ]) +dnl }}} + +dnl {{{ check for hashes +have_tr1_hashes=0 +have_ext_hashes=0 +have_std_hashes=0 +AC_MSG_CHECKING([for hashed associative containers]) +AC_COMPILE_IFELSE([ +#include <tr1/unordered_map> +int main(int, char **) +{ + std::tr1::unordered_map<int, int> m; + m.insert(std::make_pair(1, 2)); +} +], + [ + AC_MSG_RESULT([std::tr1::unordered_map]) + have_tr1_hashes=1 + ], + [ + AC_COMPILE_IFELSE([ +#include <ext/hash_map> +int main(int, char **) +{ + __gnu_cxx::hash_map<int, int> m; + m.insert(std::make_pair(1, 2)); +} +], + [ + AC_MSG_RESULT([__gnu_cxx::hash_map]) + have_ext_hashes=1 + ], + [ + AC_COMPILE_IFELSE([ +#include <hash_map> +int main(int, char **) +{ + std::hash_map<int, int> m; + m.insert(std::make_pair(1, 2)); +} +], + [ + AC_MSG_RESULT([std::hash_map]) + have_std_hashes=1 + ], + [ + AC_MSG_RESULT([no, falling back to std::map (slower)]) + ])])]) + +HAVE_TR1_HASHES=$have_tr1_hashes +AC_DEFINE_UNQUOTED([HAVE_TR1_HASHES], $have_tr1_hashes, [Do we have std::tr1:: hashes?]) +AC_SUBST([HAVE_TR1_HASHES]) +HAVE_EXT_HASHES=$have_ext_hashes +AC_DEFINE_UNQUOTED([HAVE_EXT_HASHES], $have_ext_hashes, [Do we have __gnu_cxx:: hashes?]) +AC_SUBST([HAVE_EXT_HASHES]) +HAVE_STD_HASHES=$have_std_hashes +AC_DEFINE_UNQUOTED([HAVE_STD_HASHES], $have_std_hashes, [Do we have std:: hashes?]) +AC_SUBST([HAVE_STD_HASHES]) +dnl }}} + +dnl {{{ we need libebt. +dnl don't use AC_CHECK_HEADER, it does silly things +AC_MSG_CHECKING([for libebt]) +AC_COMPILE_IFELSE([ +#include <libebt/libebt.hh> +#include <string> +struct Tag { }; +int main(int, char **) +{ + libebt::BacktraceContext<Tag> context("blah"); +} +], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([libebt (http://libebt.berlios.de/) is required])]) +dnl }}} + +dnl {{{ check for various misc functions. +dnl It's probably possible to make many of these optional rather than +dnl hard requirements. If any of these fail for you, send patches. +AC_CHECK_FUNCS([alarm], [], [AC_MSG_ERROR([I need alarm])]) +AC_CHECK_FUNCS([strerror], [], [AC_MSG_ERROR([I need strerror])]) +AC_CHECK_FUNCS([signal], [], [AC_MSG_ERROR([I need signal])]) +AC_CHECK_FUNCS([popen], [], [AC_MSG_ERROR([I need popen])]) +dnl }}} + +dnl {{{ check for cxxflags +AC_MSG_CHECKING([whether our compiler is iccy]) +AC_COMPILE_IFELSE([ +#ifndef __ICC +#error nope +#endif +], + [cxx_compiler_icc=yes], + [cxx_compiler_icc=no]) +AC_MSG_RESULT([${cxx_compiler_icc}]) + +AC_DEFUN([CHECK_CXXFLAG], [ + save_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $1 -Werror" + AC_COMPILE_IFELSE([ +#include <string> +#include <iostream> +int main(int, char **) +{ + std::string s("test"); + std::cout << s << std::endl; +} + ], + [cxxflag_success=yes], + [cxxflag_success=no]) + CXXFLAGS="$save_CXXFLAGS" + if test "x$cxxflag_success" = "xyes" ; then + CXXFLAGS="$CXXFLAGS $1" + cxxflags_message="${cxxflags_message} $1" + fi + ]) + +AC_MSG_CHECKING([for appropriate compiler flags]) +if test "x${cxx_compiler_icc}" = "xyes" ; then + CHECK_CXXFLAG([-Wall]) + CHECK_CXXFLAG([-wd279]) + CHECK_CXXFLAG([-wd304]) + CHECK_CXXFLAG([-wd383]) + CHECK_CXXFLAG([-wd444]) + CHECK_CXXFLAG([-wd488]) + CHECK_CXXFLAG([-wd981]) + CHECK_CXXFLAG([-wd1125]) + CHECK_CXXFLAG([-wd1418]) +elif test "x${ac_cv_cxx_compiler_gnu}" = "xyes" ; then + CHECK_CXXFLAG([-Wall]) + CHECK_CXXFLAG([-Wextra]) + if ! test "x$cxxflag_success" = "xyes" ; then + CHECK_CXXFLAG([-W]) + fi + CHECK_CXXFLAG([-Wold-style-cast]) + CHECK_CXXFLAG([-Wredundant-decls]) + CHECK_CXXFLAG([-Wstrict-null-sentinel]) + CHECK_CXXFLAG([-Wmissing-noreturn]) + CHECK_CXXFLAG([-Woverloaded-virtual]) + CHECK_CXXFLAG([-pedantic]) +else + CHECK_CXXFLAG([-Wall]) +fi +AC_MSG_RESULT([${cxxflags_message}]) +dnl }}} + +dnl {{{ sandbox +AC_MSG_CHECKING([whether to enable sandbox]) +AC_ARG_ENABLE([sandbox], + [ --enable-sandbox Enable sandbox], + [HAVE_SANDBOX=$enableval + AC_MSG_RESULT([$enableval])], + [AC_MSG_RESULT([autodetect]) + AC_CHECK_PROG(HAVE_SANDBOX, [sandbox], [yes], [no])]) +AC_SUBST([HAVE_SANDBOX]) +AM_CONDITIONAL([HAVE_SANDBOX], test "x$HAVE_SANDBOX" = "xyes") +if test x"$HAVE_SANDBOX" = "xyes" ; then + AC_DEFINE([HAVE_SANDBOX], 1, [Do we have sandbox?]) +else + AC_DEFINE([HAVE_SANDBOX], 0) +fi +dnl }}} + +dnl {{{ doxygen, dot +AC_MSG_CHECKING([whether to enable doxygen]) +AC_ARG_ENABLE([doxygen], + [ --enable-doxygen Enable 'make doxygen' (developer docs)], + [HAVE_DOXYGEN=$enableval + AC_MSG_RESULT([$enableval])], + [AC_MSG_RESULT([autodetect]) + AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no])]) +AC_SUBST([HAVE_DOXYGEN]) +AM_CONDITIONAL([HAVE_DOXYGEN], test "x$HAVE_DOXYGEN" = "xyes") + +AC_MSG_CHECKING([whether to enable dot]) +AC_ARG_ENABLE([dot], + [ --enable-dot Enable 'HAVE_DOT' in doxygen.conf], + [HAVE_DOT=$enableval + AC_MSG_RESULT([$enableval])], + [AC_MSG_RESULT([autodetect]) + AC_CHECK_PROG(HAVE_DOT, [dot], [yes], [no])]) +AC_SUBST([HAVE_DOT]) +AM_CONDITIONAL([HAVE_DOT], test "x$HAVE_DOT" = "xyes") +dnl }}} + +dnl {{{ check for whether to build qa stuff +dnl AC_MSG_CHECKING([whether to build QA tools]) +dnl AC_ARG_ENABLE([qa], +dnl [ --enable-qa Build QA tool (qualudis) and library], +dnl [ENABLE_QA=$enableval +dnl AC_MSG_RESULT([$enableval])], +dnl [ENABLE_QA=no +dnl AC_MSG_RESULT([no])]) +ENABLE_QA=no +AC_SUBST([ENABLE_QA]) +AM_CONDITIONAL([ENABLE_QA], test "x$ENABLE_QA" = "xyes") +dnl }}} + +dnl {{{ built sources +GENERATED_FILE=misc/generated-file.txt +AC_SUBST_FILE(GENERATED_FILE) + +BUILDUSER=`whoami` +AC_SUBST([BUILDUSER]) +BUILDHOST=`hostname` +AC_SUBST([BUILDHOST]) +BUILDDATE=`date --iso=seconds` +AC_SUBST([BUILDDATE]) +if test -d "${ac_top_srcdir:-./}/.svn" ; then + SVNVERSION=`svnversion "${ac_top_srcdir:-./}"` +else + SVNVERSION= +fi +AC_SUBST([SVNVERSION]) +dnl }}} + +dnl {{{ output +AM_CONFIG_HEADER(config.h) +AC_OUTPUT( + Makefile + doc/Makefile + doc/doxygen.conf + ebuild/Makefile + ebuild/digests/Makefile + ebuild/utils/Makefile + hooks/Makefile + misc/Makefile + misc/svn-version-filter-data.bash + paludis/Makefile + paludis/about.hh + paludis/args/Makefile + paludis/hashed_containers.hh + paludis/qa/Makefile + paludis/util/Makefile + src/Makefile + src/qualudis/Makefile + test/Makefile + ) +dnl }}} + diff --git a/0.2.0/doc/Makefile.am b/0.2.0/doc/Makefile.am new file mode 100644 index 000000000..1ceb7738c --- /dev/null +++ b/0.2.0/doc/Makefile.am @@ -0,0 +1,36 @@ +CLEANFILES = *~ html/* html +MAINTAINERCLEANFILES = Makefile.in + +docfiles = \ + doc_main.doxygen \ + doc_mainpage.doxygen \ + doc_coding_standards.doxygen \ + doc_namespaces.doxygen \ + doc_directories.doxygen \ + doc_references.doxygen \ + doc_licence.doxygen \ + doc_authors.doxygen \ + doc_bootstrap_howto.doxygen \ + doc_changelog.doxygen \ + doc_portage_differences.doxygen + +EXTRA_DIST = doxygen.conf.in header.html footer.html paludis.css $(docfiles) + +if HAVE_DOXYGEN + +doxygen : doxygen.conf $(top_srcdir)/paludis/*.cc $(top_srcdir)/paludis/*.hh \ + $(docfiles) + doxygen doxygen.conf + +else + +doxygen : + @echo "You don't have doxygen installed!" + exit 1 + +endif + +upload-homepage : doxygen + cd `readlink -f $(top_srcdir)/doc/html` && tar jc ./ | \ + ssh shell.berlios.de tar vjx -C /home/groups/paludis/htdocs/ + diff --git a/0.2.0/doc/doc_authors.doxygen b/0.2.0/doc/doc_authors.doxygen new file mode 100644 index 000000000..8d9d855de --- /dev/null +++ b/0.2.0/doc/doc_authors.doxygen @@ -0,0 +1,9 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** +\page Authors Authors + +\verbinclude AUTHORS + +*/ + diff --git a/0.2.0/doc/doc_bootstrap_howto.doxygen b/0.2.0/doc/doc_bootstrap_howto.doxygen new file mode 100644 index 000000000..879266d27 --- /dev/null +++ b/0.2.0/doc/doc_bootstrap_howto.doxygen @@ -0,0 +1,302 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** +\page BootstrapHowto Bootstrap Howto + +\section BootstrapHowtoMain How to make a Paludis chroot + +\warning READ EVERYTHING CAREFULLY, OR YOU WILL BREAK YOUR SYSTEM! + +<b>THIS WILL PROBABLY NOT ACTUALLY WORK!</b> Paludis is at the very +early alpha stage. It can sometimes install things, if you're very lucky, and +if you're really lucky it might let you upgrade or uninstall them too. There are +zillions of things that are not implemented. There are zillions of things that +Paludis does differently from Portage -- some of these are intentional, some are +not. + +You should join the <code>#paludis</code> channel on Freenode. If you're doing +anything development-related, you should probably also ask to be allowed to +subscribe to the <code>paludis-sekrit</code> mailing list. + +\warning Do not try to use Paludis and Portage to install things inside the same + root. The config and vdb formats are not compatible! + +\section BootstrapHowtoRequirements Requirements + +Install Paludis locally, being sure to configure <code>sysconfdir</code> as +<code>/etc</code> to avoid confusion later on. There's an ebuild +<a href="http://svn.berlios.de/viewcvs/%2acheckout%2a/paludis/overlay/sys-apps/paludis/paludis-0.ebuild">here</a>. + +You'll need libebt, eselect and Subversion. You'll also need either g++-3.4, +g++-4.1 or some other reasonably standard C++ compiler along with a complete +standard library implementation (so no uClibc++). If you're trying to run on +non-Linux, you'll also need to fix a few includes and submit a patch. + +Make sure the test suite passes (either <code>FEATURES="test"</code> for +Portage, or <code>make check</code>). If it fails, don't continue until you +figure out why. + +\section BootstrapConfiguration Configuration + +Set up a local bootstrap config directory. We're assuming in this document that +you're using <code>/mychroot</code> as the root path, but anywhere not on a +noexec / nodev filesystem should work. The reason for doing things this way will +become apparent later on. + +\verbatim +mkdir ~/.paludis-bootstrap +cat <<END > ~/.paludis-bootstrap/specpath +root = /mychroot +config-suffix = +END +\endverbatim + +Make some skeleton directories and files: + +\verbatim +mkdir -p /mychroot/etc/{env.d,paludis/repositories} +mkdir -p /mychroot/var/{db/pkg,paludis/repositories/gentoo/distfiles} +mkdir -p /mychroot/tmp/ +touch /mychroot/etc/ld.so.conf +\endverbatim + +Set up your <code>keywords.conf</code>. At the very least, you'll need a <code>* +keywords</code> line. Further lines can be added in the form "atom keywords". +Like with Portage, accepting <code>~keyword</code> does <b>not</b> accept +<code>keyword</code>, so if you want a fully <code>~arch</code> system you +should use <code>* arch ~arch</code>. + +\verbatim +cat <<END > /mychroot/etc/paludis/keywords.conf +* x86 +dev-cpp/libebt x86 ~x86 +sys-apps/paludis x86 ~x86 +dev-util/subversion x86 ~x86 +app-admin/eselect x86 ~x86 +app-editors/vim x86 ~x86 +app-editors/vim-core x86 ~x86 +END +\endverbatim + +Set up your <code>use.conf</code>. At the very least, you'll need a <code>* +flags</code> line. Again, additional per-atom lines can be specified. The +<code>-apache2</code> is important, if you value your sanity, since you'll be +installing subversion. We're experimenting with a slightly different way of +handling <code>USE_EXPAND</code> variables that allows different settings for +different packages. This may change, but for now it looks like this: + +\verbatim +cat <<END > /mychroot/etc/paludis/use.conf +* -doc nls -apache2 LINGUAS: en INPUT_DEVICES: keyboard mouse VIDEO_CARDS: ati +app-editors/vim -nls +END +\endverbatim + +Set up your <code>licenses.conf</code>. If you don't care about licences, which +is probably wise until we get licence grouping, it should look like this: + +\verbatim +cat <<END > /mychroot/etc/paludis/licenses.conf +* * +END +\endverbatim + +If you want some more fun, the following list might be enough to install a +base system if you don't turn on too many extra USE flags: + +\verbatim +cat <<END > /mychroot/etc/paludis/licenses.conf +# These are the basic system requirements. It's possible to knock off +# a few of these by turning off some default USE flags. +* LGPL-2.1 LGPL-2 GPL-2 BSD MIT BZIP2 Artistic DB PSF-2.1.1 PSF-2.2 +* as-is tcp_wrappers_license freedist ZLIB openssl CRACKLIB PAM FLEX + +# These are needed to get Subversion. +* Apache-1.1 Apache-2.0 + +# These are needed to get an editor that doesn't suck. +* vim + +# These are needed if you want modular X. This is utterly ridiculous, +# and the people responsible for using different licence IDs for +# identical licences should be shot. +* xorg-server libXfont xtrans util-macros libfontenc xproto fontsproto +* FTL fontcacheproto libXau libXext libX11 libXdmcp kbproto inputproto +* xf86bigfontproto bigreqsproto xextproto xcmiscproto libxkbfile libXmu +* libXt libSM libICE libXrender renderproto libXi libXxf86vm +* xf86vidmodeproto libdrm MOTIF libXaw libXpm libXp printproto xbitmaps +* makedepend xf86driproto glproto font-adobe-75dpi bdftopcf font-util +* encodings mkfontscale mkfontdir font-misc-misc font-cursor-misc +* xkbcomp iceauth rgb xauth xinit twm xclock libXft fontconfig xrdb X11 +* libXxf86misc xf86miscproto libdmx dmxproto libXtst recordproto libXres +* resourceproto libxkbui liblbxutil randrproto fixesproto damageproto +* xf86dgaproto xf86rushproto compositeproto videoproto scrnsaverproto +* evieext trapproto xineramaproto glut setxkbmap xhost xmodmap xrandr +* libXrandr libXcomposite libXfixes libXcursor libXdamage libXv +* libXxf86dga libXinerama libXScrnSaver BitstreamVera font-bh-type1 +* font-adobe-utopia-type1 font-adobe-100dpi xorg-docs +* xf86-input-keyboard xf86-input-mouse xf86-video-ati font-alias +END +\endverbatim + +Set up your <code>package_unmask.conf</code> and <code>package_mask.conf</code>, +if necessary:: + +\verbatim +cat <<END > /mychroot/etc/paludis/package_unmask.conf +app-editors/vim +app-editors/vim-core +END +\endverbatim + +Set up your <code>bashrc</code>. This must <b>NOT</b> be used to change any +values that affect dependency resolution (e.g. <code>USE</code>, +<code>LINGUAS</code>). It can be used to set <code>CFLAGS</code>, +<code>CHOST</code> and the like (on some archs you'll have to do this to +avoid getting junk from your profile). Remember to <code>export</code> your +variables. + +Unfortunately, some packages in system have broken test suites, and some +packages abuse non-${ROOT} locations in pkg_postinst. Thus, you will also +need to add a bit of magic to work around these packages. + +\note The backslash before the dollar is for cat. If you're not using cat, + don't include the backslash before the dollar signs. + +\verbatim +cat <<END > /mychroot/etc/paludis/bashrc +export CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer" +export CXXFLAGS="\${CFLAGS}" +export CHOST="i686-pc-linux-gnu" +export MAKEOPTS="-j2" +export EBEEP_IGNORE="yes" +export EPAUSE_IGNORE="yes" + +case "${PN}" in + + python) + export SKIP_FUNCTIONS=test + export SANDBOX_PREDICT=/ + ;; + + automake|glibc|e2fsprogs|neon|gettext) + export SKIP_FUNCTIONS=test + ;; + +esac + +END +\endverbatim + +Set up your repository files. Do not tinker with the VDB location, it +<b>must</b> go in <code>${ROOT}/var/db/pkg</code>. Here we'll avoid using +<code>/usr/portage</code> for the main tree because sticking data that gets +changed on <code>/usr</code> is silly. We use the <code>${ROOT}</code> variable, +which is set magically, to make the config work both in and outside of a +chroot (this is one of the reasons we have the weird-looking specpath +thing): + +\verbatim +cat <<END > /mychroot/etc/paludis/repositories/gentoo.conf +location = \${ROOT}/var/paludis/repositories/gentoo/ +sync = rsync://rsync.europe.gentoo.org/gentoo-portage/ +profile = \${ROOT}/var/paludis/repositories/gentoo/profiles/default-linux/x86/2006.0 +format = portage +END + +cat <<END > /mychroot/etc/paludis/repositories/installed.conf +location = \${ROOT}/var/db/pkg/ +format = vdb +END + +cat <<END > /mychroot/etc/paludis/repositories/paludis-overlay.conf +location = \${ROOT}/var/paludis/repositories/paludis-overlay/ +sync = svn://svn.berlios.de/paludis/overlay +profile = \${ROOT}/var/paludis/repositories/gentoo/profiles/default-linux/x86/2006.0 +eclassdir = \${ROOT}/var/paludis/repositories/gentoo/eclass +distdir = \${ROOT}/var/paludis/repositories/gentoo/distfiles +cache = /var/empty +format = portage +importance = 10 +END +\endverbatim + +\section BootstrapHowtoSync Initial Sync + +Now check that the config looks ok, and sync: + +\verbatim +paludis --config-suffix bootstrap --list-repositories +sudo paludis --config-suffix bootstrap --sync +\endverbatim + +If you have problems, try adding <code>--log-level debug</code>. This may or may +not give helpful information... This applies at all stages. + +The initial sync will be slow. You can cheat and copy an existing Portage tree +checkout into <code>/mychroot/var/paludis/repositories/gentoo/</code>, but +remember to preserve mtimes and permissions if you do. Note that there's no +hideously painful 'Updating the Portage cache...' to go through. Paludis will +use the metadata cache, if available, but does not use the dep cache. + +\section BootstrapInstalling Installing Things + +Now install baselayout and then system. We install baselayout manually first +because it's easier than creating a bunch of directories by hand. + +Note that there're a whole load of circular dependencies in system +(ncurses <-> gpm, patch <-> patch, gcc <-> glibc for example), so you'll +almost certainly need --dl-drop-circular at this stage. + +\verbatim +paludis --config-suffix bootstrap --install --pretend --dl-drop-all sys-apps/baselayout +sudo paludis --config-suffix bootstrap --install --dl-drop-all sys-apps/baselayout + +paludis --config-suffix bootstrap --install --pretend --dl-drop-circular system +sudo paludis --config-suffix bootstrap --install --dl-drop-circular system +\endverbatim + +Note that system will pull in Portage. That's a profiles thing that's +unavoidable for now. It won't pull in Paludis, so we do that manually. + +\note It seems apr and apr-util are rather picky about compiling into ROOT +unless an identical version is installed onto / . + +\verbatim +paludis --config-suffix bootstrap --install --pretend sys-apps/paludis +sudo paludis --config-suffix bootstrap --install sys-apps/paludis +\endverbatim + +\section BootstrapHowtoChroot Chrooting + +And that should (but probably won't) give you a usable chroot: + +\verbatim +sudo cp /etc/resolv.conf /mychroot/etc/ +sudo chroot /mychroot +reset +export HOME=/root +cd +cp /etc/skel/.bashrc . +. .bashrc +ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime +mount -tproc none /proc +mount -tsysfs none /sys +udevstart +mount -tdevpts none /dev/pts +eselect env update +source /etc/profile +( . /etc/paludis/bashrc ; export REAL_CHOST=$CHOST ; gcc-config 1 ) +eselect env update +source /etc/profile +paludis --uninstall sys-apps/portage +paludis --install app-editors/vim +paludis --uninstall app-editors/nano +\endverbatim + +If you're especially crazy you can tar up your chroot and use it like a stage 3 +when installing a system. This has worked at least once for one person, but +note that there was a full moon at the time. + +*/ + diff --git a/0.2.0/doc/doc_changelog.doxygen b/0.2.0/doc/doc_changelog.doxygen new file mode 100644 index 000000000..7d387e23c --- /dev/null +++ b/0.2.0/doc/doc_changelog.doxygen @@ -0,0 +1,10 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** +\page ChangeLog ChangeLog + +\verbinclude ChangeLog + +*/ + + diff --git a/0.2.0/doc/doc_coding_standards.doxygen b/0.2.0/doc/doc_coding_standards.doxygen new file mode 100644 index 000000000..50030231c --- /dev/null +++ b/0.2.0/doc/doc_coding_standards.doxygen @@ -0,0 +1,184 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** +\page CodingStandards Coding Standards + +These are rough guidelines. You should stick to these unless there's a good +reason to do otherwise. There are lots more standards that aren't documented +here yet -- ask for clarification as necessary. + +\section CodingStandardsCopyrights Copyrights and Licence + +Paludis is licenced under the GPLv2. Any contributions must use this licence. +You should copy the standard licence header from another source file when +creating new source files. + +Copyright is handled on a per-file basis. If you are the primary author of +a file, you should list yourself as the copyright holder. If you make a +substantial contribution to a source file (for example, one or more +non-trivial classes, functions or methods), you should add yourself as a +copyright holder on that file. You should <em>not</em> add to the copyright for +small changes or bug fixes. + +Copyright years are per contributor. See, for example, paludis/fs_entry.hh for +a file that has multiple copyright holders with different years. + +Substantial contributors should also list themselves in the AUTHORS file. + +\section CodingStandardsIndentingAndSpacing Indenting and Spacing + +Indents are four spaces. There are no tabs anywhere. Braces go on a line of +their own, and may be omitted if the clarity of the code isn't affected. Make +sure you don't include trailing whitespace. + +Function calls have no space before or after the parentheses. Most operators +and built-in functions have spaces before the opening parenthesis but not +inside. The ! operator has a space after it. + +For example:: +\code +if (some_function("moo", 2)) + do_stuff("moo"); +else +{ + // this needs some explanation + while (end != do_other_stuff(foo) || ! foo) + ++foo; +} +\endcode + +\section CodingStandardsSwitches Switches + +You'll sometimes see code like this: + +\code +do +{ + switch (my_enum) + { + case e_one: + // ... + continue; + + case e_two: + // ... + continue; + } + + throw InternalError(PALUDIS_HERE, "Unexpected value for my_enum"); +} while (false); +\endcode + +The reason for using this rather than a <code>default:</code> label is that the +compiler will (or at least the compiler we use will) generate a warning if +someone later goes and adds <code>e_three</code>, and we haven't updated our +switch to recognise it. + +\section CodingStandardsComments Comments + +All public and protected interfaces and classes should be documented in the +header files via Doxygen. Implementations should be documented appropriately -- +explain complicated or unobvious parts and anything that can easily be broken +by other people. Don't bother with comments on obvious things. + +\section CodingStandardsNaming Naming + +Types are named in <code>MixedCaseNoUnderscores</code>. + +Variables and functions are named in <code>lower_case_with_underscores</code>. + +Private member variables that aren't going to end up being used anywhere +external are <code>_prefixed_with_underscore</code>. + +Template values are <code>suffixed_with_underscore_</code>, and template +typenames are <code>SuffixedAsWell_</code> (and use <code>typename</code> rather +than <code>class</code>, \ref EffCpp item 42). + +The files for <code>SomeClass</code> (and any small related utilities) would be +<code>some_class.hh</code> and <code>some_class.cc</code>. We are somewhat +inconsistent when it comes to what warrants its own file -- originally it was +pretty much one class per file, but then compiles started taking too long so +it's now more like one class plus related utilities and exceptions per file. + +Macros are <code>PALUDIS_UPPER_CASE</code>, but they're evil (\ref TCppPL +section 7.8, \ref EffCpp item 2) so don't use them. + +Very short names for loop indices and the like are fine, but prefer longer, +self-documenting names for proper variables. For loop iterator pairs, the +usual style is: + +\code +for (MyType::Iterator i(my_container.begin()), i_end(my_container.end()) ; + i != i_end ; ++i) +{ + // ... +} +\endcode + +If there's a convenient standard library algorithm available, use that +instead of a manual loop (\ref EffSTL item 43). + +\section CodingStandardsPointers Pointers and References + +Try to avoid returning raw pointer types from raw interfaces, especially if the +programmer is expected to deallocate them manually. Make liberal use of +<code>paludis::CountedPtr</code> instead -- it's low overhead and a lot less +prone to subtle screwups. See \ref EffCpp item 18. + +Pass object parameters by const reference rather than pointer to const unless +you're prepared to accept a zero pointer. Avoid pass by value except for small +integral types. See \ref EffCpp item 20. + +\section CodingStandardsNamespaces Namespaces + +Everything under <code>paludis/</code> should be inside namespace +<code>paludis</code>. Sometimes sub-namespaces are used where they look useful. + +\section CodingStandardsIncludeGuards Include Guards + +Include guards are <code>\#define PALUDIS_GUARD_FILE_NAME_HH 1</code>. + +\section CodingStandardsStandardLibrary Standard Library + +Never use <code>using namespace std</code>. It can bring arbitrary weirdness +into the current namespace. It's ok to selectively introduce things from std +where they're used a lot. See \ref TCppPL section 8.2.9.1. + +Make use of the standard library where suitable. It has fewer bugs than +code you write yourself, and it may be doing clever optimisations behind +the scenes. + +Remember the container member functions. Many containers have template +constructors that take iterator pairs. Many containers have assign and +swap methods. Use these over <code>std::copy</code>. See \ref EffSTL item +25. + +Don't use <code>vector<bool></code>. It's just not worth it. See +\ref EffSTL item 18. + +Although some compilers will let you get away with <code>std::make_pair("foo", +"bar")</code>, some won't. Strictly speaking this violates the standard. +Use <code>std::make_pair(std::string("foo"), std::string("bar"))</code> instead. + +\section CodingStandardsCasts Casts + +<code>dynamic_cast</code> is banned. It's slow (\ref EffCpp item 27) and a sign +that you should be using one of visitors (\ref GoF Visitor), multiple dispatch +(\ref MCppD chapter 11) or capability queries via a <code>get_interface</code> +type method (for example, as described in \ref GoF Composite -- Implementation +item 4) instead. + +<code>reinterpret_cast</code> is probably banned as well, unless we end up +having to talk to some weirdly broken C libraries. + +There are very few legitimate uses for <code>const_cast</code>. It +<em>might</em> be ok to use it as described in \ref EffCpp item 3. It +<em>might</em> be ok to use it to talk to C libraries. + +There's nothing wrong with making appropriate use of <code>static_cast</code>. + +Old C style <code>(Type) variable</code> casts are banned. Function style casts +(that is, <code>Type(value)</code>) should only be used when calling an explicit +constructor to pass an object to a function. See \ref EffCpp item 27. + +*/ diff --git a/0.2.0/doc/doc_directories.doxygen b/0.2.0/doc/doc_directories.doxygen new file mode 100644 index 000000000..6db86ff2c --- /dev/null +++ b/0.2.0/doc/doc_directories.doxygen @@ -0,0 +1,18 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** \dir paludis + * Paludis library code. + */ + +/** \dir src + * Paludis program source. + */ + +/** \dir paludis/args + * Paludis commandline argument handling utilities. + */ + +/** \dir test + * Test framework. + */ + diff --git a/0.2.0/doc/doc_licence.doxygen b/0.2.0/doc/doc_licence.doxygen new file mode 100644 index 000000000..f1938f5f0 --- /dev/null +++ b/0.2.0/doc/doc_licence.doxygen @@ -0,0 +1,12 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** +\page Licence Licence + +Paludis is distributed under the terms of the GNU General Public Licence, +version 2. + +\verbinclude COPYING + +*/ + diff --git a/0.2.0/doc/doc_main.doxygen b/0.2.0/doc/doc_main.doxygen new file mode 100644 index 000000000..e224c2ca1 --- /dev/null +++ b/0.2.0/doc/doc_main.doxygen @@ -0,0 +1,321 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +// ----- Top Level Groups ----- + +/** \defgroup grplibpaludis Main Paludis library + */ + +/** \defgroup grplibpaludisutil Paludis utilities library + */ + +/** \defgroup grplibpaludisqa Paludis QA library + */ + +/** \defgroup grplibpaludisargs Paludis args library + */ + +/** \defgroup grptestcases Test cases + */ + +/** \defgroup grpexceptions Exceptions + */ + +// ----- grplibpaludis Subgroups ----- + +/** \defgroup grpdependencies Dependencies + * + * \ingroup grplibpaludis + */ + +/** \defgroup grpabout About Paludis + * + * \ingroup grplibpaludis + */ + +/** \defgroup grpconfigfile Configuration files + * + * \ingroup grplibpaludis + */ + +/** \defgroup grpenvironment Environment + * + * \ingroup grplibpaludis + */ + +/** \defgroup grphashedcontainers Hashed containers + * + * \ingroup grplibpaludis + */ + +/** \defgroup grpnames Names + * + * \ingroup grplibpaludis + */ + +/** \defgroup grpversions Versions + * + * \ingroup grplibpaludis + */ + +/** \defgroup grpcontents Contents + * + * \ingroup grplibpaludis + */ + +// ----- grpconfigfile Subgroups ----- + +/** \defgroup grpkvconfigfile Key/Value configuration file + * + * \ingroup grpconfigfile + */ + +/** \defgroup grplineconfigfile Line configuration file + * + * \ingroup grpconfigfile + */ + +/** \defgroup grpadvisoryconfigfile Security advisory file + * + * \ingroup grpconfigfile + */ + +// ----- grpenvironment Subgroups ----- + +/** \defgroup grpdefaultenvironment Default environment + * + * \ingroup grpenvironment + */ + +/** \defgroup grptestenvironment Test environment + * + * \ingroup grpenvironment + */ + +/** \defgroup grppackagedatabase Package database + * + * \ingroup grpenvironment + */ + +/** \defgroup grpmaskreasons Mask reasons + * + * \ingroup grpenvironment + */ + +// ----- grpdefaultenvironment Subgroups ----- + +/** \defgroup grpdefaultconfig Default configuration + * + * \ingroup grpdefaultenvironment + */ + +// --- grppackagedatabase Subgroups ----- + +/** \defgroup grprepository Repositories + * + * \ingroup grppackagedatabase + */ + +// --- grprepository Subgroups ----- + +/** \defgroup grpfakerepository Fake repository + * + * \ingroup grprepository + */ + +/** \defgroup grpportagerepository Portage repository + * + * \ingroup grprepository + */ + +/** \defgroup grpvdbrepository VDB repository + * + * \ingroup grprepository + */ + +/** \defgroup grpebuildinterface Ebuild interface + * + * \ingroup grprepository + */ + +/** \defgroup grpsyncer Sync protocol handler classes + * + * \ingroup grprepository + */ + +// ----- grpdepatoms Subgroups ----- + +/** \defgroup grpdepatomdumper Dep atom dumper + * + * \ingroup grpdepatoms + */ + +/** \defgroup grpdepatomflattener Dep atom flattener + * + * \ingroup grpdepatoms + */ + +/** \defgroup grpdepatomprettyprinter Dep atom pretty printer + * + * \ingroup grpdepatoms + */ + +// ----- grpdependencies Subgroups ----- + +/** \defgroup grpdepresolver Dependency resolution + * + * \ingroup grpdependencies + */ + +/** \defgroup grpdepatoms Dependency atoms + * + * \ingroup grpdependencies + */ + +/** \defgroup grpdepparser Dependency parsing + * + * \ingroup grpdependencies + */ + +/** \defgroup grpmatchpackage Match package + * + * \ingroup grpdependencies + */ + +// ----- grpdepparser Subgroups ----- + +/** \defgroup grpdeplexer Dependency lexing + * + * \ingroup grpdepparser + */ + +// ----- grplibpaludisutil Subgroups ----- + +/** \defgroup grpcollections Collections + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpcompare Comparisons + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grppatterns Patterns + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpcontainerentries Container entries + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grppointers Pointers + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpdeleter Deleter + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpfilesystem Filesystem + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpstrings Strings + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grplog Log + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpsystem System + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grprandom Random numbers + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpsave Save + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grprecords Records + * + * \ingroup grplibpaludisutil + */ + +/** \defgroup grpvalidated Validated + * + * \ingroup grplibpaludisutil + */ + +// ----- grppatterns Subgroups ----- + +/** \defgroup grpcomposite Composite pattern + * + * \ingroup grppatterns + */ + +/** \defgroup grpinstance Instance patterns + * + * \ingroup grppatterns + */ + +/** \defgroup grppimp Private implementation pattern + * + * \ingroup grppatterns + */ + +/** \defgroup grpvc Virtual constructor + * + * \ingroup grppatterns + */ + +/** \defgroup grpvisitor Visitor + * + * \ingroup grpvisitor + */ + +// ----- grpstrings Subgroups ----- + +/** \defgroup grpdestringify Destringify + * + * \ingroup grpstrings + */ + +/** \defgroup grpjoin Join + * + * \ingroup grpstrings + */ + +/** \defgroup grpstringify Stringify + * + * \ingroup grpstrings + */ + +/** \defgroup grptokenise Tokenise + * + * \ingroup grpstrings + */ + +/** \defgroup grpmatch Match + * + * \ingroup grpstrings + */ + +/** \defgroup grpstrippers Strippers + * + * \ingroup grpstrings + */ + diff --git a/0.2.0/doc/doc_mainpage.doxygen b/0.2.0/doc/doc_mainpage.doxygen new file mode 100644 index 000000000..38d5e4d36 --- /dev/null +++ b/0.2.0/doc/doc_mainpage.doxygen @@ -0,0 +1,57 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** \mainpage + +\section overview Overview + +This is the documentation for Paludis, the other package manager. It is available as part of Paludis via <code>make doxygen</code>, or on the web at <a href="http://paludis.berlios.de/">the Paludis project page</a>. + +\section userdocs For End Users + +You shouldn't be touching Paludis at the moment. Paludis will delete all your +files, then delete everyone else's files, then rape your dog. Go away. + +If you're still here, read \link BootstrapHowto the Bootstrap HOWTO \endlink for +how to break your system or possibly set up a chroot. You may also like to read +about \link PortageDifferences some of the differences between Paludis and +Portage\endlink. + +We have a <a href="https://developer.berlios.de/bugs/?group_id=6360">bug +tracker</a> and some +<a href="https://developer.berlios.de/mail/?group_id=6360">mailing lists</a>, but +you shouldn't try to use these until after you've discussed your problem in our +IRC channel. Read the howto for more details. + +\section developerdocs For Developers + +Start by getting a +<a href="https://developer.berlios.de/svn/?group_id=6360">Subversion +checkout</a>, and reading the \link PortageDifferences Paludis and Portage +differences \endlink document. + +It's best to start by skimming over the main program to get a feel for how +everything fits together. Useful files: + +- src/paludis.cc The main program. +- src/query.cc The --query action handler. +- src/install.cc The --install action handler. +- src/applets.cc Various small action handlers. +- src/list.cc The --list action handlers + +After that, the following classes are good places to begin: + +- paludis::DefaultEnvironment provides a representation of the default + operating environment. +- paludis::PackageDatabase provides routines for querying packages. An + instance can be obtained via paludis::DefaultEnvironment. +- paludis::DepList can be used for making dependency lists. +- paludis::Repository is subclassed to do querying, installing, + uninstalling, syncing and the like. + +The <a href="modules.html">Modules</a> link in the header bar will probably +be of more use than any of the full class lists. + +You should also read \link CodingStandards the Coding Standards \endlink +before tinkering. + +*/ diff --git a/0.2.0/doc/doc_namespaces.doxygen b/0.2.0/doc/doc_namespaces.doxygen new file mode 100644 index 000000000..8b8164f16 --- /dev/null +++ b/0.2.0/doc/doc_namespaces.doxygen @@ -0,0 +1,29 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** \namespace test_cases + * Test cases. + * + * \ingroup Test + */ + +/** \namespace test + * Test framework. + * + * \ingroup Test + */ + +/** \namespace paludis + * Paludis library code. + */ + +/** \namespace paludis::args + * Commandline argument handling. + * + * \ingroup Args + */ + +/** \namespace paludis::qa + * QA checks. + * + * \ingroup Args + */ diff --git a/0.2.0/doc/doc_portage_differences.doxygen b/0.2.0/doc/doc_portage_differences.doxygen new file mode 100644 index 000000000..865e27a2f --- /dev/null +++ b/0.2.0/doc/doc_portage_differences.doxygen @@ -0,0 +1,73 @@ +/* vim: set ft=cpp tw=80 sw=4 et spell spelllang=en : */ + +/** +\page PortageDifferences How Paludis and Portage Differ + +This is not a complete list. It's not even vaguely near complete. Rather, it's +a collection of lists of things of interest that are intentionally different +between Paludis and its predecessor, Portage. + +\section PortageDifferencesEndUser For the End User + +Paludis isn't aimed at end users. Having said that, the following features +would be relevant if it were: + +- A whole different configuration system, making it far easier to maintain + multiple systems, some in chroots, with entirely separate configuration + files. + +- Performance. Paludis is fast. + +- Low dependency bloat. No Python, no big external crypto libraries. + +- Security integration. + +- Multiple repository support, replacing Portage's highly limited overlays. + +- Simple per-(category, package, version, anything else) environment variable + setting (e.g. CFLAGS). + +- Licence filtering. + +- Hook scripts, for running code after a certain action occurs. + +- Wrappers for econf, emake, wget etc to allow user defined command bindings + (nice, ionice, taskset etc). + +\section PortageDifferencesEbuildDeveloper For the Ebuild Developer + +As well as the end user advantages, ebuild authors will benefit from: + +- :slot dependencies + +- ::repository dependencies + +- [use] dependencies + +- Circular dependency detection + +- Per package use masking, and from this per package use combination + restrictions. + +- Default deep dependency resolution. + +- Support for -scm versions. + +- Multiple inheritance for profiles. + +- Ability to install hook scripts. + +\section PortageDifferencesProgrammer For the Programmer + +- Proper library / interface separation. + +- Reasonable internals documentation, via Doxygen. + +- Consistent interfaces for different repository types. + +- Modularity where it matters. + +- Test suites, to detect the impact of changes. + +*/ + diff --git a/0.2.0/doc/doc_references.doxygen b/0.2.0/doc/doc_references.doxygen new file mode 100644 index 000000000..2609f8de6 --- /dev/null +++ b/0.2.0/doc/doc_references.doxygen @@ -0,0 +1,43 @@ +/* vim: set ft=cpp tw=80 sw=4 et : */ + +/** +\page References References + +\section ReferencesBooks Books + +\anchor AppCrypt +<strong>AppCrypt</strong>: Applied Cryptography Second Edition / Bruce +Schneier / Wiley / ISBN 0-471-11709-9 + +\anchor EffCpp +<strong>EffCpp</strong>: Effective C++ Third Edition / Scott Meyers / +Addison-Wesley / ISBN 0-321-33487-6 + +\anchor EffSTL +<strong>EffSTL</strong>: Effective STL / Scott Meyers / Addison-Wesley / ISBN +0-201-74962-9 + +\anchor GoF +<strong>GoF</strong>: Design Patterns: Elements of Reusable Object-Oriented +Software / Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides / +Addison-Wesley / ISBN 0-201-63361-2 + +\anchor MCppD +<strong>MCppD</strong>: Modern C++ Design: Generic Programming and Design +Patterns Applied / Andrei Alexandrescu / Addison-Wesley / ISBN 0-201-70431-5 + +\anchor TaoCP2 +<strong>TaoCP2</strong>: The Art of Computer Programming, Volume 2: +Seminumerical Algorithms, Third Edition / Donald E. Knuth / Addison-Wesley / +ISBN 0-201-89684-2 + +\anchor TCppSL +<strong>TCppSL</strong>: The C++ Standard Library / Nicolai M. Josuttis / +Addison-Wesley / ISBN 0-201-37926-0 + +\anchor TCppPL +<strong>TCppPL</strong>: The C++ Programming Language Third Edition / Bjarne +Stroustrup / Addison-Wesley / ISBN 0-201-88954-4 + +*/ + diff --git a/0.2.0/doc/doxygen.conf.in b/0.2.0/doc/doxygen.conf.in new file mode 100644 index 000000000..a266c2f30 --- /dev/null +++ b/0.2.0/doc/doxygen.conf.in @@ -0,0 +1,1223 @@ +# Doxyfile 1.4.2 + +@GENERATED_FILE@ + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = @PACKAGE@ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = "Version @VERSION@" + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = YES + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the progam writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = "../misc/svn-version-filter.bash" + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../paludis ../paludis/args ../paludis/util ../test ../doc ../src + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm + +FILE_PATTERNS = *.hh *.cc *.doxygen + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = YES + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = ../ + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = "grep -v '^#define .*_GUARD_'" + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = header.html + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = footer.html + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = paludis.css + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = YES + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = DOXYGEN + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = @HAVE_DOT@ + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = NO + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = NO + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = NO + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + + + diff --git a/0.2.0/doc/footer.html b/0.2.0/doc/footer.html new file mode 100644 index 000000000..a6d1e0c74 --- /dev/null +++ b/0.2.0/doc/footer.html @@ -0,0 +1,12 @@ +<div class="qindex" style="text-align: center; margin-top: 1em;"> + <p>Copyright © 2005, 2006 Ciaran McCreesh and various. See the <a href="Authors.html">Authors list</a> and <a href="Licence.html">Licence</a> for details and redistribution conditions.</p> + <table style="border-style: none; margin: auto;"> + <tr> + <td style="text-align: center; padding: 2px 50px;"><a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" border="0"></a></td> + <td style="text-align: center; padding: 2px 50px;"><a href="http://developer.berlios.de" title="BerliOS Developer"><img src="http://developer.berlios.de/bslogo.php?group_id=6360" border="0" alt="BerliOS Developer Logo"></a></td> + </tr> + </table> +</div> +</body> +</html> + diff --git a/0.2.0/doc/header.html b/0.2.0/doc/header.html new file mode 100644 index 000000000..d234e711a --- /dev/null +++ b/0.2.0/doc/header.html @@ -0,0 +1,31 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!-- vim: set sw=4 sts=4 et : --> +<html> + <head> + <title>$title</title> + <link href="$relpath$paludis.css" rel="stylesheet" type="text/css"> + </head> + <body> + <div class="qindex">Documentation: [ + <a class="qindex" href="index.html">Main Page</a> | + <a class="qindex" href="modules.html">Modules</a> | + <a class="qindex" href="namespaces.html">Namespace List</a> | + <a class="qindex" href="annotated.html">Class List</a> | + <a class="qindex" href="files.html">File List</a> | + <a class="qindex" href="namespacemembers.html">Namespace Members</a> | + <a class="qindex" href="functions.html">Class Members</a> | + <a class="qindex" href="globals.html">File Members</a> | + <a class="qindex" href="pages.html">Other Topics</a> ] + </div> + <div class="qindex">About: [ + <a class="qindex" href="ChangeLog.html">ChangeLog</a> | + <a class="qindex" href="Licence.html">Licence</a> | + <a class="qindex" href="Authors.html">Authors</a> | + <a class="qindex" href="CodingStandards.html">Coding Standards</a> | + <a class="qindex" href="BootstrapHowto.html">Bootstrap Howto</a> | + <a class="qindex" href="PortageDifferences.html">Portage Differences</a> | + <a class="qindex" href="https://developer.berlios.de/projects/paludis/">Berlios Project Page</a> | + <a class="qindex" href="https://developer.berlios.de/svn/?group_id=6360">SVN</a> ] + </div> + + diff --git a/0.2.0/doc/paludis.css b/0.2.0/doc/paludis.css new file mode 100644 index 000000000..3fe883fcc --- /dev/null +++ b/0.2.0/doc/paludis.css @@ -0,0 +1,322 @@ +body { + background-color: #eeeeee; + color: #333333; +} + +h1 { + text-align: center; + font-size: x-large; + border-bottom: 1px dashed #999999; +} + +h2 { + text-align: left; + border-bottom: 1px dashed #999999; + font-size: x-large; +} + +h3 { + font-size: large; +} + +caption { + font-weight: bold; +} + +div.qindex { + width: 100%; + background-color: #cccccc; + border: 1px solid #999999; + text-align: center; + margin: 2px; + padding: 2px; + font-size: 80%; + line-height: 140%; +} + +div.nav { + width: 100%; + background-color: #cccccc; + border: 1px solid #999999; + text-align: center; + margin: 2px; + padding: 2px; + font-size: 80%; + line-height: 140%; +} + +a:link { + text-decoration: none; + font-weight: bold; + color: #663399; +} + +a:visited { + text-decoration: none; + font-weight: bold; + color: #663399; +} + +a:hover { + text-decoration: none; + background-color: #663399; + font-weight: bold; + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { + font-weight: bold; +} + +.fragment { + font-family: monospace; +} + +pre.fragment { + border: 1px solid #cccccc; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; +} + +td.md { + background-color: #f4f4fb; + font-weight: bold; +} + +td.mdPrefix { + background-color: #F4F4FB; + color: #606060; +} + +td.mdname1 { + background-color: #f4f4fb; + font-weight: bold; + color: #602020; +} + +td.mdname { + background-color: #f4f4fb; + font-weight: bold; + color: #602020; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; + font-size: 90%; +} + +td.indexkey { + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #cccccc; +} + +td.indexvalue { + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #cccccc; +} + +tr.memlist { + background-color: #f0f0f0; +} + +p.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #eeeeff; +} +TD.tiny { font-size: 75%; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #b0b0b0; +} +TH.dirtab { background: #eeeeff; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + diff --git a/0.2.0/ebuild/Makefile.am b/0.2.0/ebuild/Makefile.am new file mode 100644 index 000000000..95b0e46b2 --- /dev/null +++ b/0.2.0/ebuild/Makefile.am @@ -0,0 +1,48 @@ +MAINTAINERCLEANFILES = Makefile.in +CLEANFILES = *~ +SUBDIRS = . utils digests + +libexecprogdir = $(libexecdir)/paludis/ + +libexecprog_SCRIPTS = \ + build_functions.bash \ + builtin_fetch.bash \ + builtin_init.bash \ + builtin_merge.bash \ + builtin_metadata.bash \ + builtin_strip.bash \ + builtin_tidyup.bash \ + builtin_unmerge.bash \ + ebuild.bash \ + echo_functions.bash \ + eclass_functions.bash \ + install_functions.bash \ + list_functions.bash \ + multilib_functions.bash \ + pkg_config.bash \ + pkg_nofetch.bash \ + pkg_postinst.bash \ + pkg_postrm.bash \ + pkg_preinst.bash \ + pkg_prerm.bash \ + pkg_setup.bash \ + portage_stubs.bash \ + sandbox.bash \ + src_compile.bash \ + src_install.bash \ + src_test.bash \ + src_unpack.bash \ + unpack_functions.bash \ + usage_error.bash + +TESTS_ENVIRONMENT = env \ + PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \ + TEST_SCRIPT_DIR="$(srcdir)/" \ + $(SHELL) $(top_srcdir)/ebuild/run_test.bash + +TESTS = echo_functions_TEST.bash list_functions_TEST.bash +EXTRA_DIST = $(libexecprog_SCRIPTS) run_test.bash $(TESTS) + +check_SCRIPTS = run_test.bash $(TESTS) +check_PROGRAMS = + diff --git a/0.2.0/ebuild/build_functions.bash b/0.2.0/ebuild/build_functions.bash new file mode 100644 index 000000000..377555fce --- /dev/null +++ b/0.2.0/ebuild/build_functions.bash @@ -0,0 +1,92 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +econf() +{ + local LOCAL_EXTRA_ECONF="${EXTRA_ECONF}" + local LOCAL_ECONF_WRAPPER="${ECONF_WRAPPER}" + + [[ -z "${ECONF_SOURCE}" ]] && ECONF_SOURCE=. + + if [[ -x "${ECONF_SOURCE}/configure" ]] ; then + if [[ -d /usr/share/gnuconfig ]] ; then + local f + for f in $(find "${WORKDIR}" -type f -name config.guess -or -name config.sub ) ; do + echo "econf: updating ${f} with /usr/share/gnuconfig/${f##*/}" + cp -f /usr/share/gnuconfig/${f##*/} ${f} + done + fi + + [[ -z "${CBUILD}" ]] || LOCAL_EXTRA_ECONF="--build=${CBUILD} ${LOCAL_EXTRA_ECONF}" + [[ -z "${CTARGET}" ]] || LOCAL_EXTRA_ECONF="--target=${CTARGET} ${LOCAL_EXTRA_ECONF}" + + local cmd="${ECONF_SOURCE}/configure" + cmd="${cmd} --prefix=/usr" + cmd="${cmd} --host=${CHOST}" + cmd="${cmd} --mandir=/usr/share/man" + cmd="${cmd} --infodir=/usr/share/info" + cmd="${cmd} --datadir=/usr/share" + cmd="${cmd} --sysconfdir=/etc" + cmd="${cmd} --localstatedir=/var/lib" + # Check that this is actually what's wanted for multilib etc. + if [[ -n "${ABI}" ]] ; then + local v="LIBDIR_${ABI}" + if [[ -n "${!v}" ]] ; then + cmd="${cmd} --libdir=/usr/$(ebuild_get_libdir)" + fi + fi + + cmd="${LOCAL_ECONF_WRAPPER} ${cmd} $@ ${LOCAL_EXTRA_ECONF}" + + echo "${cmd}" 1>&2 + ${cmd} || die "econf failed" + + else + die "No configure script for econf" + fi +} + +emake() +{ + echo ${EMAKE_WRAPPER} ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" 1>&2 + ${EMAKE_WRAPPER} ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" +} + +einstall() +{ + if [[ -f Makefile ]] || [[ -f makefile ]] || [[ -f GNUmakefile ]] ; then + local cmd="${EINSTALL_WRAPPER} make prefix=${D}/usr" + cmd="${cmd} mandir=${D}/usr/share/man" + cmd="${cmd} infodir=${D}/usr/share/info" + cmd="${cmd} datadir=${D}/usr/share" + cmd="${cmd} sysconfdir=${D}/etc" + cmd="${cmd} localstatedir=${D}/var/lib" + cmd="${cmd} libdir=${D}/usr/$(ebuild_get_libdir)" + cmd="${cmd} ${EXTRA_EINSTALL} ${@} install" + echo "${cmd}" 1>&2 + ${cmd} || die "einstall failed" + else + die "No Makefile for einstall" + fi +} + diff --git a/0.2.0/ebuild/builtin_fetch.bash b/0.2.0/ebuild/builtin_fetch.bash new file mode 100644 index 000000000..a8b0d34ee --- /dev/null +++ b/0.2.0/ebuild/builtin_fetch.bash @@ -0,0 +1,129 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +builtin_fetch() +{ + local a nofetch unique_aa old_aa + local LOCAL_WGET=${WGET:-wget} + for a in ${FLAT_SRC_URI} ; do + local aa=${a##*/} + hasq "${aa}" ${unique_aa} || unique_aa="${unique_aa} ${aa}" + + if [[ -f "${DISTDIR}/${aa}" ]] && [[ "0" != $(stat -c '%s' "${DISTDIR}/${aa}" ) ]] ; then + if [[ "${old_aa}" != "${aa}" ]] ; then + ebuild_section "Already have ${aa}" + old_aa="${aa}" + fi + else + if [[ -f "${DISTDIR}/${aa}" ]] ; then + ebuild_section "Trying to remove existing ${aa}..." + rm -f "${DISTDIR}/${aa}" + fi + + if ! hasq fetch ${RESTRICT} ; then + if [[ "${old_aa}" != "${aa}" ]] ; then + ebuild_section "Need to fetch ${aa}" + old_aa="${aa}" + fi + echo ${WGET_WRAPPER} ${LOCAL_WGET} ${EXTRA_WGET} -T 30 -t 1 -O "${DISTDIR}/${aa}" "${a}" 1>&2 + if ! ${WGET_WRAPPER} ${LOCAL_WGET} ${EXTRA_WGET} -T 30 -t 1 -O "${DISTDIR}/${aa}" "${a}" ; then + rm -f "${DISTDIR}/${aa}" + fi + else + if ! [[ "${old_aa}" != "${aa}" ]] ; then + ebuild_section "Can't fetch ${aa}" + old_aa="${aa}" + fi + fi + fi + done + + for a in ${unique_aa} ; do + [[ -f ${DISTDIR}/${a} ]] || nofetch="${nofetch} ${a}" + done + + if [[ -n "${nofetch}" ]] ; then + local c + echo + eerror "Couldn't fetch the following components:" + for c in ${nofetch} ; do + eerror " * ${c}" + done + echo + die "builtin_fetch failed" + fi + + local badfetch= + if [[ -f "${FILESDIR}/digest-${PN}-${PVR%-r0}" ]] ; then + local line items prg + while read line ; do + line=( ${line} ) + if ! hasq "${line[2]}" ${A} ; then + ebuild_section "Skipping check for ${line[2]}" + continue + fi + + prg="${PALUDIS_EBUILD_DIR}/digests/do$(echo ${line[0]} | tr \ + '[[:upper:]]' '[[:lower:]]')" + if [[ -x "${prg}" ]] ; then + ebegin "Checking ${line[0]} for ${line[2]}" + if [[ $("${prg}" "${DISTDIR}/${line[2]}" ) == "${line[1]}" ]] ; then + eend 0 + else + eend 1 + hasq "${line[2]}" ${badfetch} || badfetch="${badfetch} ${line[2]}" + fi + else + einfo "Can't check ${line[0]} for ${line[2]}" + fi + + done < "${FILESDIR}"/digest-${PN}-${PVR%-r0} + else + ebuild_section "No digest file, skipping integrity checks" + fi + + if [[ -n "${badfetch}" ]] ; then + local c + echo + eerror "Bad digests encountered for the following components:" + for c in ${badfetch} ; do + eerror " * ${c}" + done + echo + die "builtin_fetch failed" + fi +} + +ebuild_f_fetch() +{ + local old_sandbox_write="${SANDBOX_WRITE}" + SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${DISTDIR}" + if hasq "fetch" ${RESTRICT} ; then + ebuild_section "Skipping builtin_fetch (RESTRICT)" + elif hasq "fetch" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping builtin_fetch (SKIP_FUNCTIONS)" + else + ebuild_section "Starting builtin_fetch" + builtin_fetch + ebuild_section "Done builtin_fetch" + fi + SANDBOX_WRITE="${old_sandbox_write}" +} + + diff --git a/0.2.0/ebuild/builtin_init.bash b/0.2.0/ebuild/builtin_init.bash new file mode 100644 index 000000000..e8aac742c --- /dev/null +++ b/0.2.0/ebuild/builtin_init.bash @@ -0,0 +1,75 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +builtin_init() +{ + export ROOT="${ROOT//+(\/)//}" + + local a + for a in P PV PR PN PVR PF CATEGORY FILESDIR ECLASSDIR PORTDIR \ + DISTDIR KV PALUDIS_TMPDIR PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR \ + USERLAND KERNEL ARCH CHOST PALUDIS_COMMAND ROOT ; do + [[ -z "${!a}" ]] && die "\$${a} unset or empty" + declare -r ${a}="${!a}" + done + + for a in FILESDIR ECLASSDIR PORTDIR DISTDIR ; do + [[ -d "${!a}" ]] || die "\$${a} (\"${!a}\") not a directory" + done + + if [[ -e "${PALUDIS_TMPDIR}/${CATEGORY}/${PF}" ]] ; then + rm -fr "${PALUDIS_TMPDIR}/${CATEGORY}/${PF}" || die "Couldn't remove previous work" + fi + + export WORKDIR="${PALUDIS_TMPDIR}/${CATEGORY}/${PF}/work" + mkdir -p "${WORKDIR}" || die "Couldn't create \$WORKDIR (\"${WORKDIR}\")" + declare -r WORKDIR="${WORKDIR}" + + export T="${PALUDIS_TMPDIR}/${CATEGORY}/${PF}/temp/" + mkdir -p "${T}" || die "Couldn't create \$T (\"${T}\")" + declare -r T="${T}" + export PALUDIS_HOME="${HOME}" + export HOME="${T}" + + export D="${PALUDIS_TMPDIR}/${CATEGORY}/${PF}/image/" + export D="${D//+(\/)//}" + mkdir -p "${D}" || die "Couldn't create \$D (\"${D}\")" + declare -r D="${D}" + + export IMAGE="${D}" + declare -r IMAGE="${IMAGE}" + + export S="${WORKDIR}/${P}" + + export PATH="${PALUDIS_EBUILD_DIR}/utils:${PATH}" +} + +ebuild_f_init() +{ + if hasq "init" ${RESTRICT} ; then + ebuild_section "Skipping builtin_init (RESTRICT)" + elif hasq "init" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping builtin_init (SKIP_FUNCTIONS)" + else + ebuild_section "Starting builtin_init" + builtin_init + ebuild_section "Done builtin_init" + fi +} + diff --git a/0.2.0/ebuild/builtin_merge.bash b/0.2.0/ebuild/builtin_merge.bash new file mode 100644 index 000000000..24dde1646 --- /dev/null +++ b/0.2.0/ebuild/builtin_merge.bash @@ -0,0 +1,98 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +builtin_merge() +{ + ebuild_section "Merging to '${ROOT:-/}'..." + + shopt -q dotglob + local olddotglob=$? + shopt -s dotglob + + local dbdir="${ROOT%/}"/var/db/pkg/"${CATEGORY}/${PF}" + ebuild_section "Writing VDB entry to '${dbdir}'..." + install -d "${dbdir}" || die "couldn't make pkg db directory (\"${dbdir}\")" + install -d "${ROOT%/}"/var/db/pkg/.cache || die "couldn't make pkg db cache" + + local v + for v in CATEGORY CBUILD CFLAGS CHOST CXXFLAGS DEPEND DESCRIPTION EAPI \ + FEATURES HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \ + PROVIDE RDEPEND SLOT SRC_URI USE CONFIG_PROTECT CONFIG_PROTECT_MASK ; do + echo "${!v}" > "${dbdir}"/${v} || die "pkg db write ${v} failed" + done + + if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT} ]]; then + CONFIG_PROTECT=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT} + fi + if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK} ]]; then + CONFIG_PROTECT_MASK=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK} + fi + + [[ -f "${EBUILD}" ]] && cp "${EBUILD}" ${dbdir}/ + local x + for i in ${INHERITED} ; do + cp "${ECLASSDIR}/${i}".eclass "${dbdir}/" || die "save eclass ${i} failed" + done + + local reinstall= + if [[ -f "${dbdir}/CONTENTS" ]] ; then + mv "${dbdir}/CONTENTS" "${dbdir}/OLDCONTENTS" || die "save contents failed" + reinstall="yes" + fi + + env | bzip2 > ${dbdir}/environment.bz2 + > ${dbdir}/CONTENTS + + if [[ -n "${D}" ]] && [[ -d "${D}" ]] ; then + install -d "${ROOT%/}/" || die "couldn't make \${ROOT} (\"${ROOT}\")" + if [[ -d "${D}" ]] ; then + ${PALUDIS_EBUILD_MODULES_DIR}/utils/merge "${D%/}/" "${ROOT%/}/" "${dbdir}/CONTENTS" \ + || die "merge failed" + fi + fi + + if [[ -n "${reinstall}" ]] ; then + ${PALUDIS_EBUILD_MODULES_DIR}/utils/unmerge "${ROOT%/}/" "${dbdir}/OLDCONTENTS" \ + || die "unmerge failed" + rm -f "${dbdir}/OLDCONTENTS" + fi + + [[ $olddotglob != 0 ]] && shopt -u dotglob + shopt -q dotglob + [[ $olddotglob == $? ]] || ebuild_notice "warning" "shopt dotglob restore failed" +} + +ebuild_f_merge() +{ + local old_sandbox_write="${SANDBOX_WRITE}" + SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/" + + if hasq "merge" ${RESTRICT} ; then + ebuild_section "Skipping builtin_merge (RESTRICT)" + elif hasq "merge" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping builtin_merge (SKIP_FUNCTIONS)" + else + ebuild_section "Starting builtin_merge" + builtin_merge + ebuild_section "Done builtin_merge" + fi + + SANDBOX_WRITE="${old_sandbox_write}" +} + diff --git a/0.2.0/ebuild/builtin_metadata.bash b/0.2.0/ebuild/builtin_metadata.bash new file mode 100644 index 000000000..35f408565 --- /dev/null +++ b/0.2.0/ebuild/builtin_metadata.bash @@ -0,0 +1,39 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +ebuild_f_metadata() +{ + local key + + for key in DEPEND RDEPEND PDEPEND IUSE SLOT SRC_URI RESTRICT LICENSE \ + KEYWORDS INHERITED PROVIDE EAPI HOMEPAGE DESCRIPTION E_IUSE \ + E_DEPEND E_RDEPEND E_PDEPEND E_KEYWORDS ; do + set -o noglob + local k=${!key} + k=${k/\\/\\\\} + k=${k/\"/\\\"} + echo "${key}=\""${k}"\"" + set +o noglob + done +} + diff --git a/0.2.0/ebuild/builtin_strip.bash b/0.2.0/ebuild/builtin_strip.bash new file mode 100644 index 000000000..9e4bb7274 --- /dev/null +++ b/0.2.0/ebuild/builtin_strip.bash @@ -0,0 +1,57 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +builtin_strip() +{ + STRIP=${STRIP:-${CHOST}-strip} + if ! type -p -- ${STRIP} >/dev/null; then + STRIP=strip + fi + PALUDIS_STRIP_FLAGS=${PALUDIS_STRIP_FLAGS:---strip-unneeded} + + for fn in $(find "${D}" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name '*.so' -or -name '*.so.*' \)); do + local ft=$(file "${fn}") + if [[ $? != 0 || -z ${ft} ]]; then + return 1 + fi + + if [[ ${ft} == *"current ar archive"* ]]; then + echo ${STRIP} -g "${fn}" + ${STRIP} -g "${fn}" + elif [[ ${ft} == *"SB executable"* || ${ft} == *"SB shared object"* ]]; then + echo ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}" + ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}" + fi + done +} + +ebuild_f_strip() +{ + if hasq "strip" ${RESTRICT} ; then + ebuild_section "Skipping builtin_strip (RESTRICT)" + elif hasq "strip" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping builtin_strip (SKIP_FUNCTIONS)" + else + ebuild_section "Starting builtin_strip" + builtin_strip + ebuild_section "Done builtin_strip" + fi +} + diff --git a/0.2.0/ebuild/builtin_tidyup.bash b/0.2.0/ebuild/builtin_tidyup.bash new file mode 100644 index 000000000..203902353 --- /dev/null +++ b/0.2.0/ebuild/builtin_tidyup.bash @@ -0,0 +1,39 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +builtin_tidyup() +{ + if [[ -e "${PALUDIS_TMPDIR}/${CATEGORY}/${PF}" ]] ; then + rm -fr "${PALUDIS_TMPDIR}/${CATEGORY}/${PF}" || die "Couldn't remove work" + fi +} + +ebuild_f_tidyup() +{ + if hasq "tidyup" ${RESTRICT} ; then + ebuild_section "Skipping builtin_tidyup (RESTRICT)" + elif hasq "tidyup" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping builtin_tidyup (SKIP_FUNCTIONS)" + else + ebuild_section "Starting builtin_tidyup" + builtin_tidyup + ebuild_section "Done builtin_tidyup" + fi +} + diff --git a/0.2.0/ebuild/builtin_unmerge.bash b/0.2.0/ebuild/builtin_unmerge.bash new file mode 100644 index 000000000..c202f7d18 --- /dev/null +++ b/0.2.0/ebuild/builtin_unmerge.bash @@ -0,0 +1,77 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +builtin_unmerge() +{ + local dbdir="${ROOT}"/var/db/pkg/"${CATEGORY}/${PF}" entry + [[ -d "${dbdir}" ]] || die "couldn't find pkg db directory (\"${dbdir}\")" + + for v in CATEGORY CBUILD CFLAGS CHOST CXXFLAGS DEPEND DESCRIPTION EAPI \ + FEATURES HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \ + PROVIDE RDEPEND SLOT SRC_URI USE ; do + eval "${v}=\$(< ${dbdir}/${v} ) || die \"Load key ${v} failed\"" + done + + if [[ -f ${dbdir}/CONFIG_PROTECT ]]; then + CONFIG_PROTECT="$(< ${dbdir}/CONFIG_PROTECT) ${CONFIG_PROTECT}" + if [[ -f ${dbdir}/CONFIG_PROTECT_MASK ]]; then + CONFIG_PROTECT_MASK="$(< ${dbdir}/CONFIG_PROTECT_MASK)" + fi + else + eval $(bzcat "${dbdir}/environment.bz2" | while read line; do + if [[ ${line%%=*} == CONFIG_PROTECT ]]; then + echo "CONFIG_PROTECT='${line#*=} ${CONFIG_PROTECT}'" + elif [[ ${line%%=*} == CONFIG_PROTECT_MASK ]]; then + echo "CONFIG_PROTECT_MASK='${line#*=}'" + fi + done) + fi + + if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT} ]]; then + CONFIG_PROTECT=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT} + fi + if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK} ]]; then + CONFIG_PROTECT_MASK=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK} + fi + + ${PALUDIS_EBUILD_MODULES_DIR}/utils/unmerge "${ROOT}/" "${dbdir}/CONTENTS" \ + || die "unmerge failed" + + rm -fr "${dbdir}" +} + +ebuild_f_unmerge() +{ + local old_sandbox_write="${SANDBOX_WRITE}" + SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/" + + if hasq "unmerge" ${RESTRICT} ; then + ebuild_section "Skipping builtin_unmerge (RESTRICT)" + elif hasq "unmerge" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping builtin_unmerge (SKIP_FUNCTIONS)" + else + ebuild_section "Starting builtin_unmerge" + builtin_unmerge + ebuild_section "Done builtin_unmerge" + fi + + SANDBOX_WRITE="${old_sandbox_write}" +} + + diff --git a/0.2.0/ebuild/digests/Makefile.am b/0.2.0/ebuild/digests/Makefile.am new file mode 100644 index 000000000..e83ccea36 --- /dev/null +++ b/0.2.0/ebuild/digests/Makefile.am @@ -0,0 +1,44 @@ +MAINTAINERCLEANFILES = Makefile.in +CLEANFILES = *~ +SUBDIRS = . + +libexecprogdir = $(libexecdir)/paludis/digests/ + +libexecprog_SCRIPTS = \ + domd5 + +libexecprog_PROGRAMS = \ + dosha256 \ + dormd160 + +dosha256_SOURCES = \ + sha256.cc \ + sha256.hh \ + dosha256.cc + +dormd160_SOURCES = \ + rmd160.cc \ + rmd160.hh \ + dormd160.cc + +TESTS_ENVIRONMENT = env \ + PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \ + TEST_SCRIPT_DIR="$(srcdir)/" \ + $(SHELL) $(top_srcdir)/test/run_test.sh + +TESTS = dosha256_TEST dormd160_TEST +EXTRA_DIST = $(libexecprog_SCRIPTS) dosha256_TEST.cc dormd160_TEST.cc + +check_SCRIPTS = +check_PROGRAMS = $(TESTS) + +AM_CXXFLAGS = -I$(top_srcdir) + +dosha256_TEST_SOURCES = sha256.cc sha256.hh dosha256_TEST.cc +dosha256_TEST_CXXFLAGS = -I$(top_srcdir) +dosha256_TEST_LDADD = $(top_builddir)/test/libtest.a + +dormd160_TEST_SOURCES = rmd160.cc rmd160.hh dormd160_TEST.cc +dormd160_TEST_CXXFLAGS = -I$(top_srcdir) +dormd160_TEST_LDADD = $(top_builddir)/test/libtest.a + diff --git a/0.2.0/ebuild/digests/domd5 b/0.2.0/ebuild/digests/domd5 new file mode 100755 index 000000000..cb8276193 --- /dev/null +++ b/0.2.0/ebuild/digests/domd5 @@ -0,0 +1,4 @@ +#!/bin/bash + +md5sum "$1" | cut -d\ -f1 + diff --git a/0.2.0/ebuild/digests/dormd160.cc b/0.2.0/ebuild/digests/dormd160.cc new file mode 100644 index 000000000..b71565c35 --- /dev/null +++ b/0.2.0/ebuild/digests/dormd160.cc @@ -0,0 +1,52 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "rmd160.hh" +#include <iostream> +#include <cstdlib> + +int +main(int argc, char * argv[]) +{ + if (argc >= 3) + { + std::cerr << "usage: " << argv[0] << " [filename]" << std::endl; + return EXIT_FAILURE; + } + + if (argc == 2) + { + std::ifstream f(argv[1]); + if (! f) + { + std::cerr << argv[0] << ": could not open '" << argv[1] << "'" << std::endl; + return EXIT_FAILURE; + } + rmd160::RMD160 sum(f); + std::cout << sum.hexsum() << std::endl; + } + else + { + rmd160::RMD160 sum(std::cin); + std::cout << sum.hexsum() << std::endl; + } + +} + + diff --git a/0.2.0/ebuild/digests/dormd160_TEST.cc b/0.2.0/ebuild/digests/dormd160_TEST.cc new file mode 100644 index 000000000..b17bfc1bb --- /dev/null +++ b/0.2.0/ebuild/digests/dormd160_TEST.cc @@ -0,0 +1,95 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "rmd160.hh" +#include <test/test_framework.hh> +#include <test/test_runner.hh> + +using namespace test; + +namespace +{ + unsigned char dehex_c(unsigned char c) + { + if (c >= '0' && c <= '9') + return c - '0'; + else if (c >= 'a' && c <= 'f') + return c + 10 - 'a'; + else + throw "meh!"; + } + + std::string dehex(const std::string & s) + { + std::string result; + std::string::size_type p(0); + while (p < s.length()) + { + unsigned char c; + c = (dehex_c(s.at(p)) << 4) + dehex_c(s.at(p + 1)); + result.append(1, c); + p += 2; + } + return result; + } +} + +namespace test_cases +{ + struct RMD160TestCase : TestCase + { + std::string data; + std::string expected; + + RMD160TestCase(const std::string & s, const std::string & d, + const std::string & e) : + TestCase("rmd160 " + s), + data(d), + expected(e) + { + } + + void run() + { + std::stringstream ss(data); + rmd160::RMD160 s(ss); + TEST_CHECK_EQUAL(s.hexsum(), expected); + } + }; + + RMD160TestCase t_0("empty", "", "9c1185a5c5e9fc54612808977ee8f548b2258d31"); + RMD160TestCase t_1("a", "a", "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe"); + RMD160TestCase t_2("abc", "abc", "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"); + RMD160TestCase t_3("message digest", "message digest", "5d0689ef49d2fae572b881b123a85ffa21595f36"); + RMD160TestCase t_4("a..z", "abcdefghijklmnopqrstuvwxyz", + "f71c27109c692c1b56bbdceb5b9d2865b3708dbc"); + RMD160TestCase t_5("abcdbcde...nopq", + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "12a053384a9c0c88e405a06c27dcf49ada62eb2b"); + RMD160TestCase t_6("A...Za...z0...9", + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "b0e20b6e3116640286ed3a87a5713079b21f5189"); + RMD160TestCase t_7("8 times 1234567890", + "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "9b752e45573d4b39f4dbd3323cab82bf63326bfb"); + RMD160TestCase t_8("one million times a", + std::string(1000000, 'a'), + "52783243c1697bdbe16d37f97f68f08325dc1528"); +} + diff --git a/0.2.0/ebuild/digests/dosha256.cc b/0.2.0/ebuild/digests/dosha256.cc new file mode 100644 index 000000000..09c2478f9 --- /dev/null +++ b/0.2.0/ebuild/digests/dosha256.cc @@ -0,0 +1,51 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "sha256.hh" +#include <iostream> +#include <cstdlib> + +int +main(int argc, char * argv[]) +{ + if (argc >= 3) + { + std::cerr << "usage: " << argv[0] << " [filename]" << std::endl; + return EXIT_FAILURE; + } + + if (argc == 2) + { + std::ifstream f(argv[1]); + if (! f) + { + std::cerr << argv[0] << ": could not open '" << argv[1] << "'" << std::endl; + return EXIT_FAILURE; + } + sha256::SHA256 sum(f); + std::cout << sum.hexsum() << std::endl; + } + else + { + sha256::SHA256 sum(std::cin); + std::cout << sum.hexsum() << std::endl; + } + +} + diff --git a/0.2.0/ebuild/digests/dosha256_TEST.cc b/0.2.0/ebuild/digests/dosha256_TEST.cc new file mode 100644 index 000000000..52d37f94a --- /dev/null +++ b/0.2.0/ebuild/digests/dosha256_TEST.cc @@ -0,0 +1,419 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "sha256.hh" +#include <test/test_framework.hh> +#include <test/test_runner.hh> + +using namespace test; + +namespace +{ + unsigned char dehex_c(unsigned char c) + { + if (c >= '0' && c <= '9') + return c - '0'; + else if (c >= 'a' && c <= 'f') + return c + 10 - 'a'; + else + throw "meh!"; + } + + std::string dehex(const std::string & s) + { + std::string result; + std::string::size_type p(0); + while (p < s.length()) + { + unsigned char c; + c = (dehex_c(s.at(p)) << 4) + dehex_c(s.at(p + 1)); + result.append(1, c); + p += 2; + } + return result; + } +} + +namespace test_cases +{ + struct SHA256TestCase : TestCase + { + std::string data; + std::string expected; + + SHA256TestCase(const std::string & s, const std::string & d, + const std::string & e) : + TestCase("sha256 " + s), + data(d), + expected(e) + { + } + + void run() + { + std::stringstream ss(data); + sha256::SHA256 s(ss); + TEST_CHECK_EQUAL(s.hexsum(), expected); + } + }; + + SHA256TestCase t1("empty", "", + "e3b0c442""98fc1c14""9afbf4c8""996fb924" + "27ae41e4""649b934c""a495991b""7852b855"); + SHA256TestCase t2("abc", "abc", + "ba7816bf""8f01cfea""414140de""5dae2223" + "b00361a3""96177a9c""b410ff61""f20015ad"); + SHA256TestCase t3("abcd...", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "248d6a61""d20638b8""e5c02693""0c3e6039" + "a33ce459""64ff2167""f6ecedd4""19db06c1"); + + /* + * the following tests are from: + * http://csrc.ncsl.nist.gov/cryptval/ + */ + + SHA256TestCase t_11_SHA256ShortMsg("t 11 SHA256ShortMsg", + dehex("bd"), "68325720aabd7c82f30f554b313d0570c95accbb" + "7dc4b5aae11204c08ffe732b"); + + SHA256TestCase t_14_SHA256ShortMsg("t 14 SHA256ShortMsg", + dehex("5fd4"), "7c4fbf484498d21b487b9d61de8914b2eadaf269" + "8712936d47c3ada2558f6788"); + + SHA256TestCase t_17_SHA256ShortMsg("t 17 SHA256ShortMsg", + dehex("b0bd69"), "4096804221093ddccfbf46831490ea63e9e99414" + "858f8d75ff7f642c7ca61803"); + + SHA256TestCase t_20_SHA256ShortMsg("t 20 SHA256ShortMsg", + dehex("c98c8e55"), "7abc22c0ae5af26ce93dbb94433a0e0b2e119d01" + "4f8e7f65bd56c61ccccd9504"); + + SHA256TestCase t_23_SHA256ShortMsg("t 23 SHA256ShortMsg", + dehex("81a723d966"), "7516fb8bb11350df2bf386bc3c33bd0f52cb4c67" + "c6e4745e0488e62c2aea2605"); + + SHA256TestCase t_26_SHA256ShortMsg("t 26 SHA256ShortMsg", + dehex("c97a2db566e5"), "0eb0281b27a4604709b0513b43ad29fdcff9a7a9" + "58554abc689d7fe35af703e4"); + + SHA256TestCase t_29_SHA256ShortMsg("t 29 SHA256ShortMsg", + dehex("f53210aa6ed72e"), "dee684641421d1ba5a65c71f986a117cbb3d619a" + "052a0b3409306c629575c00f"); + + SHA256TestCase t_32_SHA256ShortMsg("t 32 SHA256ShortMsg", + dehex("0df1cd526b5a4edd"), "47f527210d6e8f940b5082fec01b7305908fa2b4" + "9ea3ae597c19a3986097153c"); + + SHA256TestCase t_35_SHA256ShortMsg("t 35 SHA256ShortMsg", + dehex("b80233e2c53ab32cc3"), "c60d239cc6da3ad31f4de0c2d58a73ccf3f9279e" + "504fa60ad55a31dcf686f3ca"); + + SHA256TestCase t_38_SHA256ShortMsg("t 38 SHA256ShortMsg", + dehex("5d54ed5b52d879aeb5dd"), "e0164d90dbfcf173bb88044fac596ccd03b8d247" + "c79907aaa5701767fad7b576"); + + SHA256TestCase t_41_SHA256ShortMsg("t 41 SHA256ShortMsg", + dehex("df866ecb67ab00515f6247"), "dc990ef3109a7bcf626199db9ab7801213ceb0ad" + "2ee398963b5061e39c05c7b5"); + + SHA256TestCase t_44_SHA256ShortMsg("t 44 SHA256ShortMsg", + dehex("0757de9485a2eaea51126077"), "c1c9a4daadcc8678835872c7f1f8824376ac7b41" + "2e1fc2285069b41afd51397e"); + + SHA256TestCase t_47_SHA256ShortMsg("t 47 SHA256ShortMsg", + dehex("7c66f5d443c11cfb39dd0aa715"), "6840619417b4d8ecaa7902f8eaf2e82be2638dec" + "97cb7e8fcc377007cc176718"); + + SHA256TestCase t_50_SHA256ShortMsg("t 50 SHA256ShortMsg", + dehex("329624fed35639fe54957b7d47a9"), "0f5308ff22b828e18bd65afbc427e3c1a6789628" + "32519df5f2f803f68f55e10b"); + + SHA256TestCase t_53_SHA256ShortMsg("t 53 SHA256ShortMsg", + dehex("c34e59652acc043873ecf6a4ab1060"), "0fdf1604ac0d717ec9587b4de5444aaade807589" + "d90eb326eaf6acb58a051e79"); + + SHA256TestCase t_56_SHA256ShortMsg("t 56 SHA256ShortMsg", + dehex("fdf4700984ee11b70af1880d0e0fefd4"), "b01ae16eed3b4a770f127b98469ba26fe3d8e9f5" + "9d8a2983214afe6cff0e6b6c"); + + SHA256TestCase t_59_SHA256ShortMsg("t 59 SHA256ShortMsg", + dehex("ea40aadbefedb0e0d78d067c6cd65c2c87"), "36157bbe61931d58a3a644953eaf131bbc2591c6" + "73a1f20353f51ca5054fc1c2"); + + SHA256TestCase t_62_SHA256ShortMsg("t 62 SHA256ShortMsg", + dehex("6d1092004670efab3af483d265d8e7b3da73"), "67fbf35d360d72b101410794ccf197106c0e784a" + "fa9c80206a550b600dbf1f16"); + + SHA256TestCase t_65_SHA256ShortMsg("t 65 SHA256ShortMsg", + dehex("55a10148ae7b09ac4e71df438135bc70e873eb"), "cbe7965513af46dfd596dc5839cb82a5c6c73280" + "34b1dd0042a9f4b71fb14430"); + + SHA256TestCase t_68_SHA256ShortMsg("t 68 SHA256ShortMsg", + dehex("a03f8fcd777bd933b4b0af8c5ce3d61308565649"), "ddfce4e8c7b38845e2a81b7fc27a06366467a9e1" + "11316014013f9701e2413ce0"); + + SHA256TestCase t_71_SHA256ShortMsg("t 71 SHA256ShortMsg", + dehex("8e5d6cba8d4b206381e33ca7339bec504f3d6119" + "ba"), "92f678a3e59d0dd3610eec3222b8c6ebd28eead5" + "30723fbd226747534da22b6c"); + + SHA256TestCase t_74_SHA256ShortMsg("t 74 SHA256ShortMsg", + dehex("96db1b62eed85f2628d0c25da534401fe80d13d0" + "9beb"), "725bab4457c789d6a4cc4736b9c2c662cda18407" + "150844d74d6aa4efd72dbb05"); + + SHA256TestCase t_77_SHA256ShortMsg("t 77 SHA256ShortMsg", + dehex("1c482a45dfbcda549729126b533477edfaf7476f" + "de498f"), "6523f24f225b996aad1a8b317e6e0f8e97673dcf" + "f3fd62a27ff9f3888ea1302d"); + + SHA256TestCase t_80_SHA256ShortMsg("t 80 SHA256ShortMsg", + dehex("0f677d8e4c6d6a057492670d99adb870adf68a36" + "ead37919"), "44acbbc6b48bf37ee088b9c8546fc46e5a5f0d63" + "7b5e444f628de186144087fd"); + + SHA256TestCase t_83_SHA256ShortMsg("t 83 SHA256ShortMsg", + dehex("c09056d597816542bffe4bb33e475dfb2d629301" + "6906ddc18c"), "f4baeaef70588a0820d63c2401dd84f98adf7366" + "782d196f8698d7dfd3db1c29"); + + SHA256TestCase t_86_SHA256ShortMsg("t 86 SHA256ShortMsg", + dehex("72f313fdcf52d0749c9937cc2e53f50b44d65a54" + "4876bab7d2f8"), "cfa67aa52fd675fca985f69f9ca58af62baead8c" + "39723bb6bfbae8a5d4bb9beb"); + + SHA256TestCase t_89_SHA256ShortMsg("t 89 SHA256ShortMsg", + dehex("09f6fe6cbe6744149f792a4a827e4e8909627abf" + "75301bf7bbd7f5"), "657633891dc6274d6aeda78e7313dfb960eac9a2" + "4d29293a057b9746a18de4ec"); + + SHA256TestCase t_92_SHA256ShortMsg("t 92 SHA256ShortMsg", + dehex("9e1cfeb335bc331744247df4bbd56876a7f69298" + "aaf6b9e7a8731889"), "930058dd21cb48b2cf90eaca55322ddf48582687" + "838a584928440504a2fde578"); + + SHA256TestCase t_95_SHA256ShortMsg("t 95 SHA256ShortMsg", + dehex("b8913001efb1b7f4bd975e349c5b2cbe66045bf0" + "d2fb019b3bc0f059a4"), "a0eb0b7fad1d1b6de4f9096724a621720538a9c3" + "f2f6d11134d68cb9ee52fc88"); + + SHA256TestCase t_98_SHA256ShortMsg("t 98 SHA256ShortMsg", + dehex("8f08537d50928c911a68b071d65b9e8f038264d3" + "b62c5f33de18a484cde9"), "10aad5cd4484387373577a881974f1a550782108" + "bc88b4e2e8085e9c3e938bbb"); + + SHA256TestCase t_101_SHA256ShortMsg("t 101 SHA256ShortMsg", + dehex("fd846162c4da936d004ffe0cbe844d940f1c2953" + "157cf4765dceba2a6f4c64"), "c13ba769aea0e478816f2f608b5cec3fe14672ea" + "033088a8641cfe69b4ff57cb"); + + SHA256TestCase t_104_SHA256ShortMsg("t 104 SHA256ShortMsg", + dehex("8cf53d90077df9a043bf8d10b470b144784411c9" + "3a4d504556834dae3ea4a5bb"), "56059e8cb3c2978b198208bf5ca1e1ea5659b737" + "a506324b7cec75b5ebaf057d"); + + SHA256TestCase t_107_SHA256ShortMsg("t 107 SHA256ShortMsg", + dehex("1bbc2b15253c126e301f9f64b97be4ce13e96337" + "687e2e78fbfd4c8daf4a5fa1cd"), "d973b5dcdae4cf2599f4db4068e4aa354f22d890" + "1adc463ca3938c465578147b"); + + SHA256TestCase t_110_SHA256ShortMsg("t 110 SHA256ShortMsg", + dehex("c1bdb3bfc65dfe9a393331266c58d05fb9c8b747" + "6bb717dadc29bc43dabd91504fc9"), "57844e1d762e6b7bb86dbfcc5c5a59578d39cc66" + "5d1ddbe4de03a61778061af1"); + + SHA256TestCase t_113_SHA256ShortMsg("t 113 SHA256ShortMsg", + dehex("26eb621a45bd9c9c764ccbb672b99f2a8379c7bb" + "f4fb07eec58a8b0ea4747b72196ccf"), "73dc27bd45daccd0f811381230cf7f2a1d3ed120" + "2e9a770af733146b1e166315"); + + SHA256TestCase t_116_SHA256ShortMsg("t 116 SHA256ShortMsg", + dehex("7e3e3986109162e0c56357048bbd86ff49b93644" + "b7fb064e7280968650978466f02c9adf"), "682c474799f5103252c3e2efef7f747783e514b5" + "4e93b8303b0e07ee4218f78e"); + + SHA256TestCase t_119_SHA256ShortMsg("t 119 SHA256ShortMsg", + dehex("763c1a9ea50bd72bfc516989ddf3eff2f208f64f" + "ccea3cf0ca8dba7f3d10e237c99226510f"), "54d6cb2b09825eab064c8952113b9897a3344737" + "cd186a8e6be0a0b258da3e57"); + + SHA256TestCase t_122_SHA256ShortMsg("t 122 SHA256ShortMsg", + dehex("e1a7ffea8417e7cd49b96e355fd44f3f7a150fab" + "6dd8343dfba3b262eaf3a6175a3c4607552b"), "83baa80caade404c446833ecef2e595bba6dce2c" + "b7f7422fad2972a9fe327aca"); + + SHA256TestCase t_125_SHA256ShortMsg("t 125 SHA256ShortMsg", + dehex("692a18effad8317a11a5cddb917f7389e1be6dba" + "34572a300e52e056047e758bc363a0be53784c"), "0c0c6a6b27a6d7a7a5130d70db3b8bc1bd8001d1" + "03efe72f45b082cadbd03742"); + + SHA256TestCase t_128_SHA256ShortMsg("t 128 SHA256ShortMsg", + dehex("73fda1e1cb7dc9a9ece858d040d7105cc126eab1" + "53fb0bb55703f4317dfff97bd980f4523aee3a09"), "9878f8804e00828b39261843f2b3eda19a7e9b9f" + "f4cc2e23f7ea1f62f4491ff2"); + + SHA256TestCase t_131_SHA256ShortMsg("t 131 SHA256ShortMsg", + dehex("2321d88c19e3e6a8309a09a5428c01991e164468" + "23f13b2f0db4ade30e9a7c3521868fb99b440f48" + "02"), "f1bd3a8a74c8f0093038499ef63794d86fc6d826" + "02a802a435718e61e7b396cc"); + + SHA256TestCase t_134_SHA256ShortMsg("t 134 SHA256ShortMsg", + dehex("b9eaebda29172b052bcc1e3a9c7f2eced43c084a" + "86f89f61e7237425137c167aac29e4cac4071afa" + "fd3f"), "ea43ec91285145d8f29915b227a0e35c89f90d96" + "8f9a14332dad275cfd52d619"); + + SHA256TestCase t_137_SHA256ShortMsg("t 137 SHA256ShortMsg", + dehex("332daf07d3a6775b18572549a6e12b8a27d81b7c" + "4abcc5bd0b2b9ff936546b0026af131cd3ecd8a1" + "0c29ab"), "a573959ba6b1c3bebfd6288c806b72a65650d23b" + "d46d123816a2a6a0e47d1e66"); + + SHA256TestCase t_140_SHA256ShortMsg("t 140 SHA256ShortMsg", + dehex("30ac7eace1f2e41034c25a3d3e2db979c23dfaa7" + "a4914b0da147625b3e1f12e9fedc1c41d8ee47dd" + "e84fb332"), "c0c3f40d34e711bfadf517b3a78140e379fba5f7" + "edf2c1bc3ce82469dae4d2d5"); + + SHA256TestCase t_143_SHA256ShortMsg("t 143 SHA256ShortMsg", + dehex("02c3964c4ad9c4af97d373099302c2cd770ad06c" + "7d8bd11c970161d861e917a854265e223da28031" + "ee38041534"), "c13c622bf08a3d3cf1fd6fa5e26e505e551b1643" + "bc5a0f59ed29541235218f77"); + + SHA256TestCase t_146_SHA256ShortMsg("t 146 SHA256ShortMsg", + dehex("b9eed82edcf0c7ba69f6f6ac5722cb61daecaf30" + "437511582117ad36ad410ebc6582511ef6e32dce" + "5f7a30ab543c"), "6ac64caaeda4763d28a44b363823a6b819285410" + "fb4162af6ca657396f6028d0"); + + SHA256TestCase t_149_SHA256ShortMsg("t 149 SHA256ShortMsg", + dehex("b574865024828bf651df070ac0cec1849aa64709" + "01d2e30fa01dcb43862d9827344cf900f46fa9ef" + "6d709e5e759f84"), "4c839e8f8f373c25a9a3351257c6152258ff8e6a" + "88dad42f30f2bbecab56c20b"); + + SHA256TestCase t_152_SHA256ShortMsg("t 152 SHA256ShortMsg", + dehex("eebcf5cd6b12c90db64ff71a0e08ccd956e170a5" + "0dad769480d6b1fb3eff4934cde90f9e9b930ee6" + "37a66285c10f4e8a"), "c117b9dce689c399ec99008788cd5d24d8396fab" + "7d96315c4f3fe6d56da63bb3"); + + SHA256TestCase t_155_SHA256ShortMsg("t 155 SHA256ShortMsg", + dehex("1b7a73770d168da45bf2e512eee45153e02f4dfe" + "3b42e50304a3d63d7826f0469562be8fdc6569b0" + "56a7dafcd53d1f597c"), "0b42cfc3dd3d3198f06c30e087837ec6a6dd35d0" + "8e54e886c682709f8f42457a"); + + SHA256TestCase t_158_SHA256ShortMsg("t 158 SHA256ShortMsg", + dehex("0072ae2f3bda67736b9c66e2130260b3a4847bc3" + "968e037cb6835efcc2014273336725cd5a94f592" + "aef20a0a65b459a4415b"), "217cf25b8b343c28336b1c1e9bed29e0c96045bc" + "93daf426e490b608b0905c90"); + + SHA256TestCase t_161_SHA256ShortMsg("t 161 SHA256ShortMsg", + dehex("2ac748680f3bc1bf098c4be38c7194643b0d009e" + "51c43630404cdfaf9807aa9b299094916c9466c3" + "1fe37fa630c6d3eadc9434"), "3ea59e2e79513679a22e962f22408306f7e8f6e5" + "62c2f1f210e279fad8eaacc6"); + + SHA256TestCase t_164_SHA256ShortMsg("t 164 SHA256ShortMsg", + dehex("893d1a8863d234ee50e5a8c7650a4de047230ad0" + "3d268dde8921401ff97b79dfb97cf2426b0f782b" + "79c7e75daa2155e1f4098ea7"), "f7808e03e5d5af43c2bffb66e35d1ecbd79f4d8f" + "ec44f821f73a235d17c70a89"); + + SHA256TestCase t_167_SHA256ShortMsg("t 167 SHA256ShortMsg", + dehex("cf673b96eaf241cfa3e262dc6fe65f08bcc2be56" + "d8a2c9710eaddae212ded6859f0ff83e5e57d0e8" + "0a968b8ed24e74defeb5bbdad6"), "9bdb7cf0492ace4620a47660acd127f951767b07" + "38b5504451d6ed56e4fa3cbd"); + + SHA256TestCase t_170_SHA256ShortMsg("t 170 SHA256ShortMsg", + dehex("0d545be1f47b966214691c21278704e89a17d52d" + "d96aeeeacc5325a9a1ddafdecd39407a4dfa72bd" + "32856b4c5cc2ba838618830c8399"), "ad53e0db7e63211c8b00947908ce29660c4376e2" + "44e19cd30a659af65dc6f1fe"); + + SHA256TestCase t_173_SHA256ShortMsg("t 173 SHA256ShortMsg", + dehex("9eabfcd3603337df3dcd119d6287a9bc8bb94d65" + "0ef29bcf1b32e60d425adc2a35e06577d0c7ce24" + "56cf260efee9e8d8aeeddb3d068f37"), "83eeed2dfeb8d2604ab5ec1ac9b5dcab8cc22225" + "18468bc5c24c16ce72e70687"); + + SHA256TestCase t_176_SHA256ShortMsg("t 176 SHA256ShortMsg", + dehex("2fc7b9e8b8dcaac64ecef4c5f91877543ac36ae4" + "94d9faf84b1d347b6cf925570db84043d6f500dc" + "c153cef81d6f2437d913f3dbffad42d9"), "6ef7e9f12267ebc4901267da147effdcdebcd6ec" + "5393c7f62ec4c4f06ca72649"); + + SHA256TestCase t_179_SHA256ShortMsg("t 179 SHA256ShortMsg", + dehex("cf95929ab732f9ef5e8c3e6b4ed753852ee74e4f" + "ddf31b56c29a6ec95d23fcde2209eb7288b787f0" + "5d9036735c32ae2f01fc650d9cce4995a5"), "3e5854169da065407fa465a4694f3fcb1d141480" + "a8f84c970a0f63364ec8f590"); + + SHA256TestCase t_182_SHA256ShortMsg("t 182 SHA256ShortMsg", + dehex("826378013988684c40f4d917c7ed8b72aba66fd6" + "8f085d0b2eb20948ef3f349dbbc71f8e0ba84501" + "4586495a48902ee44505c673d2f76d473950"), "5b506b823ef6658939aca22f52bbe5a4b849c31b" + "8fa1d09139352e501137bc04"); + + SHA256TestCase t_185_SHA256ShortMsg("t 185 SHA256ShortMsg", + dehex("0cab6d38ce9849fcbd589f7235a6d2c2cb933e26" + "e1ca6f4e78189104452c280c069b024e16276937" + "3f409d5cd0cb8160f0239418325d23ee6ad1bd"), "92943076cda4c46718e55df64d7580e12b8fb2c2" + "911e87851246ccf6791fa3e6"); + + SHA256TestCase t_188_SHA256ShortMsg("t 188 SHA256ShortMsg", + dehex("3fb4a8c5b57c14731179256608614c95c9725dda" + "d5fbfa99111d4fa319d3015ad830601556e8e4c6" + "d012d7da0e2c4f60f1605f6e4c058ec0f46988a3"), "8e90da3eb146935264576f874fcc5a64b7a90ab6" + "c8a36c15d855b0179f52f899"); + + SHA256TestCase t_191_SHA256ShortMsg("t 191 SHA256ShortMsg", + dehex("9050a6d002c90f6036c592b0f6b866713e7894d2" + "9645f4a19e0858b3ebd8078711c26d2601ca104d" + "962dc6ce6ae92634ee7f3ca6baf8810e2126097a" + "09"), "03c516677735ae83dbe5a7e4c22c1ac1bfedcd46" + "e7dd785f8bfe38e148eda632"); + + SHA256TestCase t_194_SHA256ShortMsg("t 194 SHA256ShortMsg", + dehex("d659ec136bacfa0b5c906aabedc93c01c5f1efa3" + "f370a1432ea8778461703f0c67c454da12bac2da" + "73b8abb755e5eaf10bddf52f6ca908d61bee80da" + "0c64"), "fff2852957a0eeb577e73fd7d827f650261dfb9a" + "8a65f52df4bbbc9b2d0ae50e"); + + SHA256TestCase t_197_SHA256ShortMsg("t 197 SHA256ShortMsg", + dehex("b498555658332b197bc5cb7adc5c1997aabbdcf1" + "f7ffcc2b6b82eb0f350019d247f8e399c3559d3b" + "b04eb049f28b344c7989c24db83f839b59028dc8" + "2fa670"), "bfbbf242f79bff4ae0aafb4ccf69b24fdca4342d" + "83db1dfd1822c74a9e218e8d"); + + SHA256TestCase t_200_SHA256ShortMsg("t 200 SHA256ShortMsg", + dehex("3592ecfd1eac618fd390e7a9c24b656532509367" + "c21a0eac1212ac83c0b20cd896eb72b801c4d212" + "c5452bbbf09317b50c5c9fb1997553d2bbc29bb4" + "2f5748ad"), "105a60865830ac3a371d3843324d4bb5fa8ec0e0" + "2ddaa389ad8da4f10215c454"); +} + diff --git a/0.2.0/ebuild/digests/rmd160.cc b/0.2.0/ebuild/digests/rmd160.cc new file mode 100644 index 000000000..ecbf5704a --- /dev/null +++ b/0.2.0/ebuild/digests/rmd160.cc @@ -0,0 +1,211 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "rmd160.hh" +#include <paludis/util/attributes.hh> +#include <sstream> + +using namespace rmd160; + +/* + * Implemented based upon the description at: + * http://homes.esat.kuleuven.be/~bosselae/ripemd160.html + */ + +namespace +{ + inline uint32_t rl(uint32_t x, unsigned int shift) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t rl(uint32_t x, unsigned int shift) + { + return (x << shift) | (x >> (32 - shift)); + } + + inline uint32_t _f(uint32_t j, uint32_t x, uint32_t y, uint32_t z) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t _f(uint32_t j, uint32_t x, uint32_t y, uint32_t z) + { + switch (j / 16) + { + case 0: + return x ^ y ^ z; + + case 1: + return (x & y) | (~x & z); + + case 2: + return (x | ~y) ^ z; + + case 3: + return (x & z) | (y & ~z); + + case 4: + return x ^ (y | ~z); + } + + throw 0; + } + + inline uint32_t _x(unsigned i, const uint8_t * const block) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t _x(unsigned i, const uint8_t * const block) + { + return + (block[(i << 2) + 3] << 24) | + (block[(i << 2) + 2] << 16) | + (block[(i << 2) + 1] << 8) | + (block[(i << 2) + 0]); + } + + inline uint32_t _e(const uint32_t x) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t _e(const uint32_t x) + { + return + ((x & 0xff) << 24) | + ((x & 0xff00) << 8) | + ((x & 0xff0000) >> 8) | + ((x & 0xff000000) >> 24); + } +} + +void +RMD160::_update(const uint8_t * const block) +{ + uint32_t a(_h[0]), b(_h[1]), c(_h[2]), d(_h[3]), e(_h[4]); + uint32_t ap(_h[0]), bp(_h[1]), cp(_h[2]), dp(_h[3]), ep(_h[4]); + uint32_t t; + + for (unsigned j(0) ; j <= 79 ; ++j) + { + t = a + _f(j, b, c, d) + _x(_r[j], block) + _k[j / 16]; + t = rl(t, _s[j]) + e; + a = e; + e = d; + d = rl(c, 10); + c = b; + b = t; + + t = ap + _f(79 - j, bp, cp, dp) + _x(_rp[j], block) + _kp[j / 16]; + t = rl(t, _sp[j]) + ep; + ap = ep; + ep = dp; + dp = rl(cp, 10); + cp = bp; + bp = t; + } + + t = _h[1] + c + dp; + _h[1] = _h[2] + d + ep; + _h[2] = _h[3] + e + ap; + _h[3] = _h[4] + a + bp; + _h[4] = _h[0] + b + cp; + _h[0] = t; +} + +RMD160::RMD160(std::istream & stream) : + _size(0), + _done_one_pad(false) +{ + _h[0] = 0x67452301; + _h[1] = 0xefcdab89; + _h[2] = 0x98badcfe; + _h[3] = 0x10325476; + _h[4] = 0xc3d2e1f0; + + uint8_t buffer[64]; + int c, s(0); + while (-1 != ((c = _get(stream)))) + { + buffer[s++] = c; + if (64 == s) + { + _update(&buffer[0]); + s = 0; + } + } + while (56 != s) + { + buffer[s++] = 0; + if (64 == s) + { + _update(&buffer[0]); + s = 0; + } + } + + buffer[56] = static_cast<uint8_t>(_size >> (0 * 8)); + buffer[57] = static_cast<uint8_t>(_size >> (1 * 8)); + buffer[58] = static_cast<uint8_t>(_size >> (2 * 8)); + buffer[59] = static_cast<uint8_t>(_size >> (3 * 8)); + buffer[60] = static_cast<uint8_t>(_size >> (4 * 8)); + buffer[61] = static_cast<uint8_t>(_size >> (5 * 8)); + buffer[62] = static_cast<uint8_t>(_size >> (6 * 8)); + buffer[63] = static_cast<uint8_t>(_size >> (7 * 8)); + _update(&buffer[0]); +} + +std::string +RMD160::hexsum() const +{ + std::stringstream result; + + for (int j(0) ; j < 5 ; ++j) + result << std::hex << std::right << std::setw(8) << std::setfill('0') << + _e(static_cast<unsigned int>(_h[j])) << std::flush; + + return result.str(); +} + +const uint8_t RMD160::_r[80] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +}; + +const uint8_t RMD160::_rp[80] = { + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +}; + +const uint8_t RMD160::_s[80] = { + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +}; + +const uint8_t RMD160::_sp[80] = { + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +}; + +const uint32_t RMD160::_k[5] = { + 0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e +}; + +const uint32_t RMD160::_kp[5] = { + 0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000 +}; + diff --git a/0.2.0/ebuild/digests/rmd160.hh b/0.2.0/ebuild/digests/rmd160.hh new file mode 100644 index 000000000..2b25c3908 --- /dev/null +++ b/0.2.0/ebuild/digests/rmd160.hh @@ -0,0 +1,69 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_EBUILD_DIGESTS_RMD160_HH +#define PALUDIS_GUARD_EBUILD_DIGESTS_RMD160_HH 1 + +#include <fstream> +#include <iomanip> +#include <string> +#include <inttypes.h> + +namespace rmd160 +{ + class RMD160 + { + private: + static const uint8_t _r[80], _rp[80]; + static const uint8_t _s[80], _sp[80]; + static const uint32_t _k[5], _kp[5]; + + uint32_t _h[5]; + uint64_t _size; + bool _done_one_pad; + + void _update(const uint8_t * const block); + + inline int _get(std::istream & stream) __attribute__((always_inline)) + { + char c; + if (stream.get(c)) + { + _size += 8; + return static_cast<unsigned char>(c); + } + else if (! _done_one_pad) + { + _done_one_pad = true; + return 0x80; + } + else + return -1; + } + + public: + RMD160(std::istream & stream); + + std::string hexsum() const; + }; + +} + +#endif + diff --git a/0.2.0/ebuild/digests/sha256.cc b/0.2.0/ebuild/digests/sha256.cc new file mode 100644 index 000000000..909aadc92 --- /dev/null +++ b/0.2.0/ebuild/digests/sha256.cc @@ -0,0 +1,209 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "sha256.hh" +#include <paludis/util/attributes.hh> +#include <sstream> + +using namespace sha256; + +/* + * Implemented based upon the description at: + * http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf + */ + +namespace +{ + inline uint32_t ch(uint32_t x, uint32_t y, uint32_t z) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t ch(uint32_t x, uint32_t y, uint32_t z) + { + return (x & y) ^ (~x & z); + } + + inline uint32_t maj(uint32_t x, uint32_t y, uint32_t z) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t maj(uint32_t x, uint32_t y, uint32_t z) + { + return (x & y) ^ (x & z) ^ (y & z); + } + + inline uint32_t rr(uint32_t x, unsigned int shift) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t rr(uint32_t x, unsigned int shift) + { + return (x >> shift) | (x << (32 - shift)); + } + + inline uint32_t sigma0(uint32_t x) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t sigma0(uint32_t x) + { + return rr(x, 2) ^ rr(x, 13) ^ rr(x, 22); + } + + inline uint32_t sigma1(uint32_t x) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t sigma1(uint32_t x) + { + return rr(x, 6) ^ rr(x, 11) ^ rr(x, 25); + } + + inline uint32_t lsigma0(uint32_t x) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t lsigma0(uint32_t x) + { + return rr(x, 7) ^ rr(x, 18) ^ (x >> 3); + } + + inline uint32_t lsigma1(uint32_t x) PALUDIS_ATTRIBUTE((always_inline)); + inline uint32_t lsigma1(uint32_t x) + { + return rr(x, 17) ^ rr(x, 19) ^ (x >> 10); + } + + inline void wload(unsigned j, const uint8_t * const block, + uint32_t * const dest) PALUDIS_ATTRIBUTE((always_inline)); + inline void wload(unsigned j, const uint8_t * const block, + uint32_t * const dest) + { + dest[j] = + (block[(j << 2) + 0] << 24) | + (block[(j << 2) + 1] << 16) | + (block[(j << 2) + 2] << 8) | + (block[(j << 2) + 3]); + } + + inline void wblend(unsigned j, uint32_t * const dest) PALUDIS_ATTRIBUTE((always_inline)); + inline void wblend(unsigned j, uint32_t * const dest) + { + dest[j] = lsigma1(dest[j - 2]) + dest[j - 7] + lsigma0(dest[j - 15]) + dest[j - 16]; + } +} + +void +SHA256::_update(const uint8_t * const block) +{ + uint32_t a(_h[0]), b(_h[1]), c(_h[2]), d(_h[3]), e(_h[4]), f(_h[5]), + g(_h[6]), h(_h[7]); + + uint32_t w[64]; + + for (uint32_t j(0) ; j < 16 ; ++j) + wload(j, block, &w[0]); + + for (uint32_t j(16) ; j <= 63 ; ++j) + wblend(j, &w[0]); + + for (uint32_t j(0) ; j <= 63 ; ++j) + { + uint32_t t1(h + sigma1(e) + ch(e, f, g) + _k[j] + w[j]); + uint32_t t2(sigma0(a) + maj(a, b, c)); + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + _h[0] += a; + _h[1] += b; + _h[2] += c; + _h[3] += d; + _h[4] += e; + _h[5] += f; + _h[6] += g; + _h[7] += h; +} + +SHA256::SHA256(std::istream & stream) : + _size(0), + _done_one_pad(false) +{ + _h[0] = 0x6a09e667; + _h[1] = 0xbb67ae85; + _h[2] = 0x3c6ef372; + _h[3] = 0xa54ff53a; + _h[4] = 0x510e527f; + _h[5] = 0x9b05688c; + _h[6] = 0x1f83d9ab; + _h[7] = 0x5be0cd19; + + uint8_t buffer[64]; + int c, s(0); + while (-1 != ((c = _get(stream)))) + { + buffer[s++] = c; + if (64 == s) + { + _update(&buffer[0]); + s = 0; + } + } + while (56 != s) + { + buffer[s++] = 0; + if (64 == s) + { + _update(&buffer[0]); + s = 0; + } + } + + buffer[56] = static_cast<uint8_t>(_size >> (7 * 8)); + buffer[57] = static_cast<uint8_t>(_size >> (6 * 8)); + buffer[58] = static_cast<uint8_t>(_size >> (5 * 8)); + buffer[59] = static_cast<uint8_t>(_size >> (4 * 8)); + buffer[60] = static_cast<uint8_t>(_size >> (3 * 8)); + buffer[61] = static_cast<uint8_t>(_size >> (2 * 8)); + buffer[62] = static_cast<uint8_t>(_size >> (1 * 8)); + buffer[63] = static_cast<uint8_t>(_size >> (0 * 8)); + _update(&buffer[0]); +} + +std::string +SHA256::hexsum() const +{ + std::stringstream result; + + for (int j(0) ; j < 8 ; ++j) + result << std::hex << std::right << std::setw(8) << std::setfill('0') << + static_cast<unsigned int>(_h[j]) << std::flush; + + return result.str(); +} + + +const uint32_t +sha256::SHA256::_k[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + diff --git a/0.2.0/ebuild/digests/sha256.hh b/0.2.0/ebuild/digests/sha256.hh new file mode 100644 index 000000000..0b0e1ec1e --- /dev/null +++ b/0.2.0/ebuild/digests/sha256.hh @@ -0,0 +1,66 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_EBUILD_DIGESTS_SHA256_HH +#define PALUDIS_GUARD_EBUILD_DIGESTS_SHA256_HH 1 + +#include <fstream> +#include <iomanip> +#include <string> +#include <inttypes.h> + +namespace sha256 +{ + class SHA256 + { + private: + static const uint32_t _k[64]; + + uint32_t _h[8]; + uint64_t _size; + bool _done_one_pad; + + void _update(const uint8_t * const block); + + inline int _get(std::istream & stream) __attribute__((always_inline)) + { + char c; + if (stream.get(c)) + { + _size += 8; + return static_cast<unsigned char>(c); + } + else if (! _done_one_pad) + { + _done_one_pad = true; + return 0x80; + } + else + return -1; + } + + public: + SHA256(std::istream & stream); + + std::string hexsum() const; + }; + +} + +#endif diff --git a/0.2.0/ebuild/ebuild.bash b/0.2.0/ebuild/ebuild.bash new file mode 100755 index 000000000..e9cedf71e --- /dev/null +++ b/0.2.0/ebuild/ebuild.bash @@ -0,0 +1,224 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +unalias -a +unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE +eval unset LANG ${!LC_*} + +export SANDBOX_PREDICT="${SANDBOX_PREDICT+${SANDBOX_PREDICT}:}" +export SANDBOX_PREDICT="${SANDBOX_PREDICT}/proc/self/maps:/dev/console:/dev/random" +export SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}" +export SANDBOX_WRITE="${SANDBOX_WRITE}/dev/shm:/dev/stdout:/dev/stderr:/dev/null:/dev/tty" +export SANDBOX_WRITE="${SANDBOX_WRITE}:${PALUDIS_TMPDIR}" +export SANDBOX_ON="1" + +shopt -s expand_aliases + +EBUILD_KILL_PID=$$ +alias die='diefunc "$FUNCNAME" "$LINENO"' +alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ -z "${_pipestatus//[ 0]/}" ]] || diefunc "$FUNCNAME" "$LINENO" "$_pipestatus"' +trap 'echo "die trap: exiting with error." 1>&2 ; exit 250' 15 + +export EBUILD_PROGRAM_NAME="$0" + +diefunc() +{ + local func="$1" line="$2" + shift 2 + echo 1>&2 + echo "ERROR in ${CATEGORY:-?}/${PF:-?}:" 1>&2 + echo "!!! In ${func:-?} at line ${line:-?}" 1>&2 + echo "!!! ${*:-(no message provided)}" 1>&2 + echo 1>&2 + + kill ${EBUILD_KILL_PID} + exit 249 +} + +EBUILD_MODULES_DIR=$(readlink -f $(dirname $0 ) ) +[[ -d ${EBUILD_MODULES_DIR} ]] || die "${EBUILD_MODULES_DIR} is not a directory" +export PALUDIS_EBUILD_MODULES_DIR="${EBUILD_MODULES_DIR}" + +ebuild_load_module() +{ + source "${EBUILD_MODULES_DIR}/${1}.bash" || die "Error loading module ${1}" +} + +source /sbin/functions.sh || die "Couldn't source functions.sh" +ebuild_load_module echo_functions +ebuild_load_module sandbox +ebuild_load_module portage_stubs +ebuild_load_module list_functions +ebuild_load_module multilib_functions +ebuild_load_module install_functions +ebuild_load_module build_functions +ebuild_load_module unpack_functions +ebuild_load_module eclass_functions + +ebuild_source_profile() +{ + if [[ -f ${1}/parent ]] ; then + while read line; do + ebuild_source_profile $(readlink -f ${1}/${line} ) + done <${1}/parent + fi + + if [[ -f ${1}/make.defaults ]] ; then + eval "$(sed -e 's/^\([a-zA-Z0-9\-_]\+=\)/export \1/' ${1}/make.defaults )" || die "Couldn't source ${1}/make.defaults" + fi + + if [[ -f ${1}/bashrc ]] ; then + source ${1}/bashrc || die "Couldn't source ${1}/bashrc" + fi +} + +save_vars="USE USE_EXPAND" + +for var in ${save_vars} ; do + eval "export save_var_${var}='${!var}'" +done + +if [[ -n "${PALUDIS_PROFILE_DIR}" ]] ; then + ebuild_source_profile $(readlink -f "${PALUDIS_PROFILE_DIR}") +fi + +unset ${save_vars} + +for f in ${PALUDIS_BASHRC_FILES} ; do + if [[ -f ${f} ]] ; then + ebuild_notice "debug" "Loading bashrc file ${f}" + source ${f} + else + ebuild_notice "debug" "Skipping bashrc file ${f}" + fi +done + +for var in ${save_vars}; do + if [[ -n ${!var} ]]; then + die "${var} should not be set in bashrc. Aborting." + fi +done + +for var in ${save_vars} ; do + eval "export ${var}=\${save_var_${var}}" +done + +ebuild_load_ebuild() +{ + export EBUILD="${1}" + if [[ "${CATEGORY}" == "virtual" ]] ; then + if [[ -f "${1}" ]] ; then + source ${1} || die "Error sourcing ebuild '${1}'" + elif [[ -e "${1}" ]] ; then + die "'${1}' exists but is not a regular file" + fi + else + [[ -f "${1}" ]] || die "Ebuild '${1}' is not a file" + source ${1} || die "Error sourcing ebuild '${1}'" + fi + [[ ${RDEPEND-unset} == "unset" ]] && RDEPEND="${DEPEND}" + + IUSE="${IUSE} ${E_IUSE}" + DEPEND="${DEPEND} ${E_DEPEND}" + RDEPEND="${RDEPEND} ${E_RDEPEND}" + PDEPEND="${PDEPEND} ${E_PDEPEND}" + KEYWORDS="${KEYWORDS} ${E_KEYWORDS}" +} + +perform_hook() +{ + export HOOK=${1} + ebuild_notice "debug" "Starting hook '${HOOK}'" + + local old_sandbox_on="${SANDBOX_ON}" + export SANDBOX_ON="0" + + local hook_dir + for hook_dir in ${PALUDIS_HOOK_DIRS} ; do + [[ -d "${hook_dir}/${HOOK}" ]] || continue + local hook_file + for hook_file in "${hook_dir}/${HOOK}/"*.bash ; do + [[ -e "${hook_file}" ]] || continue + ebuild_notice "debug" "Starting hook script '${hook_file}' for '${HOOK}'" + if ! bash "${hook_file}" ; then + ebuild_notice "warning" "Hook '${hook_file}' returned failure" + else + ebuild_notice "warning" "Hook '${hook_file}' returned success" + fi + done + done + + export SANDBOX_ON="${old_sandbox_on}" +} + +ebuild_main() +{ + local action ebuild="$1" + shift + + for action in $@ ; do + case ${action} in + metadata|init|fetch|merge|unmerge|tidyup|strip) + ebuild_load_module builtin_${action} + ;; + + unpack|compile|install|test) + ebuild_load_module src_${action} + ;; + + setup|config|nofetch|preinst|postinst|prerm|postrm) + ebuild_load_module pkg_${action} + ;; + + *) + ebuild_load_module usage_error + ebuild_f_usage_error "Unknown action '${action}'" + exit 1 + ;; + esac + done + + if [[ $1 == metadata ]] ; then + for f in cut tr ; do + eval "export ebuild_real_${f}=\"$(which $f )\"" + eval "${f}() { ebuild_notice qa 'global scope ${f}' ; $(which $f ) \"\$@\" ; }" + done + perform_hook ebuild_${action}_pre + PATH="" ebuild_load_ebuild "${ebuild}" + ebuild_f_metadata || die "${1} failed" + perform_hook ebuild_${action}_post + else + ebuild_load_ebuild "${ebuild}" + for action in $@ ; do + perform_hook ebuild_${action}_pre + ebuild_f_${action} || die "${action} failed" + if [[ ${action} == "init" ]] ; then + ebuild_load_ebuild "${ebuild}" + fi + perform_hook ebuild_${action}_post + done + fi +} + +ebuild_main $@ + diff --git a/0.2.0/ebuild/echo_functions.bash b/0.2.0/ebuild/echo_functions.bash new file mode 100644 index 000000000..f57d39b6e --- /dev/null +++ b/0.2.0/ebuild/echo_functions.bash @@ -0,0 +1,88 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +use_with() +{ + if useq "${1}" ; then + echo "--with-${2:-${1}}${3+=${3}}" + else + echo "--without-${2:-${1}}" + fi +} + +use_enable() +{ + if useq "${1}" ; then + echo "--enable-${2:-${1}}${3+=${3}}" + else + echo "--disable-${2:-${1}}" + fi +} + +ebuild_notice_level() +{ + case "$1" in + debug) + echo "1"; + ;; + + qa) + echo "2"; + ;; + + warning) + echo "3"; + ;; + + silent) + echo "4"; + ;; + + *) + echo "[WARNING.EBUILD] Bad value '$1' for qa level" 1>&2 + echo "2"; + ;; + esac +} + +ebuild_notice() +{ + local level="$1" + shift + + local level_num=$(ebuild_notice_level "${level}" ) + local min_level_num=$(ebuild_notice_level "${PALUDIS_EBUILD_LOG_LEVEL}" ) + + if [[ "${level_num}" -ge "${min_level_num}" ]] ; then + local upper_level=$(echo ${level} | ${ebuild_real_tr:-tr} '[:lower:]' '[:upper:]' ) + echo -n "${EBUILD_PROGRAM_NAME:-ebuild.bash}@$(date +%s ): " 1>&2 + echo "[${upper_level}.EBUILD] $* (from ${EBUILD:-?})" 1>&2 + fi + true +} + +ebuild_section() +{ + echo ">>> $*" +} + diff --git a/0.2.0/ebuild/echo_functions_TEST.bash b/0.2.0/ebuild/echo_functions_TEST.bash new file mode 100644 index 000000000..4c8591817 --- /dev/null +++ b/0.2.0/ebuild/echo_functions_TEST.bash @@ -0,0 +1,45 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License version 2, as published by the Free Software Foundation. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +use_with_TEST() +{ + export USE="foo" + test_equality "$(use_with foo )" "--with-foo" + test_equality "$(use_with foo bar )" "--with-bar" + test_equality "$(use_with foo bar baz )" "--with-bar=baz" + + export USE="oink" + test_equality "$(use_with foo )" "--without-foo" + test_equality "$(use_with foo bar )" "--without-bar" + test_equality "$(use_with foo bar baz )" "--without-bar" +} + + +use_enable_TEST() +{ + export USE="foo" + test_equality "$(use_enable foo )" "--enable-foo" + test_equality "$(use_enable foo bar )" "--enable-bar" + test_equality "$(use_enable foo bar baz )" "--enable-bar=baz" + + export USE="oink" + test_equality "$(use_enable foo )" "--disable-foo" + test_equality "$(use_enable foo bar )" "--disable-bar" + test_equality "$(use_enable foo bar baz )" "--disable-bar" +} + diff --git a/0.2.0/ebuild/eclass_functions.bash b/0.2.0/ebuild/eclass_functions.bash new file mode 100644 index 000000000..5c9bffc5b --- /dev/null +++ b/0.2.0/ebuild/eclass_functions.bash @@ -0,0 +1,79 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +EXPORT_FUNCTIONS() +{ + [[ -z "${ECLASS}" ]] && die "EXPORT_FUNCTIONS called but ECLASS undefined" + + local e + for e in "$@" ; do + case "$e" in + pkg_setup|pkg_prerm|pkg_postrm|pkg_preinst|pkg_postinst) + eval "${e}() { ${ECLASS}_${e} \"\$@\" ; }" + ;; + + src_unpack|src_compile|src_install|src_test) + eval "${e}() { ${ECLASS}_${e} \"\$@\" ; }" + ;; + + *) + eval "${e}() { ${ECLASS}_${e} \"\$@\" ; }" + ebuild_notice "qa" "$e should not be in EXPORT_FUNCTIONS for ${ECLASS}" + ;; + esac + done +} + +inherit() +{ + local e + for e in "$@" ; do + local location="${ECLASSDIR}/${e}.eclass" + local old_ECLASS="${ECLASS}" + export ECLASS="${e}" + + local current_IUSE="${IUSE}" current_DEPEND="${DEPEND}" + local current_RDEPEND="${RDEPEND}" current_PDEPEND="${PDEPEND}" + local current_KEYWORDS="${KEYWORDS}" + + unset IUSE DEPEND RDEPEND PDEPEND KEYWORDS + + source "${location}" || die "Error sourcing eclass ${e}" + hasq "${ECLASS}" ${INHERITED} || export INHERITED="${INHERITED} ${ECLASS}" + + E_IUSE="${E_IUSE} ${IUSE}" + E_PDEPEND="${E_PDEPEND} ${PDEPEND}" + E_RDEPEND="${E_RDEPEND} ${RDEPEND}" + E_DEPEND="${E_DEPEND} ${DEPEND}" + E_KEYWORDS="${KEYWORDS:+${KEYWORDS} }${E_KEYWORDS}" + + IUSE="${current_IUSE}" + DEPEND="${current_DEPEND}" + RDEPEND="${current_RDEPEND}" + PDEPEND="${current_PDEPEND}" + KEYWORDS="${current_KEYWORDS}" + + export ECLASS="${old_ECLASS}" + done +} + diff --git a/0.2.0/ebuild/install_functions.bash b/0.2.0/ebuild/install_functions.bash new file mode 100644 index 000000000..3bab4077e --- /dev/null +++ b/0.2.0/ebuild/install_functions.bash @@ -0,0 +1,110 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +umask 022 +export DESTTREE="/usr" +export INSDESTTREE="" +export EXEDESTTREE="" +export DOCDESTTREE="" +export INSOPTIONS="-m0644" +export EXEOPTIONS="-m0755" +export LIBOPTIONS="-m0644" +export DIROPTIONS="-m0755" +export MOPREFIX="${PN}" + +keepdir() +{ + dodir "$@" + if [[ "${1}" == "-R" ]] || [[ "${1}" == "-r" ]] ; then + shift + find "$@" -type d -printf "${D}/%p/.keep\0" | xargs -0 touch + assert "Failed to create .keep files" + else + local f + for f in "$@" ; do + touch "${D}/${f}/.keep" || die "Couldn't touch .keep in ${f}" + done + fi +} + +into() +{ + if [[ "${1}" == "/" ]] ; then + export DESTTREE= + else + export DESTTREE="${1}" + [[ -d "${D}${DESTTREE}" ]] || install -d "${D}${DESTTREE}" + fi +} + +insinto() +{ + if [[ "${1}" == "/" ]] ; then + export INSDESTTREE= + else + export INSDESTTREE="${1}" + [[ -d "${D}${INSDESTTREE}" ]] || install -d "${D}${INSDESTTREE}" + fi +} + +exeinto() +{ + if [[ "${1}" == "/" ]] ; then + export EXEDESTTREE= + else + export EXEDESTTREE="${1}" + [[ -d "${D}${EXEDESTTREE}" ]] || install -d "${D}${EXEDESTTREE}" + fi +} + +docinto() +{ + if [[ "${1}" == "/" ]] ; then + export DOCDESTTREE= + else + export DOCDESTTREE="${1}" + [[ -d "${D}usr/share/doc/${PF}/${DOCDESTTREE}" ]] || \ + install -d "${D}usr/share/doc/${PF}/${DOCDESTTREE}" + fi +} + +insopts() +{ + export INSOPTIONS="$@" +} + +diropts() +{ + export DIROPTIONS="$@" +} + +exeopts() +{ + export EXEOPTIONS="$@" +} + +libopts() +{ + export LIBOPTIONS="$@" +} + diff --git a/0.2.0/ebuild/list_functions.bash b/0.2.0/ebuild/list_functions.bash new file mode 100644 index 000000000..53557cb67 --- /dev/null +++ b/0.2.0/ebuild/list_functions.bash @@ -0,0 +1,71 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +use() +{ + useq "${1}" +} + +usev() +{ + if useq "${1}" ; then + echo "${1#!}" + return 0 + else + return 1 + fi +} + +useq() +{ + if [[ "${1:0:1}" == "!" ]] ; then + ! hasq "${1#!}" "${USE}" + else + hasq "${1}" "${USE}" + fi +} + +has() +{ + hasq "${@}" +} + +hasv() +{ + if hasq "${@}" ; then + echo "${1}" + return 0 + else + return 1 + fi +} + +hasq() +{ + local x= want="$1" + shift + for x in $@ ; do + [[ "${x}" == "${want}" ]] && return 0 + done + return 1 +} diff --git a/0.2.0/ebuild/list_functions_TEST.bash b/0.2.0/ebuild/list_functions_TEST.bash new file mode 100644 index 000000000..3bbbc709b --- /dev/null +++ b/0.2.0/ebuild/list_functions_TEST.bash @@ -0,0 +1,74 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License version 2, as published by the Free Software Foundation. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +use_TEST() +{ + export USE="foo bar" + + use foo ; test_return_code + use bar ; test_return_code + ! use baz ; test_return_code + ! use foofoo ; test_return_code + ! use fo ; test_return_code + + ! use !foo ; test_return_code + ! use !bar ; test_return_code + use !baz ; test_return_code + use !foofoo ; test_return_code + use !fo ; test_return_code +} + +usev_TEST() +{ + export USE="foo bar" + usev foo 1>/dev/null ; test_return_code + test_equality "$(usev foo)" "foo" + + usev bar 1>/dev/null ; test_return_code + test_equality "$(usev bar)" "bar" + + ! usev baz 1>/dev/null ; test_return_code + test_equality "$(usev baz)" "" + + ! usev !foo 1>/dev/null ; test_return_code + test_equality "$(usev !foo)" "" + + ! usev !bar 1>/dev/null ; test_return_code + test_equality "$(usev !bar)" "" + + ! usev baz 1>/dev/null ; test_return_code + test_equality "$(usev !baz)" "baz" +} + +useq_TEST() +{ + export USE="foo bar" + + useq foo ; test_return_code + useq bar ; test_return_code + ! useq baz ; test_return_code + ! useq foofoo ; test_return_code + ! useq fo ; test_return_code + + ! useq !foo ; test_return_code + ! useq !bar ; test_return_code + useq !baz ; test_return_code + useq !foofoo ; test_return_code + useq !fo ; test_return_code +} + diff --git a/0.2.0/ebuild/multilib_functions.bash b/0.2.0/ebuild/multilib_functions.bash new file mode 100644 index 000000000..181339609 --- /dev/null +++ b/0.2.0/ebuild/multilib_functions.bash @@ -0,0 +1,67 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +# Default values. Those used on a non-multilib profile. +export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"} +export DEFAULT_ABI=${DEFAULT_ABI:-"default"} +export CFLAGS_default +export LDFLAGS_default +export CHOST_default=${CHOST_default:-${CHOST}} +export CTARGET_default=${CTARGET_default:-${CTARGET:-${CHOST_default}}} +export LIBDIR_default=${CONF_LIBDIR:-"lib"} +export CDEFINE_default + + +ebuild_get_libdir() { + local CONF_LIBDIR + if [[ -n "${CONF_LIBDIR_OVERRIDE}" ]]; then + echo ${CONF_LIBDIR_OVERRIDE} + else + ebuild_get_abi_LIBDIR + fi +} + +ebuild_get_abi_var() { + local flag=$1 + local abi + if [[ $# -gt 1 ]]; then + abi=${2} + elif [[ -n "${ABI}" ]]; then + abi=${ABI} + elif [[ -n "${DEFAULT_ABI}" ]]; then + abi=${DEFAULT_ABI} + else + abi="default" + fi + + local var="${flag}_${abi}" + echo ${!var} +} + +ebuild_get_abi_CFLAGS() { ebuild_get_abi_var CFLAGS "$@"; } +ebuild_get_abi_LDFLAGS() { ebuild_get_abi_var LDFLAGS "$@"; } +ebuild_get_abi_CHOST() { ebuild_get_abi_var CHOST "$@"; } +ebuild_get_abi_CTARGET() { ebuild_get_abi_var CTARGET "$@"; } +ebuild_get_abi_FAKE_TARGETS() { ebuild_get_abi_var FAKE_TARGETS "$@"; } +ebuild_get_abi_CDEFINE() { ebuild_get_abi_var CDEFINE "$@"; } +ebuild_get_abi_LIBDIR() { ebuild_get_abi_var LIBDIR "$@"; } diff --git a/0.2.0/ebuild/pkg_config.bash b/0.2.0/ebuild/pkg_config.bash new file mode 100644 index 000000000..a141d7a31 --- /dev/null +++ b/0.2.0/ebuild/pkg_config.bash @@ -0,0 +1,28 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +pkg_config() +{ + eerror "No configuration function is defined" +} + diff --git a/0.2.0/ebuild/pkg_nofetch.bash b/0.2.0/ebuild/pkg_nofetch.bash new file mode 100644 index 000000000..f364f55e9 --- /dev/null +++ b/0.2.0/ebuild/pkg_nofetch.bash @@ -0,0 +1,34 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +pkg_nofetch() +{ + [[ -z "${SRC_URI}" ]] && return + + local f + echo "The following files could not be fetched automatically for ${PN}:" + for f in ${SRC_URI} ; do + echo "* ${f}" + done +} + diff --git a/0.2.0/ebuild/pkg_postinst.bash b/0.2.0/ebuild/pkg_postinst.bash new file mode 100644 index 000000000..ac28a4b0d --- /dev/null +++ b/0.2.0/ebuild/pkg_postinst.bash @@ -0,0 +1,46 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +pkg_postinst() +{ + : +} + +ebuild_f_postinst() +{ + local old_sandbox_write="${SANDBOX_WRITE}" + SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/" + + if hasq "postinst" ${RESTRICT} ; then + ebuild_section "Skipping pkg_postinst (RESTRICT)" + elif hasq "postinst" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping pkg_postinst (SKIP_FUNCTIONS)" + else + ebuild_section "Starting pkg_postinst" + pkg_postinst + ebuild_section "Done pkg_postinst" + fi + + SANDBOX_WRITE="${old_sandbox_write}" +} + diff --git a/0.2.0/ebuild/pkg_postrm.bash b/0.2.0/ebuild/pkg_postrm.bash new file mode 100644 index 000000000..ac8d76a40 --- /dev/null +++ b/0.2.0/ebuild/pkg_postrm.bash @@ -0,0 +1,47 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +pkg_postrm() +{ + : +} + +ebuild_f_postrm() +{ + local old_sandbox_write="${SANDBOX_WRITE}" + SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/" + + if hasq "postrm" ${RESTRICT} ; then + ebuild_section "Skipping pkg_postrm (RESTRICT)" + elif hasq "postrm" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping pkg_postrm (SKIP_FUNCTIONS)" + else + ebuild_section "Starting pkg_postrm" + pkg_postrm + ebuild_section "Done pkg_postrm" + fi + + SANDBOX_WRITE="${old_sandbox_write}" +} + + diff --git a/0.2.0/ebuild/pkg_preinst.bash b/0.2.0/ebuild/pkg_preinst.bash new file mode 100644 index 000000000..943e7bdc0 --- /dev/null +++ b/0.2.0/ebuild/pkg_preinst.bash @@ -0,0 +1,46 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +pkg_preinst() +{ + : +} + +ebuild_f_preinst() +{ + local old_sandbox_write="${SANDBOX_WRITE}" + SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/" + + if hasq "preinst" ${RESTRICT} ; then + ebuild_section "Skipping pkg_preinst (RESTRICT)" + elif hasq "preinst" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping pkg_preinst (SKIP_FUNCTIONS)" + else + ebuild_section "Starting pkg_preinst" + pkg_preinst + ebuild_section "Done pkg_preinst" + fi + + SANDBOX_WRITE="${old_sandbox_write}" +} + diff --git a/0.2.0/ebuild/pkg_prerm.bash b/0.2.0/ebuild/pkg_prerm.bash new file mode 100644 index 000000000..cc353f1d5 --- /dev/null +++ b/0.2.0/ebuild/pkg_prerm.bash @@ -0,0 +1,46 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +pkg_prerm() +{ + : +} + +ebuild_f_prerm() +{ + local old_sandbox_write="${SANDBOX_WRITE}" + SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/" + + if hasq "prerm" ${RESTRICT} ; then + ebuild_section "Skipping pkg_prerm (RESTRICT)" + elif hasq "prerm" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping pkg_prerm (SKIP_FUNCTIONS)" + else + ebuild_section "Starting pkg_prerm" + pkg_prerm + ebuild_section "Done pkg_prerm" + fi + + SANDBOX_WRITE="${old_sandbox_write}" +} + diff --git a/0.2.0/ebuild/pkg_setup.bash b/0.2.0/ebuild/pkg_setup.bash new file mode 100644 index 000000000..4bf709b52 --- /dev/null +++ b/0.2.0/ebuild/pkg_setup.bash @@ -0,0 +1,41 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +pkg_setup() +{ + : +} + +ebuild_f_setup() +{ + if hasq "setup" ${RESTRICT} ; then + ebuild_section "Skipping pkg_setup (RESTRICT)" + elif hasq "setup" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping pkg_setup (SKIP_FUNCTIONS)" + else + ebuild_section "Starting pkg_setup" + pkg_setup + ebuild_section "Done pkg_setup" + fi +} + diff --git a/0.2.0/ebuild/portage_stubs.bash b/0.2.0/ebuild/portage_stubs.bash new file mode 100644 index 000000000..9f70bf2ae --- /dev/null +++ b/0.2.0/ebuild/portage_stubs.bash @@ -0,0 +1,73 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +has_version() +{ + ${PALUDIS_COMMAND} --has-version "$@" +} + +portageq() +{ + # \todo Make this suck less... + if [[ "$1" == "has_version" ]] ; then + if [[ "$(readlink -f $2 )" != "$(readlink -f $ROOT )" ]] ; then + eerror "Error emulating 'portageq $@':" + die "portageq has_version emulation only works on current ROOT" + else + shift ; shift + has_version "$@" + fi + elif [[ "$1" == "best_version" ]] ; then + if [[ "$(readlink -f $2 )" != "$(readlink -f $ROOT )" ]] ; then + eerror "Error emulating 'portageq $@':" + die "portageq best_version emulation only works on current ROOT" + else + shift ; shift + best_version "$@" + fi + else + eerror "Error emulating 'portageq $@':" + die "portageq emulation for $1 not implemented" + fi +} + +best_version() +{ + ${PALUDIS_COMMAND} --best-version "$@" +} + +check_KV() +{ + die "check_KV not implenented" +} + +debug-print() +{ + : +} + +debug-print-function() +{ + : +} + diff --git a/0.2.0/ebuild/run_test.bash b/0.2.0/ebuild/run_test.bash new file mode 100644 index 000000000..b5587b9d1 --- /dev/null +++ b/0.2.0/ebuild/run_test.bash @@ -0,0 +1,47 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +shopt -s expand_aliases +shopt -s extglob +set +o posix + +export TEST_STATUS= +export PALUDIS_IN_TEST_FRAMEWORK="yes" + +test_return_code() +{ + local r="$?" + if [[ "0" == "${r}" ]] ; then + echo -n "." + else + echo -n "!{retcode: ${r}}" + export local_test_status="fail" + export TEST_STATUS="fail" + fi +} + +test_equality() +{ + if [[ "${1}" == "${2}" ]] ; then + echo -n "." + else + echo -n "!{'${1}' not equal to '${2}'}" + export local_test_status="fail" + export TEST_STATUS="fail" + fi +} + +echo "Test program ${1}:" +source "$(dirname ${1} )/ebuild.bash" || exit 200 +source "${1}" || exit 200 + +for testname in $(set | grep '_TEST *() *$' ) ; do + [[ ${testname/()} != ${testname} ]] && continue + echo -n "* ${testname%_TEST}: " + export local_test_status="" + ${testname} + [[ -z "$local_test_status" ]] && echo " OK" || echo " FAIL" +done + +[[ -z "$TEST_STATUS" ]] + diff --git a/0.2.0/ebuild/sandbox.bash b/0.2.0/ebuild/sandbox.bash new file mode 100644 index 000000000..d54325c5b --- /dev/null +++ b/0.2.0/ebuild/sandbox.bash @@ -0,0 +1,43 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +addread() +{ + export SANDBOX_READ="${SANDBOX_READ+${SANDBOX_READ}:}${1}" +} + +addwrite() +{ + export SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${1}" +} + +adddeny() +{ + export SANDBOX_DENY="${SANDBOX_DENY+${SANDBOX_DENY}:}${1}" +} + +addpredict() +{ + export SANDBOX_PREDICT="${SANDBOX_PREDICT+${SANDBOX_PREDICT}:}${1}" +} + diff --git a/0.2.0/ebuild/src_compile.bash b/0.2.0/ebuild/src_compile.bash new file mode 100644 index 000000000..8bf66a5bc --- /dev/null +++ b/0.2.0/ebuild/src_compile.bash @@ -0,0 +1,47 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +src_compile() +{ + [[ -x ./configure ]] && econf + if [[ -f Makefile ]] || [[ -f makefile ]] || [[ -f GNUmakefile ]] ; then + emake || die "emake failed" + fi +} + +ebuild_f_compile() +{ + mkdir -p ${S} + cd ${S} || die "cd to \${S} (\"${S}\") failed" + + if hasq "compile" ${RESTRICT} ; then + ebuild_section "Skipping src_compile (RESTRICT)" + elif hasq "compile" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping src_compile (SKIP_FUNCTIONS)" + else + ebuild_section "Starting src_compile" + src_compile + ebuild_section "Done src_compile" + fi +} + diff --git a/0.2.0/ebuild/src_install.bash b/0.2.0/ebuild/src_install.bash new file mode 100644 index 000000000..42fe02996 --- /dev/null +++ b/0.2.0/ebuild/src_install.bash @@ -0,0 +1,43 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +src_install() +{ + : +} + +ebuild_f_install() +{ + cd ${S} || die "cd to \${S} (\"${S}\") failed" + + if hasq "install" ${RESTRICT} ; then + ebuild_section "Skipping src_install (RESTRICT)" + elif hasq "install" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping src_install (SKIP_FUNCTIONS)" + else + ebuild_section "Starting src_install" + src_install + ebuild_section "Done src_install" + fi +} + diff --git a/0.2.0/ebuild/src_test.bash b/0.2.0/ebuild/src_test.bash new file mode 100644 index 000000000..da4b2f9b5 --- /dev/null +++ b/0.2.0/ebuild/src_test.bash @@ -0,0 +1,59 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +src_test() +{ + if [[ -f Makefile ]] ; then + echo "Makefile found, looking for potential test targets" + if make -j1 -n check ; then + echo "Found check target" + emake -j1 check || die "make check failed" + elif make -j1 -n test ; then + echo "Found test target" + emake -j1 test || die "make test failed" + else + echo "No check or test target, skipping tests" + fi + else + echo "No Makefile, skipping tests" + fi +} + +ebuild_f_test() +{ + local old_sandbox_predict="${SANDBOX_PREDICT}" + SANDBOX_PREDICT="${SANDBOX_PREDICT+${SANDBOX_PREDICT}:}/" + + if hasq "test" ${RESTRICT} ; then + ebuild_section "Skipping src_test (RESTRICT)" + elif hasq "test" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping src_test (SKIP_FUNCTIONS)" + else + ebuild_section "Starting src_test" + src_test + ebuild_section "Done src_test" + fi + + SANDBOX_PREDICT="${old_sandbox_predict}" +} + diff --git a/0.2.0/ebuild/src_unpack.bash b/0.2.0/ebuild/src_unpack.bash new file mode 100644 index 000000000..a309c6054 --- /dev/null +++ b/0.2.0/ebuild/src_unpack.bash @@ -0,0 +1,43 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +src_unpack() +{ + [[ -n "${A}" ]] && unpack ${A} +} + +ebuild_f_unpack() +{ + cd ${WORKDIR} || die "cd to \${WORKDIR} (\"${WORKDIR}\") failed" + + if hasq "unpack" ${RESTRICT} ; then + ebuild_section "Skipping src_unpack (RESTRICT)" + elif hasq "unpack" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping src_unpack (SKIP_FUNCTIONS)" + else + ebuild_section "Starting src_unpack" + src_unpack + ebuild_section "Done src_unpack" + fi +} + diff --git a/0.2.0/ebuild/unpack_functions.bash b/0.2.0/ebuild/unpack_functions.bash new file mode 100644 index 000000000..4efbe6d85 --- /dev/null +++ b/0.2.0/ebuild/unpack_functions.bash @@ -0,0 +1,93 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +unpack() +{ + [[ -z "$@" ]] && die "No arguments given to unpack" + + for x in "$@" ; do + x=$(echo $x ) + echo ">>> Unpacking ${x} to ${PWD}" + [[ "${x:0:2}" == "./" ]] || x="${DISTDIR}/${x}" + unpack_one "${x}" + done +} + +unpack_one() +{ + [[ -z "$1" ]] && die "Bad argument for unpack_one" + [[ -e "$1" ]] || die "${1} doesn't exist" + + case "${x}" in + *.tar) + echo tar xf "${1}" 1>&2 + tar xf "${1}" || die "Couldn't unpack ${1}" + ;; + + *.tar.gz|*.tgz) + echo tar zxf "${1}" 1>&2 + tar zxf "${1}" || die "Couldn't unpack ${1}" + ;; + + *.tar.bz2|*.tbz2) + echo tar jxf "${1}" 1>&2 + tar jxf "${1}" || die "Couldn't unpack ${1}" + ;; + + *.zip|*.ZIP|*.jar) + echo unzip -qo "${1}" 1>&2 + unzip -qo "${1}" || die "Couldn't unpack ${1}" + ;; + + *.gz|*.Z|*.z) + echo gzip -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) 1>&2 + gzip -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}" + ;; + + *.bz2) + echo bzip2 -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) 1>&2 + bzip2 -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}" + ;; + + *.rar|*.RAR) + echo unrar x -idq "${1}" 1>&2 + unrar x -idq "${1}" || die "Couldn't unpack ${1}" + ;; + + *.LHa|*.LHA|*.lha|*.lzh) + echo lha xqf "${1}" 1>&2 + lha xqf "${1}" || die "Couldn't unpack ${1}" + ;; + + *.a|*.deb) + echo ar x "${1}" 1&>2 + ar x "${1}" 1>&2 + ;; + + *) + echo "Skipping unpack for ${1}" + ;; + esac + +} + diff --git a/0.2.0/ebuild/usage_error.bash b/0.2.0/ebuild/usage_error.bash new file mode 100644 index 000000000..165d8a91c --- /dev/null +++ b/0.2.0/ebuild/usage_error.bash @@ -0,0 +1,32 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +ebuild_f_usage_error() +{ + if [[ -z ${1} ]] ; then + die "Usage error" + else + die "Usage error: ${1}" + fi +} + diff --git a/0.2.0/ebuild/utils/Makefile.am b/0.2.0/ebuild/utils/Makefile.am new file mode 100644 index 000000000..d75aa5f92 --- /dev/null +++ b/0.2.0/ebuild/utils/Makefile.am @@ -0,0 +1,70 @@ +MAINTAINERCLEANFILES = Makefile.in +CLEANFILES = *~ newlib.so newlib.a dolib.so dolib.a + +libexecprogdir = $(libexecdir)/paludis/utils + +libexecprog_SCRIPTS = \ + dobin \ + doconfd \ + dodir \ + dodoc \ + doenvd \ + doexe \ + dohard \ + dohtml \ + doinfo \ + doinitd \ + doins \ + dolib \ + dolib.a \ + dolib.so \ + doman \ + domo \ + donewins \ + dosbin \ + dosed \ + dosym \ + fowners \ + fperms \ + merge \ + newbin \ + newconfd \ + newdoc \ + newenvd \ + newexe \ + newinitd \ + newins \ + newlib.a \ + newlib.so \ + newman \ + newsbin \ + unmerge + +TESTS_ENVIRONMENT = env \ + PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \ + PALUDIS_EBUILD_LOG_LEVEL="silent" \ + TEST_SCRIPT_DIR="$(srcdir)/" \ + $(SHELL) $(top_srcdir)/ebuild/utils/run_test.bash + +TESTS = merge_TEST.bash dobin_TEST.bash unmerge_TEST.bash +check_SCRIPTS = $(TESTS) \ + merge_TEST_setup.sh merge_TEST_cleanup.sh \ + unmerge_TEST_setup.sh unmerge_TEST_cleanup.sh + +EXTRA_DIST = $(libexecprog_SCRIPTS) $(check_SCRIPTS) run_test.bash \ + newlib.so.in newlib.a.in dolib.so.in dolib.a.in + +newlib.a : newlib.a.in + cat newlib.a.in > newlib.a + +newlib.so : newlib.so.in + cat newlib.so.in > newlib.so + +dolib.so : dolib.so.in + cat dolib.so.in > dolib.so + +dolib.a : dolib.a.in + cat dolib.a.in > dolib.a + +check_PROGRAMS = + diff --git a/0.2.0/ebuild/utils/dobin b/0.2.0/ebuild/utils/dobin new file mode 100755 index 000000000..506f50f0f --- /dev/null +++ b/0.2.0/ebuild/utils/dobin @@ -0,0 +1,48 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dobin from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +if [[ ! -d "${D}${DESTTREE}/bin" ]]; then + install -d "${D}${DESTTREE}/bin" || exit 3 +fi + +ret=0 +for x in "$@" ; do + if [[ -x "${x}" ]]; then + install "${x}" "${D}${DESTTREE}/bin" || ret=2 + else + echo ">>> ${0}: making ${x} executable..." + install -m0755 -o root -g 0 "${x}" "${D}${DESTTREE}/bin" || ret=2 + fi +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/dobin_TEST.bash b/0.2.0/ebuild/utils/dobin_TEST.bash new file mode 100644 index 000000000..b9d0d9c43 --- /dev/null +++ b/0.2.0/ebuild/utils/dobin_TEST.bash @@ -0,0 +1,70 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License version 2, as published by the Free Software Foundation. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +source ${PALUDIS_EBUILD_DIR}/install_functions.bash + +dobin_TEST() +{ + mkdir -p dobin_TEST_dir/src dobin_TEST_dir/dst ; test_return_code + + echo "one contents" > dobin_TEST_dir/src/one ; test_return_code + chmod +x dobin_TEST_dir/src/one ; test_return_code + + echo "two contents" > dobin_TEST_dir/src/two ; test_return_code + chmod +x dobin_TEST_dir/src/two ; test_return_code + + echo "three contents" > dobin_TEST_dir/src/three ; test_return_code + chmod +x dobin_TEST_dir/src/three ; test_return_code + + export D=dobin_TEST_dir/dst + ${PALUDIS_EBUILD_DIR}/utils/dobin dobin_TEST_dir/src/one &>/dev/null ; test_return_code + ${PALUDIS_EBUILD_DIR}/utils/dobin dobin_TEST_dir/src/two dobin_TEST_dir/src/three &>/dev/null ; test_return_code + + [[ -f dobin_TEST_dir/dst/usr/bin/one ]] ; test_return_code + [[ -f dobin_TEST_dir/dst/usr/bin/two ]] ; test_return_code + [[ -f dobin_TEST_dir/dst/usr/bin/three ]] ; test_return_code + + test_equality "$(< dobin_TEST_dir/dst/usr/bin/one)" "one contents" + test_equality "$(< dobin_TEST_dir/dst/usr/bin/two)" "two contents" + test_equality "$(< dobin_TEST_dir/dst/usr/bin/three)" "three contents" + + rm -fr dobin_TEST_dir +} + +dobin_fail_TEST() +{ + mkdir -p dobin_TEST_dir/src dobin_TEST_dir/dst ; test_return_code + echo "one contents" > dobin_TEST_dir/src/one ; test_return_code + echo "two contents" > dobin_TEST_dir/src/two ; test_return_code + echo "three contents" > dobin_TEST_dir/src/three ; test_return_code + + export D=dobin_TEST_dir/dst + ! ${PALUDIS_EBUILD_DIR}/utils/dobin dobin_TEST_dir/src/four &>/dev/null ; test_return_code + ! ${PALUDIS_EBUILD_DIR}/utils/dobin dobin_TEST_dir/src/one dobin_TEST_dir/src/seven &>/dev/null ; test_return_code + ! ${PALUDIS_EBUILD_DIR}/utils/dobin dobin_TEST_dir/src/eight dobin_TEST_dir/src/one &>/dev/null ; test_return_code + + [[ -f dobin_TEST_dir/dst/usr/bin/one ]] ; test_return_code + ! [[ -f dobin_TEST_dir/dst/usr/bin/four ]] ; test_return_code + ! [[ -f dobin_TEST_dir/dst/usr/bin/five ]] ; test_return_code + ! [[ -f dobin_TEST_dir/dst/usr/bin/six ]] ; test_return_code + + test_equality "$(< dobin_TEST_dir/dst/usr/bin/one)" "one contents" + + rm -fr dobin_TEST_dir +} + diff --git a/0.2.0/ebuild/utils/doconfd b/0.2.0/ebuild/utils/doconfd new file mode 100644 index 000000000..37c453cc9 --- /dev/null +++ b/0.2.0/ebuild/utils/doconfd @@ -0,0 +1,32 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon doconfd from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [ ${#} -lt 1 ]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +INSDESTTREE=/etc/conf.d/ +doins "$@" || exit 2 diff --git a/0.2.0/ebuild/utils/dodir b/0.2.0/ebuild/utils/dodir new file mode 100644 index 000000000..52b7c2090 --- /dev/null +++ b/0.2.0/ebuild/utils/dodir @@ -0,0 +1,34 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dodir from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +ret=0 +for x in "$@"; do + install -d ${DIROPTIONS} "${D}${x}" || ret=2 +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/dodoc b/0.2.0/ebuild/utils/dodoc new file mode 100644 index 000000000..bfff299dd --- /dev/null +++ b/0.2.0/ebuild/utils/dodoc @@ -0,0 +1,55 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dodoc from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ $# -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +if [[ -z ${PALUDIS_COMPRESS} ]]; then + PALUDIS_COMPRESS="gzip -f -9" +fi + +dir="${D}usr/share/doc/${PF}/${DOCDESTTREE}" +if [[ ! -d "${dir}" ]]; then + install -d "${dir}" || exit 3 +fi + +ret=0 + +for x in "$@"; do + if [[ -s "${x}" ]]; then + install -m0644 "${x}" "${dir}" + ${PALUDIS_COMPRESS} "${dir}/${x##*/}" + elif [[ ! -e "${x}" ]]; then + echo "${0}: ${x} does not exist" >&2 + ret=2 + fi +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/doenvd b/0.2.0/ebuild/utils/doenvd new file mode 100644 index 000000000..7299776f9 --- /dev/null +++ b/0.2.0/ebuild/utils/doenvd @@ -0,0 +1,32 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon doenvd from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +export INSDESTTREE=/etc/env.d/ +doins "$@" diff --git a/0.2.0/ebuild/utils/doexe b/0.2.0/ebuild/utils/doexe new file mode 100644 index 000000000..a67166b09 --- /dev/null +++ b/0.2.0/ebuild/utils/doexe @@ -0,0 +1,58 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon doexe from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" + exit 1 +fi + +if [[ ! -d "${D}${EXEDESTTREE}" ]]; then + install -d "${D}${EXEDESTTREE}" || exit 3 +fi + +ret=0 + +for x in "$@"; do + if [[ -L ${x} ]]; then + cp "${x}" "${T}" + mysrc="${T}/$(/usr/bin/basename "${x}")" + elif [[ -d ${x} ]]; then + echo "${0}: skipping directory ${x}" >&2 + continue + else + mysrc="${x}" + fi + install ${EXEOPTIONS} "${mysrc}" "${D}${EXEDESTTREE}" || ret=2 +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/dohard b/0.2.0/ebuild/utils/dohard new file mode 100644 index 000000000..b0758e5ae --- /dev/null +++ b/0.2.0/ebuild/utils/dohard @@ -0,0 +1,34 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dohard from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +ln -f "${D}${1}" "${D}${2}" diff --git a/0.2.0/ebuild/utils/dohtml b/0.2.0/ebuild/utils/dohtml new file mode 100644 index 000000000..66d16109c --- /dev/null +++ b/0.2.0/ebuild/utils/dohtml @@ -0,0 +1,115 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dohtml from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +source ${PALUDIS_EBUILD_DIR}/list_functions.bash + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +allowed_exts="png gif html htm jpg css jps" +disallowed_dirs="" +recurse=0 +args=( ) + +split_names() { + list=$1 + if [[ ${list} == *,* ]]; then + echo -n "${list%%,*} " + split_names ${list#*,} + else + echo ${list} + fi +} + +parse_args() { + while [[ ${#} -gt 0 ]]; do + case $1 in + -r) + recurse=1 ;; + -V) + verbose=1 ;; + -A) + allowed_exts="${allowed_exts} $(split_names $2)" + shift + ;; + -a) + allowed_exts="$(split_names $2)" + shift + ;; + -x) + disallowed_dirs="$(split_names $2)" + shift + ;; + *) + args=( "${args[@]}" "$1" ) ;; + esac + shift + done +} + +install_file() { + bn=${1} + dn=${2} + prefix=${3} + local ret=0 + + path=${bn} + [[ -n ${prefix} ]] && path="${prefix}/${path}" + [[ -n ${dn} ]] && path="${dn}/${path}" + + [[ -z ${DOCDESTTREE} ]] && DOCDESTTREE="html" + + dir="${D}usr/share/doc/${PF}/${DOCDESTTREE}/${prefix}" + + if [[ -f ${path} ]]; then + ext="${path##*.}" + if [[ -n ${ext} ]] && has $ext $allowed_exts; then + [[ ! -d ${dir} ]] && install -d "${dir}" + echo "install -m0644 ${path} ${dir}" + install -m0644 "${path}" "${dir}/${bn}" + fi + elif [[ $recurse == 1 && -d ${path} ]] && + ! has "${bn}" ${disallowed_dirs}; then + for f in ${path}/*; do + pfx=${bn} + [[ -n ${prefix} ]] && pfx="${prefix}/${pfx}" + install_file "$(basename "${f}")" "${dn}" "${pfx}" + (( ret += $? )) + done + else + (( ++ret )) + fi + return ${ret} +} + +parse_args "$@" + +retval=0 +for i in "${args[@]}"; do + install_file "$(basename "${i}")" "$(dirname "${i}")" + (( retval += $? )) +done + +exit $retval diff --git a/0.2.0/ebuild/utils/doinfo b/0.2.0/ebuild/utils/doinfo new file mode 100644 index 000000000..746812c9c --- /dev/null +++ b/0.2.0/ebuild/utils/doinfo @@ -0,0 +1,55 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon doinfo from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 1 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +if [[ ! -d "${D}usr/share/info" ]]; then + install -d "${D}usr/share/info" || exit 3 +fi + +if [[ -z ${PALUDIS_COMPRESS} ]]; then + PALUDIS_COMPRESS="gzip -f -9" +fi + +ret=0 + +for x in "$@"; do + if [[ -e "${x}" ]]; then + install -m0644 "${x}" "${D}usr/share/info" + ${PALUDIS_COMPRESS} "${D}usr/share/info/$(basename "${x}")" + else + echo "${0}: ${x} does not exist" + ret=2 + fi +done + +exit ${ret} + diff --git a/0.2.0/ebuild/utils/doinitd b/0.2.0/ebuild/utils/doinitd new file mode 100644 index 000000000..8fc7080da --- /dev/null +++ b/0.2.0/ebuild/utils/doinitd @@ -0,0 +1,32 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon doinitd from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +EXEDESTTREE=/etc/init.d +doexe "$@" diff --git a/0.2.0/ebuild/utils/doins b/0.2.0/ebuild/utils/doins new file mode 100644 index 000000000..2d70f5acf --- /dev/null +++ b/0.2.0/ebuild/utils/doins @@ -0,0 +1,89 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon doins from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +if [[ ${1} == "-r" ]]; then + DOINSRECUR=y + shift +else + DOINSRECUR=n +fi + +if [[ -z "${INSDEPTH}" ]]; then + declare -i INSDEPTH=0 +fi + +if [[ ${INSDESTTREE} == ${D}* ]]; then + echo "-------------------------------------------------------" >&2 + echo "You should not use \${D} with helpers." >&2 + echo " --> ${INSDESTTREE}" >&2 + echo "-------------------------------------------------------" >&2 + exit 248 +fi + +if [[ ! -d "${D}${INSDESTTREE}" ]]; then + dodir "${INSDESTTREE}" +fi + +ret=0 + +for x in "$@"; do + if [[ -L ${x} ]]; then + cp "${x}" "${T}" + mysrc="${T}/$(basename "${x}")" + elif [[ -d ${x} ]]; then + if [[ ${DOINSRECUR} == "n" ]]; then + continue + fi + + mydir="${INSDESTTREE}/$(basename "${x}")" + find "${x}" -mindepth 1 -maxdepth 1 -exec \ + env \ + INSDESTTREE="${mydir}" \ + INSDEPTH=$((INSDEPTH+1)) \ + ${0} -r {} \; + continue + else + mysrc="${x}" + fi + + install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}" || ret=2 +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/dolib b/0.2.0/ebuild/utils/dolib new file mode 100644 index 000000000..c35b20245 --- /dev/null +++ b/0.2.0/ebuild/utils/dolib @@ -0,0 +1,62 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dolib from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ! -d ${PALUDIS_EBUILD_MODULES_DIR} ]]; then + echo "${0}: \${PALUDIS_EBUILD_MODULES_DIR} not valid; aborting" >&2 + exit 1 +fi + +source "${PALUDIS_EBUILD_MODULES_DIR}/multilib_functions.bash" + +libdir="${D}${DESTTREE}/$(ebuild_get_libdir)" + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" + exit 1 +fi + +if [[ ! -d ${libdir} ]]; then + install -d "${libdir}" || exit 3 +fi + +ret=0 + +for x in "$@"; do + if [[ -e ${x} ]]; then + if [[ ! -L ${x} ]]; then + install ${LIBOPTIONS} "${x}" "${libdir}" || ret=2 + else + ln -s "$(readlink "${x}")" "${libdir}/$(basename "${x}")" || ret=2 + fi + else + echo "${0}: ${x} does not exist" + ret=2 + fi +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/dolib.a.in b/0.2.0/ebuild/utils/dolib.a.in new file mode 100644 index 000000000..e766554dd --- /dev/null +++ b/0.2.0/ebuild/utils/dolib.a.in @@ -0,0 +1,27 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dolib.a from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +LIBOPTIONS="-m0644" dolib "$@" + diff --git a/0.2.0/ebuild/utils/dolib.so.in b/0.2.0/ebuild/utils/dolib.so.in new file mode 100644 index 000000000..d4dcb4a46 --- /dev/null +++ b/0.2.0/ebuild/utils/dolib.so.in @@ -0,0 +1,26 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dolib.so from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +LIBOPTIONS="-m0755" dolib "$@" diff --git a/0.2.0/ebuild/utils/doman b/0.2.0/ebuild/utils/doman new file mode 100644 index 000000000..db13a1821 --- /dev/null +++ b/0.2.0/ebuild/utils/doman @@ -0,0 +1,84 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon doman from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +if [[ -z ${PALUDIS_COMPRESS} ]]; then + PALUDIS_COMPRESS="gzip -f -9" +fi + +BASE="/usr/share" +i18n="" + +for x in "$@"; do + if [[ ${x:0:6} == "-i18n=" ]]; then + i18n="${x:6}/" + continue + fi + if [[ ${x} == .keep ]]; then + continue + fi + + suffix=${x##*.} + + if [[ ${suffix} == "gz" ]]; then + compressed="gz" + realname=${x%.*} + suffix=${realname##*.} + else + realname=${x} + compressed="" + fi + + mandir="${i18n}man${suffix:0:1}" + + if [[ ${mandir} =~ 'man[0-9n](|f|p|pm)$' ]]; then + if [[ -s ${x} ]]; then + if [[ ! -d "${D}${BASE}/man/${mandir}" ]]; then + install -d "${D}${BASE}/man/${mandir}" + fi + + install -m0644 "${x}" "${D}${BASE}/man/${mandir}" || ret=2 + + if [[ -z ${compressed} ]]; then + ${PALUDIS_COMPRESS} "${D}${BASE}/man/${mandir}/$(basename "${x}")" + fi + else + echo "${0}: ${x} does not exist" >&2 + ret=2 + fi + else + echo "${0}: '${x}' is probably not a man page; skipping" >&2 + ret=2 + fi +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/domo b/0.2.0/ebuild/utils/domo new file mode 100644 index 000000000..b7a0dd413 --- /dev/null +++ b/0.2.0/ebuild/utils/domo @@ -0,0 +1,54 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon domo from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +if [[ ! -d "${D}${DESTTREE}/share/locale" ]]; then + install -d "${D}${DESTTREE}/share/locale" || exit 3 +fi + +ret=0 + +for x in "$@"; do + if [[ -e ${x} ]]; then + mytiny="$(basename "${x}")" + mydir="${D}${DESTTREE}/share/local/${mytiny%.*}/LC_MESSAGES" + if [[ ! -d ${mydir} ]]; then + install -d "${mydir}" + fi + install -m0644 "${x}" "${mydir}/${MOPREFIX}.mo" || ret=2 + else + echo "${0}: ${x} does not exist" >&2 + ret=2 + fi +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/donewins b/0.2.0/ebuild/utils/donewins new file mode 100644 index 000000000..e1dfc2b31 --- /dev/null +++ b/0.2.0/ebuild/utils/donewins @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon donewins from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed." >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +doins "${T}/${2}" diff --git a/0.2.0/ebuild/utils/dosbin b/0.2.0/ebuild/utils/dosbin new file mode 100644 index 000000000..25c625801 --- /dev/null +++ b/0.2.0/ebuild/utils/dosbin @@ -0,0 +1,45 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dosbin from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +if [[ ! -d "${D}${DESTTREE}/sbin" ]]; then + install -d "${D}${DESTTREE}/sbin" || exit 3 +fi + +for x in "$@"; do + if [[ -x ${x} ]]; then + install -m0755 "${x}" "${D}${DESTTREE}/sbin" || exit 2 + else + echo ">>> dosbin: making ${x} executable..." + install -m0755 -o root -g 0 "${x}" "${D}${DESTTREE}/sbin" || exit 2 + fi +done diff --git a/0.2.0/ebuild/utils/dosed b/0.2.0/ebuild/utils/dosed new file mode 100644 index 000000000..ca9dc0429 --- /dev/null +++ b/0.2.0/ebuild/utils/dosed @@ -0,0 +1,52 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dosed from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -lt 1 ]]; then + echo "${0}: at least one argument needed" >&2 + exit 1 +fi + +mysed="s:${D}::g" + +ret=0 + +for x in "$@"; do + y="${D}${x}" + if [[ -e ${y} ]]; then + if [[ -f "${y}" ]]; then + sed -i -e "${mysed}" "${y}" || ret=2 + else + echo "${0}: ${y} is not a regular file" + ret=2 + fi + else + mysed="${x}" + fi +done + +exit ${ret} diff --git a/0.2.0/ebuild/utils/dosym b/0.2.0/ebuild/utils/dosym new file mode 100644 index 000000000..dffc44a88 --- /dev/null +++ b/0.2.0/ebuild/utils/dosym @@ -0,0 +1,34 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon dosym from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +if [[ ! -d ${D} ]]; then + echo "${0}: \${D} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +ln -snf "${1}" "${D}${2}" diff --git a/0.2.0/ebuild/utils/fowners b/0.2.0/ebuild/utils/fowners new file mode 100644 index 000000000..4eb208c6e --- /dev/null +++ b/0.2.0/ebuild/utils/fowners @@ -0,0 +1,24 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon fowners from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +chown "${@/#\//${D}/}" diff --git a/0.2.0/ebuild/utils/fperms b/0.2.0/ebuild/utils/fperms new file mode 100644 index 000000000..04c5db7eb --- /dev/null +++ b/0.2.0/ebuild/utils/fperms @@ -0,0 +1,24 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon fperms from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +chmod "${@/#\//${D}/}" diff --git a/0.2.0/ebuild/utils/merge b/0.2.0/ebuild/utils/merge new file mode 100755 index 000000000..11cd907a2 --- /dev/null +++ b/0.2.0/ebuild/utils/merge @@ -0,0 +1,162 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +source ${PALUDIS_EBUILD_DIR}/echo_functions.bash + +if [[ -z "${1}" ]] || [[ -z "${2}" ]] ; then + echo "usage: ${0} from to contents" + exit 247 +fi + +shopt -s dotglob +shopt -s nullglob + +src=$(readlink -f "${1%/}/" ) +src="${src//+(\/)/\/}" +export top_src="${src}" +dst=$(readlink -f "${2%/}/" ) +dst="${dst//+(\/)/\/}" +export top_dst="${dst}" +export contents=${3} + +if [[ ! -d ${src} ]] ; then + echo "${src}: not a directory; aborting" >&2 + exit 247 +fi + +if [[ ! -d ${dst} ]] ; then + echo "${dst}: not a directory; aborting" >&2 + exit 247 +fi + +if ! > "${contents}" ; then + echo "${contents}: can't create; aborting" >&2 + exit 247 +fi + +make_cfgpro_filename() +{ + local fn="$(basename ${1})" i=0 + while [[ -e "${2}/${fn}" && + "$(md5sum "${2}/${fn}" |cut -d\ -f 1)" != "$(md5sum "${1}" |cut -d\ -f 1)" ]]; do + fn="._cfg$(printf '%.4i' ${i})_$(basename ${1})" + (( ++i )) + done + echo ${fn} +} + +merge_this() +{ + if [[ ! -d "${1}" ]] || [[ ! -d "${2}" ]] ; then + echo "merge_this called with bad parameters '${1}' '${2}'" >&2 + exit 247 + fi + + local f ff r=0 + for f in "${1}/"* ; do + + ff=$(basename -- "${f}" ) + echo ">>> ${2#${top_dst}}/${ff}" + + if [[ -e "${f}" ]] || [[ -h "${f}" ]] ; then + if [[ -L "${2}/${ff}" ]] ; then + if ! [[ -L "${f}" ]] ; then + ebuild_notice "qa" "ROOT has '${2}/${ff}' as a non-symlink, " \ + "but IMAGE '${f}' is a symlink" + fi + elif [[ -L "${f}" ]] ; then + ebuild_notice "qa" "ROOT has '${2}/${ff}' as a symlink, " \ + "but IMAGE '${f}' is a non-symlink" + fi + fi + + if [[ -L "${f}" ]] ; then + if ( [[ -e "${2}/${ff}" ]] || [[ -h "${2}/${ff}" ]] ) && ! rm -f -- "${2}/${ff}" ; then + echo "error removing ${2}/${ff} for link ${f}" + r=1 + elif ! ln -s -- "$(readlink -- ${f} )" "${2}/${ff}" ; then + echo "error installing link ${f}" + r=1 + else + echo -n "sym ${2#${top_dst}}/${ff} -> " >> ${contents} + echo -n "$(readlink -- ${2}/${ff} ) " >> ${contents} + echo -n "$(stat -c '%Y' -- ${2}/${ff} )" >> ${contents} + echo >> ${contents} + fi + elif [[ -d ${f} ]] ; then + local ok= + if [[ -d "${2}/${ff}"/ ]] ; then + : + elif ! mkdir -- "${2}/${ff}" ; then + echo "error installing directory ${f}" + ok=no + fi + + if [[ -z "${ok}" ]] ; then + echo "dir ${2#${top_dst}}/${ff}" >> ${contents} + if ! merge_this "${1}/${ff}" "${2}/${ff}" ; then + echo "error installing directory contents ${f}" + r=1 + fi + else + r=1 + fi + else + local cfgpro= + for c in ${CONFIG_PROTECT}; do + if [[ ${2#${top_dst}} == "${c%/}/"* ]]; then + cfgpro=yes + for cm in ${CONFIG_PROTECT_MASK}; do + if [[ ${2#${top_dst}} == "${cm%/}/"* ]]; then + cfgpro= + fi + done + fi + done + local fn=${f} + if [[ -n ${cfgpro} && + -e ${2}/${ff} && + "$(md5sum ${f} |cut -d\ -f 1)" != "$(md5sum ${2}/${ff} |cut -d\ -f 1)" ]]; then + fn="${1}/$(make_cfgpro_filename ${f} ${2})" + if [[ ${fn} != ${f} ]]; then + mv "${f}" "${fn}" + fi + fi + if ! cp -pR --remove-destination --no-preserve=timestamps \ + -- "${fn}" "${2}"/ ; then + echo "error installing file ${fn}" + r=1 + else + if [[ -f "${fn}" ]] ; then + echo -n "obj ${2#${top_dst}}/${ff} " >> ${contents} + echo -n "$(md5sum -- ${2}/${ff} | cut -d' ' -f1 ) " >> ${contents} + echo -n "$(stat -c '%Y' -- ${2}/${ff} )" >> ${contents} + echo >> ${contents} + else + echo "misc ${2#${top_dst}}/${ff}" >> ${contents} + fi + fi + fi + done + + return $r +} + +merge_this "${src}" "${dst}" + diff --git a/0.2.0/ebuild/utils/merge_TEST.bash b/0.2.0/ebuild/utils/merge_TEST.bash new file mode 100644 index 000000000..88b070fcf --- /dev/null +++ b/0.2.0/ebuild/utils/merge_TEST.bash @@ -0,0 +1,130 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License version 2, as published by the Free Software Foundation. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +merge_empty_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/empty_src" \ + "merge_TEST_dir/empty_dst" \ + "merge_TEST_dir/empty_contents" 1>/dev/null + test_return_code +} + +merge_files_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/files_src" \ + "merge_TEST_dir/files_dst" \ + "merge_TEST_dir/files_contents" 1>/dev/null + test_return_code + + [[ -f "merge_TEST_dir/files_dst/one" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/files_dst/one)" "contents of one" + + [[ -f "merge_TEST_dir/files_dst/two" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/files_dst/two)" "contents of two" +} + +merge_dirs_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/dirs_src" \ + "merge_TEST_dir/dirs_dst" \ + "merge_TEST_dir/dirs_contents" 1>/dev/null + test_return_code + + [[ -d "merge_TEST_dir/dirs_dst/dir_one" ]] ; test_return_code + [[ -d "merge_TEST_dir/dirs_dst/dir_two" ]] ; test_return_code + [[ -d "merge_TEST_dir/dirs_dst/dir_two/dir_three" ]] ; test_return_code + + [[ -f "merge_TEST_dir/dirs_dst/dir_one/one" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/dirs_dst/dir_one/one)" "contents of one" + + [[ -f "merge_TEST_dir/dirs_dst/dir_two/two" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/dirs_dst/dir_two/two)" "contents of two" + + [[ -f "merge_TEST_dir/dirs_dst/dir_two/dir_three/three" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/dirs_dst/dir_two/dir_three/three)" "contents of three" +} + +merge_dirs_over_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/dirs_over_src" \ + "merge_TEST_dir/dirs_over_dst" \ + "merge_TEST_dir/dirs_over_contents" 1>/dev/null + test_return_code + + [[ -d "merge_TEST_dir/dirs_over_dst/dir_one/" ]] ; test_return_code + [[ -d "merge_TEST_dir/dirs_over_dst/dir_two/" ]] ; test_return_code + [[ -d "merge_TEST_dir/dirs_over_dst/dir_two/dir_three/" ]] ; test_return_code + + [[ -f "merge_TEST_dir/dirs_over_dst/dir_one/one" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/dirs_over_dst/dir_one/one)" "contents of one" + + [[ -f "merge_TEST_dir/dirs_over_dst/dir_two/two" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/dirs_over_dst/dir_two/two)" "contents of two" + + [[ -f "merge_TEST_dir/dirs_over_dst/dir_two/dir_three/three" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/dirs_over_dst/dir_two/dir_three/three)" "contents of three" +} + +merge_links_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/links_src" \ + "merge_TEST_dir/links_dst" \ + "merge_TEST_dir/links_contents" 1>/dev/null + test_return_code + + [[ -f "merge_TEST_dir/links_dst/one" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/links_dst/one)" "contents of one" + + [[ -f "merge_TEST_dir/links_dst/two" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/links_dst/two)" "contents of two" + + [[ -f "merge_TEST_dir/links_dst/link_to_two" ]] ; test_return_code + [[ -L "merge_TEST_dir/links_dst/link_to_two" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/links_dst/link_to_two)" "contents of two" +} + +merge_links_over_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/links_over_src" \ + "merge_TEST_dir/links_over_dst" \ + "merge_TEST_dir/links_over_contents" 1>/dev/null + test_return_code + + [[ -f "merge_TEST_dir/links_over_dst/one" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/links_over_dst/one)" "contents of one" + + [[ -f "merge_TEST_dir/links_over_dst/two" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/links_over_dst/two)" "contents of two" + + [[ -f "merge_TEST_dir/links_over_dst/link_to_two" ]] ; test_return_code + [[ -L "merge_TEST_dir/links_over_dst/link_to_two" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/links_over_dst/link_to_two)" "contents of two" + + [[ -f "merge_TEST_dir/links_over_dst/link_to_three" ]] ; test_return_code + [[ -L "merge_TEST_dir/links_over_dst/link_to_three" ]] ; test_return_code + test_equality "$(< merge_TEST_dir/links_over_dst/link_to_three)" "contents of three" +} +merge_links_over_dir_TEST() +{ + ! ${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/links_over_dir_src" \ + "merge_TEST_dir/links_over_dir_dst" \ + "merge_TEST_dir/links_over_dir_contents" &>/dev/null + test_return_code +} + + diff --git a/0.2.0/ebuild/utils/merge_TEST_cleanup.sh b/0.2.0/ebuild/utils/merge_TEST_cleanup.sh new file mode 100755 index 000000000..2fe5c7a9e --- /dev/null +++ b/0.2.0/ebuild/utils/merge_TEST_cleanup.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# vim: set ft=sh sw=4 sts=4 et : + +if [ -d merge_TEST_dir ] ; then + rm -fr merge_TEST_dir +else + true +fi + + diff --git a/0.2.0/ebuild/utils/merge_TEST_setup.sh b/0.2.0/ebuild/utils/merge_TEST_setup.sh new file mode 100755 index 000000000..7d711500e --- /dev/null +++ b/0.2.0/ebuild/utils/merge_TEST_setup.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# vim: set ft=sh sw=4 sts=4 et : + +mkdir -p merge_TEST_dir/{empty_src,empty_dst} || exit 2 + +mkdir -p merge_TEST_dir/{files_src,files_dst} || exit 2 +echo "contents of one" > merge_TEST_dir/files_src/one +echo "contents of two" > merge_TEST_dir/files_src/two + +mkdir -p merge_TEST_dir/{dirs_src/{dir_one,dir_two/dir_three},dirs_dst} || exit 3 +echo "contents of one" > merge_TEST_dir/dirs_src/dir_one/one +echo "contents of two" > merge_TEST_dir/dirs_src/dir_two/two +echo "contents of three" > merge_TEST_dir/dirs_src/dir_two/dir_three/three + +mkdir -p merge_TEST_dir/{dirs_over_src/{dir_one,dir_two/dir_three},dirs_over_dst} || exit 4 +mkdir -p merge_TEST_dir/dirs_over_dst/{one,real} +ln -s real merge_TEST_dir/dirs_over_dst/two +echo "contents of one" > merge_TEST_dir/dirs_over_src/dir_one/one +echo "contents of two" > merge_TEST_dir/dirs_over_src/dir_two/two +echo "contents of three" > merge_TEST_dir/dirs_over_src/dir_two/dir_three/three + +mkdir -p merge_TEST_dir/{links_src,links_dst} || exit 5 +echo "contents of one" > merge_TEST_dir/links_src/one +echo "contents of two" > merge_TEST_dir/links_src/two +ln -s two merge_TEST_dir/links_src/link_to_two + +mkdir -p merge_TEST_dir/{links_over_src,links_over_dst} || exit 5 +echo "contents of one" > merge_TEST_dir/links_over_src/one +echo "contents of two" > merge_TEST_dir/links_over_src/two +echo "contents of three" > merge_TEST_dir/links_over_src/three +ln -s two merge_TEST_dir/links_over_src/link_to_two +ln -s three merge_TEST_dir/links_over_src/link_to_three +echo "existing file" > merge_TEST_dir/link_to_two +ln -s ../ merge_TEST_dir/links_over_dst/link_to_three + +mkdir -p merge_TEST_dir/{links_over_dir_src,links_over_dir_dst} || exit 5 +echo "contents of one" > merge_TEST_dir/links_over_dir_src/one +echo "contents of two" > merge_TEST_dir/links_over_dir_src/two +echo "contents of three" > merge_TEST_dir/links_over_dir_src/three +ln -s two merge_TEST_dir/links_over_dir_src/link_to_two +ln -s three merge_TEST_dir/links_over_dir_src/link_to_three +mkdir merge_TEST_dir/links_over_dir_dst/link_to_two +echo "existing file" > merge_TEST_dir/links_over_dir_dst/link_to_three + diff --git a/0.2.0/ebuild/utils/newbin b/0.2.0/ebuild/utils/newbin new file mode 100644 index 000000000..21792c697 --- /dev/null +++ b/0.2.0/ebuild/utils/newbin @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newbin from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +dobin "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newconfd b/0.2.0/ebuild/utils/newconfd new file mode 100644 index 000000000..77838656c --- /dev/null +++ b/0.2.0/ebuild/utils/newconfd @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newconfd from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +doconfd "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newdoc b/0.2.0/ebuild/utils/newdoc new file mode 100644 index 000000000..b4cb50700 --- /dev/null +++ b/0.2.0/ebuild/utils/newdoc @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newdoc from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +dodoc "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newenvd b/0.2.0/ebuild/utils/newenvd new file mode 100644 index 000000000..76f0a7f5e --- /dev/null +++ b/0.2.0/ebuild/utils/newenvd @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newenvd from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +doenvd "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newexe b/0.2.0/ebuild/utils/newexe new file mode 100644 index 000000000..9a5cb35df --- /dev/null +++ b/0.2.0/ebuild/utils/newexe @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newexe from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +doexe "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newinitd b/0.2.0/ebuild/utils/newinitd new file mode 100644 index 000000000..01ca12b2d --- /dev/null +++ b/0.2.0/ebuild/utils/newinitd @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newinitd from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +doinitd "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newins b/0.2.0/ebuild/utils/newins new file mode 100644 index 000000000..2b692adb6 --- /dev/null +++ b/0.2.0/ebuild/utils/newins @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newins from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +doins "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newlib.a.in b/0.2.0/ebuild/utils/newlib.a.in new file mode 100644 index 000000000..415a0571c --- /dev/null +++ b/0.2.0/ebuild/utils/newlib.a.in @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newlib.a from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +dolib.a "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newlib.so.in b/0.2.0/ebuild/utils/newlib.so.in new file mode 100644 index 000000000..0701351d8 --- /dev/null +++ b/0.2.0/ebuild/utils/newlib.so.in @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newlib.so from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +dolib.so "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newman b/0.2.0/ebuild/utils/newman new file mode 100644 index 000000000..0dab5fc16 --- /dev/null +++ b/0.2.0/ebuild/utils/newman @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newman from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +doman "${T}/${2}" diff --git a/0.2.0/ebuild/utils/newsbin b/0.2.0/ebuild/utils/newsbin new file mode 100644 index 000000000..da94577f7 --- /dev/null +++ b/0.2.0/ebuild/utils/newsbin @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> +# +# Based in part upon newsbin from Portage, which is Copyright 1995-2005 +# Gentoo Foundation and distributed under the terms of the GNU General +# Public License v2. +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +export PATH="${PALUDIS_EBUILD_DIR:+${PALUDIS_EBUILD_DIR}/utils:}${PATH}" + +if [[ ! -d ${T} ]]; then + echo "${0}: \${T} not valid; aborting" >&2 + exit 247 +fi + +if [[ ${#} -ne 2 ]]; then + echo "${0}: exactly two arguments needed" >&2 + exit 1 +fi + +rm -rf "${T}/${2}" +cp "${1}" "${T}/${2}" +dosbin "${T}/${2}" diff --git a/0.2.0/ebuild/utils/run_test.bash b/0.2.0/ebuild/utils/run_test.bash new file mode 100644 index 000000000..1f9db4e38 --- /dev/null +++ b/0.2.0/ebuild/utils/run_test.bash @@ -0,0 +1,62 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +shopt -s expand_aliases +shopt -s extglob +set +o posix + +export TEST_STATUS= +export PALUDIS_IN_TEST_FRAMEWORK="yes" + +test_return_code() +{ + local r="$?" + if [[ "0" == "${r}" ]] ; then + echo -n "." + else + echo -n "!{retcode: ${r}}" + export local_test_status="fail" + export TEST_STATUS="fail" + fi +} + +test_equality() +{ + if [[ "${1}" == "${2}" ]] ; then + echo -n "." + else + echo -n "!{'${1}' not equal to '${2}'}" + export local_test_status="fail" + export TEST_STATUS="fail" + fi +} + +if test -f "$TEST_SCRIPT_DIR""${1%.bash}"_"setup.sh" ; then + echo ">>> setup for test ${1%.bash}" + if ! "$TEST_SCRIPT_DIR""${1%.bash}"_"setup.sh" ; then + echo ">>> exiting with error for test ${1%.bash}" + exit 255 + fi +fi + +echo "Test program ${1%.bash}:" +source "${1}" || exit 200 + +for testname in $(set | grep '_TEST *() *$' ) ; do + [[ ${testname/()} != ${testname} ]] && continue + echo -n "* ${testname%_TEST}: " + export local_test_status="" + ${testname} + [[ -z "$local_test_status" ]] && echo " OK" || echo " FAIL" +done + +if test -f "$TEST_SCRIPT_DIR""${1%.bash}"_"cleanup.sh" ; then + echo ">>> cleanup for test ${1%.bash}" + if ! "$TEST_SCRIPT_DIR""${1%.bash}"_"cleanup.sh" ; then + echo ">>> exiting with error for test ${1%.bash}" + exit 255 + fi +fi + +[[ -z "$TEST_STATUS" ]] + diff --git a/0.2.0/ebuild/utils/unmerge b/0.2.0/ebuild/utils/unmerge new file mode 100755 index 000000000..6d8dcf57a --- /dev/null +++ b/0.2.0/ebuild/utils/unmerge @@ -0,0 +1,128 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +source ${PALUDIS_EBUILD_DIR}/echo_functions.bash + +if [[ -z "${1}" ]] || [[ -z "${2}" ]] ; then + echo "usage: ${0} from contents" + exit 247 +fi + +shopt -s dotglob +shopt -s nullglob + +ROOT=$(readlink -f "${1%/}" ) +ROOT="${ROOT//+(\/)/\/}" +export ROOT +export contents=${2} + +if [[ ! -d ${ROOT} ]] ; then + echo "${ROOT}: not a directory; aborting" >&2 + exit 247 +fi + +if [[ ! -f "${contents}" ]] ; then + echo "${contents}: not a file; aborting" >&2 + exit 247 +fi + +sort -r -t ' ' -k 2 < "${contents}" | \ +while read entry ; do + [[ -z "${entry}" ]] && continue + items=( ${entry} ) + case ${items[0]} in + dir) + ;; + + sym) + if ! [[ -L "${ROOT}/${items[1]}" ]] ; then + echo "skip !type ${items[1]}" + elif [[ $(readlink -- "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then + echo "skip !dest ${items[1]}" + elif [[ $(stat -c '%Y' -- "${ROOT}/${items[1]}" ) != "${items[4]}" ]] ; then + echo "skip !time ${items[1]}" + else + echo "remove ${items[1]}" + rm -f -- "${ROOT}/${items[1]}" + fi + ;; + + obj) + if ! [[ -f "${ROOT}/${items[1]}" ]] ; then + echo "skip !type ${items[1]}" + elif [[ $(md5sum -- "${ROOT}/${items[1]}" | cut -d' ' -f1 ) != "${items[2]}" ]] ; then + echo "skip !md5 ${items[1]}" + elif [[ $(stat -c '%Y' -- "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then + echo "skip !time ${items[1]}" + else + cfgpro= + for c in ${CONFIG_PROTECT}; do + if [[ ${items[1]} == "${c%/}"/* ]]; then + cfgpro="yes" + for cm in ${CONFIG_PROTECT_MASK}; do + if [[ ${items[1]} == "${cm%/}"/* ]]; then + cfgpro= + fi + done + fi + done + if [[ -n ${cfgpro} ]]; then + echo "cfgpro ${items[1]}" + else + echo "remove ${items[1]}" + rm -f "${ROOT}/${items[1]}" + fi + fi + ;; + + misc) + if [[ -f "${ROOT}/${items[1]}" ]] ; then + echo "skip !type ${items[1]}" + elif [[ $(stat -c '%Y' -- "${ROOT}/${items[1]}" ) != "${items[2]}" ]] ; then + echo "skip !time ${items[1]}" + else + echo "remove ${items[1]}" + rm -f "${ROOT}/${items[1]}" + fi + ;; + + *) + die "Unknown VDB entry kind '${kind}'" + ;; + esac +done + +sort -r -t ' ' -k 2 < "${contents}" | \ +while read entry ; do + [[ -z "${entry}" ]] && continue + items=( ${entry} ) + case ${items[0]} in + dir) + if ! [[ -d "${ROOT}/${items[1]}" ]] ; then + echo "skip !type ${items[1]}" + elif [[ $(echo "${ROOT}/${items[1]}"/* ) != "${ROOT}/${items[1]}/*" ]] ; then + echo "skip !empty ${items[1]}" + else + echo "remove ${items[1]}" + rm -fr -- "${ROOT}/${items[1]}" + fi + ;; + esac +done + diff --git a/0.2.0/ebuild/utils/unmerge_TEST.bash b/0.2.0/ebuild/utils/unmerge_TEST.bash new file mode 100644 index 000000000..a9d75d695 --- /dev/null +++ b/0.2.0/ebuild/utils/unmerge_TEST.bash @@ -0,0 +1,66 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License version 2, as published by the Free Software Foundation. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +unmerge_empty_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "unmerge_TEST_dir/empty_src" \ + "unmerge_TEST_dir/empty_dst" \ + "unmerge_TEST_dir/empty_contents" 1>/dev/null + test_return_code + + ${PALUDIS_EBUILD_DIR}/utils/unmerge "unmerge_TEST_dir/empty_dst" \ + "unmerge_TEST_dir/empty_contents" 1>/dev/null + test_return_code + + ok= + for a in unmerge_TEST_dir/empty_dst/* ; do + [[ -e "$a" ]] || continue + test_equality "$a" "" + ok=no + done + test_equality "$ok" "" +} + +unmerge_files_TEST() +{ + ${PALUDIS_EBUILD_DIR}/utils/merge "unmerge_TEST_dir/files_src" \ + "unmerge_TEST_dir/files_dst" \ + "unmerge_TEST_dir/files_contents" 1>/dev/null + test_return_code + + ok= + for a in unmerge_TEST_dir/files_dst/* ; do + [[ -e "$a" ]] || continue + ok=yes + break + done + test_equality "$ok" "yes" + + ${PALUDIS_EBUILD_DIR}/utils/unmerge "unmerge_TEST_dir/files_dst" \ + "unmerge_TEST_dir/files_contents" 1>/dev/null + test_return_code + + ok= + for a in unmerge_TEST_dir/files_dst/* ; do + [[ -e "$a" ]] || continue + test_equality "$a" "" + ok=no + done + test_equality "$ok" "" +} + diff --git a/0.2.0/ebuild/utils/unmerge_TEST_cleanup.sh b/0.2.0/ebuild/utils/unmerge_TEST_cleanup.sh new file mode 100755 index 000000000..1af2ac4df --- /dev/null +++ b/0.2.0/ebuild/utils/unmerge_TEST_cleanup.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# vim: set ft=sh sw=4 sts=4 et : + +if [ -d unmerge_TEST_dir ] ; then + rm -fr unmerge_TEST_dir +else + true +fi + + + diff --git a/0.2.0/ebuild/utils/unmerge_TEST_setup.sh b/0.2.0/ebuild/utils/unmerge_TEST_setup.sh new file mode 100755 index 000000000..8cbfd3a02 --- /dev/null +++ b/0.2.0/ebuild/utils/unmerge_TEST_setup.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# vim: set ft=sh sw=4 sts=4 et : + +mkdir -p unmerge_TEST_dir/{empty_src,empty_dst} || exit 2 + +mkdir -p unmerge_TEST_dir/{files_src,files_dst} || exit 3 +echo "file one" > unmerge_TEST_dir/files_src/one +echo "file two" > unmerge_TEST_dir/files_src/two diff --git a/0.2.0/hooks/Makefile.am.m4 b/0.2.0/hooks/Makefile.am.m4 new file mode 100644 index 000000000..b1cc2975b --- /dev/null +++ b/0.2.0/hooks/Makefile.am.m4 @@ -0,0 +1,80 @@ +ifdef(`__gnu__',`',`errprint(`This is not GNU m4... +')m4exit(1)') include(`misc/generated-file.txt') + +dnl vim: set ft=m4 noet : + +MAINTAINERCLEANFILES = Makefile.in Makefile.am +CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda .keep +SUBDIRS = . + +installhookcommonprogdir = $(libexecdir)/paludis/hooks/common +installhookinstallallpostdir = $(libexecdir)/paludis/hooks/install_all_post + +installhookcommonprog_SCRIPTS = \ + gnu_info_index.bash \ + eselect_env_update.bash + +installhookinstallallpost_SCRIPTS = \ + find_config_updates.bash + +TESTS_ENVIRONMENT = env \ + PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \ + TEST_SCRIPT_DIR="$(srcdir)/" \ + $(SHELL) $(top_srcdir)/ebuild/run_test.bash + +TESTS = +EXTRA_DIST = \ + Makefile.am.m4 \ + $(installhookcommonprog_SCRIPTS) \ + $(installhookinstallallpost_SCRIPTS) \ + $(TESTS) + +check_SCRIPTS = $(TESTS) +check_PROGRAMS = + +.keep : + touch $@ + +define(`userhook', ` +installuserhooks$1dir = $(datadir)/paludis/hooks/$1 +installuserhooks$1_SCRIPTS = .keep') + +userhook(`install_pre') +userhook(`install_post') +userhook(`install_all_pre') +userhook(`install_all_post') +userhook(`uninstall_pre') +userhook(`uninstall_post') +userhook(`uninstall_all_pre') +userhook(`uninstall_all_post') +userhook(`sync_pre') +userhook(`sync_post') +userhook(`sync_all_pre') +userhook(`sync_all_post') + +define(`systemhook', ` +installsystemhooks$1dir = $(libexecdir)/paludis/hooks/$1 +installsystemhooks$1_SCRIPTS = .keep') + +systemhook(`install_post') +systemhook(`install_all_post') +systemhook(`uninstall_all_post') + +install-data-local : + install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/ + install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/ + install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/ + ln -sf ../common/gnu_info_index.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/ + ln -sf ../common/gnu_info_index.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/ + ln -sf ../common/eselect_env_update.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/ + ln -sf ../common/eselect_env_update.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/ + +uninstall-local : + rm $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/gnu_info_index.bash + rm $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/gnu_info_index.bash + rm $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/eselect_env_update.bash + rm $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/eselect_env_update.bash + +Makefile.am : Makefile.am.m4 + $(top_srcdir)/misc/do_m4.bash Makefile.am + diff --git a/0.2.0/hooks/eselect_env_update.bash b/0.2.0/hooks/eselect_env_update.bash new file mode 100755 index 000000000..117c818da --- /dev/null +++ b/0.2.0/hooks/eselect_env_update.bash @@ -0,0 +1,27 @@ +#!/bin/bash +# vim: set et sw=4 sts=4 : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +source /sbin/functions.sh + +echo +einfo "Regenerating environment..." +eselect env update || exit 1 +einfo "Done regenerating environment" +echo + diff --git a/0.2.0/hooks/find_config_updates.bash b/0.2.0/hooks/find_config_updates.bash new file mode 100755 index 000000000..a570ff396 --- /dev/null +++ b/0.2.0/hooks/find_config_updates.bash @@ -0,0 +1,42 @@ +#!/bin/bash +# vim: set et sw=4 sts=4 : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +source /sbin/functions.sh + +echo +einfo "Searching for configuration files requiring action..." + +dir_count=0 +for dir in /etc ${CONFIG_PROTECT} ; do + [[ -d "${ROOT%/}/${dir}" ]] || continue + if [[ -n $(find "${ROOT%/}/${dir}" -iname '._cfg????_*' ) ]] ; then + einfo "Found files in ${ROOT%/}/${dir}" + dir_count=$((dir_count + 1)) + fi +done + +if [[ 0 -eq "${dir_count}" ]] ; then + einfo "No configuration file updates required" + exit 0 +else + ewarn "Found files in ${dir_count} directories" + ewarn "Your action is required" + exit 0 +fi + diff --git a/0.2.0/hooks/gnu_info_index.bash b/0.2.0/hooks/gnu_info_index.bash new file mode 100755 index 000000000..fa1f87a93 --- /dev/null +++ b/0.2.0/hooks/gnu_info_index.bash @@ -0,0 +1,82 @@ +#!/bin/bash +# vim: set et sw=4 sts=4 : + +# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> +# +# This file is part of the Paludis package manager. Paludis is free software; +# you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +source /sbin/functions.sh + +echo +einfo "Checking whether the GNU info directory needs updating..." + +regen_info_dirs= +for info_path in ${INFOPATH/:/ } ; do + info_path="${ROOT%/}/${info_path}" + [[ -d "${info_path}" ]] || continue + info_time=$(stat -c '%Y' "${info_path}" ) + + if [[ -f "${ROOT}/var/db/pkg/.cache/info_time_cache" ]] ; then + info_time_cache=$(stat -c '%Y' "${ROOT}"/var/db/pkg/.cache/info_time_cache ) + [[ "${info_time}" -le "${info_time_cache}" ]] && continue + fi + + regen_info_dirs="${regen_info_dirs} ${info_path}" +done + +if [[ -z "${regen_info_dirs}" ]] ; then + einfo "No updates needed" + exit 0 +fi + +good_count=0 +bad_count=0 + +for info_path in ${regen_info_dirs} ; do + einfo "Updating directory ${info_path}..." + + [[ -e "${info_path}"/dir ]] && mv -f "${info_path}/"dir{,.old} + + for d in ${regen_info_dirs}/* ; do + [[ -f "${d}" ]] || continue + [[ "${d}" != "${d%dir}" ]] && continue + [[ "${d}" != "${d%dir.old}" ]] && continue + + is_bad= + /usr/bin/install-info --quiet --dir-file="${info_path}/dir" "${d}" 2>&1 | \ + while read line ; do + [[ "${line/already exists, for file/}" != "${line}" ]] && continue + [[ "${line/warning: no info dir entry in /}" != "${line}" ]] && continue + is_bad=probably + done + + if [[ -n "${is_bad}" ]] ; then + bad_count=$(( bad_count + 1 )) + else + good_count=$(( good_count + 1 )) + fi + done +done + +touch "${ROOT}/var/db/pkg/.cache/info_time_cache" + +if [[ ${bad_count} -gt 0 ]] ; then + ewarn "Processed $(( good_count + bad_count )) info files, with ${bad_count} errors" + exit 1 +else + einfo "Processed ${good_count} info files" + exit 0 +fi + diff --git a/0.2.0/misc/Makefile.am b/0.2.0/misc/Makefile.am new file mode 100644 index 000000000..ef81f090c --- /dev/null +++ b/0.2.0/misc/Makefile.am @@ -0,0 +1,4 @@ +CLEANFILES = *~ +MAINTAINERCLEANFILES = Makefile.in svn-version-filter-data.bash +EXTRA_DIST = generated-file.txt svn-version-filter-data.bash.in do_m4.bash + diff --git a/0.2.0/misc/do_m4.bash b/0.2.0/misc/do_m4.bash new file mode 100755 index 000000000..63a042e54 --- /dev/null +++ b/0.2.0/misc/do_m4.bash @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# vim: set sw=4 sts=4 et tw=80 : + +if test "xyes" = x"${BASH_VERSION}" ; then + echo "This is not bash!" + exit 127 +fi + +trap 'echo "exiting." ; exit 250' 15 +KILL_PID=$$ + +get_m4() { + type "gm4" &>/dev/null && echo gm4 && return + type "m4" &>/dev/null && echo m4 && return + echo "Could not find m4" 1>&2 + kill $KILL_PID +} + +echo ">>> $(get_m4 ) -I. -I.. -I../.. -E ${1}.m4 > ${1}" +if ! $(get_m4 ) -I. -I.. -I../.. -E ${1}.m4 > ${1} ; then + echo "oops!" 1>&2 + exit 127 +fi diff --git a/0.2.0/misc/generated-file.txt b/0.2.0/misc/generated-file.txt new file mode 100644 index 000000000..25c83f24c --- /dev/null +++ b/0.2.0/misc/generated-file.txt @@ -0,0 +1,9 @@ +#if 0 +# vim: set ro : + +# ********************************************************* +# THIS IS A GENERATED FILE! DO NOT EDIT THIS FILE DIRECTLY! +# ********************************************************* +# +#endif + diff --git a/0.2.0/misc/svn-version-filter-data.bash.in b/0.2.0/misc/svn-version-filter-data.bash.in new file mode 100644 index 000000000..6b4b2492d --- /dev/null +++ b/0.2.0/misc/svn-version-filter-data.bash.in @@ -0,0 +1 @@ +export VERSION=@VERSION@ diff --git a/0.2.0/misc/svn-version-filter.bash b/0.2.0/misc/svn-version-filter.bash new file mode 100755 index 000000000..38a36b74d --- /dev/null +++ b/0.2.0/misc/svn-version-filter.bash @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# For Doxygen. See: +# http://www.stack.nl/~dimitri/doxygen/config.html#cfg_file_version_filter + +source ${0/.bash/-data.bash} + +case $1 in + *.svn*) + echo $VERSION + ;; + + *) + case "$(basename $1 )" in + *.cc|*.hh|*.hh.in) + if type svn &>/dev/null ; then + echo -n "svn " + svn stat -v $1 | sed -n 's/^[ A-Z?\*|!]\{1,15\}/r/;s/ \{1,15\}/\/r/;s/ .*//p' + else + echo $VERSION + fi + ;; + + *) + echo $VERSION + ;; + esac + ;; +esac + diff --git a/0.2.0/paludis/Makefile.am.m4 b/0.2.0/paludis/Makefile.am.m4 new file mode 100644 index 000000000..8492060f1 --- /dev/null +++ b/0.2.0/paludis/Makefile.am.m4 @@ -0,0 +1,70 @@ +ifdef(`__gnu__',`',`errprint(`This is not GNU m4... +')m4exit(1)') include(`misc/generated-file.txt') + +dnl vim: set ft=m4 noet : + +define(`filelist', `')dnl +define(`testlist', `')dnl +define(`headerlist', `')dnl +define(`testscriptlist', `')dnl +define(`addtest', `define(`testlist', testlist `$1_TEST')dnl +$1_TEST_SOURCES = $1_TEST.cc +$1_TEST_LDADD = $(top_builddir)/paludis/util/test_extras.o \ + $(top_builddir)/test/libtest.a \ + libpaludis.a \ + $(top_builddir)/paludis/util/libpaludisutil.a +$1_TEST_CXXFLAGS = -I$(top_srcdir) +')dnl +define(`addtestscript', `define(`testscriptlist', testscriptlist `$1_TEST_setup.sh $1_TEST_cleanup.sh')')dnl +define(`addhh', `define(`filelist', filelist `$1.hh')define(`headerlist', headerlist `$1.hh')')dnl +define(`addcc', `define(`filelist', filelist `$1.cc')')dnl +define(`addimpl', `define(`filelist', filelist `$1-impl.hh')')dnl +define(`addthis', `dnl +ifelse(`$2', `hh', `addhh(`$1')', `')dnl +ifelse(`$2', `cc', `addcc(`$1')', `')dnl +ifelse(`$2', `impl', `addimpl(`$1')', `')dnl +ifelse(`$2', `test', `addtest(`$1')', `')dnl +ifelse(`$2', `testscript', `addtestscript(`$1')', `')')dnl +define(`add', `addthis(`$1',`$2')addthis(`$1',`$3')addthis(`$1',`$4')dnl +addthis(`$1',`$5')addthis(`$1',`$6')')dnl + +include(`paludis/files.m4') + +CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda +MAINTAINERCLEANFILES = Makefile.in Makefile.am about.hh paludis.hh \ + hashed_containers.hh +AM_CXXFLAGS = -I$(top_srcdir) +DEFS= \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ + -DDATADIR=\"$(datadir)\" \ + -DBIGTEMPDIR=\"/var/tmp\" +EXTRA_DIST = about.hh.in Makefile.am.m4 paludis.hh.m4 files.m4 \ + hashed_containers.hh.in testscriptlist +SUBDIRS = util . args qa + +libpaludis_a_SOURCES = filelist + +TESTS = testlist + +TESTS_ENVIRONMENT = env \ + PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \ + PALUDIS_SKIP_CONFIG="yes" \ + TEST_SCRIPT_DIR="$(srcdir)/" \ + $(SHELL) $(top_srcdir)/test/run_test.sh + +check_PROGRAMS = $(TESTS) +check_SCRIPTS = testscriptlist +lib_LIBRARIES = libpaludis.a +paludis_includedir = $(includedir)/paludis/ +paludis_include_HEADERS = headerlist + +Makefile.am : Makefile.am.m4 files.m4 + $(top_srcdir)/misc/do_m4.bash Makefile.am + +paludis.hh : paludis.hh.m4 files.m4 + $(top_srcdir)/misc/do_m4.bash paludis.hh + +comparison_policy.hh : comparison_policy.hh.m4 + $(top_srcdir)/misc/do_m4.bash comparison_policy.hh.m4 + diff --git a/0.2.0/paludis/about.hh.in b/0.2.0/paludis/about.hh.in new file mode 100644 index 000000000..cd171ec23 --- /dev/null +++ b/0.2.0/paludis/about.hh.in @@ -0,0 +1,117 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +@GENERATED_FILE@ + +#ifndef PALUDIS_GUARD_PALUDIS_ABOUT_HH +#define PALUDIS_GUARD_PALUDIS_ABOUT_HH 1 + +/** \file + * Defines constants giving the Paludis version number and information about + * how Paludis was built. + * + * \ingroup grpabout + */ + +/** + * The package name (eg Paludis). + * + * \ingroup grpabout + */ +#define PALUDIS_PACKAGE "@PACKAGE@" + +/** + * The major version (eg 0.4.1 -> 0). + * + * \ingroup grpabout + */ +#define PALUDIS_VERSION_MAJOR @VERSION_MAJOR@ + +/** + * The minor version (eg 0.4.1 -> 4). + * + * \ingroup grpabout + */ +#define PALUDIS_VERSION_MINOR @VERSION_MINOR@ + +/** + * The micro version (eg 0.4.1 -> 1). + * + * \ingroup grpabout + */ +#define PALUDIS_VERSION_MICRO @VERSION_MICRO@ + +/** + * The version, two digits per part (eg 1.3.5 -> 10305). + * + * \ingroup grpabout + */ +#define PALUDIS_VERSION ((100 * 100 * PALUDIS_VERSION_MAJOR) \ + + (100 * PALUDIS_VERSION_MINOR) + PALUDIS_VERSION_MICRO) + +/** + * The subversion revision, if applicable (eg "65" or "65M" or ""). + * + * \ingroup grpabout + */ +#define PALUDIS_SUBVERSION_REVISION "@SVNVERSION@" + +/** + * The CXXFLAGS used to build Paludis. + * + * \ingroup grpabout + */ +#define PALUDIS_BUILD_CXXFLAGS "@CXXFLAGS@" + +/** + * The LDFLAGS used to build Paludis. + * + * \ingroup grpabout + */ +#define PALUDIS_BUILD_LDFLAGS "@LDFLAGS@" + +/** + * The compiler used to build Paludis. + * + * \ingroup grpabout + */ +#define PALUDIS_BUILD_CXX "@CXX@" + +/** + * The user who built Paludis. + * + * \ingroup grpabout + */ +#define PALUDIS_BUILD_USER "@BUILDUSER@" + +/** + * The host on which Paludis was built. + * + * \ingroup grpabout + */ +#define PALUDIS_BUILD_HOST "@BUILDHOST@" + +/** + * The date when Paludis was built. + * + * \ingroup grpabout + */ +#define PALUDIS_BUILD_DATE "@BUILDDATE@" + +#endif diff --git a/0.2.0/paludis/about_TEST.cc b/0.2.0/paludis/about_TEST.cc new file mode 100644 index 000000000..512647643 --- /dev/null +++ b/0.2.0/paludis/about_TEST.cc @@ -0,0 +1,86 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/about.hh> +#include <test/test_framework.hh> +#include <test/test_runner.hh> + +using namespace test; +using namespace paludis; + +/** + * \file + * Test cases for about.hh . + * + * \ingroup grptestcases + */ + +namespace test_cases +{ + /** + * \test Version tests. + * + * \ingroup grptestcases + */ + struct VersionTest : TestCase + { + VersionTest() : TestCase("about test") { } + + void run() + { + TEST_CHECK(PALUDIS_VERSION_MAJOR >= 0); + TEST_CHECK(PALUDIS_VERSION_MAJOR <= 9); + + TEST_CHECK(PALUDIS_VERSION_MINOR >= 0); + TEST_CHECK(PALUDIS_VERSION_MINOR <= 99); + + TEST_CHECK(PALUDIS_VERSION_MICRO >= 0); + TEST_CHECK(PALUDIS_VERSION_MICRO <= 99); + + TEST_CHECK(PALUDIS_VERSION >= 0); + TEST_CHECK(PALUDIS_VERSION <= 99999); + TEST_CHECK_EQUAL(PALUDIS_VERSION, 10000 * PALUDIS_VERSION_MAJOR + + 100 * PALUDIS_VERSION_MINOR + PALUDIS_VERSION_MICRO); + + TEST_CHECK(std::string(PALUDIS_SUBVERSION_REVISION) != "i am a fish"); + } + } test_case_about; + + /** + * \test Build info tests. + * + * \ingroup grptestcases + */ + struct BuildInfoTest : TestCase + { + BuildInfoTest() : TestCase("build info test") { } + + void run() + { + TEST_CHECK(! std::string(PALUDIS_BUILD_CXX).empty()); + TEST_CHECK(! std::string(PALUDIS_BUILD_CXXFLAGS).empty()); + TEST_CHECK(std::string(PALUDIS_BUILD_LDFLAGS) != "i am a fish"); + + TEST_CHECK(! std::string(PALUDIS_BUILD_USER).empty()); + TEST_CHECK(! std::string(PALUDIS_BUILD_HOST).empty()); + TEST_CHECK(! std::string(PALUDIS_BUILD_DATE).empty()); + } + } test_case_build_info; +} + diff --git a/0.2.0/paludis/args/Makefile.am b/0.2.0/paludis/args/Makefile.am new file mode 100644 index 000000000..d2efcc1ea --- /dev/null +++ b/0.2.0/paludis/args/Makefile.am @@ -0,0 +1,46 @@ +CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda +MAINTAINERCLEANFILES = Makefile.in +AM_CXXFLAGS = -I$(top_srcdir) + +TESTS = \ + args_TEST + +paludis_args_includedir = $(includedir)/paludis/args/ + +paludis_args_include_HEADERS = \ + args.hh \ + args_error.hh \ + args_group.hh \ + args_handler.hh \ + args_option.hh \ + bad_argument.hh \ + args_visitor.hh \ + bad_value.hh \ + missing_value.hh \ + args_dumper.hh + +libpaludisargs_a_SOURCES = $(paludis_args_include_HEADERS) \ + args.cc \ + args_error.cc \ + args_group.cc \ + args_handler.cc \ + args_option.cc \ + bad_argument.cc \ + args_visitor.cc \ + bad_value.cc \ + missing_value.cc \ + args_dumper.cc + +TESTS_ENVIRONMENT = env -u PALUDIS_OPTIONS TEST_SCRIPT_DIR="$(srcdir)/" $(SHELL) $(top_srcdir)/test/run_test.sh +lib_LIBRARIES = libpaludisargs.a +check_PROGRAMS = $(TESTS) + +test_ldadd = \ + $(top_builddir)/test/libtest.a \ + libpaludisargs.a \ + $(top_builddir)/paludis/libpaludis.a \ + $(top_builddir)/paludis/util/libpaludisutil.a + +args_TEST_SOURCES = args_TEST.cc +args_TEST_LDADD = $(test_ldadd) + diff --git a/0.2.0/paludis/args/args.cc b/0.2.0/paludis/args/args.cc new file mode 100644 index 000000000..fac59ce90 --- /dev/null +++ b/0.2.0/paludis/args/args.cc @@ -0,0 +1,27 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "args.hh" + +/** \file + * Implementation for args.hh . + * + * \ingroup grplibpaludisargs + */ + diff --git a/0.2.0/paludis/args/args.hh b/0.2.0/paludis/args/args.hh new file mode 100644 index 000000000..ce54edae0 --- /dev/null +++ b/0.2.0/paludis/args/args.hh @@ -0,0 +1,35 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_ARGS_ARGS_HH +#define PALUDIS_GUARD_ARGS_ARGS_HH 1 + +/** \file + * Master include file for command line argument handling. + * + * \ingroup grplibpaludisargs + */ + +#include <paludis/args/args_error.hh> +#include <paludis/args/args_group.hh> +#include <paludis/args/args_handler.hh> +#include <paludis/args/args_option.hh> +#include <paludis/args/bad_argument.hh> + +#endif diff --git a/0.2.0/paludis/args/args_TEST.cc b/0.2.0/paludis/args/args_TEST.cc new file mode 100644 index 000000000..d94c7dd13 --- /dev/null +++ b/0.2.0/paludis/args/args_TEST.cc @@ -0,0 +1,161 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/args/args.hh> +#include <paludis/args/missing_value.hh> +#include <test/test_framework.hh> +#include <test/test_runner.hh> + +using namespace paludis; +using namespace paludis::args; +using namespace test; + +/** \file + * Test cases for paludis::args things. + * + * \ingroup grptestcases + */ + +#ifndef DOXYGEN + +struct CommandLine : public ArgsHandler +{ + ArgsGroup group_one; + SwitchArg arg_foo; + SwitchArg arg_bar; + SwitchArg arg_dummy; + + ArgsGroup group_two; + SwitchArg arg_baz; + AliasArg arg_other_baz; + StringArg arg_something; + IntegerArg arg_somenum; + EnumArg arg_enum; + + ArgsGroup group_three; + EnumArg arg_other_enum; + StringSetArg arg_stringset; + + CommandLine(); + ~CommandLine(); +}; + +CommandLine::CommandLine() : + group_one(this, "Group one"), + arg_foo(&group_one, "foo", 'f', "Enable foo"), + arg_bar(&group_one, "bar", 'b', "Enable bar"), + arg_dummy(&group_one, "dummy", 'd', "Enable something else"), + + group_two(this, "Group two"), + arg_baz(&group_two, "baz", 'z', "Enable baz"), + arg_other_baz(&arg_baz, "other-baz"), + arg_something(&group_two, "something", 's', "Value of something"), + arg_somenum(&group_two, "num", 'n', "Some number"), + arg_enum(&group_two, "enum", 'e', "One of three", EnumArg::EnumArgOptions("one", "Option one")("two", "option two")("three", "option three"), "two"), + + group_three(this, "Group three"), + arg_other_enum(&group_three, "something", '\0', "Blah.", EnumArg::EnumArgOptions("a", "A")("b", "B")("c", "C"), "b"), + arg_stringset(&group_three, "stringset", 't', "A StringSet.") +{ +} + +CommandLine::~CommandLine() +{ +} + +#endif + +namespace test_cases +{ + /** + * \test Simple args tests. + * + * \ingroup grptestcases + */ + struct ArgsTestSimple : TestCase + { + ArgsTestSimple() : TestCase("simple") { } + + void run() + { + char * args[] = { "program-name", "--other-baz", "-fsne", "blah", "7", "three", "--", "--dummy", + "one", "two" }; + CommandLine c1; + c1.run(10, args); + TEST_CHECK(c1.arg_foo.specified()); + TEST_CHECK(! c1.arg_bar.specified()); + TEST_CHECK(c1.arg_baz.specified()); + TEST_CHECK(c1.arg_other_baz.specified()); + TEST_CHECK(c1.arg_something.specified()); + TEST_CHECK(c1.arg_something.argument() == "blah"); + TEST_CHECK(c1.arg_somenum.specified()); + TEST_CHECK(c1.arg_somenum.argument() == 7); + TEST_CHECK(c1.arg_enum.specified()); + TEST_CHECK(c1.arg_enum.argument() == "three"); + TEST_CHECK(! c1.arg_dummy.specified()); + TEST_CHECK(! c1.arg_other_enum.specified()); + TEST_CHECK(c1.arg_other_enum.argument() == "b"); + + TEST_CHECK_EQUAL(std::distance(c1.begin_parameters(), c1.end_parameters()), 3); + TEST_CHECK_EQUAL(*c1.begin_parameters(), "--dummy"); + TEST_CHECK_EQUAL(*++c1.begin_parameters(), "one"); + TEST_CHECK_EQUAL(*++(++(c1.begin_parameters())), "two"); + } + } test_args_simple; + + /** + * \test Missing parameters tests. + * + * \ingroup grptestcases + */ + struct ArgsTestNoParam : TestCase + { + ArgsTestNoParam() : TestCase("Missing parameters") { } + + void run() + { + char *args[] = { "program-name", "-e" }; + CommandLine c1; + TEST_CHECK_THROWS(c1.run(2, args), MissingValue); + } + } test_args_no_param; + + /** + * \test String tests. + * + * \ingroup grptestcases + */ + struct ArgsTestStringSet : TestCase + { + ArgsTestStringSet() : TestCase("StringSet") { } + + void run() + { + char *args[] = { "program-name", "--stringset", "one", "-t", "two", "-t", "three", "fnord" }; + CommandLine c1; + c1.run(8, args); + TEST_CHECK(c1.arg_stringset.specified()); + TEST_CHECK(std::find(c1.arg_stringset.args_begin(), c1.arg_stringset.args_end(), "one") != c1.arg_stringset.args_end()); + TEST_CHECK(std::find(c1.arg_stringset.args_begin(), c1.arg_stringset.args_end(), "two") != c1.arg_stringset.args_end()); + TEST_CHECK(std::find(c1.arg_stringset.args_begin(), c1.arg_stringset.args_end(), "three") != c1.arg_stringset.args_end()); + TEST_CHECK(std::find(c1.arg_stringset.args_begin(), c1.arg_stringset.args_end(), "fnord") == c1.arg_stringset.args_end()); + } + } test_args_string_set; +} + diff --git a/0.2.0/paludis/args/args_dumper.cc b/0.2.0/paludis/args/args_dumper.cc new file mode 100644 index 000000000..afdc747c0 --- /dev/null +++ b/0.2.0/paludis/args/args_dumper.cc @@ -0,0 +1,81 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/args/args_dumper.hh> +#include <paludis/args/args_option.hh> + +#include <sstream> + +/** \file + * Implementation of ArgsDumper. + * + * \ingroup grplibpaludisargs + */ + +using namespace paludis; +using namespace paludis::args; + +ArgsDumper::ArgsDumper(std::ostream & os) : + _os(os) +{ +} + +void ArgsDumper::visit(const ArgsOption * const a) +{ + std::stringstream p; + p << " --" << a->long_name(); + if (a->short_name()) + p << ", -" << a->short_name(); + if (p.str().length() < 24) + p << std::string(24 - p.str().length(), ' '); + else + p << std::endl << std::string(24, ' '); + _os << p.str(); + _os << " " << a->description() << std::endl; +} + +#ifndef DOXYGEN +#define VISIT(type) void ArgsDumper::visit(const type * const a) \ + { visit(static_cast<const ArgsOption *>(a)); } + +VISIT(SwitchArg) +VISIT(StringArg) +VISIT(IntegerArg) +VISIT(AliasArg) +VISIT(StringSetArg) +#endif + +void ArgsDumper::visit(const EnumArg * const a) +{ + visit(static_cast<const ArgsOption *>(a)); + for (EnumArg::AllowedArgIterator it = a->begin_allowed_args(), it_end = a->end_allowed_args(); + it != it_end; ++it) + { + std::stringstream p; + p << " " << (*it).first; + if (p.str().length() < 26) + p << std::string(26 - p.str().length(), ' '); + _os << p.str(); + _os << " " << (*it).second; + if ((*it).first == a->default_arg()) + _os << " (default)"; + _os << std::endl; + } +} diff --git a/0.2.0/paludis/args/args_dumper.hh b/0.2.0/paludis/args/args_dumper.hh new file mode 100644 index 000000000..34ba0a1b3 --- /dev/null +++ b/0.2.0/paludis/args/args_dumper.hh @@ -0,0 +1,79 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_ARGS_ARGS_DUMPER_HH +#define PALUDIS_GUARD_PALUDIS_ARGS_ARGS_DUMPER_HH 1 + +#include <ostream> +#include <paludis/args/args_visitor.hh> +#include <paludis/util/visitor.hh> + +namespace paludis +{ + namespace args + { + class ArgsOption; + class SwitchArg; + class StringArg; + class IntegerArg; + class AliasArg; + class EnumArg; + + /** + * Visitor class. Prints help text appropriate to each command line option. + * + * \ingroup grplibpaludisargs + */ + class ArgsDumper : public ArgsVisitorTypes::ConstVisitor + { + private: + std::ostream & _os; + + public: + /** + * Constructor. + */ + ArgsDumper(std::ostream & os); + + /// Visit an ArgsOption. + void visit(const ArgsOption * const); + + /// Visit a SwitchArg. + void visit(const SwitchArg * const); + + /// Visit a StringArg. + void visit(const StringArg * const); + + /// Visit an IntegerArg. + void visit(const IntegerArg * const); + + /// Visit an AliasArg. + void visit(const AliasArg * const); + + /// Visit an EnumArg. + void visit(const EnumArg * const); + + /// Visit a StringSetArg. + void visit(const StringSetArg * const); + }; + } +} + +#endif diff --git a/0.2.0/paludis/args/args_error.cc b/0.2.0/paludis/args/args_error.cc new file mode 100644 index 000000000..46aaa0d27 --- /dev/null +++ b/0.2.0/paludis/args/args_error.cc @@ -0,0 +1,35 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "args_error.hh" + +/** \file + * Implementation for ArgsError. + * + * \ingroup grplibpaludisargs + * \ingroup grpexceptions + */ + +using namespace paludis::args; + +ArgsError::ArgsError(const std::string & message) throw () : + paludis::Exception("Error handling command line: " + message) +{ +} + diff --git a/0.2.0/paludis/args/args_error.hh b/0.2.0/paludis/args/args_error.hh new file mode 100644 index 000000000..8d8355bfa --- /dev/null +++ b/0.2.0/paludis/args/args_error.hh @@ -0,0 +1,53 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_ARGS_ARGS_ERROR_HH +#define PALUDIS_GUARD_ARGS_ARGS_ERROR_HH 1 + +#include <paludis/util/exception.hh> +#include <string> + +/** \file + * Declaration for ArgsError. + * + * \ingroup grplibpaludisargs + */ + +namespace paludis +{ + namespace args + { + /** + * Thrown if an invalid command line argument is provided. + * + * \ingroup grplibpaludisargs + * \ingroup grpexceptions + */ + class ArgsError : public paludis::Exception + { + protected: + /** + * Constructor. + */ + ArgsError(const std::string & message) throw (); + }; + } +} + +#endif diff --git a/0.2.0/paludis/args/args_group.cc b/0.2.0/paludis/args/args_group.cc new file mode 100644 index 000000000..593e3e7e8 --- /dev/null +++ b/0.2.0/paludis/args/args_group.cc @@ -0,0 +1,47 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "args.hh" + +/** \file + * Implementation for ArgsGroup. + * + * \ingroup grplibpaludisargs + */ + +using namespace paludis::args; + +ArgsGroup::ArgsGroup(ArgsHandler * h, const std::string & name) : + _name(name), + _handler(h) +{ + h->add(this); +} + +void +ArgsGroup::add(ArgsOption * const value) +{ + /// \bug Should check for uniqueness of short and long names. + _args_options.push_back(value); +} + +ArgsGroup::~ArgsGroup() +{ +} + diff --git a/0.2.0/paludis/args/args_group.hh b/0.2.0/paludis/args/args_group.hh new file mode 100644 index 000000000..c4d4aa53f --- /dev/null +++ b/0.2.0/paludis/args/args_group.hh @@ -0,0 +1,98 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_ARGS_ARGS_GROUP_HH +#define PALUDIS_GUARD_ARGS_ARGS_GROUP_HH 1 + +#include <list> +#include <paludis/args/args_option.hh> +#include <string> + +/** \file + * Declaration for ArgsGroup. + * + * \ingroup grplibpaludisargs + */ + +namespace paludis +{ + + namespace args + { + class ArgsHandler; + + /** + * Contains a related group of command line arguments. + * + * \ingroup grplibpaludisargs + */ + class ArgsGroup + { + friend class ArgsHandler; + friend class ArgsOption; + + private: + ArgsGroup(const ArgsGroup &); + + void operator= (const ArgsGroup &); + + const std::string _name; + + std::list<ArgsOption *> _args_options; + + ArgsHandler * _handler; + + protected: + /** + * Add an ArgsOption instance (called by the ArgsOption + * constructor). + */ + void add(ArgsOption * const value); + + public: + /** + * Constructor. + */ + ArgsGroup(ArgsHandler * h, const std::string & name); + + /** + * Destructor. + */ + ~ArgsGroup(); + + /** + * Fetch our name. + */ + const std::string & name() const + { + return _name; + } + + /** + * Fetch our handler. + */ + ArgsHandler * handler() const + { + return _handler; + } + }; + } +} + +#endif diff --git a/0.2.0/paludis/args/args_handler.cc b/0.2.0/paludis/args/args_handler.cc new file mode 100644 index 000000000..a68165554 --- /dev/null +++ b/0.2.0/paludis/args/args_handler.cc @@ -0,0 +1,129 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "args.hh" +#include "args_dumper.hh" +#include <algorithm> +#include <paludis/util/system.hh> + +/** \file + * Implementation for ArgsHandler. + * + * \ingroup grplibpaludisargs + */ + +using namespace paludis::args; + +ArgsHandler::ArgsHandler() +{ +} + +void +ArgsHandler::add(ArgsGroup * const g) +{ + /// \bug Should check for name uniqueness. + _groups.push_back(g); +} + +void +ArgsHandler::run(const int argc, const char * const * const argv) +{ + std::list<std::string> args; + + std::string env_options = paludis::getenv_with_default("PALUDIS_OPTIONS", ""); + + std::istringstream iss(env_options); + std::string option; + while(iss.good()) + { + iss >> option; + if(!option.empty()) + args.push_back(option); + } + + args.insert(args.end(), &argv[1], &argv[argc]); + + std::list<std::string>::iterator argit = args.begin(), arge = args.end(); + + ArgsVisitor visitor(&argit, arge); + + for ( ; argit != arge; ++argit ) + { + std::string arg = *argit; + + if (arg == "--") + { + ++argit; + break; + } + else if (0 == arg.compare(0, 2, "--")) + { + arg.erase(0, 2); + std::map<std::string, ArgsOption*>::iterator it = _longopts.find(arg); + if (it == _longopts.end()) + throw BadArgument("--" + arg); + (*it).second->accept(&visitor); + } + else if (arg[0] == '-') + { + arg.erase(0, 1); + for (std::string::iterator c = arg.begin(); c != arg.end(); ++c) + { + std::map<char, ArgsOption*>::iterator it = _shortopts.find(*c); + if (it == _shortopts.end()) + { + throw BadArgument(std::string("-") + *c); + } + (*it).second->accept(&visitor); + } + } + else + { + _parameters.push_back(arg); + } + } + + _parameters.insert(_parameters.end(), argit, args.end()); +} + +void +ArgsHandler::dump_to_stream(std::ostream & s) const +{ + ArgsDumper dump(s); + std::list<ArgsGroup *>::const_iterator g(_groups.begin()), g_end(_groups.end()); + for ( ; g != g_end ; ++g) + { + s << (*g)->name() << ":" << std::endl; + + std::for_each((*g)->_args_options.begin(), (*g)->_args_options.end(), + accept_visitor(&dump)); + + s << std::endl; + } +} + +#ifndef DOXYGEN +std::ostream & +paludis::args::operator<< (std::ostream & s, const ArgsHandler & h) +{ + h.dump_to_stream(s); + return s; +} +#endif + diff --git a/0.2.0/paludis/args/args_handler.hh b/0.2.0/paludis/args/args_handler.hh new file mode 100644 index 000000000..42a517920 --- /dev/null +++ b/0.2.0/paludis/args/args_handler.hh @@ -0,0 +1,129 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_ARGS_ARGS_HANDLER_HH +#define PALUDIS_GUARD_ARGS_ARGS_HANDLER_HH 1 + +#include <map> +#include <ostream> +#include <paludis/args/args_group.hh> +#include <paludis/util/instantiation_policy.hh> +#include <string> + +/** \file + * Declaration for ArgsHandler. + * + * \ingroup grplibpaludisargs + */ + +namespace paludis +{ + namespace args + { + /** + * Handles command line arguments. + * + * \ingroup grplibpaludisargs + */ + class ArgsHandler : private InstantiationPolicy<ArgsHandler, instantiation_method::NonCopyableTag> + { + friend class ArgsGroup; + friend std::ostream & operator<< (std::ostream &, const ArgsHandler &); + + private: + std::list<ArgsGroup *> _groups; + std::list<std::string> _parameters; + + std::map<std::string, ArgsOption *> _longopts; + std::map<char, ArgsOption *> _shortopts; + + protected: + /** + * Add an new ArgsGroup (called by the ArgsGroup constructor). + */ + void add(ArgsGroup * const); + + /** + * Dump, for --help output (called by operator<<). + */ + void dump_to_stream(std::ostream & s) const; + + public: + /** + * Constructor. + */ + ArgsHandler(); + + /** + * Parse command line arguments. + */ + void run(const int, const char * const * const); + + /** + * Iterate over our parameters (non - and -- switches and their + * values). + */ + typedef std::list<std::string>::const_iterator ParametersIterator; + + /** + * Pointer to the start of our parameters. + */ + ParametersIterator begin_parameters() const + { + return _parameters.begin(); + } + + /** + * Pointer to past the end of our parameters. + */ + ParametersIterator end_parameters() const + { + return _parameters.end(); + } + + /** + * Do we have no parameters? + */ + bool empty() const + { + return _parameters.empty(); + } + + /** + * Add an ArgsOption instance. + */ + void add_option(ArgsOption *opt, const std::string long_name, const char short_name = '\0') + { + _longopts[long_name] = opt; + if (short_name != '\0') + _shortopts[short_name] = opt; + } + + }; + + /** + * Output an ArgsHandler to an ostream, for --help output. + * + * \ingroup grplibpaludisargs + */ + std::ostream & operator<< (std::ostream &, const ArgsHandler &); + } +} + +#endif diff --git a/0.2.0/paludis/args/args_option.cc b/0.2.0/paludis/args/args_option.cc new file mode 100644 index 000000000..1abef9ee9 --- /dev/null +++ b/0.2.0/paludis/args/args_option.cc @@ -0,0 +1,133 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "args.hh" +#include "bad_value.hh" + +/** \file + * Implementation for ArgsOption. + * + * \ingroup grplibpaludisargs + */ + +using namespace paludis::args; + +ArgsOption::ArgsOption(ArgsGroup * const g, const std::string & long_name, + const char short_name, const std::string & description) : + _group(g), + _long_name(long_name), + _short_name(short_name), + _description(description), + _specified(false) +{ + g->add(this); + g->_handler->add_option(this, long_name, short_name); +} + +ArgsOption::~ArgsOption() +{ +} + +SwitchArg::SwitchArg(ArgsGroup * const group, std::string long_name, char short_name, + std::string description) : + ArgsOption(group, long_name, short_name, description) +{ +} + +SwitchArg::~SwitchArg() +{ +} + +AliasArg::AliasArg(ArgsOption * const other, const std::string & long_name) : + ArgsOption(other->group(), long_name, '\0', "Alias for --" + other->long_name()), + _other(other) +{ + other->group()->handler()->add_option(other, long_name); +} + +StringArg::StringArg(ArgsGroup * const g, const std::string & long_name, + const char short_name, const std::string & description) : + ArgsOption(g, long_name, short_name, description) +{ +} + +StringSetArg::StringSetArg(ArgsGroup * const g, const std::string & long_name, + const char short_name, const std::string & description) : + ArgsOption(g, long_name, short_name, description) +{ +} + +IntegerArg::IntegerArg(ArgsGroup * const group, const std::string& long_name, + char short_name, const std::string& description) : + ArgsOption(group, long_name, short_name, description) +{ +} + +namespace +{ + /** + * Is an arg a particular value? + * + * \ingroup grplibpaludisargs + */ + struct ArgIs + { + const std::string arg; + + /// Constructor. + ArgIs(const std::string & a) : + arg(a) + { + } + + /// Comparator. + bool operator() (const std::pair<std::string, std::string> & p) const + { + return p.first == arg; + } + }; +} + +void EnumArg::set_argument(const std::string & arg) +{ + if (_allowed_args.end() == std::find_if(_allowed_args.begin(), + _allowed_args.end(), ArgIs(arg))) + throw (BadValue("--" + long_name(), arg)); + + _argument = arg; +} + +EnumArg::~EnumArg() +{ +} + +EnumArg::EnumArgOptions::EnumArgOptions(std::string opt, std::string desc) +{ + _options.push_back(std::make_pair(opt, desc)); +} + +EnumArg::EnumArgOptions & EnumArg::EnumArgOptions::operator() (std::string opt, std::string desc) +{ + _options.push_back(std::make_pair(opt, desc)); + return *this; +} + +EnumArg::EnumArgOptions::~EnumArgOptions() +{ +} diff --git a/0.2.0/paludis/args/args_option.hh b/0.2.0/paludis/args/args_option.hh new file mode 100644 index 000000000..bce3c863b --- /dev/null +++ b/0.2.0/paludis/args/args_option.hh @@ -0,0 +1,359 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_ARGS_ARGS_OPTION_HH +#define PALUDIS_GUARD_ARGS_ARGS_OPTION_HH 1 + +#include <paludis/args/args_visitor.hh> +#include <set> +#include <string> +#include <vector> + +/** \file + * Declaration for ArgsOption. + * + * \ingroup grplibpaludisargs + */ + +namespace paludis +{ + namespace args + { + class ArgsGroup; + + /** + * Base class for a command line option. + * + * \ingroup grplibpaludisargs + */ + class ArgsOption : public virtual VisitableInterface<ArgsVisitorTypes> + { + friend class ArgsHandler; + + private: + ArgsGroup * const _group; + + const std::string _long_name; + const char _short_name; + const std::string _description; + + bool _specified; + + ArgsOption(const ArgsOption &); + + void operator= (const ArgsOption &); + + protected: + /** + * Constructor. + */ + ArgsOption(ArgsGroup * const, const std::string & long_name, + const char short_name, const std::string & description); + + /** + * Destructor. + */ + ~ArgsOption(); + + public: + /** + * Fetch our long name. + */ + const std::string & long_name() const + { + return _long_name; + } + + /** + * Fetch our short name (may be 0). + */ + char short_name() const + { + return _short_name; + } + + /** + * Fetch our description. + */ + const std::string & description() const + { + return _description; + } + + /** + * Fetch whether or not we were specified on the + * command line. + */ + virtual bool specified() const + { + return _specified; + } + + /** + * Set the value returned by specified(). + */ + virtual void set_specified(const bool value) + { + _specified = value; + } + + /** + * Fetch our group. + */ + ArgsGroup * group() + { + return _group; + } + }; + + /** + * A SwitchArg is an option that can either be specified or not + * specified, and that takes no value (for example, --help). + * + * \ingroup grplibpaludisargs + */ + class SwitchArg : public ArgsOption, public Visitable<SwitchArg, ArgsVisitorTypes> + { + public: + /** + * Constructor. + */ + SwitchArg(ArgsGroup * const group, std::string long_name, char short_name, + std::string description); + + ~SwitchArg(); + }; + + /** + * An option that takes a string argument. + * + * \ingroup grplibpaludisargs + */ + class StringArg : public ArgsOption, public Visitable<StringArg, ArgsVisitorTypes> + { + private: + std::string _argument; + + public: + + /** + * Constructor + */ + StringArg(ArgsGroup * const, const std::string & long_name, + const char short_name, const std::string & description); + + /** + * Fetch the argument that was given to this option. + */ + const std::string& argument() const { return _argument; } + + /** + * Set the argument returned by argument(). + */ + void set_argument(const std::string& arg) { _argument = arg; } + }; + + /** + * An option that takes a set of strings. + * + * \ingroup grplibpaludisargs + */ + class StringSetArg : public ArgsOption, public Visitable<StringSetArg, ArgsVisitorTypes> + { + private: + std::set<std::string> _args; + + public: + + /** + * Type used to iterate over specified args. + */ + typedef std::set<std::string>::const_iterator Iterator; + + /** + * Constructor + */ + StringSetArg(ArgsGroup * const, const std::string & long_name, + const char short_name, const std::string & description); + + /** + * Retrieve an iterator to the first arg + */ + Iterator args_begin() const { return _args.begin(); } + + /** + * Retrieve an iterator one past the last arg + */ + Iterator args_end() const { return _args.end(); } + + /** + * Add an argument to the set returned by [ args_begin(), args_end() ) + */ + void add_argument(const std::string & arg) { _args.insert(arg); } + }; + + + /** + * An AliasArg is an alias for another argument. + * + * \ingroup grplibpaludisargs + */ + class AliasArg : public ArgsOption, public Visitable<AliasArg, ArgsVisitorTypes> + { + private: + ArgsOption * const _other; + + public: + /** + * Constructor. + */ + AliasArg(ArgsOption * const other, const std::string & new_long_name); + + virtual bool specified() const + { + return _other->specified(); + } + + virtual void set_specified(const bool value) + { + _other->set_specified(value); + } + }; + + /** + * An option that takes an integer argument. + * + * \ingroup grplibpaludisargs + */ + class IntegerArg : public ArgsOption, public Visitable<IntegerArg, ArgsVisitorTypes> + { + private: + int _argument; + + public: + /** + * Constructor + */ + IntegerArg(ArgsGroup * const, const std::string & long_name, + const char short_name, const std::string & description); + /** + * Fetch the argument that was given to this option. + */ + int argument() const { return _argument; } + + /** + * Set the argument returned by argument(). + */ + void set_argument(const int arg) { _argument = arg; } + }; + + /** + * An option that takes one of a predefined set of string arguments. + * + * \ingroup grplibpaludisargs + */ + class EnumArg : public ArgsOption, public Visitable<EnumArg, ArgsVisitorTypes> + { + private: + const std::vector<std::pair<std::string, std::string> > _allowed_args; + std::string _argument; + const std::string _default_arg; + + public: + + /** + * Helper class for passing available options and associated descriptions + * to the EnumArg constructor. + * + * \ingroup grplibpaludisargs + */ + class EnumArgOptions + { + private: + friend class EnumArg; + std::vector<std::pair<std::string, std::string> > _options; + + public: + /** + * Constructor + */ + EnumArgOptions(const std::string, const std::string); + + /** + * Destructor. + */ + ~EnumArgOptions(); + + /** + * Adds another (option, description) pair. + */ + EnumArgOptions& operator() (const std::string, const std::string); + }; + + /** + * Constructor. + */ + EnumArg(ArgsGroup * const group, const std::string & long_name, + const char short_name, const std::string & description, + const EnumArgOptions & opts, const std::string & default_arg) : + ArgsOption(group, long_name, short_name, description), + _allowed_args(opts._options), _argument(default_arg), + _default_arg(default_arg) + { + } + + ~EnumArg(); + + /** + * Fetch the argument that was given to this option. + */ + const std::string & argument() const { return _argument; } + + /** + * Set the argument returned by argument(), having verified that + * it is one of the arguments allowed for this option. + */ + void set_argument(const std::string & arg); + + /** + * Fetch the default option, as specified to the constructor. + */ + const std::string & default_arg() const { return _default_arg; } + + /** + * Type used to iterate over valid arguments to this option + */ + typedef std::vector<std::pair<std::string, std::string> >::const_iterator AllowedArgIterator; + + /** + * Returns an iterator pointing to a pair containing the first valid argument, + * and its description. + */ + AllowedArgIterator begin_allowed_args() const { return _allowed_args.begin(); } + + /** + * Returns an iterator pointing just beyond the last valid argument. + */ + AllowedArgIterator end_allowed_args() const { return _allowed_args.end(); } + }; + } +} + +#endif diff --git a/0.2.0/paludis/args/args_visitor.cc b/0.2.0/paludis/args/args_visitor.cc new file mode 100644 index 000000000..979debd67 --- /dev/null +++ b/0.2.0/paludis/args/args_visitor.cc @@ -0,0 +1,97 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "args_option.hh" +#include "bad_value.hh" +#include "missing_value.hh" +#include <paludis/util/visitor.hh> + +#include <paludis/util/destringify.hh> + +#include <sstream> + +/** \file + * Implementation for ArgsVisitor. + * + * \ingroup grplibpaludisargs + */ + +using namespace paludis; +using namespace args; + +ArgsVisitor::ArgsVisitor(std::list<std::string>::iterator *ai, + std::list<std::string>::iterator ae) : _args_index(ai), _args_end(ae) +{ +} + +const std::string& ArgsVisitor::get_param(const ArgsOption * const arg) +{ + if (++(*_args_index) == _args_end) + { + throw MissingValue("--" + arg->long_name()); + } + return **_args_index; +} + +void ArgsVisitor::visit(ArgsOption * const arg) +{ + arg->set_specified(true); +} + +void ArgsVisitor::visit(StringArg * const arg) +{ + visit(static_cast<ArgsOption *>(arg)); + arg->set_argument(get_param(arg)); +} + +void ArgsVisitor::visit(AliasArg * const arg) +{ + visit(static_cast<ArgsOption *>(arg)); +} + +void ArgsVisitor::visit(SwitchArg * const arg) +{ + visit(static_cast<ArgsOption *>(arg)); +} + +void ArgsVisitor::visit(IntegerArg * const arg) +{ + visit(static_cast<ArgsOption*>(arg)); + std::string param = get_param(arg); + try + { + arg->set_argument(destringify<int>(param)); + } + catch(DestringifyError &e) + { + throw BadValue("--" + arg->long_name(), param); + } +} + +void ArgsVisitor::visit(EnumArg * const arg) +{ + visit(static_cast<ArgsOption*>(arg)); + arg->set_argument(get_param(arg)); +} + +void ArgsVisitor::visit(StringSetArg * const arg) +{ + visit(static_cast<ArgsOption *>(arg)); + std::string param = get_param(arg); + arg->add_argument(param); +} diff --git a/0.2.0/paludis/args/args_visitor.hh b/0.2.0/paludis/args/args_visitor.hh new file mode 100644 index 000000000..17a9eacba --- /dev/null +++ b/0.2.0/paludis/args/args_visitor.hh @@ -0,0 +1,96 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_ARGS_ARGS_VISITOR_HH +#define PALUDIS_GUARD_ARGS_ARGS_VISITOR_HH 1 + +#include <list> +#include <paludis/util/visitor.hh> +#include <string> + +/** \file + * Declaration for ArgsVisitor + * + * \ingroup grplibpaludisargs + */ + +namespace paludis +{ + namespace args + { + class ArgsOption; + class StringArg; + class AliasArg; + class SwitchArg; + class IntegerArg; + class EnumArg; + class StringSetArg; + + /** + * Visitor types for visitors that can visit Args. + * + * \ingroup grplibpaludisargs + */ + typedef VisitorTypes<ArgsOption *, StringArg *, AliasArg *, SwitchArg *, + IntegerArg *, EnumArg *, StringSetArg *> ArgsVisitorTypes; + + /** + * Visitor class. Processes command-line options as they are found. + * + * \ingroup grplibpaludisargs + */ + class ArgsVisitor : public ArgsVisitorTypes::Visitor + { + private: + std::list<std::string>::iterator *_args_index, _args_end; + + const std::string& get_param(const ArgsOption * const); + + public: + /** + * Constructor + */ + ArgsVisitor(std::list<std::string>::iterator *, std::list<std::string>::iterator); + + /// Visit an ArgsOption. + void visit(ArgsOption * const); + + /// Visit a StringArg. + void visit(StringArg * const); + + /// Visit an AliasArg. + void visit(AliasArg * const); + + /// Visit a SwitchArg. + void visit(SwitchArg * const); + + /// Visit an IntegerArg. + void visit(IntegerArg * const); + + /// Visit an EnumArg. + void visit(EnumArg * const); + + /// Visit a StringSetArg. + void visit(StringSetArg * const); + }; + } +} + +#endif diff --git a/0.2.0/paludis/args/bad_argument.cc b/0.2.0/paludis/args/bad_argument.cc new file mode 100644 index 000000000..af5554c20 --- /dev/null +++ b/0.2.0/paludis/args/bad_argument.cc @@ -0,0 +1,35 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "bad_argument.hh" + +/** \file + * Implementation for BadArgument. + * + * \ingroup Args + * \ingroup Exception + */ + +using namespace paludis::args; + +BadArgument::BadArgument(const std::string & option) throw () : + ArgsError("Bad argument '" + option + "'") +{ +} + diff --git a/0.2.0/paludis/args/bad_argument.hh b/0.2.0/paludis/args/bad_argument.hh new file mode 100644 index 000000000..2b5e5f836 --- /dev/null +++ b/0.2.0/paludis/args/bad_argument.hh @@ -0,0 +1,53 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_ARGS_BAD_ARGUMENT_HH +#define PALUDIS_GUARD_ARGS_BAD_ARGUMENT_HH 1 + +#include <paludis/args/args_error.hh> + +/** \file + * Declaration for BadArgument. + * + * \ingroup Args + * \ingroup Exception + */ + +namespace paludis +{ + namespace args + { + /** + * Thrown if an unrecognised command line argument is specified. + * + * \ingroup Args + * \ingroup Exception + */ + class BadArgument : public ArgsError + { + public: + /** + * Constructor. + */ + BadArgument(const std::string & option) throw (); + }; + } +} + +#endif diff --git a/0.2.0/paludis/args/bad_value.cc b/0.2.0/paludis/args/bad_value.cc new file mode 100644 index 000000000..5899bea4d --- /dev/null +++ b/0.2.0/paludis/args/bad_value.cc @@ -0,0 +1,32 @@ +#include "bad_value.hh" + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + * Implementation for BadValue + * + * \ingroup Args + * \ingroup Exception + */ + +using namespace paludis::args; + +BadValue::BadValue(const std::string& option, const std::string& value) throw () : + ArgsError("Invalid parameter '" + value + "' for argument '" + option + "'") +{ +} diff --git a/0.2.0/paludis/args/bad_value.hh b/0.2.0/paludis/args/bad_value.hh new file mode 100644 index 000000000..386c11207 --- /dev/null +++ b/0.2.0/paludis/args/bad_value.hh @@ -0,0 +1,51 @@ +#ifndef PALUDIS_GUARD_ARGS_BAD_VALUE_HH +#define PALUDIS_GUARD_ARGS_BAD_VALUE_HH 1 + +/* + * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/args/args_error.hh> + +/** \file + * Declaration for BadValue. + * + * \ingroup Args + * \ingroup Exception + */ + +namespace paludis +{ + namespace args + { + /** + * Thrown if an invalid parameter is passed to a valid command line argument. + * + * \ingroup Args + * \ingroup Exception + */ + class BadValue : public ArgsError + { + public: + /** + * Constructor + */ + BadValue(const std::string& option, const std::string& value) throw(); + }; + } +} + +#endif diff --git a/0.2.0/paludis/args/missing_value.cc b/0.2.0/paludis/args/missing_value.cc new file mode 100644 index 000000000..2474ea5fa --- /dev/null +++ b/0.2.0/paludis/args/missing_value.cc @@ -0,0 +1,36 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "missing_value.hh" + +/** + * \file + * Implementation of MissingValue + * + * \ingroup Args + * \ingroup Exception + */ + +using namespace paludis::args; + +MissingValue::MissingValue(const std::string & arg) throw() : + ArgsError("No parameter given for '" + arg + "'") +{ +} diff --git a/0.2.0/paludis/args/missing_value.hh b/0.2.0/paludis/args/missing_value.hh new file mode 100644 index 000000000..05a0408ba --- /dev/null +++ b/0.2.0/paludis/args/missing_value.hh @@ -0,0 +1,56 @@ +#ifndef PALUDIS_GUARD_PALUDIS_ARGS_MISSING_VALUE_HH +#define PALUDIS_GUARD_PALUDIS_ARGS_MISSING_VALUE_HH 1 + + +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/args/args_error.hh> + +/** \file + * Declaration for MissingValue + * + * \ingroup Args + * \ingroup Exception + */ + +namespace paludis +{ + namespace args + { + /** + * Thrown if an argument is specified that needs a parameter, + * but no parameter is given. + * + * \ingroup Args + * \ingroup Exception + */ + class MissingValue : public ArgsError + { + public: + /** + * Constructor. + */ + MissingValue(const std::string & arg) throw (); + }; + } +} + +#endif diff --git a/0.2.0/paludis/config_file.cc b/0.2.0/paludis/config_file.cc new file mode 100644 index 000000000..918e5f6f6 --- /dev/null +++ b/0.2.0/paludis/config_file.cc @@ -0,0 +1,457 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * Copyright (c) 2006 Danny van Dyk <kugelfang@gentoo.org> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <fstream> +#include <paludis/config_file.hh> +#include <paludis/util/exception.hh> +#include <paludis/util/stringify.hh> +#include <paludis/util/strip.hh> +#include <paludis/util/tokeniser.hh> + +/** \file + * Implementation for config_file.hh classes. + * + * \ingroup grpconfigfile + */ + +using namespace paludis; + +ConfigFileError::ConfigFileError(const std::string & message) throw () : + ConfigurationError("Config file error: " + message) +{ +} + +ConfigFile::ConfigFile(std::istream * const stream) : + _stream(stream), + _has_lines(false), + _destroy_stream(false) +{ +} + +ConfigFile::ConfigFile(const std::string & filename) try : + _stream(_make_stream(filename)), + _has_lines(false), + _filename(filename), + _destroy_stream(true) +{ +} +catch (...) +{ + _destroy_stream = false; + throw; +} + +ConfigFile::ConfigFile(const FSEntry & filename) try : + _stream(_make_stream(stringify(filename))), + _has_lines(false), + _filename(stringify(filename)), + _destroy_stream(true) +{ +} +catch (...) +{ + _destroy_stream = false; + throw; +} + +ConfigFile::~ConfigFile() +{ + if (_stream && _destroy_stream) + delete _stream; +} + +std::istream * +ConfigFile::_make_stream(const std::string & filename) +{ + Context context("When creating the filestream for a ConfigFile from file '" + filename + "':"); + + std::ifstream * result(new std::ifstream(filename.c_str())); + if (! *result) + { + delete result; + throw ConfigFileError("Could not open '" + filename + "'"); + } + + return result; +} + +void +ConfigFile::need_lines() const +{ + if (_has_lines) + return; + + std::string line, accum; + unsigned line_number(0); + while (std::getline(*_stream, line)) + { + Context c("When handling line " + stringify(++line_number) + + (_filename.empty() ? std::string(":") : " in file '" + _filename + "':")); + normalise_line(line); + + if (line.empty() || skip_line(line)) + { + if (!accum.empty()) + throw ConfigFileError("Line-continuation followed by a blank line or comment is invalid."); + + continue; + } + if ('\\' == line.at(line.length() - 1)) + { + line.erase(line.length() - 1); + accum += line; + continue; + } + + accept_line(accum + line); + accum.clear(); + } + if (! _stream->eof()) + throw ConfigFileError("Error reading from file"); + if (! accum.empty()) + throw ConfigFileError("Line-continuation needs a continuation."); + + _has_lines = true; +} + +void +ConfigFile::normalise_line(std::string & s) const +{ + s = strip_leading(strip_trailing(s, " \t\n"), " \t\n"); +} + +bool +ConfigFile::skip_line(const std::string & s) const +{ + return (s.empty() || '#' == s.at(0)); +} + +LineConfigFile::LineConfigFile(std::istream * const s) : + ConfigFile(s) +{ + need_lines(); +} + +LineConfigFile::LineConfigFile(const std::string & filename) : + ConfigFile(filename) +{ + need_lines(); +} + +LineConfigFile::LineConfigFile(const FSEntry & filename) : + ConfigFile(filename) +{ + need_lines(); +} + +void +LineConfigFile::accept_line(const std::string & s) const +{ + _lines.push_back(s); +} + +KeyValueConfigFileError::KeyValueConfigFileError(const std::string & msg, + const std::string & filename) throw () : + ConfigurationError("Key/Value config file error" + + (filename.empty() ? ": " : " in file '" + filename + "': ") + msg) +{ +} + +KeyValueConfigFile::KeyValueConfigFile(std::istream * const s) : + ConfigFile(s) +{ + need_lines(); +} + +KeyValueConfigFile::KeyValueConfigFile(const std::string & filename) : + ConfigFile(filename) +{ + need_lines(); +} + +KeyValueConfigFile::KeyValueConfigFile(const FSEntry & filename) : + ConfigFile(filename) +{ + need_lines(); +} + +KeyValueConfigFile::KeyValueConfigFile(std::istream * const s, + const std::map<std::string, std::string> & m) : + ConfigFile(s), + _entries(m.begin(), m.end()) +{ + need_lines(); +} + +KeyValueConfigFile::KeyValueConfigFile(const std::string & filename, + const std::map<std::string, std::string> & m) : + ConfigFile(filename), + _entries(m.begin(), m.end()) +{ + need_lines(); +} + +KeyValueConfigFile::KeyValueConfigFile(const FSEntry & filename, + const std::map<std::string, std::string> & m) : + ConfigFile(filename), + _entries(m.begin(), m.end()) +{ + need_lines(); +} + +KeyValueConfigFile::~KeyValueConfigFile() +{ +} + +void +KeyValueConfigFile::accept_line(const std::string & line) const +{ + std::string::size_type p(line.find('=')); + if (std::string::npos == p) + _entries[line] = ""; + else + { + std::string key(line.substr(0, p)), value(line.substr(p + 1)); + normalise_line(key); + normalise_line(value); + _entries[key] = replace_variables(strip_quotes(value)); + } +} + +std::string +KeyValueConfigFile::replace_variables(const std::string & s) const +{ + std::string r; + std::string::size_type p(0), old_p(0); + + while (p < s.length()) + { + old_p = p; + + if ('\\' == s[p]) + { + if (++p >= s.length()) + throw KeyValueConfigFileError("Backslash not followed by a character", filename()); + r += s[p++]; + } + else if ('$' != s[p]) + r += s[p++]; + else + { + std::string name; + if (++p >= s.length()) + throw KeyValueConfigFileError("Dollar not followed by a character", filename()); + + if ('{' == s[p]) + { + std::string::size_type q; + if (std::string::npos == ((q = s.find("}", p)))) + throw KeyValueConfigFileError("Closing } not found", filename()); + + name = s.substr(p + 1, q - p - 1); + p = q + 1; + } + else + { + std::string::size_type q; + if (std::string::npos == ((q = s.find_first_not_of( + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "_0123456789", p)))) + q = s.length(); + + name = s.substr(p, q - p); + p = q; + } + + if (name.empty()) + throw KeyValueConfigFileError("Empty variable name", filename()); + r += get(name); + } + + if (p <= old_p) + throw InternalError(PALUDIS_HERE, "Infinite loop"); + } + + return r; +} + +std::string +KeyValueConfigFile::strip_quotes(const std::string & s) const +{ + if (s.empty()) + return s; + if (std::string::npos != std::string("'\"").find(s[0])) + { + if (s.length() < 2) + throw KeyValueConfigFileError("Unterminated quote", filename()); + if (s[s.length() - 1] != s[0]) + throw KeyValueConfigFileError("Mismatched quote", filename()); + return s.substr(1, s.length() - 2); + } + else + return s; +} + +AdvisoryLine::AdvisoryLine(const std::string & s) : + _line(s), + _is_range(false) +{ + Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t"); + tokeniser.tokenise(s, std::back_inserter(_tokens)); + + if ((_tokens.size() < 1) || (_tokens.size() > 2)) + throw AdvisoryFileError("Wrong count of atoms on line."); + + if (_tokens.size() == 2) + { + if (!(is_range_token(0) && is_range_token(1))) + throw AdvisoryFileError("Line must exactly contain 1 non-range atom or 2 range atoms."); + + if (is_range_bigger(0) && is_range_bigger(1)) + throw AdvisoryFileError("Broken range: Two bigger/bigger than atoms."); + + if (is_range_smaller(0) && is_range_smaller(1)) + throw AdvisoryFileError("Broken range: Two smaller/smaller than atoms."); + + _is_range = true; + } +} + +AdvisoryFileError::AdvisoryFileError(const std::string & msg, + const std::string & filename) throw () : + ConfigurationError("Advisory file error" + + (filename.empty() ? ": " : "in file '" + filename + "': ") + msg) +{ +} + +AdvisoryFile::AdvisoryFile(std::istream * const s) : + ConfigFile(s), + _end_of_header(false) +{ + need_lines(); + sanitise(); +} + +AdvisoryFile::AdvisoryFile(const std::string & filename) : + ConfigFile(filename), + _end_of_header(false) +{ + need_lines(); + sanitise(); +} + +AdvisoryFile::AdvisoryFile(const FSEntry & filename) : + ConfigFile(filename), + _end_of_header(false) +{ + need_lines(); + sanitise(); +} + +AdvisoryFile::AdvisoryFile(std::istream * const s, + const std::map<std::string, std::string> & m) : + ConfigFile(s), + _entries(m.begin(), m.end()), + _end_of_header(false) +{ + need_lines(); + sanitise(); +} + +AdvisoryFile::AdvisoryFile(const std::string & filename, + const std::map<std::string, std::string> & m) : + ConfigFile(filename), + _entries(m.begin(), m.end()), + _end_of_header(false) +{ + need_lines(); + sanitise(); +} + +AdvisoryFile::AdvisoryFile(const FSEntry & filename, + const std::map<std::string, std::string> & m) : + ConfigFile(filename), + _entries(m.begin(), m.end()), + _end_of_header(false) +{ + need_lines(); + sanitise(); +} + +AdvisoryFile::~AdvisoryFile() +{ +} + +void +AdvisoryFile::accept_line(const std::string & line) const +{ + std::string::size_type p(line.find(':')); + + if ((std::string::npos == p) || (_end_of_header)) + { + _entries["Description"] += line + "\n"; + _end_of_header = true; + } + else + { + std::string key(line.substr(0, p)), value(line.substr(p + 1)); + normalise_line(key); + normalise_line(value); + if ((key == "Affected") || (key == "Unaffected") || (key == "Bug-Id") || (key == "Url") + || (key == "Reviewed-By")) + { + if (key == "Affected") + _affected.push_back(AdvisoryLine(value)); + else if (key == "Unaffected") + _unaffected.push_back(AdvisoryLine(value)); + + if (!_entries[key].empty()) + value = "\n" + value; + _entries[key] += value; + } + else + { + if (_entries[key].empty()) + _entries[key] = value; + else + throw AdvisoryFileError("When adding value for key '" + key + "': Duplicate key found."); + } + } +} + +void +AdvisoryFile::sanitise() +{ + if (_entries["Id"].empty()) + throw AdvisoryFileError("Missing mandatory key: 'Id'."); + + if (_entries["Title"].empty()) + throw AdvisoryFileError("Missing mandatory key: 'Title'."); + + if (_entries["Committed-By"].empty()) + throw AdvisoryFileError("Missing mandatory key: 'Committed-By'."); + + if (_entries["Reviewed-By"].empty()) + throw AdvisoryFileError("Missing mandatory key: 'Reviewed-by'."); + + if ((_entries["Affected"].size() + _entries["Unaffected"].size()) == 0) + throw AdvisoryFileError("Missing either 'Affected' or 'Unaffected' key."); +} diff --git a/0.2.0/paludis/config_file.hh b/0.2.0/paludis/config_file.hh new file mode 100644 index 000000000..d9235341c --- /dev/null +++ b/0.2.0/paludis/config_file.hh @@ -0,0 +1,502 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_CONFIG_FILE_HH +#define PALUDIS_GUARD_PALUDIS_CONFIG_FILE_HH 1 + +#include <istream> +#include <list> +#include <map> +#include <paludis/util/exception.hh> +#include <paludis/util/fs_entry.hh> +#include <paludis/util/instantiation_policy.hh> +#include <string> +#include <vector> + +/** \file + * Declarations for the ConfigFile classes. + * + * \ingroup grpconfigfile + */ + +namespace paludis +{ + /** + * Thrown if an error occurs when reading a ConfigFile. + * + * \ingroup grpexceptions + * \ingroup grpconfigfile + */ + class ConfigFileError : public ConfigurationError + { + public: + /** + * Constructor. + */ + ConfigFileError(const std::string & message) throw (); + }; + + /** + * A ConfigFile is a file containing one entry per line, with lines + * starting with a # being ignored and leading and trailing whitespace + * being discarded. + * + * \ingroup grpconfigfile + */ + class ConfigFile : + paludis::InstantiationPolicy<ConfigFile, instantiation_method::NonCopyableTag> + { + private: + std::istream * const _stream; + + mutable bool _has_lines; + + std::string _filename; + + bool _destroy_stream; + + static std::istream * _make_stream(const std::string & filename); + + protected: + /** + * In-place normalise a line. By default, trims leading and + * trailing whitespace. Child classes may override. + */ + virtual void normalise_line(std::string &) const; + + /** + * Return whether to skip a line. By default, skips on blank + * lines and lines starting with a #. Child classes may + * override. This is called on a normalised line, not a raw + * string. + */ + virtual bool skip_line(const std::string &) const; + + /** + * Accept a normalised line that is not to be skipped. + */ + virtual void accept_line(const std::string &) const = 0; + + /** + * If we have not done so already, read in our lines. + */ + void need_lines() const; + + /** + * Constructor. + */ + ConfigFile(std::istream * const stream); + + /** + * Constructor, from a file. + */ + ConfigFile(const std::string & filename); + + /** + * Constructor, from a file. + */ + ConfigFile(const FSEntry & filename); + + /** + * Our filename, or blank if unknown. + */ + std::string filename() const + { + return _filename; + } + + public: + /** + * Destructor. + */ + virtual ~ConfigFile(); + }; + + /** + * A LineConfigFile is a ConfigFile that provides access to the + * normalised lines. Do not subclass. + * + * \ingroup grplineconfigfile + */ + class LineConfigFile : protected ConfigFile + { + private: + mutable std::list<std::string> _lines; + + protected: + void accept_line(const std::string &) const; + + public: + /** + * Constructor, from a stream. + */ + LineConfigFile(std::istream * const); + + /** + * Constructor, from a filename. + */ + LineConfigFile(const std::string & filename); + + /** + * Constructor, from a filename. + */ + LineConfigFile(const FSEntry & filename); + + /** + * Iterator over our lines. + */ + typedef std::list<std::string>::const_iterator Iterator; + + /** + * Iterator to the start of our lines. + */ + Iterator begin() const + { + return _lines.begin(); + } + + /** + * Iterator to past the end of our lines. + */ + Iterator end() const + { + return _lines.end(); + } + }; + + /** + * A KeyValueConfigFileError is thrown if bad data is encountered in + * a ConfigFile. + * + * \ingroup grpkvconfigfile + * \ingroup grpexceptions + */ + class KeyValueConfigFileError : public ConfigurationError + { + public: + /** + * Constructor. + */ + KeyValueConfigFileError(const std::string & message, + const std::string & filename = "") throw (); + }; + + /** + * A KeyValueConfigFile is a ConfigFile that provides access to the + * normalised lines. Do not subclass. + * + * \ingroup grpkvconfigfile + */ + class KeyValueConfigFile : protected ConfigFile + { + private: + mutable std::map<std::string, std::string> _entries; + + protected: + void accept_line(const std::string &) const; + + /** + * Handle variable replacement. + */ + std::string replace_variables(const std::string &) const; + + /** + * Handle quote removal. + */ + std::string strip_quotes(const std::string &) const; + + public: + /** + * Constructor, from a stream. + */ + KeyValueConfigFile(std::istream * const); + + /** + * Constructor, from a filename. + */ + KeyValueConfigFile(const std::string & filename); + + /** + * Constructor, from a filename. + */ + KeyValueConfigFile(const FSEntry & filename); + + /** + * Constructor, from a stream, with defaults. + */ + KeyValueConfigFile(std::istream * const, + const std::map<std::string, std::string> &); + + /** + * Constructor, from a filename, with defaults. + */ + KeyValueConfigFile(const std::string & filename, + const std::map<std::string, std::string> &); + + /** + * Constructor, from a filename, with defaults. + */ + KeyValueConfigFile(const FSEntry & filename, + const std::map<std::string, std::string> &); + + /** + * Destructor. + */ + ~KeyValueConfigFile(); + + /** + * Iterator over our key/values. + */ + typedef std::map<std::string, std::string>::const_iterator Iterator; + + /** + * Start of our key/values. + */ + Iterator begin() const + { + return _entries.begin(); + } + + /** + * Past the end of our key/values. + */ + Iterator end() const + { + return _entries.end(); + } + + /** + * Fetch the specified key, or a blank string. + */ + std::string get(const std::string & key) const + { + return _entries[key]; + } + }; + + /** + * An AdvisoryFileError is thrown if bad data is encountered in + * a ConfigFile. + * + * \ingroup grpadvisoryconfigfile + * \ingroup grpexceptions + */ + class AdvisoryFileError : public ConfigurationError + { + public: + /** + * Constructor. + */ + AdvisoryFileError(const std::string & message, + const std::string & filename = "") throw (); + }; + + /** + * An AdvisoryLine represents one of the Affected: or Unaffected: lines in an AdvisoryFile. + * + * \ingroup grpadvisoryconfigfile + */ + class AdvisoryLine + { + private: + enum RangeChars { + rc_is_bigger = '>', + rc_is_smaller = '<' + }; + std::string _line; + std::vector<std::string> _tokens; + bool _is_range; + + protected: + bool is_range_bigger(int i) const + { + return _tokens[i][0] == rc_is_bigger; + } + + bool is_range_smaller(int i) const + { + return _tokens[i][0] == rc_is_smaller; + } + + bool is_range_token(int i) const + { + return is_range_smaller(i) || is_range_bigger(i); + } + + public: + AdvisoryLine(const std::string & s); + const std::string operator[] (int i) const + { + return _tokens[i]; + } + + const std::string & line() const + { + return _line; + } + + bool is_range() const + { + return _is_range; + } + }; + + /** + * An AdvisoryFile is a file containing all necessary information to + * update one or more packages in order to avoid a security problem. + * + * It uses a textformat with RFC 822 style headers, an empty line denotes + * the beginning of a multi-line description of the security problem. + * + * Valid header items are: + * Affected, Bug-Url, Committed-By, Id, Reviewed-By, Unaffected, Url + * + * \ingroup grpadvisoryconfigfile + */ + + class AdvisoryFile : protected ConfigFile + { + private: + mutable std::map<std::string, std::string> _entries; + mutable std::list<AdvisoryLine> _affected; + mutable std::list<AdvisoryLine> _unaffected; + mutable bool _end_of_header; + + protected: + void accept_line(const std::string &) const; + /** + * Ensure that the AdvisoryFile contains all mandatory items. + */ + void sanitise(); + + public: + /** + * Constructor, from a stream. + */ + AdvisoryFile(std::istream * const); + + /** + * Constructor, from a filename. + */ + AdvisoryFile(const std::string & filename); + + /** + * Constructor, from a filename. + */ + AdvisoryFile(const FSEntry & filename); + + /** + * Constructor, from a stream, with defaults. + */ + AdvisoryFile(std::istream * const, + const std::map<std::string, std::string> &); + + /** + * Constructor, from a filename, with defaults. + */ + AdvisoryFile(const std::string & filename, + const std::map<std::string, std::string> &); + + /** + * Constructor, from a filename, with defaults. + */ + AdvisoryFile(const FSEntry & filename, + const std::map<std::string, std::string> &); + + /** + * Destructor. + */ + ~AdvisoryFile(); + + /** + * Iterator over our lines. + */ + typedef std::map<std::string, std::string>::const_iterator EntriesIterator; + typedef std::list<AdvisoryLine>::const_iterator LineIterator; + + /** + * Iterator to the start of our lines. + */ + EntriesIterator begin() const + { + return _entries.begin(); + } + + /** + * Iterator to past the end of our lines. + */ + EntriesIterator end() const + { + return _entries.end(); + } + + /** + * Iterator to the start of our Affected: lines. + */ + LineIterator begin_affected() const + { + return _affected.begin(); + } + + /** + * Iterator to past the end of our Affected: lines. + */ + LineIterator end_affected() const + { + return _affected.end(); + } + + /** + * Iterator to the start of our Unaffected: lines. + */ + LineIterator begin_unaffected() const + { + return _unaffected.begin(); + } + + /** + * Iterator to past the end of our Unaffected: lines. + */ + LineIterator end_unaffected() const + { + return _unaffected.end(); + } + + /** + * Fetch the specified key, or a blank string. + */ + std::string get(const std::string & key) const + { + return _entries[key]; + } + + std::list<AdvisoryLine> & affected() const + { + return _affected; + } + + std::list<AdvisoryLine> & unaffected() const + { + return _unaffected; + } + }; + +} + +#endif diff --git a/0.2.0/paludis/config_file_TEST.cc b/0.2.0/paludis/config_file_TEST.cc new file mode 100644 index 000000000..0ac913a3a --- /dev/null +++ b/0.2.0/paludis/config_file_TEST.cc @@ -0,0 +1,305 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/config_file.hh> +#include <paludis/util/fs_entry.hh> +#include <paludis/util/stringify.hh> +#include <sstream> +#include <test/test_framework.hh> +#include <test/test_runner.hh> +#include <vector> +#include <unistd.h> + +using namespace test; +using namespace paludis; + +/** \file + * Test cases for config_file.hh . + * + * \ingroup grptestcases + * \ingroup grpconfigfile + */ + +namespace +{ + /** + * A ConfigFile descendent for use in tests. + * + * \ingroup grptestcases + */ + class TestFile : protected ConfigFile + { + public: + /** + * Constructor. + */ + TestFile(std::istream * const stream) : + ConfigFile(stream) + { + need_lines(); + } + + /** + * Constructor. + */ + TestFile(const std::string & filename) : + ConfigFile(filename) + { + need_lines(); + } + + /** + * Constructor. + */ + TestFile(const FSEntry & filename) : + ConfigFile(filename) + { + need_lines(); + } + + /** + * Our lines. + */ + mutable std::vector<std::string> lines; + + protected: + void accept_line(const std::string & s) const + { + lines.push_back(s); + } + }; +} + +namespace test_cases +{ + /** + * \test Test ConfigFile. + * + * \ingroup grptestcases + */ + struct ConfigFileTest : TestCase + { + ConfigFileTest() : TestCase("config file") { } + + void run() + { + std::stringstream s; + s << "one" << std::endl; + s << " two \t " << std::endl; + s << " \t " << std::endl; + s << "" << std::endl; + s << "three" << std::endl; + s << "# blah" << std::endl; + s << " # blah" << std::endl; + s << "#" << std::endl; + s << " # \t " << std::endl; + s << "four four" << std::endl; + TestFile f(&s); + TEST_CHECK_EQUAL(f.lines.size(), 4); + TEST_CHECK_EQUAL(f.lines.at(0), "one"); + TEST_CHECK_EQUAL(f.lines.at(1), "two"); + TEST_CHECK_EQUAL(f.lines.at(2), "three"); + TEST_CHECK_EQUAL(f.lines.at(3), "four four"); + } + } test_config_file; + + /** + * \test Test ConfigFile with file opening. + * + * \ingroup grptestcases + */ + struct ConfigFileOpenFileTest : TestCase + { + ConfigFileOpenFileTest() : TestCase("config file open file") { } + + void run() + { + FSEntry ff("config_file_TEST_dir/config_file"); + TEST_CHECK(ff.is_regular_file()); + TestFile f(ff); + TEST_CHECK_EQUAL(f.lines.size(), 1); + TEST_CHECK_EQUAL(f.lines.at(0), "I am a fish."); + + FSEntry ff2("config_file_TEST_dir/not_a_config_file"); + TEST_CHECK(! ff2.exists()); + TestFile * f2(0); + TEST_CHECK_THROWS(f2 = new TestFile(ff2), ConfigFileError); + + if (0 != geteuid()) + { + FSEntry ff3("config_file_TEST_dir/unreadable_file"); + TEST_CHECK(ff3.is_regular_file()); + TestFile * f3(0); + TEST_CHECK_THROWS(f3 = new TestFile(ff3), ConfigFileError); + } + } + } test_config_file_open_file; + + /** + * \test Test LineConfigFile. + * + * \ingroup grptestcases + */ + struct LineConfigFileTest : TestCase + { + LineConfigFileTest() : TestCase("line config file") { } + + void run() + { + std::stringstream s; + s << "one" << std::endl; + s << " two \t " << std::endl; + s << " \t " << std::endl; + s << "" << std::endl; + s << "three" << std::endl; + s << "# blah" << std::endl; + s << " # blah" << std::endl; + s << "#" << std::endl; + s << " # \t " << std::endl; + s << "four four" << std::endl; + LineConfigFile ff(&s); + std::vector<std::string> f(ff.begin(), ff.end()); + + TEST_CHECK_EQUAL(f.size(), 4); + TEST_CHECK_EQUAL(f.at(0), "one"); + TEST_CHECK_EQUAL(f.at(1), "two"); + TEST_CHECK_EQUAL(f.at(2), "three"); + TEST_CHECK_EQUAL(f.at(3), "four four"); + } + } test_line_config_file; + + /** + * \test Test KeyValueConfigFile basics. + * + * \ingroup grptestcases + */ + struct KeyValueConfigFileTest : TestCase + { + KeyValueConfigFileTest() : TestCase("key value config file") { } + + void run() + { + std::stringstream s; + s << "one=first" << std::endl; + s << "two = second" << std::endl; + s << "three" << std::endl; + s << "four = \"fourth\" " << std::endl; + s << "five = ''" << std::endl; + KeyValueConfigFile ff(&s); + + TEST_CHECK_EQUAL(ff.get("one"), "first"); + TEST_CHECK_EQUAL(ff.get("two"), "second"); + TEST_CHECK_EQUAL(ff.get("three"), ""); + TEST_CHECK_EQUAL(ff.get("four"), "fourth"); + TEST_CHECK_EQUAL(ff.get("five"), ""); + TEST_CHECK_EQUAL(ff.get("six"), ""); + } + } test_key_value_config_file; + + /** + * \test Test KeyValueConfigFile variables. + * + * \ingroup grptestcases + */ + struct KeyValueConfigFileVarsTest : TestCase + { + KeyValueConfigFileVarsTest() : TestCase("key value config file with vars") { } + + void run() + { + std::stringstream s; + s << "x=foo" << std::endl; + s << "y = \"${x}\\\\${y}\\$${z}\"" << std::endl; + s << "z = $x$y$z" << std::endl; + KeyValueConfigFile ff(&s); + + TEST_CHECK_EQUAL(ff.get("x"), "foo"); + TEST_CHECK_EQUAL(ff.get("y"), "foo\\$"); + TEST_CHECK_EQUAL(ff.get("z"), "foofoo\\$"); + + std::stringstream t; + std::map<std::string, std::string> t_defs; + t_defs.insert(std::make_pair("a", "moo")); + t_defs.insert(std::make_pair("d", "bar")); + t_defs.insert(std::make_pair("e", "baz")); + t << "a=foo" << std::endl; + t << "b=$a" << std::endl; + t << "c=$d" << std::endl; + t << "d=$d" << std::endl; + t << "f = " << std::endl; + t << "g = foo \\" << std::endl; + t << " bar" << std::endl; + KeyValueConfigFile fg(&t, t_defs); + + TEST_CHECK_EQUAL(fg.get("a"), "foo"); + TEST_CHECK_EQUAL(fg.get("b"), "foo"); + TEST_CHECK_EQUAL(fg.get("c"), "bar"); + TEST_CHECK_EQUAL(fg.get("d"), "bar"); + TEST_CHECK_EQUAL(fg.get("e"), "baz"); + TEST_CHECK_EQUAL(fg.get("f"), ""); + TEST_CHECK_EQUAL(fg.get("g"), "foo bar"); + } + } test_key_value_config_file_vars; + + /** + * \test Test KeyValueConfigFile errors. + * + * \ingroup grptestcases + */ + struct KeyValueConfigFileErrorsTest : TestCase + { + KeyValueConfigFileErrorsTest() : TestCase("key value config file with errors") { } + + void run() + { + std::stringstream s1; + s1 << "x='" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s1), ConfigurationError); + + std::stringstream s2; + s2 << "x='moo\"" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s2), ConfigurationError); + + std::stringstream s3; + s3 << "x=${foo" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s3), ConfigurationError); + + std::stringstream s4; + s4 << "x=$~" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s4), ConfigurationError); + + std::stringstream s5; + s5 << "x=abc\\" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s5), ConfigurationError); + + std::stringstream s6; + s6 << "x=$" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s6), ConfigurationError); + + std::stringstream s7; + s7 << "x=blah \\" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s7), ConfigurationError); + + std::stringstream s8; + s8 << "x=blah \\" << std::endl << "# foo" << std::endl; + TEST_CHECK_THROWS(KeyValueConfigFile ff(&s8), ConfigurationError); + } + } test_key_value_config_file_errors; +} + diff --git a/0.2.0/paludis/config_file_TEST_cleanup.sh b/0.2.0/paludis/config_file_TEST_cleanup.sh new file mode 100755 index 000000000..d2f0bd846 --- /dev/null +++ b/0.2.0/paludis/config_file_TEST_cleanup.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# vim: set ft=sh sw=4 sts=4 et : + +if [ -d config_file_TEST_dir ] ; then + rm -fr config_file_TEST_dir +else + true +fi + + diff --git a/0.2.0/paludis/config_file_TEST_setup.sh b/0.2.0/paludis/config_file_TEST_setup.sh new file mode 100755 index 000000000..766011d4a --- /dev/null +++ b/0.2.0/paludis/config_file_TEST_setup.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# vim: set ft=sh sw=4 sts=4 et : + +mkdir config_file_TEST_dir || exit 2 +cd config_file_TEST_dir || exit 3 +echo "I am a fish." > config_file || exit 4 +echo "I am a fish too." > unreadable_file || exit 5 +chmod a-r unreadable_file || exit 6 + diff --git a/0.2.0/paludis/contents.cc b/0.2.0/paludis/contents.cc new file mode 100644 index 000000000..ad9acfa5c --- /dev/null +++ b/0.2.0/paludis/contents.cc @@ -0,0 +1,58 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "contents.hh" + +/** \file + * Implementation for Contents classes. + * + * \ingroup grpcontents + */ + +using namespace paludis; + +ContentsEntry::~ContentsEntry() +{ +} + +ContentsFileEntry::ContentsFileEntry(const std::string & name) : + ContentsEntry(name) +{ +} + +ContentsDirEntry::ContentsDirEntry(const std::string & name) : + ContentsEntry(name) +{ +} + +ContentsMiscEntry::ContentsMiscEntry(const std::string & name) : + ContentsEntry(name) +{ +} + +ContentsSymEntry::ContentsSymEntry(const std::string & name, const std::string & target) : + ContentsEntry(name), + _target(target) +{ +} + +Contents::Contents() +{ +} + diff --git a/0.2.0/paludis/contents.hh b/0.2.0/paludis/contents.hh new file mode 100644 index 000000000..2cc741453 --- /dev/null +++ b/0.2.0/paludis/contents.hh @@ -0,0 +1,168 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_CONTENTS_HH +#define PALUDIS_GUARD_PALUDIS_CONTENTS_HH 1 + +#include <paludis/util/visitor.hh> +#include <paludis/util/counted_ptr.hh> +#include <paludis/util/instantiation_policy.hh> +#include <paludis/util/private_implementation_pattern.hh> +#include <string> + +/** \file + * Declarations for the Contents classes. + * + * \ingroup grpcontents + */ + +namespace paludis +{ + struct ContentsEntry; + struct ContentsFileEntry; + struct ContentsDirEntry; + struct ContentsSymEntry; + struct ContentsMiscEntry; + + typedef VisitorTypes<ContentsFileEntry *, ContentsDirEntry *, + ContentsSymEntry *, ContentsMiscEntry *> ContentsVisitorTypes; + + /** + * Base class for a contents entry. + * + * \ingroup grpcontents + */ + class ContentsEntry : + private InstantiationPolicy<ContentsEntry, instantiation_method::NonCopyableTag>, + public InternalCounted<ContentsEntry>, + public virtual VisitableInterface<ContentsVisitorTypes> + { + private: + std::string _name; + + protected: + ContentsEntry(const std::string & name) : + _name(name) + { + } + + public: + virtual ~ContentsEntry(); + + std::string name() const + { + return _name; + } + }; + + /** + * A file contents entry. + * + * \ingroup grpcontents + */ + class ContentsFileEntry : + public ContentsEntry, + public Visitable<ContentsFileEntry, ContentsVisitorTypes> + { + public: + ContentsFileEntry(const std::string & name); + }; + + /** + * A directory contents entry. + * + * \ingroup grpcontents + */ + class ContentsDirEntry : + public ContentsEntry, + public Visitable<ContentsDirEntry, ContentsVisitorTypes> + { + public: + ContentsDirEntry(const std::string & name); + }; + + /** + * A misc contents entry. + * + * \ingroup grpcontents + */ + class ContentsMiscEntry : + public ContentsEntry, + public Visitable<ContentsMiscEntry, ContentsVisitorTypes> + { + public: + ContentsMiscEntry(const std::string & name); + }; + + /** + * A sym contents entry. + * + * \ingroup grpcontents + */ + class ContentsSymEntry : + public ContentsEntry, + public Visitable<ContentsSymEntry, ContentsVisitorTypes> + { + private: + std::string _target; + + public: + ContentsSymEntry(const std::string & name, const std::string & target); + + std::string target() const + { + return _target; + } + }; + + /** + * A package's contents. + * + * \ingroup grpcontents + */ + class Contents : + private InstantiationPolicy<Contents, instantiation_method::NonCopyableTag>, + public InternalCounted<Contents> + { + private: + std::list<ContentsEntry::ConstPointer> _c; + + public: + Contents(); + + void add(ContentsEntry::ConstPointer c) + { + _c.push_back(c); + } + + typedef std::list<ContentsEntry::ConstPointer>::const_iterator Iterator; + + Iterator begin() const + { + return _c.begin(); + } + + Iterator end() const + { + return _c.end(); + } + }; +} + +#endif diff --git a/0.2.0/paludis/default_config.cc b/0.2.0/paludis/default_config.cc new file mode 100644 index 000000000..fc1ee01ce --- /dev/null +++ b/0.2.0/paludis/default_config.cc @@ -0,0 +1,377 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <paludis/config_file.hh> +#include <paludis/default_config.hh> +#include <paludis/util/destringify.hh> +#include <paludis/util/dir_iterator.hh> +#include <paludis/util/iterator.hh> +#include <paludis/util/fs_entry.hh> +#include <paludis/util/is_file_with_extension.hh> +#include <paludis/util/log.hh> +#include <paludis/util/stringify.hh> +#include <paludis/util/system.hh> +#include <paludis/util/tokeniser.hh> + +#include <fstream> +#include <algorithm> +#include <sstream> +#include <ctype.h> + +/** \file + * Implementation of default_config.hh classes. + * + * \ingroup grpdefaultconfig + */ + +using namespace paludis; + +DefaultConfigError::DefaultConfigError(const std::string & msg) throw () : + ConfigurationError("Default configuration error: " + msg) +{ +} + +DefaultConfig::DefaultConfig() : + _paludis_command("paludis") +{ + _config_suffix_can_be_set = false; + + Context context("When loading default configuration:"); + + if (! getenv_with_default("PALUDIS_SKIP_CONFIG", "").empty()) + return; + + Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n"); + + /* indirection */ + std::string root_prefix; + std::string config_suffix; + if (! _config_suffix.empty()) + config_suffix = "-" + _config_suffix; + + FSEntry config_dir(FSEntry(getenv_with_default("PALUDIS_HOME", getenv_or_error("HOME"))) / + (".paludis" + config_suffix)); + if (! config_dir.exists()) + config_dir = (FSEntry(SYSCONFDIR) / ("paludis" + config_suffix)); + if (! config_dir.exists()) + throw DefaultConfigError("Can't find configuration directory"); + + Log::get_instance()->message(ll_debug, "DefaultConfig initial directory is '" + + stringify(config_dir) + "'"); + + if ((config_dir / "specpath").exists()) + { + KeyValueConfigFile specpath(config_dir / "specpath"); + root_prefix = specpath.get("root"); + config_suffix = specpath.get("config-suffix"); + + if (! root_prefix.empty() && stringify(FSEntry(root_prefix).realpath()) != "/") + { + config_dir = FSEntry(root_prefix) / SYSCONFDIR / ("paludis" + config_suffix); + if (! config_dir.exists()) + throw DefaultConfigError("Can't find configuration directory under root (" + "tried '" + stringify(config_dir) + "'"); + } + } + + _root = root_prefix; + _config_dir = stringify(config_dir); + + std::map<std::string, std::string> conf_vars; + conf_vars.insert(std::make_pair("ROOT", root_prefix)); + + Log::get_instance()->message(ll_debug, "DefaultConfig real directory is '" + + stringify(config_dir) + "', root prefix is '" + root_prefix + + "', config suffix is '" + config_suffix + "'"); + + /* repositories */ + { + std::list<FSEntry> dirs; + dirs.push_back(config_dir / "repositories"); + + std::list<FSEntry> repo_files; + for (std::list<FSEntry>::const_iterator dir(dirs.begin()), dir_end(dirs.end()) ; + dir != dir_end ; ++dir) + { + if (! dir->exists()) + continue; + + std::copy(DirIterator(*dir), DirIterator(), + filter_inserter(std::back_inserter(repo_files), IsFileWithExtension(".conf"))); + } + + for (std::list<FSEntry>::const_iterator repo_file(repo_files.begin()), repo_file_end(repo_files.end()) ; + repo_file != repo_file_end ; ++repo_file) + { + Context local_context("When reading repository file '" + stringify(*repo_file) + "':"); + + KeyValueConfigFile k(*repo_file, conf_vars); + + std::string format(k.get("format")); + if (format.empty()) + throw DefaultConfigError("Key 'format' not specified or empty"); + + int importance(0); + if (! k.get("importance").empty()) + importance = destringify<int>(k.get("importance")); + + std::map<std::string, std::string> keys(k.begin(), k.end()); + keys["repo_file"] = stringify(*repo_file); + keys["root"] = root_prefix; + _repos.push_back(RepositoryConfigEntry(format, importance, keys)); + } + + if (_repos.empty()) + throw DefaultConfigError("No repositories specified"); + + _repos.sort(); + } + + /* keywords */ + { + std::list<FSEntry> files; + files.push_back(config_dir / "keywords.conf"); + + for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ; + file != file_end ; ++file) + { + Context local_context("When reading keywords file '" + stringify(*file) + "':"); + + if (! file->is_regular_file()) + continue; + + LineConfigFile f(*file); + for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ; + line != line_end ; ++line) + { + std::vector<std::string> tokens; + tokeniser.tokenise(*line, std::back_inserter(tokens)); + if (tokens.empty()) + continue; + if ("*" == tokens.at(0)) + std::copy(next(tokens.begin()), tokens.end(), + create_inserter<KeywordName>(std::back_inserter(_default_keywords))); + else + { + PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0))); + for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ; + t != t_end ; ++t) + _keywords[a->package()].push_back(std::make_pair(a, *t)); + } + } + } + + if (_default_keywords.empty()) + throw DefaultConfigError("No default keywords specified (a keywords.conf file should " + "contain an entry in the form '* keyword')"); + } + + /* licenses */ + { + std::list<FSEntry> files; + files.push_back(config_dir / "licenses.conf"); + + for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ; + file != file_end ; ++file) + { + Context local_context("When reading licenses file '" + stringify(*file) + "':"); + + if (! file->is_regular_file()) + continue; + + LineConfigFile f(*file); + for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ; + line != line_end ; ++line) + { + std::vector<std::string> tokens; + tokeniser.tokenise(*line, std::back_inserter(tokens)); + if (tokens.empty()) + continue; + if ("*" == tokens.at(0)) + std::copy(next(tokens.begin()), tokens.end(), std::back_inserter(_default_licenses)); + else + { + PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0))); + for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ; + t != t_end ; ++t) + _licenses[a->package()].push_back(std::make_pair(a, *t)); + } + } + } + + if (_default_licenses.empty()) + throw DefaultConfigError("No default licenses specified (a licenses.conf file should " + "contain an entry in the form '* keyword', or '* *' if you don't want any " + "license filtering)"); + } + + /* user mask */ + { + std::list<FSEntry> files; + files.push_back(config_dir / "package_mask.conf"); + + for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ; + file != file_end ; ++file) + { + Context local_context("When reading package_mask file '" + stringify(*file) + "':"); + + if (! file->is_regular_file()) + continue; + + LineConfigFile f(*file); + for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ; + line != line_end ; ++line) + { + PackageDepAtom::ConstPointer a(new PackageDepAtom(*line)); + _user_masks[a->package()].push_back(a); + } + } + } + + /* user unmask */ + { + std::list<FSEntry> files; + files.push_back(config_dir / "package_unmask.conf"); + + for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ; + file != file_end ; ++file) + { + Context local_context("When reading package_unmask file '" + stringify(*file) + "':"); + + if (! file->is_regular_file()) + continue; + + LineConfigFile f(*file); + for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ; + line != line_end ; ++line) + { + PackageDepAtom::ConstPointer a(new PackageDepAtom(*line)); + _user_unmasks[a->package()].push_back(a); + } + } + } + + /* use */ + { + std::list<FSEntry> files; + files.push_back(config_dir / "use.conf"); + + for (std::list<FSEntry>::const_iterator file(files.begin()), file_end(files.end()) ; + file != file_end ; ++file) + { + Context local_context("When reading use file '" + stringify(*file) + "':"); + + if (! file->is_regular_file()) + continue; + + LineConfigFile f(*file); + for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ; + line != line_end ; ++line) + { + std::vector<std::string> tokens; + tokeniser.tokenise(*line, std::back_inserter(tokens)); + if (tokens.empty()) + continue; + + std::string prefix; + if ("*" == tokens.at(0)) + for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ; + t != t_end ; ++t) + { + if ('-' == t->at(0)) + _default_use.push_back(std::make_pair(UseFlagName( + prefix + t->substr(1)), use_disabled)); + else if (':' == t->at(t->length() - 1)) + { + prefix.clear(); + std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix), + &::tolower); + prefix.append("_"); + } + else + _default_use.push_back(std::make_pair(UseFlagName( + prefix + *t), use_enabled)); + } + else + { + PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0))); + for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ; + t != t_end ; ++t) + { + if ('-' == t->at(0)) + _use[a->package()].push_back(UseConfigEntry( + a, UseFlagName(prefix + t->substr(1)), use_disabled)); + else if (':' == t->at(t->length() - 1)) + { + prefix.clear(); + std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix), + &::tolower); + prefix.append("_"); + } + else + _use[a->package()].push_back(UseConfigEntry( + a, UseFlagName(prefix + *t), use_enabled)); + } + } + } + } + + if (_default_keywords.empty()) + throw DefaultConfigError("No default keywords specified (a keywords.conf file should " + "contain an entry in the form '* keyword')"); + } + + _bashrc_files = stringify(config_dir / "bashrc"); +} + +DefaultConfig::~DefaultConfig() +{ +} + +std::string DefaultConfig::_config_suffix; +bool DefaultConfig::_config_suffix_can_be_set(true); + +void +DefaultConfig::set_config_suffix(const std::string & s) +{ + if (! _config_suffix_can_be_set) + throw InternalError(PALUDIS_HERE, "DefaultConfig::set_config_suffix called after " + "DefaultConfig has been instantiated."); + + static const std::string allowed_chars( + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789-_+:"); + + if (std::string::npos != s.find_first_not_of(allowed_chars)) + throw DefaultConfigError("Invalid config suffix '" + s + "'"); + + if (! s.empty()) + if ('-' == s.at(0) || '-' == s.at(s.length() - 1)) + throw DefaultConfigError("Invalid config suffix '" + s + "'"); + + _config_suffix = s; +} + +std::string +DefaultConfig::bashrc_files() const +{ + return _bashrc_files; +} + diff --git a/0.2.0/paludis/default_config.hh b/0.2.0/paludis/default_config.hh new file mode 100644 index 000000000..5bcd40814 --- /dev/null +++ b/0.2.0/paludis/default_config.hh @@ -0,0 +1,499 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk> + * + * This file is part of the Paludis package manager. Paludis is free software; + * you can redistribute it and/or modify it under the terms of the GNU General + * Public License version 2, as published by the Free Software Foundation. + * + * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PALUDIS_GUARD_PALUDIS_DEFAULT_CONFIG_HH +#define PALUDIS_GUARD_PALUDIS_DEFAULT_CONFIG_HH 1 + +#include <paludis/dep_atom.hh> +#include <paludis/name.hh> +#include <paludis/util/exception.hh> +#include <paludis/util/fs_entry.hh> +#include <paludis/util/iterator.hh> +#include <paludis/util/instantiation_policy.hh> +#include <paludis/util/smart_record.hh> + +#include <map> +#include <vector> +#include <string> + +/** \file + * Declarations for the DefaultConfig class and related utilities. + * + * \ingroup grpdefaultconfig + */ + +namespace paludis +{ + /** + * A DefaultConfigError is thrown if a configuration error is encountered + * by DefaultConfig. + * + * \ingroup grpexceptions + * \ingroup grpdefaultconfig + */ + class DefaultConfigError : public ConfigurationError + { + public: + /** + * Constructor. + */ + DefaultConfigError(const std::string & msg) throw (); + }; + + /** + * Keys for RepositoryConfigEntry. + * + * \see RepositoryConfigEntry + * + * \ingroup grpdefaultconfig + */ + enum RepositoryConfigEntryKeys + { + rce_format, ///< Our format + rce_importance, ///< Our importance, higher being more important + rce_keys, ///< Our key/value data + last_rce ///< Number of entries + }; + + /** + * Tag for RepositoryConfigEntry. + * + * \see RepositoryConfigEntry + * + * \ingroup grpdefaultconfig + */ + struct RepositoryConfigEntryTag : + SmartRecordTag<comparison_mode::FullComparisonTag, + comparison_method::SmartRecordCompareByKeyTag<rce_importance> >, + SmartRecordKeys<RepositoryConfigEntryKeys, last_rce>, + SmartRecordKey<rce_format, std::string>, + SmartRecordKey<rce_importance, unsigned>, + SmartRecordKey<rce_keys, std::map<std::string, std::string> > + { + }; + + /** + * Holds an entry in a DefaultConfig's repository configuration data. + * + * \ingroup grpdefaultconfig + */ + typedef MakeSmartRecord<RepositoryConfigEntryTag>::Type RepositoryConfigEntry; + + /** + * Keys for UseConfigEntry. + * + * \see UseConfigEntry + * + * \ingroup grpdefaultconfig + */ + enum UseConfigEntryKeys + { + uce_dep_atom, ///< A dependency atom + uce_flag_name, ///< The use flag name + uce_flag_state ///< The use flag state + }; + + /** + * Tag for UseConfigEntry. + * + * \see UseConfigEntry + * + * \ingroup grpdefaultconfig + */ + struct UseConfigEntryTag : + SmartRecordTag<comparison_mode::NoComparisonTag, void>, + SmartRecordKeys<UseConfigEntryKeys, 3>, + SmartRecordKey<uce_dep_atom, PackageDepAtom::ConstPointer>, + SmartRecordKey<uce_flag_name, UseFlagName>, + SmartRecordKey<uce_flag_state, UseFlagState> + { + }; + + /** + * An entry in a DefaultConfig's use configuration data. + * + * \ingroup grpdefaultconfig + */ + typedef MakeSmartRecord<UseConfigEntryTag>::Type UseConfigEntry; + + /** + * DefaultConfig is used by DefaultEnvironment to access the user's + * configuration settings from on-disk configuration files. + * + * \ingroup grpdefaultconfig + */ + class DefaultConfig : + public InstantiationPolicy<DefaultConfig, instantiation_method::SingletonAsNeededTag> + { + friend class InstantiationPolicy<DefaultConfig, instantiation_method::SingletonAsNeededTag>; + + private: + static std::string _config_suffix; + static bool _config_suffix_can_be_set; + std::string _paludis_command; + std::string _root; + std::string _config_dir; + std::string _bashrc_files; + + DefaultConfig(); + + ~DefaultConfig(); + + std::list<RepositoryConfigEntry> _repos; + + std::map<QualifiedPackageName, std::vector< + std::pair<PackageDepAtom::ConstPointer, KeywordName> > > _keywords; + + const std::vector<std::pair<PackageDepAtom::ConstPointer, KeywordName> > _empty_keywords; + + std::vector<KeywordName> _default_keywords; + + std::map<QualifiedPackageName, std::vector< + std::pair<PackageDepAtom::ConstPointer, std::string> > > _licenses; + + const std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> > _empty_licenses; + + std::vector<std::string> _default_licenses; + + std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > _user_masks; + + std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> > _user_unmasks; + + std::vector<PackageDepAtom::ConstPointer> _empty_masks; + + std::map<QualifiedPackageName, std::vector<UseConfigEntry> > _use; + + std::vector<UseConfigEntry> _empty_use; + + std::vector<std::pair<UseFlagName, UseFlagState> > _default_use; + + public: + /** + * Set config suffix. Must be called before we do anything, or not + * at all. + */ + static void set_config_suffix(const std::string &); + + ///\name Repositories + ///{ + + /** + * An iterator for our repositories. + */ + typedef std::list<RepositoryConfigEntry>::const_iterator RepositoryIterator; + + /** + * Iterator to the start of our repositories. + */ + RepositoryIterator begin_repositories() const + { + return _repos.begin(); + } + + /** + * Iterator to past the end of our repositories. + */ + RepositoryIterator end_repositories() const + { + return _repos.end(); + } + + ///} + + ///\name Keywords + ///{ + + /** + * Iterate over our package.keywords entries. + */ + typedef std::vector<std::pair<PackageDepAtom::ConstPointer, KeywordName> >::const_iterator + PackageKeywordsIterator; + + /** + * Iterator to the start of the package.keywords entries for a + * particular package. + */ + PackageKeywordsIterator begin_package_keywords(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector< + std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r; + if (_keywords.end() != ((r = _keywords.find(d)))) + return r->second.begin(); + else + return _empty_keywords.begin(); + } + + /** + * Iterator to past the end of the package.keywords entries for a + * particular file. + */ + PackageKeywordsIterator end_package_keywords(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector< + std::pair<PackageDepAtom::ConstPointer, KeywordName> > >::const_iterator r; + if (_keywords.end() != ((r = _keywords.find(d)))) + return r->second.end(); + else + return _empty_keywords.end(); + } + + /** + * Iterator over the default keywords entries. + */ + typedef std::vector<KeywordName>::const_iterator DefaultKeywordsIterator; + + /** + * Iterator to the start of our default keywords entries. + */ + DefaultKeywordsIterator begin_default_keywords() const + { + return _default_keywords.begin(); + } + + /** + * Iterator to past the end of our default keywords entries. + */ + DefaultKeywordsIterator end_default_keywords() const + { + return _default_keywords.end(); + } + + ///} + + ///\name Licenses + ///{ + + /** + * Iterate over our licenses entries. + */ + typedef std::vector<std::pair<PackageDepAtom::ConstPointer, std::string> >::const_iterator + PackageLicensesIterator; + + /** + * Iterator to the start of the licenses entries for a + * particular package. + */ + PackageLicensesIterator begin_package_licenses(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector< + std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r; + if (_licenses.end() != ((r = _licenses.find(d)))) + return r->second.begin(); + else + return _empty_licenses.begin(); + } + + /** + * Iterator to past the end of the licenses entries for a + * particular file. + */ + PackageLicensesIterator end_package_licenses(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector< + std::pair<PackageDepAtom::ConstPointer, std::string> > >::const_iterator r; + if (_licenses.end() != ((r = _licenses.find(d)))) + return r->second.end(); + else + return _empty_licenses.end(); + } + + /** + * Iterator over the default licenses entries. + */ + typedef std::vector<std::string>::const_iterator DefaultLicensesIterator; + + /** + * Iterator to the start of our default license entries. + */ + DefaultLicensesIterator begin_default_licenses() const + { + return _default_licenses.begin(); + } + + /** + * Iterator to past the end of our default license entries. + */ + DefaultLicensesIterator end_default_licenses() const + { + return _default_licenses.end(); + } + + ///} + + ///\name Masks + ///{ + + /** + * Iterator over user package masks. + */ + typedef IndirectIterator<std::vector<PackageDepAtom::ConstPointer>::const_iterator, + const PackageDepAtom> UserMasksIterator; + + /** + * Iterator to the start of the user package masks. + */ + UserMasksIterator begin_user_masks(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r; + if (_user_masks.end() != ((r = _user_masks.find(d)))) + return r->second.begin(); + else + return _empty_masks.begin(); + } + + /** + * Iterator to past the end of the user package masks. + */ + UserMasksIterator end_user_masks(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r; + if (_user_masks.end() != ((r = _user_masks.find(d)))) + return r->second.end(); + else + return _empty_masks.end(); + } + + /** + * Iterator over the user package unmasks. + */ + typedef IndirectIterator<std::vector<PackageDepAtom::ConstPointer>::const_iterator, + const PackageDepAtom> UserUnmasksIterator; + + /** + * Iterator to the start of the user package unmasks. + */ + UserUnmasksIterator begin_user_unmasks(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r; + if (_user_unmasks.end() != ((r = _user_unmasks.find(d)))) + return r->second.begin(); + else + return _empty_masks.begin(); + } + + /** + * Iterator to past the end of the user package unmasks. + */ + UserUnmasksIterator end_user_unmasks(const QualifiedPackageName & d) const + { + std::map<QualifiedPackageName, std::vector<PackageDepAtom::ConstPointer> >::const_iterator r; + if (_user_unmasks.end() != ((r = _user_unmasks.find(d)))) + return r->second.end(); + else + return _empty_masks.end(); + } + + ///} + + ///\name Use + ///{ + + /** + * Iterator to the start of the use configuration. + */ + typedef std::vector<UseConfigEntry>::const_iterator UseConfigIterator; + + /** + * Iterator to the start of the use configuration for a particular + * package. + */ + UseConfigIterator begin_use_config(const QualifiedPackageName & q) const + { + std::map<QualifiedPackageName, std::vector<UseConfigEntry> >::const_iterator r; + if (_use.end() != ((r = _use.find(q)))) + return r->second.begin(); + else + return _empty_use.begin(); + } + + /** + * Iterator to past the end of the use configuration for a + * particular package. + */ + UseConfigIterator end_use_config(const QualifiedPackageName & q) const + { + std::map<QualifiedPackageName, std::vector<UseConfigEntry> >::const_iterator r; + if (_use.end() != ((r = _use.find(q)))) + return r->second.end(); + else + return _empty_use.end(); + } + + /** + * Iterator over the default use settings. + */ + typedef std::vector<std::pair<UseFlagName, UseFlagState> >::const_iterator DefaultUseIterator; + + /** + * Iterator to the start of the default use settings. + */ + DefaultUseIterator begin_default_use() const + { + return _default_use.begin(); + } + + /** + * Iterator to past the end of the default use settings. + */ + DefaultUseIterator end_default_use() const + { + return _default_use.end(); + } + ///} + + /** + * Our bashrc files. + */ + std::string bashrc_files() const; + + /** + * The paludis command. + */ + std::string paludis_command() const + { + return _paludis_command; + } + + /** + * Set the paludis command. + */ + void set_paludis_command(const std::string & s) + { + _paludis_command = s; + } + + /** + * The ROOT. + */ + std::string root() const + { + return _root; + } + + /** + * The config directory. + */ + std::string config_dir() const + { + return _config_dir; + } + }; +} |