baltix 0.1.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -2
- data/README.md +136 -10
- data/Rakefile +8 -3
- data/baltix.gemspec +47 -29
- data/bin/console +4 -3
- data/data/alt-licenses/README.md +26 -0
- data/data/alt-licenses/licenses.json +2991 -0
- data/data/alt-rpm/README.md +21 -0
- data/data/alt-rpm/architectures.json +613 -0
- data/data/spdx/README.md +22 -0
- data/data/spdx/licenses.json +9287 -0
- data/docs/action-flow.md +42 -0
- data/docs/actor-integration.md +71 -0
- data/docs/alt-architectures.md +27 -0
- data/docs/cleanup-actors.md +14 -0
- data/docs/dependency-actions.md +22 -0
- data/docs/installation-actors.md +35 -0
- data/docs/pkglist.md +56 -0
- data/docs/plans/revision-003.md +328 -0
- data/docs/plans/revision-004.md +416 -0
- data/docs/plans/revision-005.md +431 -0
- data/docs/plans/revision-006.md +439 -0
- data/docs/plans/revision-007.md +441 -0
- data/docs/plans/revision-008.md +445 -0
- data/docs/plans/revision-009.md +450 -0
- data/docs/plans/revision-010.md +486 -0
- data/docs/plans/revision-011.md +500 -0
- data/docs/plans/revision-012.md +501 -0
- data/docs/plans/revision-013.md +501 -0
- data/docs/plans/revision-014.md +501 -0
- data/docs/plans/revision-015.md +502 -0
- data/docs/plans/revision-016.md +503 -0
- data/docs/plans/revision-017.md +504 -0
- data/docs/plans/revision-018.md +505 -0
- data/docs/plans/revision-019.md +510 -0
- data/docs/plans/revision-020.md +524 -0
- data/docs/plans/revision-021.md +542 -0
- data/docs/plans/revision-022.md +542 -0
- data/docs/plans/revision-023.md +545 -0
- data/docs/plans/revision-024.md +567 -0
- data/docs/plans/revision-025.md +583 -0
- data/docs/plans/revision-026.md +241 -0
- data/docs/plans/revision-027.md +305 -0
- data/docs/plans/revision-028.md +298 -0
- data/docs/plans/revision-029.md +288 -0
- data/docs/rpm-action-macros.md +52 -0
- data/docs/rpm-parts.md +53 -0
- data/docs/ruby-dependencies.md +217 -0
- data/docs/ruby-policy-2.1.md +28 -0
- data/docs/ruby-versioning.md +61 -0
- data/docs/space-format.md +58 -0
- data/exe/baltix +1 -0
- data/lib/baltix/action_flow/files.rb +49 -0
- data/lib/baltix/action_flow/inputs.rb +60 -0
- data/lib/baltix/action_flow/journal.rb +60 -0
- data/lib/baltix/action_flow/options.rb +60 -0
- data/lib/baltix/action_flow.rb +65 -0
- data/lib/baltix/actor/build/collect.rb +72 -0
- data/lib/baltix/actor/build/compile.rb +25 -0
- data/lib/baltix/actor/build/extconf.rb +14 -0
- data/lib/baltix/actor/build/make.rb +18 -0
- data/lib/baltix/actor/build/postprocess.rb +14 -0
- data/lib/baltix/actor/build/rake.rb +18 -0
- data/lib/baltix/actor/build/ronn.rb +55 -0
- data/lib/baltix/actor/build.rb +87 -0
- data/lib/baltix/actor/clean/remove.rb +45 -0
- data/lib/baltix/actor/clean.rb +37 -0
- data/lib/baltix/actor/config.rb +12 -0
- data/lib/baltix/actor/copy.rb +22 -7
- data/lib/baltix/actor/distclean.rb +20 -0
- data/lib/baltix/actor/doc/collect.rb +39 -0
- data/lib/baltix/actor/doc/generate.rb +47 -0
- data/lib/baltix/actor/doc/inputs.rb +25 -0
- data/lib/baltix/actor/doc.rb +70 -0
- data/lib/baltix/actor/gen.rb +19 -0
- data/lib/baltix/actor/install/data.rb +18 -0
- data/lib/baltix/actor/install/documentation.rb +48 -0
- data/lib/baltix/actor/install/executable.rb +27 -0
- data/lib/baltix/actor/install/extension.rb +44 -0
- data/lib/baltix/actor/install/headers.rb +10 -0
- data/lib/baltix/actor/install/library.rb +13 -0
- data/lib/baltix/actor/install/metadata.rb +21 -0
- data/lib/baltix/actor/install/paths.rb +73 -0
- data/lib/baltix/actor/install/plugin.rb +25 -0
- data/lib/baltix/actor/install/record.rb +48 -0
- data/lib/baltix/actor/install/shebang.rb +29 -0
- data/lib/baltix/actor/install/transfer.rb +64 -0
- data/lib/baltix/actor/install/trees.rb +34 -0
- data/lib/baltix/actor/install.rb +71 -0
- data/lib/baltix/actor/link.rb +15 -6
- data/lib/baltix/actor/make.rb +14 -0
- data/lib/baltix/actor/predeps/write.rb +51 -0
- data/lib/baltix/actor/predeps.rb +41 -0
- data/lib/baltix/actor/provides.rb +12 -0
- data/lib/baltix/actor/requires.rb +12 -0
- data/lib/baltix/actor/show.rb +26 -0
- data/lib/baltix/actor/spec.rb +6 -3
- data/lib/baltix/actor/test/record.rb +8 -0
- data/lib/baltix/actor/test/run.rb +30 -0
- data/lib/baltix/actor/test/select.rb +16 -0
- data/lib/baltix/actor/test.rb +41 -0
- data/lib/baltix/actor/touch.rb +14 -5
- data/lib/baltix/actor.rb +43 -26
- data/lib/baltix/cli/dependency_options.rb +63 -0
- data/lib/baltix/cli/options/action.rb +32 -0
- data/lib/baltix/cli/options.rb +280 -0
- data/lib/baltix/cli/output_options.rb +56 -0
- data/lib/baltix/cli/rake_tasks.rb +59 -0
- data/lib/baltix/cli/source_options.rb +52 -0
- data/lib/baltix/cli.rb +130 -116
- data/lib/baltix/concerns/command.rb +52 -0
- data/lib/baltix/concerns/configuration.rb +39 -0
- data/lib/baltix/concerns/dependency_output.rb +21 -0
- data/lib/baltix/concerns/extension_metadata.rb +44 -0
- data/lib/baltix/concerns/file_destination.rb +14 -0
- data/lib/baltix/concerns/inspection.rb +27 -0
- data/lib/baltix/concerns/parts.rb +16 -0
- data/lib/baltix/concerns/target_paths.rb +57 -0
- data/lib/baltix/concerns.rb +11 -0
- data/lib/baltix/core_extensions/gem_dependency.rb +24 -0
- data/lib/baltix/core_extensions/gem_requirement.rb +45 -0
- data/lib/baltix/core_extensions/open_struct_merge.rb +62 -0
- data/lib/baltix/deps/executables.rb +30 -0
- data/lib/baltix/deps/packages.rb +32 -0
- data/lib/baltix/deps.rb +103 -194
- data/lib/baltix/dsl/dependency_groups.rb +77 -0
- data/lib/baltix/dsl/dependency_sources.rb +100 -0
- data/lib/baltix/dsl/filtering.rb +26 -0
- data/lib/baltix/dsl/loading.rb +72 -0
- data/lib/baltix/dsl/merging.rb +74 -0
- data/lib/baltix/dsl/rendering.rb +54 -0
- data/lib/baltix/dsl/requirements.rb +77 -0
- data/lib/baltix/dsl/temporary_files.rb +36 -0
- data/lib/baltix/dsl.rb +66 -273
- data/lib/baltix/executable_dependencies/features.rb +53 -0
- data/lib/baltix/executable_dependencies/library.rb +21 -0
- data/lib/baltix/executable_dependencies/library_features.rb +34 -0
- data/lib/baltix/executable_dependencies/syntax.rb +102 -0
- data/lib/baltix/executable_dependencies.rb +102 -0
- data/lib/baltix/extensions/bones.rb +173 -0
- data/lib/baltix/extensions/echoe.rb +143 -0
- data/lib/baltix/extensions/hoe/metadata.rb +89 -0
- data/lib/baltix/extensions/hoe/options.rb +84 -0
- data/lib/baltix/extensions/hoe/readme.rb +29 -0
- data/lib/baltix/extensions/hoe.rb +146 -0
- data/lib/baltix/extensions/jeweler.rb +95 -0
- data/lib/baltix/extensions/levitate.rb +74 -0
- data/lib/baltix/extensions/olddoc.rb +42 -0
- data/lib/baltix/extensions.rb +340 -419
- data/lib/baltix/i18n.rb +22 -19
- data/lib/baltix/license/catalog/capture.rb +58 -0
- data/lib/baltix/license/catalog.rb +75 -0
- data/lib/baltix/license.rb +76 -0
- data/lib/baltix/loader/capture.rb +91 -0
- data/lib/baltix/loader/cmake.rb +6 -3
- data/lib/baltix/loader/evaluation.rb +49 -0
- data/lib/baltix/loader/extconf.rb +27 -0
- data/lib/baltix/loader/feature_loading.rb +54 -0
- data/lib/baltix/loader/git-version-gen.rb +36 -21
- data/lib/baltix/loader/mast/properties.rb +58 -0
- data/lib/baltix/loader/mast.rb +97 -109
- data/lib/baltix/loader/object_capture.rb +27 -0
- data/lib/baltix/loader/olddoc.gemspec.erb +31 -0
- data/lib/baltix/loader/pom.rb +36 -16
- data/lib/baltix/loader/rookbook.rb +19 -14
- data/lib/baltix/loader/yaml.rb +9 -5
- data/lib/baltix/loader.rb +85 -132
- data/lib/baltix/log.rb +26 -27
- data/lib/baltix/rake/metadata_adapter.rb +30 -0
- data/lib/baltix/rake/task_context.rb +59 -0
- data/lib/baltix/rake/task_libraries.rb +73 -0
- data/lib/baltix/rake.rb +62 -12
- data/lib/baltix/source/base/dependencies.rb +81 -0
- data/lib/baltix/source/base/file_queries.rb +67 -0
- data/lib/baltix/source/base/file_tree.rb +70 -0
- data/lib/baltix/source/base/metadata.rb +140 -0
- data/lib/baltix/source/base/options.rb +71 -0
- data/lib/baltix/source/base/roots.rb +53 -0
- data/lib/baltix/source/base.rb +95 -377
- data/lib/baltix/source/fake.rb +89 -5
- data/lib/baltix/source/gem/delegation.rb +32 -0
- data/lib/baltix/source/gem/dependencies.rb +69 -0
- data/lib/baltix/source/gem/discovery.rb +72 -0
- data/lib/baltix/source/gem/file_trees.rb +114 -0
- data/lib/baltix/source/gem/forwarding.rb +12 -0
- data/lib/baltix/source/gem/metadata.rb +104 -0
- data/lib/baltix/source/gem/specification.rb +65 -0
- data/lib/baltix/source/gem.rb +65 -312
- data/lib/baltix/source/gemfile.rb +55 -5
- data/lib/baltix/source/rakefile.rb +12 -5
- data/lib/baltix/source.rb +36 -24
- data/lib/baltix/space/configuration.rb +54 -0
- data/lib/baltix/space/data/collections.rb +33 -0
- data/lib/baltix/space/data/gem_metadata.rb +79 -0
- data/lib/baltix/space/data/models.rb +20 -0
- data/lib/baltix/space/data/values.rb +72 -0
- data/lib/baltix/space/data.rb +53 -0
- data/lib/baltix/space/dependencies.rb +53 -0
- data/lib/baltix/space/filters.rb +96 -0
- data/lib/baltix/space/initialization.rb +124 -0
- data/lib/baltix/space/metadata.rb +130 -0
- data/lib/baltix/space/source_order.rb +43 -0
- data/lib/baltix/space/source_selection.rb +136 -0
- data/lib/baltix/space/source_status.rb +114 -0
- data/lib/baltix/space/spec.rb +3 -0
- data/lib/baltix/space.rb +87 -367
- data/lib/baltix/spec/rpm/aliases.rb +79 -0
- data/lib/baltix/spec/rpm/arch.rb +119 -0
- data/lib/baltix/spec/rpm/available_overrides.rb +106 -0
- data/lib/baltix/spec/rpm/build_dependencies.rb +132 -0
- data/lib/baltix/spec/rpm/build_queries.rb +61 -0
- data/lib/baltix/spec/rpm/changelog.rb +115 -0
- data/lib/baltix/spec/rpm/dependency_overrides.rb +83 -0
- data/lib/baltix/spec/rpm/dependency_policy.rb +69 -0
- data/lib/baltix/spec/rpm/deps.rb +113 -0
- data/lib/baltix/spec/rpm/env/requirements.rb +20 -0
- data/lib/baltix/spec/rpm/env.rb +76 -0
- data/lib/baltix/spec/rpm/executable_packages.rb +49 -0
- data/lib/baltix/spec/rpm/file_manifest.rb +72 -0
- data/lib/baltix/spec/rpm/guard_compilation.rb +95 -0
- data/lib/baltix/spec/rpm/imported_secondaries.rb +26 -0
- data/lib/baltix/spec/rpm/layout.rb +14 -0
- data/lib/baltix/spec/rpm/manpages.rb +71 -0
- data/lib/baltix/spec/rpm/metadata.rb +78 -0
- data/lib/baltix/spec/rpm/name/equality.rb +68 -0
- data/lib/baltix/spec/rpm/name/formatting.rb +33 -0
- data/lib/baltix/spec/rpm/name/parsing.rb +58 -0
- data/lib/baltix/spec/rpm/name.rb +77 -108
- data/lib/baltix/spec/rpm/packaged_versions.rb +107 -0
- data/lib/baltix/spec/rpm/parser/comments.rb +35 -0
- data/lib/baltix/spec/rpm/parser/context.rb +50 -0
- data/lib/baltix/spec/rpm/parser/dependencies.rb +91 -0
- data/lib/baltix/spec/rpm/parser/file_sections.rb +68 -0
- data/lib/baltix/spec/rpm/parser/flow.rb +84 -0
- data/lib/baltix/spec/rpm/parser/header_dependencies.rb +36 -0
- data/lib/baltix/spec/rpm/parser/macros.rb +43 -0
- data/lib/baltix/spec/rpm/parser/metadata.rb +106 -0
- data/lib/baltix/spec/rpm/parser/sections.rb +88 -0
- data/lib/baltix/spec/rpm/parser/values.rb +85 -0
- data/lib/baltix/spec/rpm/parser.rb +124 -269
- data/lib/baltix/spec/rpm/part_files.rb +64 -0
- data/lib/baltix/spec/rpm/part_prelude.rb +43 -0
- data/lib/baltix/spec/rpm/part_scripts.rb +52 -0
- data/lib/baltix/spec/rpm/part_switches.rb +65 -0
- data/lib/baltix/spec/rpm/pkglist/header.rb +73 -0
- data/lib/baltix/spec/rpm/pkglist/provides.rb +57 -0
- data/lib/baltix/spec/rpm/pkglist.rb +116 -0
- data/lib/baltix/spec/rpm/preparation.rb +73 -0
- data/lib/baltix/spec/rpm/rendering.rb +66 -0
- data/lib/baltix/spec/rpm/repository_application.rb +33 -0
- data/lib/baltix/spec/rpm/revision.rb +58 -0
- data/lib/baltix/spec/rpm/root_source.rb +48 -0
- data/lib/baltix/spec/rpm/scripts.rb +85 -0
- data/lib/baltix/spec/rpm/secondaries.rb +82 -0
- data/lib/baltix/spec/rpm/secondary.rb +117 -64
- data/lib/baltix/spec/rpm/secondary_parts.rb +84 -0
- data/lib/baltix/spec/rpm/section_document.rb +84 -0
- data/lib/baltix/spec/rpm/section_guards.rb +116 -0
- data/lib/baltix/spec/rpm/source_selection.rb +82 -0
- data/lib/baltix/spec/rpm/spec_core/architecture.rb +28 -0
- data/lib/baltix/spec/rpm/spec_core/attributes.rb +89 -0
- data/lib/baltix/spec/rpm/spec_core/availability.rb +60 -0
- data/lib/baltix/spec/rpm/spec_core/dependency_rendering.rb +83 -0
- data/lib/baltix/spec/rpm/spec_core/descriptions.rb +77 -0
- data/lib/baltix/spec/rpm/spec_core/documentation.rb +48 -0
- data/lib/baltix/spec/rpm/spec_core/executable_names.rb +37 -0
- data/lib/baltix/spec/rpm/spec_core/host_names.rb +60 -0
- data/lib/baltix/spec/rpm/spec_core/interpreters.rb +103 -0
- data/lib/baltix/spec/rpm/spec_core/names.rb +80 -0
- data/lib/baltix/spec/rpm/spec_core/obsoletes.rb +38 -0
- data/lib/baltix/spec/rpm/spec_core/package_dependencies.rb +74 -0
- data/lib/baltix/spec/rpm/spec_core/plain_dependencies.rb +60 -0
- data/lib/baltix/spec/rpm/spec_core/pre_name.rb +23 -0
- data/lib/baltix/spec/rpm/spec_core/provides.rb +104 -0
- data/lib/baltix/spec/rpm/spec_core/readme.rb +78 -0
- data/lib/baltix/spec/rpm/spec_core/registration.rb +18 -0
- data/lib/baltix/spec/rpm/spec_core/runtime_dependencies.rb +81 -0
- data/lib/baltix/spec/rpm/spec_core/summaries.rb +64 -0
- data/lib/baltix/spec/rpm/spec_core/text_wrapping.rb +36 -0
- data/lib/baltix/spec/rpm/spec_core/versioning.rb +75 -0
- data/lib/baltix/spec/rpm/spec_core/versions.rb +94 -0
- data/lib/baltix/spec/rpm/spec_core.rb +75 -527
- data/lib/baltix/spec/{rpm.erb → rpm/template.erb} +131 -31
- data/lib/baltix/spec/rpm.rb +253 -644
- data/lib/baltix/spec.rb +16 -14
- data/lib/baltix/target/gem.rb +61 -0
- data/lib/baltix/target/site.rb +40 -0
- data/lib/baltix/target.rb +16 -0
- data/lib/baltix/version.rb +3 -1
- data/lib/baltix.rb +77 -5
- data/locale/en_US.UTF-8.yaml +4 -1
- data/locale/ru_RU.UTF-8.yaml +7 -1
- data/rpm/baltix.env +4 -0
- data/rpm/baltix.prov +8 -0
- data/rpm/baltix.prov.files +6 -0
- data/rpm/baltix.req +8 -0
- data/rpm/baltix.req.files +6 -0
- data/rpm/macros.baltix +24 -0
- data/utils/rubocop/compact_block_braces.rb +39 -0
- data/utils/rubocop/spacing.rb +96 -0
- data/utils/update_alt_architectures.rb +57 -0
- data/utils/update_alt_licenses.rb +19 -0
- data/utils/update_spdx_licenses.rb +21 -0
- metadata +526 -17
- data/.github/workflows/ci.yml +0 -44
- data/.gitignore +0 -10
- data/TODO +0 -84
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# RPM-макросы действий Baltix
|
|
2
|
+
|
|
3
|
+
Подготовлены исходники макросов действий и обработчиков зависимостей.
|
|
4
|
+
Упаковка `rpm-macros-baltix` описана в пункте 1.11.1 плана Baltix.
|
|
5
|
+
Его минимальная версия исполнителя будет определена при выпуске макросов.
|
|
6
|
+
Для контроля частей нужны Ruby-макросы
|
|
7
|
+
не ниже 1:3.3.12-alt6; `%baltix_with_parts` остаётся в Ruby.
|
|
8
|
+
Прежние `%ruby_*` сохраняются для setup.
|
|
9
|
+
|
|
10
|
+
Упаковка требует установки макросов и обработчиков самим `baltix install`
|
|
11
|
+
и генерации их состава `%files` из Source/Target. Ручные `install` и списки
|
|
12
|
+
файлов в `.gear/baltix.spec` не заменяют эту возможность.
|
|
13
|
+
Отложенная задача — пункт 1.11.1 правки плана №25.
|
|
14
|
+
|
|
15
|
+
Макросы `%baltix_config`, `%baltix_build`, `%baltix_doc`, `%baltix_make`,
|
|
16
|
+
`%baltix_install`, `%baltix_test` и `%baltix_predeps` вызывают одноимённый CLI.
|
|
17
|
+
Make выполняет config/build/doc/predeps. Install/test передают buildroot;
|
|
18
|
+
граф действий обеспечивает prerequisites и повторное использование результатов.
|
|
19
|
+
Аргументы макроса передаются до имени действия, включая значения с пробелами.
|
|
20
|
+
Rake-задачи из Ruby RPM-контроля выполняются перед make/build, а не перед каждой
|
|
21
|
+
последующей фазой. Макросы используют shell-функцию для передачи аргументов,
|
|
22
|
+
поскольку параметризованные макросы старого ALT RPM отвергают длинные CLI-опции.
|
|
23
|
+
|
|
24
|
+
Явный `--rpm-env` импортирует существующие Ruby RPM-контроли: ignore/regard
|
|
25
|
+
с регулярными выражениями и путями, aliases, Ruby/bindir, замены требований и
|
|
26
|
+
собственных версий самоцветов. Используются обычные настройки Source/DSL;
|
|
27
|
+
новая политика выбора версий не вводится. Переданные после этого CLI-опции имеют
|
|
28
|
+
свой обычный приоритет. Минимумы и исключения переданных требований сохраняются;
|
|
29
|
+
исходные файлы не переписываются. Неизвестное объявление требования даёт ошибку.
|
|
30
|
+
|
|
31
|
+
Для данного спека вызов нового макроса включает Baltix-потребители зависимостей
|
|
32
|
+
и выключает старый метод ruby, требующий SetupConfig. Predeps пишет списки по
|
|
33
|
+
реальным именам RPM в `%{_builddir}/%{buildsubdir}/.baltix-dependencies`.
|
|
34
|
+
`baltix.req`/`baltix.prov` читают подготовленные файлы и не запускают setup или
|
|
35
|
+
повторный анализ исходников. Отсутствующий список при активном методе — ошибка.
|
|
36
|
+
В спеках без новых макросов обработчики Baltix не выбирают файлы и не влияют
|
|
37
|
+
на прежние методы. Пользовательские AutoReq/AutoProv сохраняют своё действие.
|
|
38
|
+
|
|
39
|
+
Сборка RPM Baltix запускает `ruby -Ilib exe/baltix` из архива исходников Gear.
|
|
40
|
+
Gear выбирает исходники по `v@version@` из списка `.gear/tags/list`.
|
|
41
|
+
Один макрос спека вызывает `make`, `install` и `test` из соответствующих фаз.
|
|
42
|
+
`test` запускает Cucumber через `.setup/test.sh`.
|
|
43
|
+
`%check` читает фактический результат тестов из `.space` и завершает сборку
|
|
44
|
+
с ошибкой при сбое тестов. Для загрузки исходного CLI нужны Ruby и Rake
|
|
45
|
+
не ниже 13.0.6, как указано в `baltix.gemspec`. `rpm-macros-ruby` задаёт
|
|
46
|
+
каталоги и переключатели частей.
|
|
47
|
+
|
|
48
|
+
Макросы наследуют PATH процесса RPM без добавления служебных каталогов.
|
|
49
|
+
Унаследованный PATH не входит в отпечаток готовности: его смена между фазами
|
|
50
|
+
не запускает завершённые действия повторно. Явные параметры инструментов,
|
|
51
|
+
опции build_environment и значимые переменные сборки, например MAKEFLAGS,
|
|
52
|
+
по-прежнему учитываются.
|
data/docs/rpm-parts.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Optional RPM parts
|
|
2
|
+
|
|
3
|
+
Baltix derives optional parts from source files and metadata. The defaults apply
|
|
4
|
+
to the complete generated spec, including nested sources:
|
|
5
|
+
|
|
6
|
+
| Switch | Default enabled when |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| `doc` | A documentation part is generated from RI inputs/RDoc metadata or a retained explicit package declaration. |
|
|
9
|
+
| `devel` | A development part is generated from development dependencies or headers, including nested gems. |
|
|
10
|
+
| `exec` | A gem declares public commands in `gemspec.executables`. Manual packages retain their own metadata and files. |
|
|
11
|
+
| `check` | Test requirements, test files, `.setup/test.rb`/`.setup/test.sh`, or custom check commands exist. |
|
|
12
|
+
|
|
13
|
+
A single `%baltix_with_parts` declaration in the header lists the parts found in the
|
|
14
|
+
project, for example `%baltix_with_parts doc,devel,exec,check`. It appears before
|
|
15
|
+
conditional dependencies and the main description. Ruby's macro declares
|
|
16
|
+
`%def_enable` for those parts and `%def_disable` for omitted optional parts.
|
|
17
|
+
Ordinary RPM `--enable`/`--disable` switches override these defaults. Optional
|
|
18
|
+
package headers, descriptions and file lists use the matching `%if_enabled`
|
|
19
|
+
condition. `exec` controls executable packages and is also their internal kind.
|
|
20
|
+
The application core comes from a Gemfile and owns its private
|
|
21
|
+
`%_libexecdir/<source-name>` data directory, including for independent nested
|
|
22
|
+
applications. The library core comes from a gemspec. Its `exec` part is auxiliary:
|
|
23
|
+
only `gemspec.executables` selects the commands, and `gemspec.bindir` selects
|
|
24
|
+
their source directory (commonly `exec`). Other files in that directory, or
|
|
25
|
+
scripts elsewhere in the project, do not create public executable entries.
|
|
26
|
+
The main library still registers a valid
|
|
27
|
+
gem even if its `lib/` directory is empty: extensions, data and executables can
|
|
28
|
+
make such a gem useful. Directory emptiness alone does not exclude a library.
|
|
29
|
+
Manual service/native packages without a matching source retain their original
|
|
30
|
+
conditions and install commands; their names alone do not make them optional
|
|
31
|
+
generated executable packages.
|
|
32
|
+
For an executable package with additional manual files, the package and those
|
|
33
|
+
files retain their conditions; only its generated executable entries follow
|
|
34
|
+
`exec`. Custom installation commands remain the spec author's responsibility.
|
|
35
|
+
|
|
36
|
+
The macro implementation lives in Ruby's `.gear/ruby.macros.erb`. It records the
|
|
37
|
+
effective enabled parts; `.gear/ruby.env` exports that list and the Ruby build,
|
|
38
|
+
install and test macros pass it to setup with `--with-parts`. Generated script
|
|
39
|
+
sections need no additional macro calls or exports. An empty effective list
|
|
40
|
+
explicitly disables all optional parts. Existing specs without `%baltix_with_parts`
|
|
41
|
+
keep setup's default of all optional parts enabled.
|
|
42
|
+
The companion setup-rb patch omits RI generation/installation for `doc`, headers
|
|
43
|
+
for `devel`, and both private commands and public links for `exec` when these
|
|
44
|
+
parts are disabled. No cleanup commands are generated. Source discovery and
|
|
45
|
+
nested source boundaries remain intact; README files attached to libraries
|
|
46
|
+
remain installed. ALT RPM skips `%check` itself when check is disabled;
|
|
47
|
+
custom commands and subsystem/architecture conditions remain intact.
|
|
48
|
+
|
|
49
|
+
This requires `rpm-macros-ruby >= 1:3.3.12-alt6` with the new macro and setup's
|
|
50
|
+
part-switch patch accumulated in the unreleased `5.999.15-alt1`; the setup
|
|
51
|
+
prerequisite is `setup-rb >= 5.999.15`.
|
|
52
|
+
An older build with the same unreleased version does not implement the new
|
|
53
|
+
CLI contract. The patch does not bump setup's version.
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Ruby dependencies
|
|
2
|
+
|
|
3
|
+
See the normative rules in the [Ruby Policy 2.1 draft](ruby-policy-2.1.md).
|
|
4
|
+
|
|
5
|
+
## Declaring dependencies
|
|
6
|
+
|
|
7
|
+
Determine Ruby dependencies and version constraints when generating the RPM
|
|
8
|
+
spec, and write them explicitly into it. The generated spec must contain the
|
|
9
|
+
runtime and build requirements and applicable conflicts before the RPM package
|
|
10
|
+
build starts. Include dependencies needed by configured build tasks, even when
|
|
11
|
+
they are loaded inside a Rake task rather than at Rakefile import time.
|
|
12
|
+
|
|
13
|
+
When updating a spec, recalculate every `gem(...)` dependency, its version bounds
|
|
14
|
+
and its build/check/runtime assignment from the current source and discovery
|
|
15
|
+
metadata. A gem removed from those inputs must disappear from the generated tags
|
|
16
|
+
and dependency overrides. Preserve non-gem RPM tools and packaging commands.
|
|
17
|
+
Historical RPM tags must not supply missing gems, old bounds or group assignments.
|
|
18
|
+
|
|
19
|
+
Use the appropriate RPM declarations:
|
|
20
|
+
|
|
21
|
+
| Declaration | Purpose |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `Requires` | Gems needed at runtime |
|
|
24
|
+
| `BuildRequires` | Gems and tools needed to build or test the package |
|
|
25
|
+
| `Conflicts` | Unsupported runtime dependency versions |
|
|
26
|
+
| `BuildConflicts` | Unsupported build dependency versions |
|
|
27
|
+
|
|
28
|
+
For example, a dependency on Racc versions from 1.5 up to, but excluding, 2 is
|
|
29
|
+
written as follows when needed both at build time and at runtime:
|
|
30
|
+
|
|
31
|
+
```spec
|
|
32
|
+
BuildRequires: gem(racc) >= 1.5
|
|
33
|
+
BuildConflicts: gem(racc) >= 2
|
|
34
|
+
Requires: gem(racc) >= 1.5
|
|
35
|
+
Conflicts: gem(racc) >= 2
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Keep these declarations consistent with any corresponding
|
|
39
|
+
`%ruby_use_gem_dependency` overrides.
|
|
40
|
+
|
|
41
|
+
## Gem capabilities and package versions
|
|
42
|
+
|
|
43
|
+
Prefer gem capabilities to RPM package names for Ruby library dependencies.
|
|
44
|
+
Their constraints refer to gem versions, not RPM releases. For example:
|
|
45
|
+
|
|
46
|
+
```spec
|
|
47
|
+
Requires: gem(ruby-next-parser) = 3.4.4.0
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This requirement does not tie the consumer to a particular packaging revision
|
|
51
|
+
such as `3.4.4.0-alt1` or `3.4.4.0-alt1.1`. For snapshots, use the numeric gem
|
|
52
|
+
version described in [Versioning](ruby-versioning.md), rather than the RPM
|
|
53
|
+
`Version` spelling containing `p`.
|
|
54
|
+
|
|
55
|
+
Development packages containing compilation headers can be addressed by their
|
|
56
|
+
RPM package names. Use an exact EVR when the matching package build is required,
|
|
57
|
+
for example `gem-ruby-next-parser-devel = %EVR`.
|
|
58
|
+
|
|
59
|
+
## Individual excluded versions
|
|
60
|
+
|
|
61
|
+
A requirement such as `>= 1.15.7, != 1.16.7` still permits 1.15.7 and 1.15.8.
|
|
62
|
+
It must not become `> 1.16.7`. Baltix retains the source minimum and emits an
|
|
63
|
+
exact conflict for each exclusion, including prerelease suffixes:
|
|
64
|
+
|
|
65
|
+
```spec
|
|
66
|
+
Requires: gem(nokogiri) >= 1.15.7
|
|
67
|
+
Conflicts: gem(nokogiri) = 1.16.7
|
|
68
|
+
%ruby_use_gem_dependency nokogiri >= 1.15.7,nokogiri != 1.16.7
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The same rule applies to build dependencies. Availability and upper-bound
|
|
72
|
+
relaxation modes do not discard individual source exclusions.
|
|
73
|
+
|
|
74
|
+
## Public executable requirements
|
|
75
|
+
|
|
76
|
+
Executable RPMs derive their gem requirements from public entry points declared
|
|
77
|
+
by the gemspec and selected in the source's executable tree. Service scripts such
|
|
78
|
+
as `bin/rspec` are not entry points merely because they reside under `bin`.
|
|
79
|
+
|
|
80
|
+
Baltix parses Ruby `require`, `require_relative`, `Kernel.require` and literal
|
|
81
|
+
`gem` activation calls, following local library files recursively with cycle
|
|
82
|
+
protection. Required features are matched to current declared gem names,
|
|
83
|
+
Bundler require aliases and installed dependency gems' file ownership. Existing
|
|
84
|
+
source bounds remain in force; a literal activation can strengthen them. Calls
|
|
85
|
+
protected by a non-reraising `rescue LoadError` are optional. Comments and string contents do
|
|
86
|
+
not introduce calls. Ruby code and executables are not run by this analysis.
|
|
87
|
+
|
|
88
|
+
A whole Gemfile group is no longer copied into an executable's requirements.
|
|
89
|
+
The package still requires its own library capability at the provided version.
|
|
90
|
+
Dynamic load expressions and Ruby syntax errors are diagnosed; their expressions
|
|
91
|
+
are not evaluated to guess a dependency. Explicitly supplied dependency settings
|
|
92
|
+
remain available for code that cannot be resolved from literal loads.
|
|
93
|
+
|
|
94
|
+
## Explicitly ignored sources
|
|
95
|
+
|
|
96
|
+
`--ignore-names` excludes a source even when another discovered gem requires it.
|
|
97
|
+
A dependency does not automatically grant regard priority. Only the explicit
|
|
98
|
+
`--regard-names` setting overrides a matching name exclusion. The same policy
|
|
99
|
+
applies to settings restored from an existing spec.
|
|
100
|
+
|
|
101
|
+
Disabled nested sources still reserve their file roots. Their files are not
|
|
102
|
+
collected as data of an enclosing application. Directory boundaries are exact:
|
|
103
|
+
ignoring `rubygems-update` does not remove `rubygems-update-extra`. Invalid
|
|
104
|
+
metadata helpers do not reserve independent roots. This is a source selection
|
|
105
|
+
rule, not a generated install-time cleanup command.
|
|
106
|
+
|
|
107
|
+
## Default license
|
|
108
|
+
|
|
109
|
+
`--default-license=BSD-2-Clause` supplies a license only for a package owner
|
|
110
|
+
without license metadata. Explicit upstream licenses remain unchanged. A license
|
|
111
|
+
explicitly retained or supplied for an unlicensed main package takes precedence
|
|
112
|
+
there. Nested gems resolve their own metadata separately; a licensed nested gem
|
|
113
|
+
does not provide a license for an unlicensed root application.
|
|
114
|
+
|
|
115
|
+
The RPM header aggregates licenses of actual package owners. Metadata-only
|
|
116
|
+
helpers do not introduce another default license into an already licensed gem.
|
|
117
|
+
The upstream gemspecs are never rewritten. Without this option, the existing
|
|
118
|
+
license/fallback behavior is retained. An empty CLI value is rejected.
|
|
119
|
+
|
|
120
|
+
## Distinct project roots
|
|
121
|
+
|
|
122
|
+
An existing RPM spec may have a native/application root and a separate gem
|
|
123
|
+
library whose source name aliases the root name. For example, grpc is the native
|
|
124
|
+
project and gem-grpc is its Ruby library. The root retains its own name, version,
|
|
125
|
+
file-section presence and manual native requirements. Ruby library capabilities
|
|
126
|
+
belong to the separate Ruby package, and its explicit capability version does
|
|
127
|
+
not inherit an unrelated native-root RPM version.
|
|
128
|
+
|
|
129
|
+
Source-less packages beneath this distinct root retain literal RPM names,
|
|
130
|
+
including ABI macros and dots, rather than applying gem-name normalization.
|
|
131
|
+
Relative `%files plugins` selectors are associated with the same `grpc-plugins`
|
|
132
|
+
package as their headers. A native `-devel` name does not make that package a
|
|
133
|
+
Ruby development companion. Native packages inherit the RPM build architecture
|
|
134
|
+
when their input has no BuildArch; explicit input/caller architectures stay in
|
|
135
|
+
the header.
|
|
136
|
+
|
|
137
|
+
Enclosing subsystem and architecture conditions are retained for package/file
|
|
138
|
+
sections. New doc/devel companions inherit their library's conditions and add
|
|
139
|
+
their own feature switch. Branches remain conditional without executing RPM
|
|
140
|
+
expressions. Conditions inside file lists and build commands remain in their
|
|
141
|
+
bodies; conditional scriptlets retain their guards. Source feature defaults
|
|
142
|
+
such as `%def_with ruby` and `%def_without python3_bindings` are retained too.
|
|
143
|
+
Nested ALT feature guards use ordinary `%if` directives with the corresponding
|
|
144
|
+
flag expression: RPM must recognize the nested directive even when its parent
|
|
145
|
+
branch is disabled and macro expansion is skipped.
|
|
146
|
+
Feature references with a dash/underscore mismatch use the uniquely matching
|
|
147
|
+
declared flag in the same namespace. An exact declaration wins; unknown or
|
|
148
|
+
ambiguous references stay literal. In grpc, the Python manifest consequently
|
|
149
|
+
uses the declared `python3_bindings` switch along with the package header.
|
|
150
|
+
Build headers retain conditions of explicit non-gem RPM constraints. Regenerated
|
|
151
|
+
Gem requirements and Ruby tool prerequisites use the outer condition shared by
|
|
152
|
+
all packaged Ruby libraries; a source-specific guard cannot hide another source's
|
|
153
|
+
requirements. Adjacent headers with the same path share a conditional block.
|
|
154
|
+
Ruby override/setup macros follow that shared path as well.
|
|
155
|
+
|
|
156
|
+
An executable companion also matches an existing RPM by its exact installed
|
|
157
|
+
`%_bindir/command` entries when its user-selected name differs from the gem or
|
|
158
|
+
command name. This requires one candidate package and a single source providing
|
|
159
|
+
all known commands there. Shared names, mixed-source commands and glob-only
|
|
160
|
+
lists do not select a candidate. The matched RPM keeps its name and conditions;
|
|
161
|
+
the public commands and gem dependency are regenerated from current metadata.
|
|
162
|
+
|
|
163
|
+
## License label replacements
|
|
164
|
+
|
|
165
|
+
`--license-replacement-list=/path/to/licenses.yaml` loads an exact, case-sensitive
|
|
166
|
+
mapping. For example:
|
|
167
|
+
|
|
168
|
+
```yaml
|
|
169
|
+
GPLv2: GPL-2.0-only
|
|
170
|
+
Apache 2.0: Apache-2.0
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Defaults are resolved first. An exact source/configuration replacement takes
|
|
174
|
+
precedence over normalization; the normalized label is also checked when there
|
|
175
|
+
is no exact replacement. Replacement values are final labels, preserved through
|
|
176
|
+
later spec updates. Equal results are deduplicated.
|
|
177
|
+
|
|
178
|
+
RPM labels come from `/usr/share/license`, supplied in ALT by `common-licenses`.
|
|
179
|
+
Filenames and symbolic-link targets define the canonical labels. Thus `GPLv2`
|
|
180
|
+
resolves through the installed link to `GPL-2.0-only`, while `GPLv2+` resolves to
|
|
181
|
+
`GPL-2.0-or-later`. Standard SPDX names are recognized only when their identifier
|
|
182
|
+
is present in this catalog. An unambiguous title from the local license file can
|
|
183
|
+
also identify a label: echoe's `Academic Free License (AFL) v. 3.0` matches the
|
|
184
|
+
title of `AFL-3.0`, ignoring typographic quotation differences.
|
|
185
|
+
|
|
186
|
+
A shared title or identical license text does not establish which permissions
|
|
187
|
+
apply. Generic or ambiguous names and whole expressions stay unchanged. Upstream
|
|
188
|
+
gemspec licenses and copyright information are never rewritten.
|
|
189
|
+
|
|
190
|
+
The installed directory takes precedence. Without it, Baltix uses a bundled
|
|
191
|
+
[ALT catalog snapshot](../data/alt-licenses/README.md), generated from real
|
|
192
|
+
filenames, links, titles and file hashes. The [SPDX name list](../data/spdx/README.md)
|
|
193
|
+
is also bundled with its provenance. Spec generation does not access the network.
|
|
194
|
+
|
|
195
|
+
Keys and values must be non-empty strings (YAML symbol keys are also accepted).
|
|
196
|
+
Chains and cycles are rejected: write each original label directly to its final
|
|
197
|
+
label. An explicit identity mapping is allowed to preserve a label unchanged.
|
|
198
|
+
Malformed mappings raise an argument error; missing/unreadable files raise the
|
|
199
|
+
corresponding file error. CLI and persisted configuration use the same mapping.
|
|
200
|
+
|
|
201
|
+
## Gemfile dependencies loaded by a library
|
|
202
|
+
|
|
203
|
+
A gem's installed public Ruby entry points are also checked: the literal gem
|
|
204
|
+
name, underscore and slash variants, and its declared autorequire name. Only
|
|
205
|
+
packaged files under its require paths are considered. Their local require
|
|
206
|
+
closure can promote an already declared, supported-platform dependency into
|
|
207
|
+
RPM runtime when the code actually loads it. Other Gemfile tools are not
|
|
208
|
+
promoted merely because they share a group.
|
|
209
|
+
|
|
210
|
+
For example, oauth-tty declares oauth in its Gemfile and unconditionally requires
|
|
211
|
+
it from oauth/tty.rb, while its gemspec declares only version_gem. Its library
|
|
212
|
+
RPM therefore needs oauth too. The executable keeps its own actual loads and
|
|
213
|
+
exact library requirement; development requirements remain with devel. The
|
|
214
|
+
upstream gemspec remains intact, including its intentional circular-dependency
|
|
215
|
+
avoidance. This infers RPM requirements and does not change the group matrix or
|
|
216
|
+
invent dependencies for unmapped features. A library without a conventional
|
|
217
|
+
entry point retains its declared metadata requirements.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Ruby Policy 2.1 draft
|
|
2
|
+
|
|
3
|
+
This draft builds on [Ruby Policy 2.0](https://en.altlinux.org/Ruby/Policy_2.0).
|
|
4
|
+
|
|
5
|
+
## Versioning
|
|
6
|
+
|
|
7
|
+
Preserve upstream release versions. For prereleases, append the upstream commit
|
|
8
|
+
count since the preceding release, followed by a separate component for local
|
|
9
|
+
code patches when present; separate the upstream count with `p` in RPM `Version`
|
|
10
|
+
and a dot in the gem version.
|
|
11
|
+
|
|
12
|
+
Start release builds at `alt1` and prereleases at `alt0.1`. On the same upstream
|
|
13
|
+
release, increment the significant packaging revision for changes outside
|
|
14
|
+
`.spec`; append and increment a final component for spec-only changes.
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
Declare Ruby dependencies, version constraints, and conflicts explicitly in the
|
|
19
|
+
RPM spec during spec generation. Use `gem(name)` capabilities with gem versions;
|
|
20
|
+
address development header packages by their RPM names. Recompute every gem
|
|
21
|
+
dependency and its build/check/runtime assignment from current source and discovery
|
|
22
|
+
metadata when updating a spec; historical gem tags do not supply dependencies or bounds.
|
|
23
|
+
|
|
24
|
+
## Package macros
|
|
25
|
+
|
|
26
|
+
For `gem-*` packages, `pkgname` definitions (`%def*` and `%global`) are obsolete;
|
|
27
|
+
use `gemname` for the source gem name. Omit unused legacy definitions when updating
|
|
28
|
+
specs; retain definitions still referenced by custom packaging code for compatibility.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Ruby versioning
|
|
2
|
+
|
|
3
|
+
See the normative rules in the [Ruby Policy 2.1 draft](ruby-policy-2.1.md).
|
|
4
|
+
|
|
5
|
+
## Module versions
|
|
6
|
+
|
|
7
|
+
For an upstream release, preserve its original semantic version.
|
|
8
|
+
|
|
9
|
+
When refreshing an existing spec, preserve explicitly packaged versions from
|
|
10
|
+
`%ruby_use_gem_version`; do not discard their upstream or local patch components
|
|
11
|
+
by falling back to an unadjusted upstream gemspec version.
|
|
12
|
+
|
|
13
|
+
For a prerelease snapshot, append a numeric component to the previous upstream
|
|
14
|
+
release version. This component is the number of upstream patches (commits)
|
|
15
|
+
between that release and the selected upstream HEAD. For example, 17 upstream
|
|
16
|
+
patches after release `3.4.4.0` give the gem version `3.4.4.0.17`.
|
|
17
|
+
|
|
18
|
+
If the maintainer also patches the Ruby code, append another numeric component
|
|
19
|
+
for those local patches. The first local code patch gives `3.4.4.0.17.1`.
|
|
20
|
+
Count upstream and local code patches separately; changes confined to the RPM
|
|
21
|
+
spec do not increment either count.
|
|
22
|
+
|
|
23
|
+
The RPM spec uses `p` before the upstream patch count, while the gem version
|
|
24
|
+
uses a dot. Keep these representations consistent:
|
|
25
|
+
|
|
26
|
+
| Sources | Gem version | RPM `Version` |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| Upstream release | `3.4.4.0` | `3.4.4.0` |
|
|
29
|
+
| Prerelease with 17 upstream patches | `3.4.4.0.17` | `3.4.4.0p17` |
|
|
30
|
+
| Same prerelease with one local code patch | `3.4.4.0.17.1` | `3.4.4.0p17.1` |
|
|
31
|
+
|
|
32
|
+
For example, the last case has `Version: 3.4.4.0p17.1` in the RPM spec and
|
|
33
|
+
`3.4.4.0.17.1` in the installed gemspec.
|
|
34
|
+
|
|
35
|
+
## Package revisions
|
|
36
|
+
|
|
37
|
+
A new upstream release starts with RPM `Release: alt1`. Changes outside the
|
|
38
|
+
`.spec` file on the same release increment the significant packaging revision:
|
|
39
|
+
`alt1`, `alt2`, and so on.
|
|
40
|
+
|
|
41
|
+
For changes confined to the `.spec` file, append a separate revision component
|
|
42
|
+
and increment it for each subsequent spec-only change. For example, the first
|
|
43
|
+
two spec fixes to an `alt1` build produce `alt1.1` and `alt1.2`.
|
|
44
|
+
|
|
45
|
+
For prereleases, put a zero before the significant packaging revision. Thus
|
|
46
|
+
`alt0.1` corresponds to `alt1`, and its first two spec fixes produce `alt0.1.1`
|
|
47
|
+
and `alt0.1.2`.
|
|
48
|
+
|
|
49
|
+
| Packaging change | Release build | Prerelease build |
|
|
50
|
+
| --- | --- | --- |
|
|
51
|
+
| Initial build | `alt1` | `alt0.1` |
|
|
52
|
+
| Changes outside `.spec` on the same release | `alt2` | `alt0.2` |
|
|
53
|
+
| First spec-only fix to revision 1 | `alt1.1` | `alt0.1.1` |
|
|
54
|
+
| Second spec-only fix to revision 1 | `alt1.2` | `alt0.1.2` |
|
|
55
|
+
|
|
56
|
+
Keep the main package, its subpackages, and the changelog entry consistent
|
|
57
|
+
with the selected versions and revisions.
|
|
58
|
+
|
|
59
|
+
When Baltix changes an existing spec without changing its module version,
|
|
60
|
+
increment the spec revision and add a changelog entry. Re-rendering identical
|
|
61
|
+
content must retain the revision and changelog unchanged.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Формат .space
|
|
2
|
+
|
|
3
|
+
`.space` содержит обычные YAML-отображения, списки и скалярные значения.
|
|
4
|
+
Файл читается `YAML.safe_load(text)` без `permitted_classes` и разрешения
|
|
5
|
+
псевдонимов. Запись выполняют `Space#store` и действие `config`.
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
---
|
|
9
|
+
space_format: 1
|
|
10
|
+
rootdir: /src/example
|
|
11
|
+
spec_type: rpm
|
|
12
|
+
configuration:
|
|
13
|
+
spec_type: rpm
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`space_format` обозначает версию формата. Поле `version` остаётся версией
|
|
17
|
+
пакета. Для вручную написанного YAML без `space_format` применяется формат 1;
|
|
18
|
+
неизвестная версия отвергается.
|
|
19
|
+
|
|
20
|
+
`Space#to_h`, `Source#to_h`, `DSL#to_h`, `Spec::Rpm#to_h` и
|
|
21
|
+
`Spec::Rpm::Name#to_h` выделяют данные моделей без служебных кэшей и обратных
|
|
22
|
+
ссылок на Space. Кодек `Space::Data` переводит эти данные в YAML и обратно.
|
|
23
|
+
`Space.load_from!(state: hash)` принимает результат `YAML.safe_load`,
|
|
24
|
+
а `state: path` или поток читает YAML непосредственно. Опции и состояние
|
|
25
|
+
Space сохраняют публичный интерфейс OpenStruct. Явно переданные опции имеют
|
|
26
|
+
приоритет над сохранённой конфигурацией.
|
|
27
|
+
|
|
28
|
+
## Типизированные значения
|
|
29
|
+
|
|
30
|
+
Значения, которым недостаточно YAML-скаляра, записываются как отображения
|
|
31
|
+
с полями `$type` и `value`, например:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
version:
|
|
35
|
+
$type: gem_version
|
|
36
|
+
value: 1.2.3
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Поддержаны символы, регулярные выражения, Pathname, Time, Date, DateTime,
|
|
40
|
+
OpenStruct, метаданные RubyGems, зависимости Bundler, источники Baltix,
|
|
41
|
+
DSL и RPM-имена. Восстановление использует явно заданные конструкторы;
|
|
42
|
+
имена произвольных Ruby-классов из файла не исполняются.
|
|
43
|
+
|
|
44
|
+
У обычных отображений символьные ключи перечислены в `$symbols`.
|
|
45
|
+
При совпадении строкового и символьного ключей либо использовании служебного
|
|
46
|
+
ключа отображение записывается как `$type: hash` со списком пар ключ/значение.
|
|
47
|
+
Это сохраняет различие между `:part` и `"part"` и позволяет хранить
|
|
48
|
+
пользовательские отображения с ключом `$type`. Повторяющиеся коллекции
|
|
49
|
+
записываются независимо, без YAML-псевдонимов.
|
|
50
|
+
|
|
51
|
+
`store` сохраняет снимок обнаруженных источников с gemspec и DSL.
|
|
52
|
+
`config` сохраняет конфигурацию и результаты действий без закрепления
|
|
53
|
+
обнаруженных источников: последующие действия могут перечитать метаданные
|
|
54
|
+
проекта. RPM восстанавливается с привязкой к загруженному Space.
|
|
55
|
+
|
|
56
|
+
Старые `.space` с `!ruby/object` не загружаются. Их следует заново создать
|
|
57
|
+
действием `config`. Неизвестные типы, версии формата, YAML-псевдонимы
|
|
58
|
+
и некорректные служебные записи вызывают исключение.
|
data/exe/baltix
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'digest'
|
|
4
|
+
|
|
5
|
+
# Fingerprints file contents, permissions and symlink targets without following links.
|
|
6
|
+
module Baltix::ActionFlow::Files
|
|
7
|
+
RESULT_FIELDS = { 'doc' => :doc_results, 'install' => :install_results }.freeze
|
|
8
|
+
|
|
9
|
+
def self.signature file, checksums: true
|
|
10
|
+
if File.symlink?(file)
|
|
11
|
+
[:link, File.readlink(file)]
|
|
12
|
+
elsif File.file?(file)
|
|
13
|
+
result = [:file, File.stat(file).mode & 0o7777]
|
|
14
|
+
|
|
15
|
+
result << Digest::SHA256.file(file).hexdigest if checksums
|
|
16
|
+
|
|
17
|
+
result
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.current? file, recorded, checksums: true
|
|
22
|
+
expected = checksums ? recorded : recorded.first(2)
|
|
23
|
+
|
|
24
|
+
signature(file, checksums: checksums) == expected
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.outputs space, name
|
|
28
|
+
case name
|
|
29
|
+
when 'config' then [File.join(space.rootdir, '.space')]
|
|
30
|
+
when 'build' then build_outputs(space)
|
|
31
|
+
when 'predeps' then Array(space.state.predep_results&.[](:outputs))
|
|
32
|
+
else recorded_outputs(space, name)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.recorded_outputs space, name
|
|
37
|
+
field = RESULT_FIELDS[name]
|
|
38
|
+
|
|
39
|
+
field ? Array(space.state[field]).flat_map {|record| record[:outputs] } : []
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.build_outputs space
|
|
43
|
+
Array(space.state.build_results).flat_map {|record| Array(record[:generated]) | Array(record[:outputs]) }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.signatures files, checksums: true
|
|
47
|
+
files.uniq.to_h {|file| [file, signature(file, checksums: checksums)] }
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Collects source inputs independently of generated and staged action results.
|
|
4
|
+
class Baltix::ActionFlow::Inputs
|
|
5
|
+
def initialize space
|
|
6
|
+
@space = space
|
|
7
|
+
@root = File.expand_path(space.rootdir)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def fingerprint
|
|
11
|
+
files = Dir.glob(File.join(@root, '**/*'), File::FNM_DOTMATCH)
|
|
12
|
+
|
|
13
|
+
files |= [@space.options.spec_file].compact
|
|
14
|
+
|
|
15
|
+
files.reject! {|file| excluded?(file) }
|
|
16
|
+
files.sort!
|
|
17
|
+
|
|
18
|
+
Digest::SHA256.hexdigest(Marshal.dump(files.map {|file| byte_signature(file) }))
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def byte_signature file
|
|
22
|
+
signature = Baltix::ActionFlow::Files.signature(file)
|
|
23
|
+
|
|
24
|
+
[file.b, signature&.map {|item| item.is_a?(String) ? item.b : item }]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def excluded? file
|
|
28
|
+
relative = file.delete_prefix(File.join(@root, ''))
|
|
29
|
+
first = relative.split('/').first
|
|
30
|
+
|
|
31
|
+
generated_name?(first) || outputs.include?(file) || excluded_root?(file)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def generated_name? first
|
|
35
|
+
%w[.git .space].include?(first) || first&.start_with?('.ri.', '.so.')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def excluded_root? file
|
|
39
|
+
excluded_roots.any? {|root| file == root || file.start_with?(File.join(root, '')) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def outputs
|
|
43
|
+
@outputs ||= generated_outputs | Array(@space.state.test_outputs)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def generated_outputs
|
|
47
|
+
%w[build doc install predeps].flat_map {|name| Baltix::ActionFlow::Files.outputs(@space, name) }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def excluded_roots
|
|
51
|
+
@excluded_roots ||=
|
|
52
|
+
%i[install_prefix buildroot predep_dir].filter_map do |name|
|
|
53
|
+
path = @space.options[name]
|
|
54
|
+
|
|
55
|
+
root = File.expand_path(path) if path
|
|
56
|
+
|
|
57
|
+
root if root && root != @root
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Persists successful phase fingerprints in the existing Space state.
|
|
4
|
+
class Baltix::ActionFlow::Journal
|
|
5
|
+
def initialize space
|
|
6
|
+
@space = space
|
|
7
|
+
@entries = space.state.action_journal ||= {}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def current? name
|
|
11
|
+
entry = @entries[name]
|
|
12
|
+
|
|
13
|
+
entry && entry[:inputs] == input_fingerprint && entry[:options] == option_fingerprint(name) &&
|
|
14
|
+
outputs_current?(name, entry[:outputs])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def outputs_current? name, outputs
|
|
18
|
+
return outputs.keys.all? {|file| File.file?(file) } if name == 'config'
|
|
19
|
+
|
|
20
|
+
outputs.all? do |file, signature|
|
|
21
|
+
signature && Baltix::ActionFlow::Files.current?(file, signature,
|
|
22
|
+
checksums: @space.options.verify_output_checksums)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def outputs name
|
|
27
|
+
@entries.fetch(name).fetch(:outputs).keys
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def record name
|
|
31
|
+
files = Baltix::ActionFlow::Files.outputs(@space, name)
|
|
32
|
+
outputs = Baltix::ActionFlow::Files.signatures(files, checksums: @space.options.verify_output_checksums)
|
|
33
|
+
|
|
34
|
+
@entries[name] = { inputs: input_fingerprint, options: option_fingerprint(name),
|
|
35
|
+
outputs: outputs }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def invalidate name
|
|
39
|
+
names = { 'build' => %w[build install], 'doc' => %w[doc install],
|
|
40
|
+
'install' => ['install'], 'config' => ['config'], 'predeps' => ['predeps'] }
|
|
41
|
+
|
|
42
|
+
Array(names[name]).each {|key| @entries.delete(key) }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_snapshot
|
|
46
|
+
Dir.glob(File.join(@space.rootdir, '**/*'), File::FNM_DOTMATCH)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def record_test_outputs before
|
|
50
|
+
@space.state.test_outputs = Array(@space.state.test_outputs) | (test_snapshot - before)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def input_fingerprint
|
|
54
|
+
Baltix::ActionFlow::Inputs.new(@space).fingerprint
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def option_fingerprint name
|
|
58
|
+
Baltix::ActionFlow::Options.fingerprint(@space, name)
|
|
59
|
+
end
|
|
60
|
+
end
|