# ----------------------------------------------------------------------------- # RU: Dive — анализатор образов Docker/OCI (Go) # EN: Dive — Docker/OCI image analyzer (Go) # ----------------------------------------------------------------------------- %global _project wagoodman %global _repo dive %global _importpath github.com/%{_project}/%{_repo} # RU: Включить unit-тесты Go при сборке: rpmbuild --with tests # EN: Enable Go unit tests during build: rpmbuild --with tests %bcond_without tests Name: %{_repo} Version: 0.13.1 Release: 1%{?dist} Summary: Docker/OCI image analyzer for layer efficiency and wasted space Summary(ru): Анализатор образов Docker/OCI: слои, эффективность, потери места License: MIT URL: https://github.com/%{_project}/%{_repo} Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#%{name}-%{version}.tar.gz Source1: %{name}-%{version}-vendor.tar.xz Packager: NICE SOFT GROUP LLC (ООО "НАЙС СОФТ ГРУПП") 5024245440 Vendor: NiceSOFT Distribution: NiceOS.Core BugURL: https://bugs.niceos.ru/ VCS: https://git.niceos.ru/niceos/%{name} BuildRequires: golang >= 1.21 Requires(post): bash %description Dive is a CLI tool to explore a Docker/OCI image layer by layer: discover wasted space, view file changes per layer, estimate image efficiency, and spot common anti-patterns. It can work with a Docker/Podman daemon and can also analyze saved image tar archives. %description -l ru Dive — консольный инструмент для постадийного анализа образов Docker/OCI: показывает изменения файлов по слоям, оценку эффективности и «пустые» места, помогает выявлять антипаттерны сборки. Может работать через Docker/Podman-демон, а также анализировать сохранённые tar-архивы образов. %prep %autosetup -n %{_repo}-%{version} -p1 # RU: Подкладываем vendor/ для офлайновой сборки (Go: -mod=vendor). # EN: Provide vendor/ for offline build (Go: -mod=vendor). tar -xJf %{SOURCE1} --strip-components=1 # RU: Выровнять mtimes для воспроизводимости (без изменения содержимого). # EN: Normalize mtimes for reproducible builds (without changing contents). find . -type f -name "*.go" -print0 | xargs -0 --no-run-if-empty touch -r . %build export CGO_ENABLED=0 export GO111MODULE=on export GOPATH="%{_builddir}/go" # RU: Строго офлайн: запрещаем модульные прокси и sumdb; используем vendor/. # EN: Strict offline: disable module proxy and sumdb; use vendor/. export GOPROXY=off export GOSUMDB=off export GOFLAGS="-mod=vendor" build_ldflags="-s -w" mkdir -p build go build -v -trimpath -buildvcs=false -ldflags "${build_ldflags}" -o build/%{name} . # RU: Автодополнения генерируем только если команда поддерживается; установка не производится в данном spec. # EN: Generate shell completions only if supported; they are not installed by this spec. if ./build/%{name} -h 2>&1 | grep -q 'completion'; then ./build/%{name} completion bash > build/%{name}.bash || : ./build/%{name} completion zsh > build/_%{name} || : ./build/%{name} completion fish > build/%{name}.fish || : fi %check %if %{with tests} # RU: Тесты могут быть тяжёлыми; включаются только при --with tests. # EN: Tests can be heavy; enabled only with --with tests. export GOPROXY=off export GOSUMDB=off export GOFLAGS="-mod=vendor" go test -v ./... %else echo "RU: Тесты пропущены (сборка без --with tests)." echo "EN: Tests skipped (built without --with tests)." %endif %install install -Dpm 0755 build/%{name} %{buildroot}%{_bindir}/%{name} install -Dpm 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE install -Dpm 0644 README.md %{buildroot}%{_datadir}/doc/%{name}/README.md %files %license %{_datadir}/licenses/%{name}/LICENSE %doc %{_datadir}/doc/%{name}/README.md %{_bindir}/%{name} %post # RU: no-op # EN: no-op %postun # RU: no-op # EN: no-op %changelog * Sun May 24 2026 NiceOS Team - 0.13.1-1 - Upstream bugfix release: fix layer selection to select only one layer, GitLab CI integration, container creation after 0.13.0, and `getent` lookup; add x-cmd install support. - Релиз upstream с исправлениями: выбор слоя теперь ограничен одним слоем, исправлены GitLab CI integration, создание контейнера после 0.13.0 и поиск `getent`; добавлен способ установки через x-cmd. * Thu Apr 30 2026 NiceOS Team - 0.12.0-1 - Initial build for NiceOS (Первая сборка для НАЙС.ОС)