Remove boost::program_options dependency #13482

pull ken2812221 wants to merge 2 commits into bitcoin:master from ken2812221:program_options changing 7 files +42 −123
  1. ken2812221 commented at 4:25 am on June 16, 2018: contributor
    Concept from #12744, but without parsing negated options.
  2. fanquake added the label Refactoring on Jun 16, 2018
  3. ken2812221 force-pushed on Jun 16, 2018
  4. in src/util.h:290 in 9b0d45aa74 outdated
    281@@ -282,6 +282,17 @@ class ArgsManager
    282      * Check whether we know of this arg
    283      */
    284     bool IsArgKnown(const std::string& key, std::string& error);
    285+
    286+private:
    287+    /**
    288+     * Trim string by the pattern
    289+     */
    290+    std::string trimString(std::string str, const std::string& pattern);
    


    qmma70 commented at 6:16 pm on June 16, 2018:
    Is there a reason for this method to start with a lower case letter while all other start with upper case letters?

    ken2812221 commented at 8:50 pm on June 16, 2018:
    No reason. So make it uppercase.
  5. in src/util.cpp:822 in 9b0d45aa74 outdated
    821-    {
    822-        std::string strKey = std::string("-") + it->string_key;
    823-        std::string strValue = it->value[0];
    824+    auto options = GetConfigOptions(stream);
    825+
    826+    for (auto it = options.begin(), end = options.end(); it != end; ++it) {
    


    qmma70 commented at 6:19 pm on June 16, 2018:
    Use cbegin() and cend() please.

    ken2812221 commented at 8:52 pm on June 16, 2018:
    I made it range-based
  6. in src/util.cpp:954 in 9b0d45aa74 outdated
    949+            if (*str.begin() == '[' && *str.rbegin() == ']')
    950+                prefix = str.substr(1, str.size() - 2) + '.';
    951+            else if ((pos = str.find('=')) != std::string::npos) {
    952+                std::string name = prefix + trimString(str.substr(0, pos), " \t\r\n");
    953+                std::string value = trimString(str.substr(pos + 1), " \t\r\n");
    954+                options.push_back(std::pair<std::string, std::string>(name, value));
    


    qmma70 commented at 6:21 pm on June 16, 2018:
    Minor: can use std::make_pair(name, value) for simplicity.

    ken2812221 commented at 8:54 pm on June 16, 2018:
    emplace_back is more simple.
  7. ken2812221 force-pushed on Jun 16, 2018
  8. ken2812221 force-pushed on Jun 16, 2018
  9. qmma70 commented at 9:07 pm on June 16, 2018: contributor

    I’m utAck on this. Nicely done.

    This could have also been implemented with regex, but the pattern is simple enough that the logic is easily understandable.

  10. Empact commented at 9:12 pm on June 17, 2018: member
    Concept ACK - maybe include the tests from #12744?
  11. ken2812221 commented at 1:19 am on June 18, 2018: contributor
    @Empact Those tests have been added by #12713
  12. ken2812221 commented at 6:05 pm on June 18, 2018: contributor
    Current on master, if there are some options in the config file without =, they would cause an exception. In this PR, I simply ignore them, or should I also throw an exception?
  13. DrahtBot commented at 10:40 pm on June 19, 2018: member
    • #13562 (travis: Switch back to trusty for now by MarcoFalke)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  14. fanquake added this to the "In progress" column in a project

  15. jezzalladmins changes_requested
  16. jezzalladmins commented at 8:04 am on June 22, 2018: none
    Run
  17. DrahtBot added the label Needs rebase on Jun 24, 2018
  18. DrahtBot commented at 2:18 pm on June 24, 2018: member
  19. MarcoFalke commented at 2:21 pm on June 24, 2018: member
    Update doc/build-unix.md as well?
  20. ken2812221 force-pushed on Jun 25, 2018
  21. ken2812221 force-pushed on Jun 25, 2018
  22. ken2812221 commented at 2:52 am on June 25, 2018: contributor
  23. DrahtBot removed the label Needs rebase on Jun 25, 2018
  24. in src/util.cpp:940 in 092864dfc7 outdated
    935+{
    936+    std::vector<std::pair<std::string, std::string>> options;
    937+    std::string str, prefix;
    938+    std::string::size_type pos;
    939+    while (std::getline(stream, str)) {
    940+        if ((pos = str.find('#')) != std::string::npos)
    


    sipa commented at 0:25 am on June 27, 2018:
    Coding style nit: use braces whenever indenting.

    ken2812221 commented at 2:07 am on June 29, 2018:
    Fixed
  25. in src/util.cpp:949 in 092864dfc7 outdated
    941+            str = str.substr(0, pos);
    942+        str = TrimString(str, " \t\r\n");
    943+        if (!str.empty()) {
    944+            if (*str.begin() == '[' && *str.rbegin() == ']')
    945+                prefix = str.substr(1, str.size() - 2) + '.';
    946+            else if ((pos = str.find('=')) != std::string::npos) {
    


    sipa commented at 0:25 am on June 27, 2018:
    Same here.

    ken2812221 commented at 2:07 am on June 29, 2018:
    Fixed
  26. in src/util.cpp:942 in 092864dfc7 outdated
    937+    std::string str, prefix;
    938+    std::string::size_type pos;
    939+    while (std::getline(stream, str)) {
    940+        if ((pos = str.find('#')) != std::string::npos)
    941+            str = str.substr(0, pos);
    942+        str = TrimString(str, " \t\r\n");
    


    sipa commented at 0:27 am on June 27, 2018:
    Maybe introduce a static constant for this set of trimmable characters?

    ken2812221 commented at 2:07 am on June 29, 2018:
    I’m not sure this is what you want.
  27. ken2812221 force-pushed on Jun 27, 2018
  28. ken2812221 force-pushed on Jun 27, 2018
  29. ken2812221 force-pushed on Jun 29, 2018
  30. ken2812221 force-pushed on Jun 29, 2018
  31. in src/util.cpp:925 in 5d7d1a2db8 outdated
    921@@ -927,6 +922,40 @@ std::string ArgsManager::GetChainName() const
    922     return CBaseChainParams::MAIN;
    923 }
    924 
    925+std::string ArgsManager::TrimString(const std::string& str, const std::string& pattern)
    


    sipa commented at 2:02 am on July 18, 2018:
    This can just be a static function; it doesn’t need to be a method of ArgsManager.
  32. ken2812221 force-pushed on Jul 18, 2018
  33. ken2812221 closed this on Jul 18, 2018

  34. Replace boost program_options 11588c639e
  35. Remove program options from build system f447a0a707
  36. sipa commented at 2:50 am on July 18, 2018: member
    Why close?
  37. ken2812221 commented at 2:51 am on July 18, 2018: contributor
    Sorry, misclicked
  38. ken2812221 reopened this on Jul 18, 2018

  39. ken2812221 force-pushed on Jul 18, 2018
  40. fanquake added this to the milestone 0.17.0 on Jul 18, 2018
  41. sipa commented at 9:50 pm on July 19, 2018: member
    utACK f447a0a7079619f0d650084df192781cca9fd826
  42. in build-aux/m4/ax_boost_program_options.m4:1 in f447a0a707
    -1@@ -1,108 +0,0 @@
    0-# ============================================================================
    


    laanwj commented at 2:30 pm on July 20, 2018:
    I like this file-bloodbath.
  43. laanwj commented at 2:40 pm on July 20, 2018: member
    +42 −123 even though this is removing an external dependency, if that isn’t a clear indication that this should be done I don’t know what is. utACK f447a0a7079619f0d650084df192781cca9fd826
  44. laanwj merged this on Jul 20, 2018
  45. laanwj closed this on Jul 20, 2018

  46. laanwj referenced this in commit 2dc5ab6378 on Jul 20, 2018
  47. ken2812221 deleted the branch on Jul 20, 2018
  48. fanquake moved this from the "In progress" to the "Done" column in a project

  49. laanwj referenced this in commit 90c0b6aca2 on Nov 12, 2018
  50. furszy referenced this in commit 4bf92204e4 on Apr 30, 2021
  51. UdjinM6 referenced this in commit 0c5896078f on Jun 29, 2021
  52. UdjinM6 referenced this in commit db8ed9f495 on Jun 29, 2021
  53. UdjinM6 referenced this in commit 63443e26fd on Jul 1, 2021
  54. UdjinM6 referenced this in commit bec6b5e19f on Jul 2, 2021
  55. UdjinM6 referenced this in commit a9fb8a57ab on Jul 2, 2021
  56. knst referenced this in commit e74373879b on Aug 10, 2021
  57. knst referenced this in commit a4062f57d9 on Aug 10, 2021
  58. knst referenced this in commit 705d36cd39 on Aug 16, 2021
  59. PastaPastaPasta referenced this in commit 42d1b0ba71 on Aug 23, 2021
  60. christiancfifi referenced this in commit b33ca8474a on Aug 27, 2021
  61. christiancfifi referenced this in commit 74858f06b4 on Aug 27, 2021
  62. christiancfifi referenced this in commit 33876d2450 on Aug 28, 2021
  63. christiancfifi referenced this in commit 1feb306462 on Aug 29, 2021
  64. christiancfifi referenced this in commit bfd9852f90 on Aug 29, 2021
  65. christiancfifi referenced this in commit b9d2e81286 on Aug 29, 2021
  66. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me