diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-10-27 17:32:11 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-11-02 14:04:09 +0300 |
commit | 0370038a2c2e5fc575a543e2fbcf85a7c254283d (patch) | |
tree | d9edd44b7744593d052632a7d5f026a643cf0f31 /tests/pkg-build.testscript | |
parent | ee7ec3887d5c15ae3ef719dd38237282fe8c11e8 (diff) |
Add support for preserving old package configuration on up/downgrade and reconfiguration
Diffstat (limited to 'tests/pkg-build.testscript')
-rw-r--r-- | tests/pkg-build.testscript | 430 |
1 files changed, 360 insertions, 70 deletions
diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index cc69b1a..8319001 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -75,6 +75,7 @@ # | # |-- t2 # | |-- libbar-1.0.0.tar.gz -> libfoo +# | |-- libfoo-0.1.0.tar.gz # | |-- libfoo-1.0.0.tar.gz # | `-- repositories.manifest # | @@ -223,6 +224,7 @@ # | | libbar {require {config.libbar.extras=true}} # | |-- fox-1.0.0.tar.gz -> libfoo {require {config.libfoo.extras=true}} # | |-- fux-0.1.0.tar.gz -> libfoo ? ($config.fux.extras=true) +# | |-- fux-0.1.1.tar.gz -> libfoo ? ($config.fux.extras=true) # | |-- fux-0.2.0.tar.gz -> libfoo {enable($config.fux.extras=true) require {config.libfoo.extras=true}} # | |-- fux-1.0.0.tar.gz -> libfoo # | |-- fix-0.1.0.tar.gz -> foo == 0.1.0 @@ -1889,7 +1891,7 @@ test.arguments += --sys-no-query updated libbar/1.2.0 EOE - $pkg_status libfoo >'libfoo available 1.0.0'; + $pkg_status libfoo >'libfoo available 1.0.0 0.1.0'; $pkg_status libbar >'!libbar configured 1.2.0'; $* libbar/1.0.0 libfoo 2>>~%EOE%; @@ -2684,7 +2686,7 @@ test.arguments += --sys-no-query configured libbar/1.2.0 EOE - $pkg_status libfoo >'libfoo available 1.0.0'; + $pkg_status libfoo >'libfoo available 1.0.0 0.1.0'; $pkg_disfigure libbar 2>'disfigured libbar/1.2.0'; $pkg_purge libbar 2>'purged libbar/1.2.0' @@ -6088,7 +6090,7 @@ test.arguments += --sys-no-query { +$clone_root_cfg && $rep_add $rep/t11a && $rep_fetch - test.arguments += --yes --plan 'build plan:' --verbose 5 --build-option --quiet + test.arguments += --yes --plan='build plan:' --verbose 5 --build-option --quiet # Note that on some platforms matching bpkg's stderr using a regular # expression which contains too may '%.*' lines ends up with the @@ -6362,12 +6364,216 @@ test.arguments += --sys-no-query $pkg_drop fex } - : reconfigure-existing-dependent + : reconf-existing-dept : { +$clone_cfg - : require-clause + : no-build-clause + : + { + +$clone_cfg + + : no-config + : + { + $clone_cfg; + + # Dependencies: + # + # fex: depends: fux(c) + # + # fux: depends: libfoo + # + $* fex/0.1.0 fux libfoo 2>!; + + $pkg_status -r >>EOO; + !libfoo configured 1.0.0 + !fux configured 1.0.0 + !libfoo configured 1.0.0 + !fex configured !0.1.0 available 1.0.0 + !fux configured 1.0.0 + !libfoo configured 1.0.0 + EOO + + cat cfg/fux-1.0.0/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + $* libfoo/0.1.0 2>!; + + $pkg_status -r >>EOO; + !libfoo configured !0.1.0 available 1.0.0 + !fux configured 1.0.0 + !libfoo configured !0.1.0 available 1.0.0 + !fex configured !0.1.0 available 1.0.0 + !fux configured 1.0.0 + !libfoo configured !0.1.0 available 1.0.0 + EOO + + cat cfg/fux-1.0.0/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + $pkg_drop fex fux libfoo + } + + : dept-upgrade + : + { + $clone_cfg; + + # Dependencies: + # + # fux: depends: libfoo ? + # + $* fux/0.1.0 +{ config.fux.extras=true } 2>!; + + $pkg_status -r >>EOO; + !fux configured !0.1.0 available 1.0.0 0.2.0 0.1.1 + libfoo configured 1.0.0 + EOO + + cat cfg/fux-0.1.0/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + $* fux/0.1.1 2>!; + + $pkg_status -r >>EOO; + !fux configured !0.1.1 available 1.0.0 0.2.0 + libfoo configured 1.0.0 + EOO + + cat cfg/fux-0.1.1/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + $pkg_drop fux + } + + : dept-depc + : + { + $clone_cfg; + + # Dependencies: + # + # fux: depends: libfoo + # + $* fux +{ config.fux.extras=true } ?libfoo +{ config.libfoo.extras=true } 2>!; + + $pkg_status -r >>EOO; + !fux configured 1.0.0 + libfoo configured 1.0.0 + EOO + + cat cfg/fux-1.0.0/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + cat cfg/libfoo-1.0.0/build2/config.build2 >>~%EOO%; + %.* + config.libfoo.extras = true + config.libfoo.network = false + %.* + EOO + + $* ?libfoo/0.1.0 2>!; + + $pkg_status -r >>EOO; + !fux configured 1.0.0 + libfoo configured !0.1.0 available 1.0.0 + EOO + + cat cfg/fux-1.0.0/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + cat cfg/libfoo-0.1.0/build/config.build >>~%EOO%; + %.* + config.libfoo.extras = true + EOO + + $pkg_drop fux + } + + : dept-depc-no-plan + : + : As above but the configuration is not printed (as a part of the + : plan) before the plan execution. + : + { + $clone_cfg; + + # Dependencies: + # + # fux: depends: libfoo + # + $* fux +{ config.fux.extras=true } ?libfoo +{ config.libfoo.extras=true } 2>!; + + $pkg_status -r >>EOO; + !fux configured 1.0.0 + libfoo configured 1.0.0 + EOO + + cat cfg/fux-1.0.0/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + cat cfg/libfoo-1.0.0/build2/config.build2 >>~%EOO%; + %.* + config.libfoo.extras = true + config.libfoo.network = false + EOO + + test.arguments = $regex.filter_out_match($test.arguments, '--plan=.*'); + + $* ?libfoo/0.1.0 2>!; + + $pkg_status -r >>EOO; + !fux configured 1.0.0 + libfoo configured !0.1.0 available 1.0.0 + EOO + + cat cfg/fux-1.0.0/build/config.build >>~%EOO%; + %.* + config.fux.extras = true + config.fux.network = false + %.* + EOO + + cat cfg/libfoo-0.1.0/build/config.build >>~%EOO%; + %.* + config.libfoo.extras = true + EOO + + $pkg_drop fux + } + } + + : enabled-clause : { $clone_cfg; @@ -6376,78 +6582,36 @@ test.arguments += --sys-no-query # # fex: depends: fux(c) # - # fux: depends: libfoo(c) ? + # fux: depends: libfoo ? # - $* fex/0.1.0 fux/0.2.0 2>!; + $* fex/0.1.0 fux/0.1.0 2>!; $pkg_status -r >>EOO; - !fux configured !0.2.0 available 1.0.0 + !fux configured !0.1.0 available 1.0.0 0.2.0 0.1.1 libfoo configured 1.0.0 !fex configured !0.1.0 available 1.0.0 - !fux configured !0.2.0 available 1.0.0 + !fux configured !0.1.0 available 1.0.0 0.2.0 0.1.1 libfoo configured 1.0.0 EOO - cat cfg/fux-0.2.0/build/config.build >>~%EOO%; + cat cfg/fux-0.1.0/build/config.build >>~%EOO%; %.* config.fux.extras = true config.fux.network = false %.* EOO - $* ?libfoo/0.1.0 2>&1 | $filter 2>>~%EOE%; - %.* - trace: pkg_build: refine package collection/plan execution from scratch - trace: execute_plan: simulate: yes - trace: evaluate_dependency: libfoo/1.0.0: update to libfoo/0.1.0 - trace: pkg_build: refine package collection/plan execution - trace: collect_build_prerequisites: pre-reeval fux/0.2.0 - trace: collect_build_prerequisites: pre-reevaluated fux/0.2.0: 1,1 - trace: collect_build_prerequisites: cfg-postpone dependency libfoo/0.1.0 of existing dependent fux/0.2.0 due to dependency libfoo/0.1.0 - trace: collect_build: add fux/0.2.0 - trace: postponed_configurations::add: create {fux^ | libfoo->{fux/1,1}} - trace: collect_build_postponed (0): begin - trace: collect_build_postponed (1): begin {fux^ | libfoo->{fux/1,1}} - trace: collect_build_prerequisites: pre-reeval fux/0.2.0 - trace: collect_build_prerequisites: pre-reevaluated fux/0.2.0: 1,1 - trace: collect_build_postponed (1): re-evaluate existing dependents for {fux^ | libfoo->{fux/1,1}} - trace: collect_build_prerequisites: reeval fux/0.2.0 - trace: collect_build: pick libfoo/0.1.0 over libfoo/1.0.0 - trace: postponed_configurations::add: add {fux^ 1,1: libfoo} to {fux^ | libfoo->{fux/1,1}} - trace: collect_build_prerequisites: re-evaluating dependent fux/0.2.0 results in {fux^ | libfoo->{fux/1,1}} - trace: collect_build_prerequisites: re-evaluated fux/0.2.0 - trace: collect_build_postponed (1): cfg-negotiate begin {fux^ | libfoo->{fux/1,1}} - trace: collect_build_postponed (1): recursively collect cfg-negotiated dependencies - trace: collect_build_prerequisites: begin libfoo/0.1.0 - trace: collect_build_prerequisites: end libfoo/0.1.0 - trace: collect_build_postponed (1): recursively collect cfg-negotiated dependents - trace: collect_build_postponed (1): select cfg-negotiated dependency alternative for dependent fux/0.2.0 - trace: collect_build_prerequisites: resume fux/0.2.0 - trace: collect_build_prerequisites: end fux/0.2.0 - trace: collect_build_postponed (1): cfg-negotiate end {fux^ | libfoo->{fux/1,1}}! - trace: collect_build_postponed (1): end {fux^ | libfoo->{fux/1,1}} - trace: collect_build_postponed (0): end - trace: execute_plan: simulate: yes - %.* - build plan: - downgrade libfoo/0.1.0 - config.libfoo.extras=true (set by fux) - reconfigure fux/0.2.0 (dependent of libfoo) - config.fux.extras=true (dependent configuration) - reconfigure fex (dependent of fux) - trace: execute_plan: simulate: no - %.* - EOE + $* ?libfoo/0.1.0 2>!; $pkg_status -r >>EOO; - !fux configured !0.2.0 available 1.0.0 + !fux configured !0.1.0 available 1.0.0 0.2.0 0.1.1 libfoo configured !0.1.0 available 1.0.0 !fex configured !0.1.0 available 1.0.0 - !fux configured !0.2.0 available 1.0.0 + !fux configured !0.1.0 available 1.0.0 0.2.0 0.1.1 libfoo configured !0.1.0 available 1.0.0 EOO - cat cfg/fux-0.2.0/build/config.build >>~%EOO%; + cat cfg/fux-0.1.0/build/config.build >>~%EOO%; %.* config.fux.extras = true config.fux.network = false @@ -6457,7 +6621,7 @@ test.arguments += --sys-no-query $pkg_drop fex fux } - : require-clause-user-config + : require-clause : { $clone_cfg; @@ -6468,7 +6632,7 @@ test.arguments += --sys-no-query # # fux: depends: libfoo(c) ? # - $* fex/0.1.0 fux/0.2.0 +{ config.fux.network=true } 2>!; + $* fex/0.1.0 fux/0.2.0 2>!; $pkg_status -r >>EOO; !fux configured !0.2.0 available 1.0.0 @@ -6481,7 +6645,14 @@ test.arguments += --sys-no-query cat cfg/fux-0.2.0/build/config.build >>~%EOO%; %.* config.fux.extras = true - config.fux.network = true + config.fux.network = false + %.* + EOO + + cat cfg/libfoo-1.0.0/build2/config.build2 >>~%EOO%; + %.* + config.libfoo.extras = true + config.libfoo.network = false %.* EOO @@ -6523,7 +6694,6 @@ test.arguments += --sys-no-query downgrade libfoo/0.1.0 config.libfoo.extras=true (set by fux) reconfigure fux/0.2.0 (dependent of libfoo) - config.fux.network=true (user configuration) config.fux.extras=true (dependent configuration) reconfigure fex (dependent of fux) trace: execute_plan: simulate: no @@ -6541,11 +6711,71 @@ test.arguments += --sys-no-query cat cfg/fux-0.2.0/build/config.build >>~%EOO%; %.* config.fux.extras = true - config.fux.network = true + config.fux.network = false %.* EOO - $pkg_drop fex fux + cat cfg/libfoo-0.1.0/build/config.build >>~%EOO%; + %.* + config.libfoo.extras = true + EOO + + $* ?fex ?fux libfoo/0.1.0 2>&1 | $filter 2>>~%EOE%; + %.* + trace: pkg_build: refine package collection/plan execution from scratch + trace: collect_build: add libfoo/0.1.0 + trace: collect_build_prerequisites: skip configured libfoo/0.1.0 + trace: execute_plan: simulate: yes + trace: evaluate_dependency: fux/0.2.0: update to fux/1.0.0 + trace: evaluate_dependency: fex/0.1.0: unused + trace: pkg_build: refine package collection/plan execution + trace: collect_build_prerequisites: pre-reeval fex/0.1.0 + trace: collect_build_prerequisites: pre-reevaluated fex/0.1.0: 1,1 + trace: collect_build_prerequisites: cfg-postpone dependency fux/1.0.0 of existing dependent fex/0.1.0 due to dependency fux/1.0.0 + trace: postponed_configurations::add: create {fex^ | fux->{fex/1,1}} + trace: collect_drop: fex/0.1.0 package version needs to be replaced with drop + trace: pkg_build: collection failed due to package version replacement, retry from scratch + trace: pkg_build: refine package collection/plan execution from scratch + trace: collect_build: add libfoo/0.1.0 + trace: collect_build_prerequisites: skip configured libfoo/0.1.0 + trace: collect_build_prerequisites: skip expected to be dropped existing dependent fex of dependency fux + trace: collect_build_prerequisites: begin fux/1.0.0 + trace: collect_build_prerequisites: no cfg-clause for dependency libfoo/0.1.0 of dependent fux/1.0.0 + trace: collect_build_prerequisites: end fux/1.0.0 + trace: collect_drop: overwrite fex + trace: execute_plan: simulate: yes + %.* + trace: evaluate_dependency: fux/1.0.0: unused + trace: pkg_build: refine package collection/plan execution from scratch + trace: collect_build: add libfoo/0.1.0 + trace: collect_build_prerequisites: skip configured libfoo/0.1.0 + trace: collect_drop: overwrite fex + trace: execute_plan: simulate: yes + %.* + trace: evaluate_dependency: fux/0.2.0: unused + trace: pkg_build: refine package collection/plan execution + trace: collect_drop: overwrite fex + trace: collect_drop: overwrite fux + trace: execute_plan: simulate: yes + %.* + build plan: + update libfoo/0.1.0 + drop fux/0.2.0 (unused) + drop fex/0.1.0 (unused) + trace: execute_plan: simulate: no + %.* + EOE + + $pkg_status -r >>EOO; + !libfoo configured !0.1.0 available 1.0.0 + EOO + + cat cfg/libfoo-0.1.0/build/config.build >>~%EOO%; + %.* + config.libfoo.extras = true + EOO + + $pkg_drop libfoo } } @@ -6807,7 +7037,7 @@ test.arguments += --sys-no-query # # foo/1.0.0: depends: libfoo(c) # - $* foo 2>>~%EOE%; + $* foo +{ config.foo.extras=true } 2>>~%EOE%; %.* trace: pkg_build: refine package collection/plan execution from scratch %.* @@ -6835,8 +7065,34 @@ test.arguments += --sys-no-query trace: collect_build_postponed (0): end trace: execute_plan: simulate: yes %.* + build plan: + new libfoo/1.0.0 (required by foo) + config.libfoo.extras=true (set by foo) + new foo/1.0.0 + config.foo.extras=true (user configuration) + config.foo.libfoo_extras=true (set by foo) + trace: execute_plan: simulate: no + %.* EOE + $pkg_status -r >>EOO; + !foo configured 1.0.0 + libfoo configured 1.0.0 + EOO + + cat cfg/foo-1.0.0/build/config.build >>~%EOO%; + %.* + config.foo.extras = true + config.foo.libfoo_extras = true + %.* + EOO + + cat cfg/libfoo-1.0.0/build2/config.build2 >>~%EOO%; + %.* + config.libfoo.extras = true + %.* + EOO + # Downgrade the dependency. # $* ?libfoo/0.1.0 2>>~%EOE%; @@ -6909,6 +7165,19 @@ test.arguments += --sys-no-query libfoo configured !0.1.0 available 1.0.0 EOO + cat cfg/foo-1.0.0/build/config.build >>~%EOO%; + %.* + config.foo.extras = true + config.foo.libfoo_extras = true + %.* + EOO + + cat cfg/libfoo-0.1.0/build/config.build >>~%EOO%; + %.* + config.libfoo.extras = true + %.* + EOO + # Reconfigure the dependency and hold. # $* libfoo/0.1.0 +{ config.libfoo.extras=true } 2>>~%EOE%; @@ -6974,6 +7243,19 @@ test.arguments += --sys-no-query !libfoo configured !0.1.0 available 1.0.0 EOO + cat cfg/foo-1.0.0/build/config.build >>~%EOO%; + %.* + config.foo.extras = true + config.foo.libfoo_extras = true + %.* + EOO + + cat cfg/libfoo-0.1.0/build/config.build >>~%EOO%; + %.* + config.libfoo.extras = true + %.* + EOO + # Upgrade the dependency and unhold existing dependent. # $* libfoo ?foo 2>>~%EOE%; @@ -7042,6 +7324,7 @@ test.arguments += --sys-no-query %.* build plan: upgrade libfoo/1.0.0 + config.libfoo.extras=true (user configuration) drop foo/1.0.0 (unused) %.* disfigured foo/1.0.0 @@ -7064,6 +7347,12 @@ test.arguments += --sys-no-query !libfoo configured 1.0.0 EOO + cat cfg/libfoo-1.0.0/build2/config.build2 >>~%EOO%; + %.* + config.libfoo.extras = true + %.* + EOO + $pkg_drop libfoo } @@ -7381,6 +7670,7 @@ test.arguments += --sys-no-query downgrade libfoo/0.1.0 config.libfoo.extras=true (set by foo) downgrade foo/0.1.0 (required by fix) + config.foo.extras=true (dependent configuration) downgrade fix/0.1.0 trace: execute_plan: simulate: no %.* @@ -27088,7 +27378,7 @@ else $pkg_status -or libbar >>EOO; !libbar configured 1.0.0 available 1.1.0 (1.0.0) - libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) + libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) 0.1.0 EOO $pkg_drop libbar @@ -27138,7 +27428,7 @@ else $pkg_status -or libbar >>EOO; !libbar configured 1.0.0 available 1.1.0 (1.0.0) - libfoo configured !1.0.0 available [1.2.0] [1.1.1] 1.1.0+1 [1.1.0] (1.0.0) + libfoo configured !1.0.0 available [1.2.0] [1.1.1] 1.1.0+1 [1.1.0] (1.0.0) 0.1.0 EOO $pkg_drop libbar @@ -27178,7 +27468,7 @@ else $pkg_status -or libbar >>EOO; !libbar configured 1.0.0 available 1.1.0 (1.0.0) - libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) + libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) 0.1.0 EOO $pkg_drop libbar @@ -27246,7 +27536,7 @@ else $pkg_status -or libbaz >>EOO; !libbaz configured 1.0.0 available (1.0.0) !libbar configured 1.0.0 available (1.0.0) - libfoo configured !1.1.0 available [1.2.0] [1.1.1] (1.1.0) [1.0.0] + libfoo configured !1.1.0 available [1.2.0] [1.1.1] (1.1.0) [1.0.0] [0.1.0] EOO cat <<"EOI" >=libbar/repositories.manifest; @@ -27282,7 +27572,7 @@ else $pkg_status -or libbaz >>EOO; !libbaz configured 1.0.0 available (1.0.0) !libbar configured 1.0.0 available (1.0.0) - libfoo configured !1.1.1 available [1.2.0] (1.1.1) [1.0.0] + libfoo configured !1.1.1 available [1.2.0] (1.1.1) [1.0.0] [0.1.0] EOO $pkg_drop libbaz libbar @@ -27344,7 +27634,7 @@ else $pkg_status -or libbar >>EOO; !libbar configured 1.0.0 available 1.1.0 (1.0.0) - libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) + libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) 0.1.0 EOO $pkg_drop libbar @@ -27384,7 +27674,7 @@ else $pkg_status -or libbar >>EOO; !libbar configured 1.0.0 available 1.1.0 (1.0.0) - libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) + libfoo configured !1.0.0 available 1.1.0+1 [1.1.0] (1.0.0) 0.1.0 EOO $pkg_drop libbar |