2019-02-07 04:07:33 +03:00
#!/usr/bin/env python3
# Copyright (C) Catalyst.Net Ltd 2019
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Manage dependencies and bootstrap environments for Samba .
Config file for packages and templates .
2021-09-01 11:45:03 +03:00
Update the lists in this file to require new packages in the
container images used in GitLab CI
2019-02-07 04:07:33 +03:00
Author : Joe Guo < joeg @catalyst.net.nz >
"""
import os
from os . path import abspath , dirname , join
HERE = abspath ( dirname ( __file__ ) )
# output dir for rendered files
2019-04-11 11:34:28 +03:00
OUT = join ( HERE , ' generated-dists ' )
2019-02-07 04:07:33 +03:00
# pkgs with same name in all packaging systems
COMMON = [
2019-03-20 00:06:44 +03:00
' acl ' ,
2019-02-07 04:07:33 +03:00
' attr ' ,
' autoconf ' ,
' binutils ' ,
' bison ' ,
2020-03-29 17:49:51 +03:00
' ccache ' ,
2019-02-07 04:07:33 +03:00
' curl ' ,
2019-12-07 07:35:26 +03:00
' chrpath ' ,
2023-10-11 13:15:42 +03:00
' codespell ' ,
2019-04-19 12:04:58 +03:00
' flex ' ,
2019-02-07 04:07:33 +03:00
' gcc ' ,
' gdb ' ,
' git ' ,
2019-03-22 14:34:14 +03:00
' gzip ' ,
' hostname ' ,
2019-03-20 00:06:44 +03:00
' htop ' ,
2022-03-18 13:47:37 +03:00
' jq ' ,
2019-05-03 05:21:24 +03:00
' lcov ' ,
2019-02-07 04:07:33 +03:00
' make ' ,
2019-03-29 11:43:08 +03:00
' patch ' ,
2019-02-07 04:07:33 +03:00
' perl ' ,
' psmisc ' , # for pstree in test
2019-03-20 00:06:44 +03:00
' rng-tools ' ,
2019-03-29 11:43:08 +03:00
' rsync ' ,
2019-03-20 00:06:44 +03:00
' sed ' ,
2023-10-11 13:15:42 +03:00
' shfmt ' ,
2019-02-07 04:07:33 +03:00
' sudo ' , # docker images has no sudo by default
2019-03-29 11:43:08 +03:00
' tar ' ,
2019-03-20 00:06:44 +03:00
' tree ' ,
2020-03-29 17:49:51 +03:00
' wget ' ,
2024-07-05 23:23:09 +03:00
' cargo ' ,
2019-02-07 04:07:33 +03:00
]
# define pkgs for all packaging systems in parallel
# make it easier to find missing ones
# use latest ubuntu and fedora as defaults
# deb, rpm, ...
PKGS = [
# NAME1-dev, NAME2-devel
2019-03-28 14:04:15 +03:00
( ' lmdb-utils ' , ' lmdb ' ) ,
2019-05-23 16:01:52 +03:00
( ' mingw-w64 ' , ' mingw64-gcc ' ) ,
2019-02-07 04:07:33 +03:00
( ' zlib1g-dev ' , ' zlib-devel ' ) ,
( ' libbsd-dev ' , ' libbsd-devel ' ) ,
2020-02-07 13:00:21 +03:00
( ' liburing-dev ' , ' liburing-devel ' ) ,
2019-02-07 04:07:33 +03:00
( ' libarchive-dev ' , ' libarchive-devel ' ) ,
( ' libblkid-dev ' , ' libblkid-devel ' ) ,
2019-03-20 00:06:44 +03:00
( ' libcap-dev ' , ' libcap-devel ' ) ,
2019-02-07 04:07:33 +03:00
( ' libacl1-dev ' , ' libacl-devel ' ) ,
( ' libattr1-dev ' , ' libattr-devel ' ) ,
# libNAME1-dev, NAME2-devel
( ' libpopt-dev ' , ' popt-devel ' ) ,
( ' libreadline-dev ' , ' readline-devel ' ) ,
( ' libjansson-dev ' , ' jansson-devel ' ) ,
( ' liblmdb-dev ' , ' lmdb-devel ' ) ,
( ' libncurses5-dev ' , ' ncurses-devel ' ) ,
# NOTE: Debian 7+ or Ubuntu 16.04+
( ' libsystemd-dev ' , ' systemd-devel ' ) ,
( ' libkrb5-dev ' , ' krb5-devel ' ) ,
( ' libldap2-dev ' , ' openldap-devel ' ) ,
( ' libcups2-dev ' , ' cups-devel ' ) ,
( ' libpam0g-dev ' , ' pam-devel ' ) ,
( ' libgpgme11-dev ' , ' gpgme-devel ' ) ,
# NOTE: Debian 8+ and Ubuntu 14.04+
( ' libgnutls28-dev ' , ' gnutls-devel ' ) ,
2023-06-09 15:07:06 +03:00
( ' gnutls-bin ' , ' gnutls-utils ' ) ,
2019-05-09 19:21:24 +03:00
( ' libtasn1-bin ' , ' libtasn1-tools ' ) ,
2019-03-20 00:06:44 +03:00
( ' libtasn1-dev ' , ' libtasn1-devel ' ) ,
( ' ' , ' quota-devel ' ) ,
( ' uuid-dev ' , ' libuuid-devel ' ) ,
( ' libjs-jquery ' , ' ' ) ,
2019-03-20 00:08:08 +03:00
( ' libavahi-common-dev ' , ' avahi-devel ' ) ,
( ' libdbus-1-dev ' , ' dbus-devel ' ) ,
( ' libpcap-dev ' , ' libpcap-devel ' ) ,
( ' libunwind-dev ' , ' libunwind-devel ' ) , # for back trace
2019-03-29 14:13:09 +03:00
( ' libglib2.0-dev ' , ' glib2-devel ' ) ,
2019-04-09 17:55:37 +03:00
( ' libicu-dev ' , ' libicu-devel ' ) ,
2019-10-30 23:49:55 +03:00
( ' heimdal-multidev ' , ' ' ) ,
2019-02-07 04:07:33 +03:00
# NAME1, NAME2
# for debian, locales provide locale support with language packs
# ubuntu split language packs to language-pack-xx
# for centos, glibc-common provide locale support with language packs
# fedora split language packs to glibc-langpack-xx
( ' locales ' , ' glibc-common ' ) , # required for locale
( ' language-pack-en ' , ' glibc-langpack-en ' ) , # we need en_US.UTF-8
( ' bind9utils ' , ' bind-utils ' ) ,
( ' dnsutils ' , ' ' ) ,
( ' xsltproc ' , ' libxslt ' ) ,
2021-07-20 16:55:53 +03:00
( ' krb5-user ' , ' krb5-workstation ' ) ,
2019-03-20 00:06:44 +03:00
( ' krb5-config ' , ' ' ) ,
2019-04-29 11:51:33 +03:00
( ' krb5-kdc ' , ' krb5-server ' ) ,
2019-02-07 04:07:33 +03:00
( ' apt-utils ' , ' yum-utils ' ) ,
( ' pkg-config ' , ' pkgconfig ' ) ,
( ' procps ' , ' procps-ng ' ) , # required for the free cmd in tests
2022-10-27 01:39:02 +03:00
( ' lsb-release ' , ' lsb-release ' ) , # we need lsb_release to show info
2019-02-07 04:07:33 +03:00
( ' ' , ' rpcgen ' ) , # required for test
# refer: https://fedoraproject.org/wiki/Changes/SunRPCRemoval
( ' ' , ' libtirpc-devel ' ) , # for <rpc/rpc.h> header on fedora
2019-04-25 11:14:44 +03:00
( ' ' , ' rpcsvc-proto-devel ' ) , # for <rpcsvc/rquota.h> header
2019-03-20 00:06:44 +03:00
( ' mawk ' , ' gawk ' ) ,
2022-02-13 14:08:57 +03:00
( ' ' , ' mold ' ) ,
2023-10-11 13:15:42 +03:00
( ' shellcheck ' , ' ShellCheck ' ) ,
2023-04-20 09:25:31 +03:00
( ' ' , ' crypto-policies-scripts ' ) ,
2019-02-07 04:07:33 +03:00
2019-04-30 10:48:39 +03:00
( ' python3 ' , ' python3 ' ) ,
2020-03-24 17:36:48 +03:00
( ' python3-cryptography ' , ' python3-cryptography ' ) , # for krb5 tests
2019-02-07 04:07:33 +03:00
( ' python3-dev ' , ' python3-devel ' ) ,
2019-03-20 00:06:44 +03:00
( ' python3-dbg ' , ' ' ) ,
2020-08-18 05:50:36 +03:00
( ' python3-iso8601 ' , ' python3-iso8601 ' ) ,
2019-02-07 04:07:33 +03:00
( ' python3-gpg ' , ' python3-gpg ' ) , # defaults to ubuntu/fedora latest
( ' python3-markdown ' , ' python3-markdown ' ) ,
( ' python3-dnspython ' , ' python3-dns ' ) ,
2019-03-20 00:06:44 +03:00
( ' python3-pexpect ' , ' ' ) , # for wintest only
2020-03-24 17:36:48 +03:00
( ' python3-pyasn1 ' , ' python3-pyasn1 ' ) , # for krb5 tests
2019-11-08 23:06:53 +03:00
( ' python3-setproctitle ' , ' python3-setproctitle ' ) ,
2022-05-06 18:06:23 +03:00
( ' python3-requests ' , ' python3-requests ' ) , # for cert auto enroll
2019-02-07 04:07:33 +03:00
2021-11-04 11:31:08 +03:00
( ' ' , ' python3-libsemanage ' ) ,
( ' ' , ' python3-policycoreutils ' ) ,
2019-02-07 04:07:33 +03:00
# perl
( ' libparse-yapp-perl ' , ' perl-Parse-Yapp ' ) ,
2019-03-20 00:06:44 +03:00
( ' perl-modules ' , ' ' ) ,
2020-11-04 18:15:16 +03:00
( ' ' , ' perl-FindBin ' ) ,
2019-03-20 00:06:44 +03:00
( ' ' , ' perl-Archive-Tar ' ) ,
( ' ' , ' perl-ExtUtils-MakeMaker ' ) ,
( ' ' , ' perl-Test-Base ' ) ,
( ' ' , ' perl-generators ' ) ,
( ' ' , ' perl-interpreter ' ) ,
2019-02-07 04:07:33 +03:00
2019-04-25 12:10:15 +03:00
# fs
( ' xfslibs-dev ' , ' xfsprogs-devel ' ) , # for xfs quota support
2019-04-25 11:23:45 +03:00
( ' ' , ' glusterfs-api-devel ' ) ,
( ' glusterfs-common ' , ' glusterfs-devel ' ) ,
( ' libcephfs-dev ' , ' libcephfs-devel ' ) ,
2019-04-25 12:10:15 +03:00
2021-05-18 10:14:09 +03:00
# spotlight
( ' libtracker-sparql-2.0-dev ' , ' tracker-devel ' ) ,
2019-02-07 04:07:33 +03:00
# misc
# @ means group for rpm, use fedora as rpm default
( ' build-essential ' , ' @development-tools ' ) ,
( ' debhelper ' , ' ' ) ,
# rpm has no pkg for docbook-xml
( ' docbook-xml ' , ' docbook-dtds ' ) ,
( ' docbook-xsl ' , ' docbook-style-xsl ' ) ,
2023-03-31 20:42:13 +03:00
( ' libkeyutils-dev ' , ' keyutils-libs-devel ' ) ,
2019-03-22 14:34:14 +03:00
( ' ' , ' which ' ) ,
2021-10-14 02:01:16 +03:00
( ' xz-utils ' , ' xz ' )
2019-02-07 04:07:33 +03:00
]
DEB_PKGS = COMMON + [ pkg for pkg , _ in PKGS if pkg ]
RPM_PKGS = COMMON + [ pkg for _ , pkg in PKGS if pkg ]
2019-04-11 11:34:28 +03:00
GENERATED_MARKER = r """
#
# This file is generated by 'bootstrap/template.py --render'
# See also bootstrap/config.py
#
"""
2019-02-07 04:07:33 +03:00
APT_BOOTSTRAP = r """
#!/bin/bash
2019-04-11 11:34:28 +03:00
{ GENERATED_MARKER }
2019-02-07 04:07:33 +03:00
set - xueo pipefail
export DEBIAN_FRONTEND = noninteractive
apt - get - y update
apt - get - y install \
{ pkgs }
apt - get - y autoremove
apt - get - y autoclean
apt - get - y clean
"""
YUM_BOOTSTRAP = r """
#!/bin/bash
2019-04-11 11:34:28 +03:00
{ GENERATED_MARKER }
2019-02-07 04:07:33 +03:00
set - xueo pipefail
2019-04-30 09:33:15 +03:00
yum update - y
yum install - y epel - release
2019-08-08 09:18:55 +03:00
yum install - y yum - plugin - copr
yum copr enable - y sergiomb / SambaAD
2019-04-30 09:33:15 +03:00
yum update - y
2019-02-07 04:07:33 +03:00
2019-04-30 09:33:15 +03:00
yum install - y \
2019-02-07 04:07:33 +03:00
{ pkgs }
yum clean all
2019-04-30 10:48:39 +03:00
if [ ! - f / usr / bin / python3 ] ; then
2019-05-06 11:33:01 +03:00
ln - sf / usr / bin / python3 .6 / usr / bin / python3
2019-04-30 10:48:39 +03:00
fi
2019-02-07 04:07:33 +03:00
"""
2024-08-27 18:32:43 +03:00
ROCKY8_DNF_BOOTSTRAP = r """
2019-10-07 12:28:24 +03:00
#!/bin/bash
{ GENERATED_MARKER }
set - xueo pipefail
yum update - y
yum install - y dnf - plugins - core
yum install - y epel - release
2020-06-17 15:16:13 +03:00
yum - v repolist all
2022-10-10 03:54:08 +03:00
yum config - manager - - set - enabled powertools - y
2022-02-03 09:53:33 +03:00
2019-10-07 12:28:24 +03:00
yum update - y
yum install - y \
- - setopt = install_weak_deps = False \
{ pkgs }
yum clean all
"""
2019-02-07 04:07:33 +03:00
2024-06-07 15:16:28 +03:00
CENTOS9S_DNF_BOOTSTRAP = r """
#!/bin/bash
{ GENERATED_MARKER }
set - xueo pipefail
dnf update - y
dnf install - y dnf - plugins - core
dnf install - y epel - release
dnf install - y centos - release - gluster9
dnf - v repolist all
dnf config - manager - - set - enabled crb - y
dnf update - y
dnf install - y \
- - setopt = install_weak_deps = False \
{ pkgs }
dnf clean all
"""
2019-02-07 04:07:33 +03:00
DNF_BOOTSTRAP = r """
#!/bin/bash
2019-04-11 11:34:28 +03:00
{ GENERATED_MARKER }
2019-02-07 04:07:33 +03:00
set - xueo pipefail
2019-04-23 12:40:07 +03:00
dnf update - y
2019-02-07 04:07:33 +03:00
2019-04-23 12:40:07 +03:00
dnf install - y \
2019-04-30 11:10:24 +03:00
- - setopt = install_weak_deps = False \
2019-02-07 04:07:33 +03:00
{ pkgs }
dnf clean all
2023-04-20 09:25:31 +03:00
update - crypto - policies - - set DEFAULT : AD - SUPPORT
2019-03-07 07:02:50 +03:00
"""
2019-02-07 04:07:33 +03:00
2022-01-18 13:13:21 +03:00
DNF_BOOTSTRAP_MIT = r """
#!/bin/bash
{ GENERATED_MARKER }
set - xueo pipefail
dnf update - y
dnf install - y dnf - plugins - core
dnf copr - y enable abbra / krb5 - test
dnf update - y
dnf install - y \
- - setopt = install_weak_deps = False \
{ pkgs }
dnf clean all
"""
2019-03-22 16:15:31 +03:00
ZYPPER_BOOTSTRAP = r """
#!/bin/bash
2019-04-11 11:34:28 +03:00
{ GENERATED_MARKER }
2019-03-22 16:15:31 +03:00
set - xueo pipefail
zypper - - non - interactive refresh
zypper - - non - interactive update
zypper - - non - interactive install \
2019-04-30 10:59:15 +03:00
- - no - recommends \
system - user - nobody \
{ pkgs }
2019-03-22 16:15:31 +03:00
zypper - - non - interactive clean
if [ - f / usr / lib / mit / bin / krb5 - config ] ; then
ln - sf / usr / lib / mit / bin / krb5 - config / usr / bin / krb5 - config
fi
"""
2019-02-07 04:07:33 +03:00
2019-03-07 07:02:50 +03:00
# A generic shell script to setup locale
LOCALE_SETUP = r """
#!/bin/bash
2019-04-11 11:34:28 +03:00
{ GENERATED_MARKER }
2019-03-07 07:02:50 +03:00
set - xueo pipefail
# refer to /usr/share/i18n/locales
INPUTFILE = en_US
# refer to /usr/share/i18n/charmaps
CHARMAP = UTF - 8
# locale to generate in /usr/lib/locale
# glibc/localedef will normalize UTF-8 to utf8, follow the naming style
LOCALE = $ INPUTFILE . utf8
# if locale is already correct, exit
( locale | grep LC_ALL | grep - i $ LOCALE ) & & exit 0
# if locale not available, generate locale into /usr/lib/locale
if ! ( locale - - all - locales | grep - i $ LOCALE )
then
# no-archive means create its own dir
localedef - - inputfile $ INPUTFILE - - charmap $ CHARMAP - - no - archive $ LOCALE
fi
2019-02-07 04:07:33 +03:00
2019-03-07 07:02:50 +03:00
# update locale conf and global env file
# set both LC_ALL and LANG for safe
# update conf for Debian family
FILE = / etc / default / locale
if [ - f $ FILE ]
then
echo LC_ALL = " $LOCALE " > $ FILE
echo LANG = " $LOCALE " >> $ FILE
fi
# update conf for RedHat family
FILE = / etc / locale . conf
if [ - f $ FILE ]
then
# LC_ALL is not valid in this file, set LANG only
echo LANG = " $LOCALE " > $ FILE
fi
# update global env file
FILE = / etc / environment
if [ - f $ FILE ]
then
# append LC_ALL if not exist
grep LC_ALL $ FILE | | echo LC_ALL = " $LOCALE " >> $ FILE
# append LANG if not exist
grep LANG $ FILE | | echo LANG = " $LOCALE " >> $ FILE
fi
2019-02-07 04:07:33 +03:00
"""
DOCKERFILE = r """
2019-04-11 11:34:28 +03:00
{ GENERATED_MARKER }
2019-02-07 04:07:33 +03:00
FROM { docker_image }
2019-03-19 06:31:47 +03:00
# pass in with --build-arg while build
ARG SHA1SUM
RUN [ - n $ SHA1SUM ] & & echo $ SHA1SUM > / sha1sum . txt
2019-03-07 07:02:50 +03:00
ADD * . sh / tmp /
2019-02-07 04:07:33 +03:00
# need root permission, do it before USER samba
2019-03-07 07:02:50 +03:00
RUN / tmp / bootstrap . sh & & / tmp / locale . sh
2019-02-07 04:07:33 +03:00
2019-03-21 01:04:24 +03:00
# if ld.gold exists, force link it to ld
2022-05-27 11:54:25 +03:00
RUN set - x ; ! LD_GOLD = $ ( which ld . gold ) | | { { LD = $ ( which ld ) & & ln - sf $ LD_GOLD $ LD & & test - x $ LD & & echo " $LD is now $LD_GOLD " ; } }
2022-02-13 14:01:47 +03:00
# if ld.mold exists, force link it to ld (prefer mold over gold! ;-)
2022-05-27 11:54:25 +03:00
RUN set - x ; ! LD_MOLD = $ ( which ld . mold ) | | { { LD = $ ( which ld ) & & ln - sf $ LD_MOLD $ LD & & test - x $ LD & & echo " $LD is now $LD_MOLD " ; } }
2019-03-21 01:04:24 +03:00
2019-02-07 04:07:33 +03:00
# make test can not work with root, so we have to create a new user
2019-03-27 20:00:09 +03:00
RUN useradd - m - U - s / bin / bash samba & & \
2019-02-07 04:07:33 +03:00
mkdir - p / etc / sudoers . d & & \
echo " samba ALL=(ALL) NOPASSWD:ALL " > / etc / sudoers . d / samba
USER samba
WORKDIR / home / samba
# samba tests rely on this
2023-06-09 15:02:48 +03:00
ENV USER = samba LC_ALL = en_US . utf8 LANG = en_US . utf8 LANGUAGE = en_US
2019-02-07 04:07:33 +03:00
"""
# Vagrantfile snippet for each dist
VAGRANTFILE_SNIPPET = r """
config . vm . define " {name} " do | v |
v . vm . box = " {vagrant_box} "
v . vm . hostname = " {name} "
v . vm . provision : shell , path : " {name} /bootstrap.sh "
2019-03-07 07:02:50 +03:00
v . vm . provision : shell , path : " {name} /locale.sh "
2019-02-07 04:07:33 +03:00
end
"""
# global Vagrantfile with snippets for all dists
VAGRANTFILE_GLOBAL = r """
2019-04-11 11:34:28 +03:00
{ GENERATED_MARKER }
2019-02-07 04:07:33 +03:00
Vagrant . configure ( " 2 " ) do | config |
config . ssh . insert_key = false
{ vagrantfile_snippets }
end
"""
DEB_DISTS = {
2021-10-14 06:50:41 +03:00
' debian11 ' : {
' docker_image ' : ' debian:11 ' ,
' vagrant_box ' : ' debian/bullseye64 ' ,
' replace ' : {
' language-pack-en ' : ' ' , # included in locales
2023-10-11 13:15:42 +03:00
' shfmt ' : ' ' ,
2021-10-14 06:50:41 +03:00
}
} ,
2022-11-17 18:14:27 +03:00
' debian11-32bit ' : {
' docker_image ' : ' registry-1.docker.io/i386/debian:11 ' ,
' vagrant_box ' : ' debian/bullseye32 ' ,
' replace ' : {
' language-pack-en ' : ' ' , # included in locales
2023-10-11 13:15:42 +03:00
' shfmt ' : ' ' ,
2022-11-17 18:14:27 +03:00
}
} ,
' debian12 ' : {
' docker_image ' : ' debian:12 ' ,
' vagrant_box ' : ' debian/bookworm64 ' ,
' replace ' : {
' language-pack-en ' : ' ' , # included in locales
' libtracker-sparql-2.0-dev ' : ' ' , # only tracker 3.x is available
}
} ,
' debian12-32bit ' : {
' docker_image ' : ' registry-1.docker.io/i386/debian:12 ' ,
' vagrant_box ' : ' debian/bookworm32 ' ,
' replace ' : {
' language-pack-en ' : ' ' , # included in locales
' libtracker-sparql-2.0-dev ' : ' ' , # only tracker 3.x is available
}
} ,
2019-02-07 04:07:33 +03:00
' ubuntu1804 ' : {
' docker_image ' : ' ubuntu:18.04 ' ,
' vagrant_box ' : ' ubuntu/bionic64 ' ,
2020-02-07 13:00:21 +03:00
' replace ' : {
' liburing-dev ' : ' ' , # not available
2023-10-11 13:15:42 +03:00
' shfmt ' : ' ' ,
2020-02-07 13:00:21 +03:00
}
2019-02-07 04:07:33 +03:00
} ,
2022-11-22 12:41:39 +03:00
' ubuntu1804-32bit ' : {
' docker_image ' : ' registry-1.docker.io/i386/ubuntu:18.04 ' ,
' vagrant_box ' : ' ubuntu/bionic32 ' ,
' replace ' : {
' liburing-dev ' : ' ' , # not available
2023-10-11 13:15:42 +03:00
' shfmt ' : ' ' ,
2022-11-22 12:41:39 +03:00
}
} ,
2020-03-26 00:17:46 +03:00
' ubuntu2004 ' : {
' docker_image ' : ' ubuntu:20.04 ' ,
' vagrant_box ' : ' ubuntu/focal64 ' ,
' replace ' : {
' liburing-dev ' : ' ' , # not available
2023-10-11 13:15:42 +03:00
' shfmt ' : ' ' ,
2020-03-26 00:17:46 +03:00
}
} ,
2022-11-02 18:56:31 +03:00
' ubuntu2204 ' : {
' docker_image ' : ' ubuntu:22.04 ' ,
' vagrant_box ' : ' ubuntu/jammy64 ' ,
' replace ' : {
' libtracker-sparql-2.0-dev ' : ' ' , # only tracker 3.x is available
} ,
}
2019-02-07 04:07:33 +03:00
}
RPM_DISTS = {
2024-08-27 18:32:43 +03:00
' rocky8 ' : {
' docker_image ' : ' docker.io/library/rockylinux:8 ' ,
' vagrant_box ' : ' rocky/8 ' ,
' bootstrap ' : ROCKY8_DNF_BOOTSTRAP ,
2019-10-07 12:28:24 +03:00
' replace ' : {
' lsb-release ' : ' redhat-lsb ' ,
' @development-tools ' : ' " @Development Tools " ' , # add quotes
' lcov ' : ' ' , # does not exist
' perl-JSON-Parse ' : ' ' , # does not exist?
' perl-Test-Base ' : ' perl-Test-Simple ' ,
2020-11-04 18:15:16 +03:00
' perl-FindBin ' : ' ' ,
2020-02-07 13:00:21 +03:00
' liburing-devel ' : ' ' , # not available yet, Add me back, once available!
2022-02-13 14:08:57 +03:00
' mold ' : ' ' ,
2022-02-21 13:29:29 +03:00
' ShellCheck ' : ' ' ,
' shfmt ' : ' ' ,
2023-03-22 12:17:13 +03:00
' codespell ' : ' ' ,
2019-10-07 12:28:24 +03:00
}
} ,
2024-06-07 15:16:28 +03:00
' centos9s ' : {
' docker_image ' : ' quay.io/centos/centos:stream9 ' ,
' vagrant_box ' : ' centos/stream9 ' ,
' bootstrap ' : CENTOS9S_DNF_BOOTSTRAP ,
' replace ' : {
' lsb-release ' : ' lsb_release ' ,
' @development-tools ' : ' " @Development Tools " ' , # add quotes
' lcov ' : ' ' , # does not exist
' perl-JSON-Parse ' : ' ' , # does not exist?
' perl-Test-Base ' : ' perl-Test-Simple ' ,
' perl-FindBin ' : ' ' ,
' mold ' : ' ' ,
' ShellCheck ' : ' ' ,
' shfmt ' : ' ' ,
' codespell ' : ' ' ,
' libcephfs-devel ' : ' ' , # not available anymore
' curl ' : ' ' , # Use installed curl-minimal
}
} ,
2024-04-30 12:30:48 +03:00
' fedora40 ' : {
' docker_image ' : ' quay.io/fedora/fedora:40 ' ,
' vagrant_box ' : ' fedora/40-cloud-base ' ,
2020-03-19 12:32:17 +03:00
' bootstrap ' : DNF_BOOTSTRAP ,
' replace ' : {
' lsb-release ' : ' redhat-lsb ' ,
2021-05-06 16:24:06 +03:00
' perl-FindBin ' : ' ' ,
2021-07-21 10:32:42 +03:00
' python3-iso8601 ' : ' python3-dateutil ' ,
2022-01-18 13:13:21 +03:00
' libtracker-sparql-2.0-dev ' : ' ' , # only tracker 3.x is available
}
} ,
2022-11-17 18:14:27 +03:00
' opensuse155 ' : {
' docker_image ' : ' opensuse/leap:15.5 ' ,
' vagrant_box ' : ' opensuse/openSUSE-15.5-x86_64 ' ,
2019-06-18 12:03:41 +03:00
' bootstrap ' : ZYPPER_BOOTSTRAP ,
' replace ' : {
' @development-tools ' : ' ' ,
' dbus-devel ' : ' dbus-1-devel ' ,
' docbook-style-xsl ' : ' docbook-xsl-stylesheets ' ,
' glibc-common ' : ' glibc-locale ' ,
' glibc-locale-source ' : ' glibc-i18ndata ' ,
' glibc-langpack-en ' : ' ' ,
' jansson-devel ' : ' libjansson-devel ' ,
' keyutils-libs-devel ' : ' keyutils-devel ' ,
' krb5-workstation ' : ' krb5-client ' ,
2022-10-27 10:05:46 +03:00
' python3-libsemanage ' : ' python3-semanage ' ,
2019-06-18 12:03:41 +03:00
' openldap-devel ' : ' openldap2-devel ' ,
' perl-Archive-Tar ' : ' perl-Archive-Tar-Wrapper ' ,
' perl-JSON-Parse ' : ' perl-JSON-XS ' ,
' perl-generators ' : ' ' ,
' perl-interpreter ' : ' ' ,
2020-11-04 18:15:16 +03:00
' perl-FindBin ' : ' ' ,
2019-03-22 16:15:31 +03:00
' procps-ng ' : ' procps ' ,
2021-07-21 10:32:42 +03:00
' python3-iso8601 ' : ' python3-python-dateutil ' ,
2019-03-22 16:15:31 +03:00
' python3-dns ' : ' python3-dnspython ' ,
' python3-markdown ' : ' python3-Markdown ' ,
' quota-devel ' : ' ' ,
2019-04-25 11:23:45 +03:00
' glusterfs-api-devel ' : ' ' ,
2023-06-09 15:07:06 +03:00
' gnutls-utils ' : ' gnutls ' ,
2019-05-09 19:21:24 +03:00
' libtasn1-tools ' : ' ' , # asn1Parser is part of libtasn1
2022-02-13 14:08:57 +03:00
' mold ' : ' ' ,
2022-02-21 13:29:29 +03:00
' shfmt ' : ' ' ,
2022-10-27 10:05:46 +03:00
' yum-utils ' : ' ' ,
2019-03-22 16:15:31 +03:00
}
}
2019-02-07 04:07:33 +03:00
}
DEB_FAMILY = {
' name ' : ' deb ' ,
' pkgs ' : DEB_PKGS ,
' bootstrap ' : APT_BOOTSTRAP , # family default
' dists ' : DEB_DISTS ,
}
RPM_FAMILY = {
' name ' : ' rpm ' ,
' pkgs ' : RPM_PKGS ,
' bootstrap ' : YUM_BOOTSTRAP , # family default
' dists ' : RPM_DISTS ,
}
YML_HEADER = r """
- - -
packages :
"""
def expand_family_dists ( family ) :
dists = { }
for name , config in family [ ' dists ' ] . items ( ) :
config = config . copy ( )
config [ ' name ' ] = name
config [ ' home ' ] = join ( OUT , name )
config [ ' family ' ] = family [ ' name ' ]
2019-04-11 11:34:28 +03:00
config [ ' GENERATED_MARKER ' ] = GENERATED_MARKER
2019-02-07 04:07:33 +03:00
# replace dist specific pkgs
replace = config . get ( ' replace ' , { } )
pkgs = [ ]
for pkg in family [ ' pkgs ' ] :
pkg = replace . get ( pkg , pkg ) # replace if exists or get self
if pkg :
pkgs . append ( pkg )
pkgs . sort ( )
lines = [ ' - {} ' . format ( pkg ) for pkg in pkgs ]
config [ ' packages.yml ' ] = YML_HEADER . lstrip ( ) + os . linesep . join ( lines )
sep = ' \\ ' + os . linesep + ' '
config [ ' pkgs ' ] = sep . join ( pkgs )
# get dist bootstrap template or fall back to family default
bootstrap_template = config . get ( ' bootstrap ' , family [ ' bootstrap ' ] )
config [ ' bootstrap.sh ' ] = bootstrap_template . format ( * * config ) . strip ( )
2019-03-07 07:02:50 +03:00
config [ ' locale.sh ' ] = LOCALE_SETUP . format ( * * config ) . strip ( )
2019-02-07 04:07:33 +03:00
config [ ' Dockerfile ' ] = DOCKERFILE . format ( * * config ) . strip ( )
# keep the indent, no strip
config [ ' vagrantfile_snippet ' ] = VAGRANTFILE_SNIPPET . format ( * * config )
dists [ name ] = config
return dists
# expanded config for dists
DEB_DISTS_EXP = expand_family_dists ( DEB_FAMILY )
RPM_DISTS_EXP = expand_family_dists ( RPM_FAMILY )
# assemble all together
DISTS = { }
DISTS . update ( DEB_DISTS_EXP )
DISTS . update ( RPM_DISTS_EXP )
def render_vagrantfile ( dists ) :
"""
Render all snippets for each dist into global Vagrantfile .
Vagrant supports multiple vms in one Vagrantfile .
This make it easier to manage the fleet , e . g :
start all : vagrant up
start one : vagrant up ubuntu1804
All other commands apply to above syntax , e . g . : status , destroy , provision
"""
# sort dists by name and put all vagrantfile snippets together
snippets = [
dists [ dist ] [ ' vagrantfile_snippet ' ]
for dist in sorted ( dists . keys ( ) ) ]
2019-04-11 11:34:28 +03:00
return VAGRANTFILE_GLOBAL . format (
vagrantfile_snippets = ' ' . join ( snippets ) ,
GENERATED_MARKER = GENERATED_MARKER
)
2019-02-07 04:07:33 +03:00
VAGRANTFILE = render_vagrantfile ( DISTS )
# data we need to expose
__all__ = [ ' DISTS ' , ' VAGRANTFILE ' , ' OUT ' ]