Page MenuHomePhabricator

Deduplicate settings merge code
ClosedPublic

Authored by deadalnix on Apr 30 2020, 11:50.

Details

Summary

Get rid of settings merging code in util/system.cpp repeated 5 places,
inconsistently:

  • ArgsManagerHelper::GetArg
  • ArgsManagerHelper::GetNetBoolArg
  • ArgsManager::GetArgs
  • ArgsManager::IsArgNegated
  • ArgsManager::GetUnsuitableSectionOnlyArgs

Having settings merging code separated from parsing simplifies parsing somewhat
(for example negated values can simply be represented as false values instead
of partially cleared or emply placeholder lists).

Having settings merge happen one place instead of 5 makes it easier to add new
settings sources and harder to introduce new inconsistencies in the way
settings are merged.

This commit does not change behavior in any way.

This is a partial backport of Core PR15934 : https://github.com/bitcoin/bitcoin/pull/15934/commits/7f40528cd50fc43ac0bd3e785de24d661adddb7a

This PR had to be modified due to ClearForcedArg and ForceSetMultiArg not being supported by Core.

Depends on D5905

Test Plan
make check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
pr15934-5
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 10503
Build 18824: Default Diff Build & Tests
Build 18823: arc lint + arc unit

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

Snippet of first build failure:

[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  48% (21/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  51% (22/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  53% (23/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  55% (24/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  58% (25/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  60% (26/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  62% (27/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  65% (28/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  67% (29/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  69% (30/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  72% (31/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  74% (32/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  76% (33/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  79% (34/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  81% (35/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  83% (36/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  86% (37/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  88% (38/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  90% (39/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  93% (40/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  95% (41/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects:  97% (42/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects: 100% (43/43)        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Compressing objects: 100% (43/43), done.        
[11:50:53]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] remote: Total 43 (delta 39), reused 0 (delta 0), pack-reused 0        
[11:50:54]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285] From ssh://reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging
[11:50:54]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285]  * [new tag]             phabricator/diff/19285 -> phabricator/diff/19285
[11:50:54]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285]  * [new tag]             phabricator/base/19281 -> phabricator/base/19281
[11:50:54]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19285:refs/tags/phabricator/diff/19285]  * [new tag]             phabricator/base/19285 -> phabricator/base/19285
[11:50:54] :			 [Update git mirror (/home/teamcity/buildAgent/system/git/git-48AA3180.git)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 09c4280a492a89c8e818342cb24b923ede13718f --
[11:50:54] :			 [Update git mirror (/home/teamcity/buildAgent/system/git/git-48AA3180.git)] /usr/bin/git pack-refs --all
[11:50:54] :		 [VCS Root: Bitcoin ABC Staging] Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] The .git directory is missing in '/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc'. Running 'git init'...
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git init
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config lfs.storage /home/teamcity/buildAgent/system/git/git-48AA3180.git/lfs
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config core.sparseCheckout true
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config http.sslCAInfo
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref refs/tags/phabricator/diff/19285
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 09c4280a492a89c8e818342cb24b923ede13718f --
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git -c credential.helper= checkout -q -f phabricator/diff/19285
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref refs/tags/phabricator/diff/19285
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] Cleaning Bitcoin ABC Staging in /home/teamcity/buildAgent/work/jailed-build/bitcoin-abc the file set ALL_UNTRACKED
[11:50:54] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git clean -f -d -x
[11:50:54] : Build preparation done
[11:50:54]E: Step 1/2: Command Line (15m:21s)
[11:50:54] :	 [Step 1/2] Ant JUnit report watcher
[11:50:54] :		 [Ant JUnit report watcher] Watching paths:
[11:50:54] :		 [Ant JUnit report watcher] +:results/test_bitcoin.xml
[11:50:54] :		 [Ant JUnit report watcher] +:results/**/junit_results*.xml
[11:50:54] :	 [Step 1/2] Starting: /home/teamcity/buildAgent/temp/agentTmp/custom_script9179497012881008370
[11:50:54] :	 [Step 1/2] in directory: /home/teamcity/buildAgent/work/jailed-build
[11:50:54] :	 [Step 1/2] ~/buildAgent/work/jailed-build/bitcoin-abc ~/buildAgent/work/jailed-build
[11:50:54] :	 [Step 1/2] ~/buildAgent/work/jailed-build
[11:50:54] :	 [Step 1/2] Building base image for: 09c4280a4...
[11:50:54] :	 [Step 1/2] ~/buildAgent/work/jailed-build/bitcoin-abc ~/buildAgent/work/jailed-build
[11:50:54] :	 [Step 1/2] ~/buildAgent/work/jailed-build
[11:50:54] :	 [Step 1/2] Tag name: abc-base-image-09c4280a4
[12:06:15]W:	 [Step 1/2] Process exited with code 1
[12:06:16]E:	 [Step 1/2] Process exited with code 1 (Step: Command Line)

Snippet of first build failure:

[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Counting objects:  90% (27/30)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Counting objects:  93% (28/30)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Counting objects:  96% (29/30)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Counting objects: 100% (30/30)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Counting objects: 100% (30/30), done.        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:   5% (1/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  11% (2/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  16% (3/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  22% (4/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  27% (5/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  33% (6/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  38% (7/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  44% (8/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  50% (9/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  55% (10/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  61% (11/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  66% (12/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  72% (13/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  77% (14/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  83% (15/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  88% (16/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects:  94% (17/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects: 100% (18/18)        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Compressing objects: 100% (18/18), done.        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] remote: Total 18 (delta 16), reused 0 (delta 0), pack-reused 0        
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288] From ssh://reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288]  * [new tag]             phabricator/diff/19288 -> phabricator/diff/19288
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288]  * [new tag]             phabricator/base/19287 -> phabricator/base/19287
[12:26:40]i:				 [/usr/bin/git -c credential.helper= fetch --progress origin +refs/tags/phabricator/diff/19288:refs/tags/phabricator/diff/19288]  * [new tag]             phabricator/base/19288 -> phabricator/base/19288
[12:26:40] :			 [Update git mirror (/home/teamcity/buildAgent/system/git/git-48AA3180.git)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 642f223551b512bb22c0c9b71ae4a91c194ad55e --
[12:26:40] :			 [Update git mirror (/home/teamcity/buildAgent/system/git/git-48AA3180.git)] /usr/bin/git pack-refs --all
[12:26:40] :		 [VCS Root: Bitcoin ABC Staging] Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] The .git directory is missing in '/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc'. Running 'git init'...
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git init
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config lfs.storage /home/teamcity/buildAgent/system/git/git-48AA3180.git/lfs
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config core.sparseCheckout true
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git config http.sslCAInfo
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref refs/tags/phabricator/diff/19288
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 642f223551b512bb22c0c9b71ae4a91c194ad55e --
[12:26:40] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git -c credential.helper= checkout -q -f phabricator/diff/19288
[12:26:41] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git show-ref refs/tags/phabricator/diff/19288
[12:26:41] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] Cleaning Bitcoin ABC Staging in /home/teamcity/buildAgent/work/jailed-build/bitcoin-abc the file set ALL_UNTRACKED
[12:26:41] :			 [Update checkout directory (/home/teamcity/buildAgent/work/jailed-build/bitcoin-abc)] /usr/bin/git clean -f -d -x
[12:26:41] : Build preparation done
[12:26:41]E: Step 1/2: Command Line (10m:16s)
[12:26:41] :	 [Step 1/2] Ant JUnit report watcher
[12:26:41] :		 [Ant JUnit report watcher] Watching paths:
[12:26:41] :		 [Ant JUnit report watcher] +:results/test_bitcoin.xml
[12:26:41] :		 [Ant JUnit report watcher] +:results/**/junit_results*.xml
[12:26:41] :	 [Step 1/2] Starting: /home/teamcity/buildAgent/temp/agentTmp/custom_script821022660266140053
[12:26:41] :	 [Step 1/2] in directory: /home/teamcity/buildAgent/work/jailed-build
[12:26:41] :	 [Step 1/2] ~/buildAgent/work/jailed-build/bitcoin-abc ~/buildAgent/work/jailed-build
[12:26:41] :	 [Step 1/2] ~/buildAgent/work/jailed-build
[12:26:41] :	 [Step 1/2] Building base image for: 642f22355...
[12:26:41] :	 [Step 1/2] ~/buildAgent/work/jailed-build/bitcoin-abc ~/buildAgent/work/jailed-build
[12:26:41] :	 [Step 1/2] ~/buildAgent/work/jailed-build
[12:26:41] :	 [Step 1/2] Tag name: abc-base-image-642f22355
[12:36:56]W:	 [Step 1/2] Process exited with code 1
[12:36:56]E:	 [Step 1/2] Process exited with code 1 (Step: Command Line)
This revision is now accepted and ready to land.Apr 30 2020, 15:56
This revision was landed with ongoing or failed builds.Apr 30 2020, 16:00
This revision was automatically updated to reflect the committed changes.