Skip to content

Commit

Permalink
rock: override built-in checks
Browse files Browse the repository at this point in the history
The ability to override built-in modules was introduced with [1].
After [1], checks is embedded to the core Tarantool. The ability to
override them with installed rock will make it possible to use old
Tarantool with new checks.

1. tarantool/tarantool#7774
2. tarantool/tarantool#7726
  • Loading branch information
DifferentialOrange committed Mar 17, 2023
1 parent 05b7db5 commit 66f0a77
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jobs:
with:
module-name: checks
version-pre-extraction-hook: |
local rock_utils = require('test.rock_utils')
rock_utils.remove_builtin('checks')
rock_utils.assert_nonbuiltin('checks')
require('test.rock_utils').assert_nonbuiltin('checks')
package:
# Skip pull request jobs when the source branch is in the same
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/push_rockspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ jobs:
with:
module-name: checks
version-pre-extraction-hook: |
local rock_utils = require('test.rock_utils')
rock_utils.remove_builtin('checks')
rock_utils.assert_nonbuiltin('checks')
require('test.rock_utils').assert_nonbuiltin('checks')
push-scm-rockspec:
runs-on: [ ubuntu-20.04 ]
Expand Down
3 changes: 3 additions & 0 deletions checks-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ build = {
modules = {
['checks'] = 'checks.lua',
['checks.version'] = 'checks/version.lua',

['override.checks'] = 'checks.lua',
['override.checks.version'] = 'checks/version.lua',
}
}

2 changes: 2 additions & 0 deletions debian/tarantool-checks.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
checks.lua usr/share/tarantool/
checks usr/share/tarantool/
checks.lua usr/share/tarantool/override
checks usr/share/tarantool/override
3 changes: 3 additions & 0 deletions rpm/tarantool-checks.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ Easy, terse, readable and fast function arguments type checking.
mkdir -p %{br_luapkgdir}
cp -av checks.lua %{br_luapkgdir}
cp -rv checks %{br_luapkgdir}
cp -av checks.lua %{br_luapkgdir}/override
cp -rv checks %{br_luapkgdir}/override

%files
%{luapkgdir}/checks.lua
%{luapkgdir}/checks
%{luapkgdir}/override
%doc README.md
%{!?_licensedir:%global license %doc}
%license LICENSE
Expand Down
6 changes: 2 additions & 4 deletions test/helper.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
-- Clean up built-in checks to run tests with repository module.
local rock_utils = require('test.rock_utils')
rock_utils.remove_builtin('checks')
rock_utils.assert_nonbuiltin('checks')
-- Override should be preferred over built-in.
require('test.rock_utils').assert_nonbuiltin('checks')

0 comments on commit 66f0a77

Please sign in to comment.