bootstrap: Add OpenSUSE 15.1 image
[samba.git] / bootstrap / config.py
index 33f2df011321894c5cfbd73286f4f3702e93c46e..9126961fc9354c6e82736c9c672dac4b30dddb77 100644 (file)
@@ -26,7 +26,7 @@ import os
 from os.path import abspath, dirname, join
 HERE = abspath(dirname(__file__))
 # output dir for rendered files
-OUT = join(HERE, 'dists')
+OUT = join(HERE, 'generated-dists')
 
 
 # pkgs with same name in all packaging systems
@@ -37,10 +37,14 @@ COMMON = [
     'binutils',
     'bison',
     'curl',
+    'flex',
     'gcc',
     'gdb',
     'git',
+    'gzip',
+    'hostname',
     'htop',
+    'lcov',
     'make',
     'patch',
     'perl',
@@ -60,7 +64,8 @@ COMMON = [
 # deb, rpm, ...
 PKGS = [
     # NAME1-dev, NAME2-devel
-    ('lmdb-utils', 'lmdb-devel'),
+    ('lmdb-utils', 'lmdb'),
+    ('mingw-w64', 'mingw64-gcc'),
     ('nettle-dev', 'nettle-devel'),
     ('zlib1g-dev', 'zlib-devel'),
     ('libbsd-dev', 'libbsd-devel'),
@@ -86,7 +91,7 @@ PKGS = [
     ('libgpgme11-dev', 'gpgme-devel'),
     # NOTE: Debian 8+ and Ubuntu 14.04+
     ('libgnutls28-dev', 'gnutls-devel'),
-    ('libtasn1-bin', ''),
+    ('libtasn1-bin', 'libtasn1-tools'),
     ('libtasn1-dev', 'libtasn1-devel'),
     ('', 'quota-devel'),
     ('uuid-dev', 'libuuid-devel'),
@@ -95,6 +100,8 @@ PKGS = [
     ('libdbus-1-dev', 'dbus-devel'),
     ('libpcap-dev', 'libpcap-devel'),
     ('libunwind-dev', 'libunwind-devel'),  # for back trace
+    ('libglib2.0-dev', 'glib2-devel'),
+    ('libicu-dev', 'libicu-devel'),
 
     # NAME1, NAME2
     # for debian, locales provide locale support with language packs
@@ -108,15 +115,16 @@ PKGS = [
     ('xsltproc', 'libxslt'),
     ('krb5-user', ''),
     ('krb5-config', ''),
-    ('', 'krb5-server'),
+    ('krb5-kdc', 'krb5-server'),
     ('apt-utils', 'yum-utils'),
     ('pkg-config', 'pkgconfig'),
     ('procps', 'procps-ng'),  # required for the free cmd in tests
-    ('lsb-release', 'redhat-lsb'),  # we need lsb_relase to show info
+    ('lsb-release', 'lsb-release'),  # we need lsb_relase to show info
     ('', 'rpcgen'),  # required for test
     # refer: https://fedoraproject.org/wiki/Changes/SunRPCRemoval
     ('', 'libtirpc-devel'),  # for <rpc/rpc.h> header on fedora
     ('', 'libnsl2-devel'),  # for <rpcsvc/yp_prot.h> header on fedora
+    ('', 'rpcsvc-proto-devel'), # for <rpcsvc/rquota.h> header
     ('mawk', 'gawk'),
 
     # python
@@ -129,6 +137,7 @@ PKGS = [
     ('python-dnspython', 'python-dns'),
     ('python-pexpect', ''),  # for wintest only
 
+    ('python3', 'python3'),
     ('python3-dev', 'python3-devel'),
     ('python3-dbg', ''),
     ('python3-iso8601', ''),
@@ -152,6 +161,12 @@ PKGS = [
     ('', 'perl-generators'),
     ('', 'perl-interpreter'),
 
+    # fs
+    ('xfslibs-dev', 'xfsprogs-devel'), # for xfs quota support
+    ('', 'glusterfs-api-devel'),
+    ('glusterfs-common', 'glusterfs-devel'),
+    ('libcephfs-dev', 'libcephfs-devel'),
+
     # misc
     # @ means group for rpm, use fedora as rpm default
     ('build-essential', '@development-tools'),
@@ -159,18 +174,25 @@ PKGS = [
     # rpm has no pkg for docbook-xml
     ('docbook-xml', 'docbook-dtds'),
     ('docbook-xsl', 'docbook-style-xsl'),
-    ('flex', ''),
     ('', 'keyutils-libs-devel'),
-
+    ('', 'which'),
 ]
 
 
 DEB_PKGS = COMMON + [pkg for pkg, _ in PKGS if pkg]
 RPM_PKGS = COMMON + [pkg for _, pkg in PKGS if pkg]
 
+GENERATED_MARKER = r"""
+#
+# This file is generated by 'bootstrap/template.py --render'
+# See also bootstrap/config.py
+#
+"""
+
 
 APT_BOOTSTRAP = r"""
 #!/bin/bash
+{GENERATED_MARKER}
 set -xueo pipefail
 
 export DEBIAN_FRONTEND=noninteractive
@@ -187,35 +209,61 @@ apt-get -y clean
 
 YUM_BOOTSTRAP = r"""
 #!/bin/bash
+{GENERATED_MARKER}
 set -xueo pipefail
 
-yum -y -q update
-yum -y -q install epel-release
-yum -y -q update
+yum update -y
+yum install -y epel-release
+yum update -y
 
-yum -y -q --verbose install \
+yum install -y \
     {pkgs}
 
 yum clean all
+
+if [ ! -f /usr/bin/python3 ]; then
+    ln -sf /usr/bin/python3.6 /usr/bin/python3
+fi
 """
 
 
 DNF_BOOTSTRAP = r"""
 #!/bin/bash
+{GENERATED_MARKER}
 set -xueo pipefail
 
-dnf -y -q update
+dnf update -y
 
-dnf -y -q --verbose install \
+dnf install -y \
+    --setopt=install_weak_deps=False \
     {pkgs}
 
 dnf clean all
 """
 
+ZYPPER_BOOTSTRAP = r"""
+#!/bin/bash
+{GENERATED_MARKER}
+set -xueo pipefail
+
+zypper --non-interactive refresh
+zypper --non-interactive update
+zypper --non-interactive install \
+    --no-recommends \
+    system-user-nobody \
+    {pkgs}
+
+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
+"""
 
 # A generic shell script to setup locale
 LOCALE_SETUP = r"""
 #!/bin/bash
+{GENERATED_MARKER}
 set -xueo pipefail
 
 # refer to /usr/share/i18n/locales
@@ -268,6 +316,7 @@ fi
 
 
 DOCKERFILE = r"""
+{GENERATED_MARKER}
 FROM {docker_image}
 
 # pass in with --build-arg while build
@@ -282,7 +331,7 @@ RUN /tmp/bootstrap.sh && /tmp/locale.sh
 RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"
 
 # make test can not work with root, so we have to create a new user
-RUN useradd -m -s /bin/bash samba && \
+RUN useradd -m -U -s /bin/bash samba && \
     mkdir -p /etc/sudoers.d && \
     echo "samba ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/samba
 
@@ -304,6 +353,8 @@ VAGRANTFILE_SNIPPET = r"""
 
 # global Vagrantfile with snippets for all dists
 VAGRANTFILE_GLOBAL = r"""
+{GENERATED_MARKER}
+
 Vagrant.configure("2") do |config|
     config.ssh.insert_key = false
 
@@ -354,6 +405,8 @@ DEB_DISTS = {
             'lmdb-utils': 'lmdb-utils/trusty-backports',
             'liblmdb-dev': 'liblmdb-dev/trusty-backports',
             'libunwind-dev': 'libunwind8-dev',
+            'glusterfs-common': '',
+            'libcephfs-dev': '',
         }
     },
     'ubuntu1604': {
@@ -362,6 +415,8 @@ DEB_DISTS = {
         'replace': {
             'python-gpg': 'python-gpgme',
             'python3-gpg': 'python3-gpgme',
+            'glusterfs-common': '',
+            'libcephfs-dev': '',
         }
     },
     'ubuntu1804': {
@@ -377,7 +432,9 @@ RPM_DISTS = {
         'vagrant_box': 'centos/6',
         'bootstrap': YUM_BOOTSTRAP,
         'replace': {
-            'python3-devel': 'python34-devel',
+            'lsb-release': 'redhat-lsb',
+            'python3': 'python36',
+            'python3-devel': 'python36-devel',
             'python2-gpg': 'pygpgme',
             'python3-gpg': '',  # no python3-gpg yet
             '@development-tools': '"@Development Tools"',  # add quotes
@@ -387,6 +444,10 @@ RPM_DISTS = {
             # update perl core modules on centos
             # fix: Can't locate Archive/Tar.pm in @INC
             'perl': 'perl-core',
+            'rpcsvc-proto-devel': '',
+            'glusterfs-api-devel': '',
+            'glusterfs-devel': '',
+            'libcephfs-devel': '',
         }
     },
     'centos7': {
@@ -394,10 +455,17 @@ RPM_DISTS = {
         'vagrant_box': 'centos/7',
         'bootstrap': YUM_BOOTSTRAP,
         'replace': {
-            'python3-devel': 'python34-devel',
+            'lsb-release': 'redhat-lsb',
+            'python3': 'python36',
+            'python3-crypto': 'python36-crypto',
+            'python3-devel': 'python36-devel',
+            'python3-dns': 'python36-dns',
+            'python3-gpg': 'python36-gpg',
+            'python3-iso8601' : 'python36-iso8601',
+            'python3-markdown': 'python36-markdown',
             # although python36-devel is available
             # after epel-release installed
-            # however, all other python3 pkgs are still python34-ish
+            # however, all other python3 pkgs are still python36-ish
             'python2-gpg': 'pygpgme',
             'python3-gpg': '',  # no python3-gpg yet
             '@development-tools': '"@Development Tools"',  # add quotes
@@ -406,18 +474,102 @@ RPM_DISTS = {
             # update perl core modules on centos
             # fix: Can't locate Archive/Tar.pm in @INC
             'perl': 'perl-core',
+            'rpcsvc-proto-devel': '',
+            'glusterfs-api-devel': '',
+            'glusterfs-devel': '',
+            'libcephfs-devel': '',
         }
     },
     'fedora28': {
         'docker_image': 'fedora:28',
         'vagrant_box': 'fedora/28-cloud-base',
         'bootstrap': DNF_BOOTSTRAP,
+        'replace': {
+            'lsb-release': 'redhat-lsb',
+        }
     },
     'fedora29': {
         'docker_image': 'fedora:29',
         'vagrant_box': 'fedora/29-cloud-base',
         'bootstrap': DNF_BOOTSTRAP,
+        'replace': {
+            'lsb-release': 'redhat-lsb',
+        }
     },
+    'fedora30': {
+        'docker_image': 'fedora:30',
+        'vagrant_box': 'fedora/30-cloud-base',
+        'bootstrap': DNF_BOOTSTRAP,
+        'replace': {
+            'lsb-release': 'redhat-lsb',
+        }
+    },
+    'opensuse150': {
+        'docker_image': 'opensuse/leap:15.0',
+        'vagrant_box': 'opensuse/openSUSE-15.0-x86_64',
+        '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',
+            'libnsl2-devel': 'libnsl-devel',
+            'libsemanage-python': 'python2-semanage',
+            'nettle-devel': 'libnettle-devel',
+            'openldap-devel': 'openldap2-devel',
+            'perl-Archive-Tar': 'perl-Archive-Tar-Wrapper',
+            'perl-JSON-Parse': 'perl-JSON-XS',
+            'perl-generators': '',
+            'perl-interpreter': '',
+            'procps-ng': 'procps',
+            'python-dns': 'python2-dnspython',
+            'python3-crypto': 'python3-pycrypto',
+            'python3-dns': 'python3-dnspython',
+            'python3-markdown': 'python3-Markdown',
+            'quota-devel': '',
+            'glusterfs-api-devel': '',
+            'libtasn1-tools': '', # asn1Parser is part of libtasn1
+            'mingw64-gcc': '', # doesn't exist
+        }
+    },
+    'opensuse151': {
+        'docker_image': 'opensuse/leap:15.1',
+        'vagrant_box': 'opensuse/openSUSE-15.1-x86_64',
+        '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',
+            'libnsl2-devel': 'libnsl-devel',
+            'libsemanage-python': 'python2-semanage',
+            'nettle-devel': 'libnettle-devel',
+            'openldap-devel': 'openldap2-devel',
+            'perl-Archive-Tar': 'perl-Archive-Tar-Wrapper',
+            'perl-JSON-Parse': 'perl-JSON-XS',
+            'perl-generators': '',
+            'perl-interpreter': '',
+            'procps-ng': 'procps',
+            'python-dns': 'python2-dnspython',
+            'python3-crypto': 'python3-pycrypto',
+            'python3-dns': 'python3-dnspython',
+            'python3-markdown': 'python3-Markdown',
+            'quota-devel': '',
+            'glusterfs-api-devel': '',
+            'libtasn1-tools': '', # asn1Parser is part of libtasn1
+            'mingw64-gcc': '', # doesn't exist
+        }
+    }
 }
 
 
@@ -450,6 +602,7 @@ def expand_family_dists(family):
         config['name'] = name
         config['home'] = join(OUT, name)
         config['family'] = family['name']
+        config['GENERATED_MARKER'] = GENERATED_MARKER
 
         # replace dist specific pkgs
         replace = config.get('replace', {})
@@ -506,7 +659,10 @@ def render_vagrantfile(dists):
         dists[dist]['vagrantfile_snippet']
         for dist in sorted(dists.keys())]
 
-    return VAGRANTFILE_GLOBAL.format(vagrantfile_snippets=''.join(snippets))
+    return VAGRANTFILE_GLOBAL.format(
+            vagrantfile_snippets=''.join(snippets),
+            GENERATED_MARKER=GENERATED_MARKER
+            )
 
 
 VAGRANTFILE = render_vagrantfile(DISTS)