Skip to content

chore(core): build bzip2 and file packages #988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions component_versions/version_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ package:
dmidecode: 3-6
glib2: 2.82.5
acl: 2.3.1
bzip2: bzip2-1.0.8
file: FILE5_45
30 changes: 22 additions & 8 deletions images/dvcr-artifact/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ binaries:
- /usr/local/bin/dvcr-importer
- /usr/bin/nbd*
- /usr/bin/file
- /usr/share/file/magic
- /usr/share/file/magic.mgc
- /etc/magic
- /usr/share/misc/magic.mgc
- /usr/local/bin/dvcr-uploader
- /usr/local/bin/dvcr-cleaner
- /usr/bin/qemu-img
- /usr/bin/qemu-nbd
{{- end -}}

{{ $dvcrDependencies := include "$name" . | fromYaml }}
Expand All @@ -61,17 +61,31 @@ import:
add: /out
to: /usr/local/bin
before: setup
- image: packages/binaries/file
add: /file
to: /file
before: install
# deps for file
- image: packages/binaries/bzip2
add: /bzip2
to: /bzip2
before: install
- image: qemu
add: /qemu-img
to: /relocate
before: setup
to: /qemu-img
before: install
shell:
install:
- |
apt-get update && apt-get install --yes \
libnbd file
- apt-get clean
- rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin
libnbd
apt-get clean
rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin

cp -a /qemu-img/. /
cp -a /bzip2/. /
cp -a /file/. /
rm -rf /{file,bzip2,qemu-img}
setup:
- |
/relocate_binaries.sh -i "{{ $dvcrDependencies.binaries | join " " }}" -o /relocate
67 changes: 67 additions & 0 deletions images/packages/binaries/bzip2/werf.inc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# development pkgs
image: {{ $.ImageType }}/{{ $.ImageName }}
final: false
fromImage: builder/scratch
import:
- image: {{ $.ImageType }}/{{ $.ImageName }}-builder
add: /out
to: /{{ $.ImageName }}
before: setup
---
{{- $version := get $.Package $.ImageName }}
{{- $gitRepoUrl := "bzip2/bzip2.git" }}

{{- $name := print $.ImageName "-dependencies" -}}
{{- define "$name" -}}
packages:
- gcc git libtool
- make automake autoconf libtool makeinfo
- meson ninja-build
- pkg-config
{{- end -}}

{{ $builderDependencies := include "$name" . | fromYaml }}

image: {{ $.ImageType }}/{{ $.ImageName }}-builder
final: false
fromImage: builder/alt
secrets:
- id: SOURCE_REPO
value: {{ $.SOURCE_REPO_GIT }}
shell:
beforeInstall:
- |
apt-get update && apt-get install -y \
{{ $builderDependencies.packages | join " " }}

apt-get clean
rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin

install:
- |
OUTDIR=/out
pkgver=$( echo {{ $version }} | cut -d "-" -f2)

mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config

git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch {{ $version }} /src
cd /src

mkdir -p $OUTDIR/usr/lib64

sed -i \
-e 's:\$(PREFIX)/man:\$(PREFIX)/share/man:g' \
-e 's:ln -s -f \$(PREFIX)/bin/:ln -s :' \
Makefile

make -f Makefile-libbz2_so all -j $(nproc)
make all

make -j $(nproc) PREFIX=${OUTDIR}/usr install

install -D libbz2.so.$pkgver "${OUTDIR}"/usr/lib64/libbz2.so.$pkgver
ln -s libbz2.so.$pkgver "${OUTDIR}"/usr/lib64/libbz2.so
ln -s libbz2.so.$pkgver "${OUTDIR}"/usr/lib64/libbz2.so.${pkgver%%.*}

rm -rf $OUTDIR/usr/share
55 changes: 55 additions & 0 deletions images/packages/binaries/file/werf.inc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
image: {{ $.ImageType }}/{{ $.ImageName }}
final: false
fromImage: builder/scratch
import:
- image: {{ $.ImageType }}/{{ $.ImageName }}-builder
add: /out
to: /{{ $.ImageName }}
before: setup
---
{{- $version := get $.Package $.ImageName }}
{{- $gitRepoUrl := "file/file.git" }}

{{- $name := print $.ImageName "-dependencies" -}}
{{- define "$name" -}}
packages:
- gcc git libtool
- make automake autoconf libtool makeinfo
- pkg-config
- bison
- bzlib-devel libcap-devel liblzma-devel libseccomp-devel libzstd-devel zlib-devel lzip ncompress strace
{{- end -}}


{{ $builderDependencies := include "$name" . | fromYaml }}

image: {{ $.ImageType }}/{{ $.ImageName }}-builder
final: false
fromImage: builder/alt
secrets:
- id: SOURCE_REPO
value: {{ $.SOURCE_REPO_GIT }}
shell:
beforeInstall:
- |
apt-get update && apt-get install -y \
{{ $builderDependencies.packages | join " " }}

apt-get clean
rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin

install:
- |
OUTDIR=/out
mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config

git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch {{ $version }} /src
cd /src

autoreconf -f -i
./configure --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share

make install -j $(nproc) DESTDIR=$OUTDIR

rm -rf $OUTDIR/share/man
1 change: 0 additions & 1 deletion werf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ build:
{{- $_ := set $.Packages $k $v}}
{{- end }}


{{- $_ := set $ "ImagesIDList" list }}

{{- range $path, $content := .Files.Glob ".werf/*.yaml" }}
Expand Down
Loading