aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorLines
2022-11-08cave: Remove redundant StringSetArgOptions parameters (NFC)HEADmasterAvatar Marvin Schmidt -14/+7
2022-11-08action: Fix comment alignment (NFC)Avatar Marvin Schmidt -7/+7
2022-11-08util: indirect_iterator_TEST: Remove superfluous std::shared_ptr ctors (NFC)Avatar Marvin Schmidt -4/+4
2022-11-08util: fs_iterator: Remove superfluous std::shared_ptr ctor (NFC)Avatar Marvin Schmidt -1/+1
2022-11-08e: vdb_id: Remove superfluous std::shared_ptr ctor (NFC)Avatar Marvin Schmidt -1/+1
2022-11-08hooker: Remove superfluous std::shared_ptr ctor (NFC)Avatar Marvin Schmidt -3/+3
2022-11-08environments: Remove superfluous std::shared_ptr ctors (NFC)Avatar Marvin Schmidt -6/+12
2022-11-08fuzzy_finder_TEST: Deduplicate code (NFC)Avatar Marvin Schmidt -23/+17
2022-11-08args: Replace function pointer with std::functionAvatar Marvin Schmidt -10/+12
2022-11-08cave: Use IteratorRange<T>::empty() (NFC)Avatar Marvin Schmidt -28/+28
2022-11-08args: Use IteratorRange<T>::empty() (NFC)Avatar Marvin Schmidt -7/+7
2022-11-08args: Remove unnecessary if statement (NFC)Avatar Marvin Schmidt -11/+10
2022-11-08util: iterator_range: Add empty()Avatar Marvin Schmidt -0/+18
2022-11-08cave: Consistently use size() on lhs in comparisons (NFC)Avatar Marvin Schmidt -20/+20
2022-11-08util: iterator_funcs: Remove capped_distanceAvatar Marvin Schmidt -87/+0
2022-11-08cave: cmd_import: Use IteratorRange<T>::size() (NFC)Avatar Marvin Schmidt -6/+4
2022-11-08cave: Use IteratorRange<T>::size() instead of capped_distanceAvatar Marvin Schmidt -3/+3
There's not much benefit in using `capped_distance` if any. Replace it with IteratorRange<T>::size() to make the code simpler and more readable
2022-11-08cave: Use IteratorRange<T>::size() instead of std::distance() (NFC)Avatar Marvin Schmidt -28/+27
2022-11-08util: iterator_range: Add some testsAvatar Marvin Schmidt -0/+67
2022-11-08util: iterator_range: Fix size()Avatar Marvin Schmidt -1/+1
The size() method returned wrong results because it had begin and end iterators switched. It went unnoticed because we neither had any test nor user for it so far Fixes: 0161a0f68496 ("util: add IteratorRange utility")
2022-11-08util: iterator_range: Provide const_iterator definitionAvatar Marvin Schmidt -0/+1
Fixes the following build error with gtest 1.11.0: ``` FAILED: paludis/util/CMakeFiles/iterator_range_TEST.dir/iterator_range_TEST.cc.o /usr/bin/g++ -DDATADIR=\"/usr/share\" -DENABLE_PBINS -DENABLE_PYTHON_HOOKS -DENABLE_STRIPPER -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DLIBDIR=\"/usr/x86_64-pc-linux-gnu/lib\" -DLIBEXECDIR=\"/usr/x86_64-pc-linux-gnu/libexec\" -DPALUDIS_NO_EXPLICIT_FULLY_SPECIALISED=1 -DPALUDIS_VERSION_MAJOR=3 -DPALUDIS_VERSION_MINOR=0 -DSYSCONFDIR=\"/etc\" -I/builds/marv/paludis/build-obj -I/builds/marv/paludis -Werror -pipe -O0 -pedantic -g3 -Wall -Wextra -Wold-style-cast -Wredundant-decls -Wstrict-null-sentinel -Wmissing-noreturn -Woverloaded-virtual -Winit-self -Wunreachable-code -Wunused -Wshadow -Wwrite-strings -Wfloat-equal -Wno-ignored-qualifiers -Wno-non-virtual-dtor -fvisibility=hidden -fvisibility-inlines-hidden -Wno-return-type-c-linkage -g -fPIE -std=gnu++17 -MD -MT paludis/util/CMakeFiles/iterator_range_TEST.dir/iterator_range_TEST.cc.o -MF paludis/util/CMakeFiles/iterator_range_TEST.dir/iterator_range_TEST.cc.o.d -o paludis/util/CMakeFiles/iterator_range_TEST.dir/iterator_range_TEST.cc.o -c /builds/marv/paludis/paludis/util/iterator_range_TEST.cc In file included from /usr/include/gmock/gmock-spec-builders.h:75, from /usr/include/gmock/gmock-function-mocker.h:42, from /usr/include/gmock/gmock.h:61, from /builds/marv/paludis/paludis/util/iterator_range_TEST.cc:24: /usr/include/gmock/gmock-matchers.h: In instantiation of 'bool testing::internal::ElementsAreMatcherImpl<Container>::MatchAndExplain(Container, testing::MatchResultListener*) const [with Container = const paludis::IteratorRange<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > > >&]': /usr/include/gmock/gmock-matchers.h:3228:8: required from here /usr/include/gmock/gmock-matchers.h:3238:43: error: no type named 'const_iterator' in 'testing::internal::ElementsAreMatcherImpl<const paludis::IteratorRange<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > > >&>::StlContainer' {aka 'class paludis::IteratorRange<__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > > >'} 3238 | typename StlContainer::const_iterator it = stl_container.begin(); | ^~ ``` This surfaced in the Gentoo build in our CI pipeline. gtest >=1.12.0 uses `auto` instead of `typename Container::const_iterator` which is why the error didn't come up on Exherbo where gtest is already at 1.12.0
2022-11-08util: iterator_range: Provide value_type definitionAvatar Marvin Schmidt -0/+2
This allows checking IteratorRange<T> types using gmock like: ``` EXPECT_THAT(range, ElementsAre("one", "two", "three")); ``` which would otherwise fail with the following error: ``` In file included from /home/marv/devel/paludis-worktrees/master/paludis/args/args_TEST.cc:25: In file included from /usr/x86_64-pc-linux-gnu/include/gmock/gmock.h:58: In file included from /usr/x86_64-pc-linux-gnu/include/gmock/gmock-function-mocker.h:43: In file included from /usr/x86_64-pc-linux-gnu/include/gmock/gmock-spec-builders.h:77: /usr/x86_64-pc-linux-gnu/include/gmock/gmock-matchers.h:3737:28: error: no type named 'value_type' in 'paludis::IteratorRange<paludis::WrappedForwardIterator<args::StringSetArg::ConstIteratorTag, const std::string>>' typedef typename View::value_type Element; ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/x86_64-pc-linux-gnu/include/gmock/gmock-matchers.h:370:12: note: in instantiation of function template specialization 'testing::internal::ElementsAreMatcher<std::tuple<const char *, const char *, const char *>>::operator Matcher<const paludis::IteratorRange<paludis::WrappedForwardIterator<args::StringSetArg::ConstIteratorTag, const std::string>> &>' requested here return polymorphic_matcher_or_value; ^ /usr/x86_64-pc-linux-gnu/include/gmock/gmock-matchers.h:352:12: note: in instantiation of function template specialization 'testing::internal::MatcherCastImpl<const paludis::IteratorRange<paludis::WrappedForwardIterator<args::StringSetArg::ConstIteratorTag, const std::string>> &, testing::internal::ElementsAreMatcher<std::tuple<const char *, const char *, const char *>>>::CastImpl<true>' requested here return CastImpl(polymorphic_matcher_or_value, ^ /usr/x86_64-pc-linux-gnu/include/gmock/gmock-matchers.h:512:43: note: in instantiation of member function 'testing::internal::MatcherCastImpl<const paludis::IteratorRange<paludis::WrappedForwardIterator<args::StringSetArg::ConstIteratorTag, const std::string>> &, testing::internal::ElementsAreMatcher<std::tuple<const char *, const char *, const char *>>>::Cast' requested here return internal::MatcherCastImpl<T, M>::Cast(matcher); ^ /usr/x86_64-pc-linux-gnu/include/gmock/gmock-matchers.h:519:10: note: in instantiation of function template specialization 'testing::MatcherCast<const paludis::IteratorRange<paludis::WrappedForwardIterator<args::StringSetArg::ConstIteratorTag, const std::string>> &, testing::internal::ElementsAreMatcher<std::tuple<const char *, const char *, const char *>>>' requested here return MatcherCast<T>(polymorphic_matcher_or_value); ^ /usr/x86_64-pc-linux-gnu/include/gmock/gmock-matchers.h:1587:39: note: in instantiation of function template specialization 'testing::SafeMatcherCast<const paludis::IteratorRange<paludis::WrappedForwardIterator<args::StringSetArg::ConstIteratorTag, const std::string>> &, testing::internal::ElementsAreMatcher<std::tuple<const char *, const char *, const char *>>>' requested here const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_); ^ /home/marv/devel/paludis-worktrees/master/paludis/args/args_TEST.cc:191:5: note: in instantiation of function template specialization 'testing::internal::PredicateFormatterFromMatcher<testing::internal::ElementsAreMatcher<std::tuple<const char *, const char *, const char *>>>::operator()<paludis::IteratorRange<paludis::WrappedForwardIterator<args::StringSetArg::ConstIteratorTag, const std::string>>>' requested here EXPECT_THAT(c1.arg_stringset.args(), ElementsAre("one", "two", "three")); ^ ```
2022-11-08cave: cmd_graph_jobs: Assure graphviz file is written before running graph ↵Avatar Marvin Schmidt -2/+6
program SafeOFStream uses a buffer, so we can't really be sure the contents are written to file completely before the stream object is destroyed. Assure this by limiting its scope
2022-11-08cave: cmd_graph_jobs: Simplify control flow (NFC)Avatar Marvin Schmidt -9/+20
There are two different cases: non-empty basename: - write graphviz to ${basename}.graphviz - create ${basename}.${format} if `--graph-jobs-format` was given empty basename: - just print graphviz to stdout Instead of checking whether we are supposed to write/have written the graphviz to a file in three places handle the two cases separately to make it more readable
2022-11-08cave: cmd_graph_jobs: Fix graphviz outputAvatar Marvin Schmidt -3/+3
- Add a comma and whitespace after install job labels - Remove redundant whitespace in job dependency attributes Before: job543 [ label="paludis:0::arbor -> pbins-amd64"shape=octagon, fillcolor=aquamarine3, style=filled ] job543 -> job542 [ color=crimson ] job543 -> job527 [ color=indianred style=dotted ] job543 -> job529 [ color=indianred style=dotted ] After: job543 [ label="paludis:0::arbor -> pbins-amd64", shape=octagon, fillcolor=aquamarine3, style=filled ] job543 -> job542 [ color=crimson ] job543 -> job527 [ color=indianred style=dotted ] job543 -> job529 [ color=indianred style=dotted ]
2022-11-08cave: cmd_graph_jobs: Remove else after return (NFC)Avatar Marvin Schmidt -9/+8
2022-11-08clang-tidy: Enable modernize-loop-convert checkAvatar Marvin Schmidt -25/+22
2022-11-08serialise: Use range-based for loop (NFC)Avatar Marvin Schmidt -3/+2
2022-11-08syncer: Use range-based for loop (NFC)Avatar Marvin Schmidt -3/+5
Remove the `! ok` from the loop condition statement and instead break out of the loop if `ok` is `true` This allows converting to a range-based loop
2022-11-08Use range-based for loops to iterate EAPIPhases (NFC)Avatar Marvin Schmidt -115/+102
2022-11-08e: Rename EAPIPhases::{begin,end}_phases to begin/end (NFC)Avatar Marvin Schmidt -32/+32
The class already includes the 'phases' part in its name so it's redundant and we can just use `begin`/`end`. This also allows the use of range-based for loops
2022-11-08util: options: Use range-based for loop (NFC)Avatar Marvin Schmidt -3/+2
2022-11-08paludis: Give loop variables better names (NFC)Avatar Marvin Schmidt -170/+170
2022-11-08generator: Remove unnecessary loop over categoriesAvatar Marvin Schmidt -5/+3
2022-11-08hooker: Give variable a better name (NFC)Avatar Marvin Schmidt -5/+5
`name` is rather ambigious in this context since we're dealing with phase names and the filename of the hook
2022-11-08environments: Give loop variables better names (NFC)Avatar Marvin Schmidt -43/+41
2022-11-08repositories: Give loop variables better names (NFC)Avatar Marvin Schmidt -351/+330
2022-11-08repositories: Convert more loops (NFC)Avatar Marvin Schmidt -15/+14
2022-11-08e_repository: Rename variable and simplify code a bit (NFC)Avatar Marvin Schmidt -6/+2
2022-11-08resolver: Convert more loops (NFC)Avatar Marvin Schmidt -8/+6
2022-11-08resolver: Give loop variables better names (NFC)Avatar Marvin Schmidt -138/+141
2022-11-08resolver: Give variable a better name (NFC)Avatar Marvin Schmidt -4/+4
2022-11-08python: Give loop variables better names (NFC)Avatar Marvin Schmidt -4/+4
2022-11-08ruby: Convert more loops (NFC)Avatar Marvin Schmidt -17/+14
2022-11-08ruby: Rename argument to prepare for loop conversion (NFC)Avatar Marvin Schmidt -2/+2
2022-11-08ruby: Give loop variables better names (NFC)Avatar Marvin Schmidt -36/+36
2022-11-08cave: Give loop variables better names (NFC)Avatar Marvin Schmidt -314/+313
2022-11-08examples: Give loop variables better names (NFC)Avatar Marvin Schmidt -75/+74
2022-11-08Add MetadataKeyHolder::metadataAvatar Marvin Schmidt -50/+42
2022-11-08Add PackageID::masks and PackageID::overridden_masksAvatar Marvin Schmidt -55/+54