[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Thu Feb 21 04:38:02 UTC 2019


The branch, master has been updated
       via  cbf23f2b0fb selftest: Confirm new and old SDDL strings differ after a samba-tool dsacl set
       via  8e2015293e4 selftest: Add test for samba-tool dsacl get, cross-checked with samba-tool dsacl set
       via  8431cd40c23 samba-tool dsacl: Mark old and new descriptor output correctly
       via  fb7a8064830 Add command "samba-tool dsacl get" This code is very equal to "samba-tool dsacl set", except it only prints out the current sddl of an object.
       via  cf8ff6b821b Update dsacl.py - add_ace to handle/verify sddl parameter correct
       via  d6f6eb4f25a bootstrap/README.md: add README.md
       via  50a1109c8e4 bootstrap/dists: add rendered files for dists
       via  26d2f74cc91 bootstrap/docker.py: add cli to build/tag/push docker images
       via  3737518afea bootstrap/template.py: add cli to render templates
       via  3803f87f477 bootstrap/config.py: define package lists and templates
       via  8216a619b48 selftest/tests: add smoketests for dbcheck --quick-membership-checks
       via  e051d787f4d selftest/tests: add helper method to simplify plantestsuite
       via  fa8a8483651 dbcheck: skip reverse member link checks when cli option specified
       via  5f9a5ef262b s4/param: Fix provision_get_schema leaking python object
      from  8c92702d152 vfs_ceph: refactor if-error-return-else logic

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cbf23f2b0fbc7705f6050ddc8b0b925132c4a290
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Feb 21 15:53:07 2019 +1300

    selftest: Confirm new and old SDDL strings differ after a samba-tool dsacl set
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Thu Feb 21 05:37:31 CET 2019 on sn-devel-144

commit 8e2015293e4798c8c1832633e07eec95a38de624
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Feb 21 15:49:25 2019 +1300

    selftest: Add test for samba-tool dsacl get, cross-checked with samba-tool dsacl set
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit 8431cd40c23c079f92083985fda784cd38159df3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Feb 21 15:33:01 2019 +1300

    samba-tool dsacl: Mark old and new descriptor output correctly
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>

commit fb7a80648305077a2891f43dd740c5b831cbbc4a
Author: Martin Krämer <mk.maddin at gmail.com>
Date:   Wed Jan 9 15:13:58 2019 +0000

    Add command "samba-tool dsacl get" This code is very equal to "samba-tool dsacl set", except it only prints out the current sddl of an object.
    
    Signed-off-by: Martin Krämer <mk.maddin at gmail.com>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit cf8ff6b821bce02def8e3846bfbae96e3ebe0778
Author: Martin Krämer <mk.maddin at gmail.com>
Date:   Sat Jan 26 09:17:25 2019 +0000

    Update dsacl.py - add_ace to handle/verify sddl parameter correct
    
    Test for samba-tool dsacl set --sddl parmeter
    
    Update tests.py - add dsacl (dsacl.py / samba-tool dsacl set) test
    
    Signed-off-by: <Martin Krämer mk.maddin at gmail.com>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d6f6eb4f25aca1a55709feb1f87afc01cb851d8b
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Fri Feb 8 16:28:18 2019 +1300

    bootstrap/README.md: add README.md
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 50a1109c8e42c9a6ca64e46b093183bff3abc0d1
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Tue Feb 12 13:01:17 2019 +1300

    bootstrap/dists: add rendered files for dists
    
    Add these into repo, then we can link it to samba wiki,
    for people to get a latest and precise pkg list
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 26d2f74cc915d4499a6abfedc9034e60f33a3138
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Mon Feb 18 12:47:50 2019 +1300

    bootstrap/docker.py: add cli to build/tag/push docker images
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3737518afeaf26bbb0afa534a453d19e92d923cd
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Mon Feb 18 12:31:28 2019 +1300

    bootstrap/template.py: add cli to render templates
    
    - bootstrap for each dist
    - Dockerfile for each dist
    - Vagrantfile all in one
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3803f87f4776b3729d8033cf6ae09120fa4f3c54
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Thu Feb 7 14:07:33 2019 +1300

    bootstrap/config.py: define package lists and templates
    
    Define default pkg list, and allow to override for each dist.
    Also define bootstrap/Dockerfile/Vagrantfile templates.
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8216a619b480dbc18f72ea2215624fe7d4781a75
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Fri Feb 15 22:55:51 2019 +1300

    selftest/tests: add smoketests for dbcheck --quick-membership-checks
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e051d787f4d69536581e1e2ad9f6c54ab882537a
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Fri Feb 15 22:15:23 2019 +1300

    selftest/tests: add helper method to simplify plantestsuite
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fa8a8483651b4c5a4c337d23714f16d47e7d6ad0
Author: Joe Guo <joeg at catalyst.net.nz>
Date:   Thu Jan 3 15:55:16 2019 +1300

    dbcheck: skip reverse member link checks when cli option specified
    
    currently dbcheck cmd tooks about 1 day to finish on a 100k user database.
    We can skip member reverse link checks to speed it up dramatically.
    A new cli option is added to enable the skipping.
    
    Signed-off-by: Joe Guo <joeg at catalyst.net.nz>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5f9a5ef262b4700b47bfb931b6b096f56aa56b15
Author: Noel Power <noel.power at suse.com>
Date:   Fri Feb 15 10:04:23 2019 +0000

    s4/param: Fix provision_get_schema leaking python object
    
    provision_get_schema returns a ldb_context object which is stored
    in a python object. As a result the parent python object is never
    decrefed and probably not released ever.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 bootstrap/READMD.md                       |  71 +++++
 bootstrap/config.py                       | 469 ++++++++++++++++++++++++++++++
 bootstrap/dists/Vagrantfile               |  67 +++++
 bootstrap/dists/centos6/Dockerfile        |  18 ++
 bootstrap/dists/centos6/bootstrap.sh      |  91 ++++++
 bootstrap/dists/centos6/packages.yml      |  72 +++++
 bootstrap/dists/centos7/Dockerfile        |  18 ++
 bootstrap/dists/centos7/bootstrap.sh      |  91 ++++++
 bootstrap/dists/centos7/packages.yml      |  72 +++++
 bootstrap/dists/debian7/Dockerfile        |  18 ++
 bootstrap/dists/debian7/bootstrap.sh      |  90 ++++++
 bootstrap/dists/debian7/packages.yml      |  66 +++++
 bootstrap/dists/debian8/Dockerfile        |  18 ++
 bootstrap/dists/debian8/bootstrap.sh      |  94 ++++++
 bootstrap/dists/debian8/packages.yml      |  70 +++++
 bootstrap/dists/debian9/Dockerfile        |  18 ++
 bootstrap/dists/debian9/bootstrap.sh      |  94 ++++++
 bootstrap/dists/debian9/packages.yml      |  70 +++++
 bootstrap/dists/fedora28/Dockerfile       |  18 ++
 bootstrap/dists/fedora28/bootstrap.sh     |  92 ++++++
 bootstrap/dists/fedora28/packages.yml     |  75 +++++
 bootstrap/dists/fedora29/Dockerfile       |  18 ++
 bootstrap/dists/fedora29/bootstrap.sh     |  92 ++++++
 bootstrap/dists/fedora29/packages.yml     |  75 +++++
 bootstrap/dists/ubuntu1404/Dockerfile     |  18 ++
 bootstrap/dists/ubuntu1404/bootstrap.sh   |  94 ++++++
 bootstrap/dists/ubuntu1404/packages.yml   |  70 +++++
 bootstrap/dists/ubuntu1604/Dockerfile     |  18 ++
 bootstrap/dists/ubuntu1604/bootstrap.sh   |  95 ++++++
 bootstrap/dists/ubuntu1604/packages.yml   |  71 +++++
 bootstrap/dists/ubuntu1804/Dockerfile     |  18 ++
 bootstrap/dists/ubuntu1804/bootstrap.sh   |  95 ++++++
 bootstrap/dists/ubuntu1804/packages.yml   |  71 +++++
 bootstrap/docker.py                       | 164 +++++++++++
 bootstrap/template.py                     |  72 +++++
 python/samba/dbchecker.py                 |  14 +-
 python/samba/netcmd/dbcheck.py            |  10 +-
 python/samba/netcmd/dsacl.py              |  92 ++++--
 python/samba/tests/samba_tool/dsacl.py    | 124 ++++++++
 selftest/tests.py                         | 117 +++++---
 source4/dsdb/schema/tests/schema_syntax.c |   1 +
 source4/libnet/libnet_vampire.c           |   2 +-
 source4/param/provision.c                 |  12 +-
 source4/selftest/tests.py                 |   1 +
 44 files changed, 2971 insertions(+), 65 deletions(-)
 create mode 100644 bootstrap/READMD.md
 create mode 100644 bootstrap/config.py
 create mode 100644 bootstrap/dists/Vagrantfile
 create mode 100644 bootstrap/dists/centos6/Dockerfile
 create mode 100644 bootstrap/dists/centos6/bootstrap.sh
 create mode 100644 bootstrap/dists/centos6/packages.yml
 create mode 100644 bootstrap/dists/centos7/Dockerfile
 create mode 100644 bootstrap/dists/centos7/bootstrap.sh
 create mode 100644 bootstrap/dists/centos7/packages.yml
 create mode 100644 bootstrap/dists/debian7/Dockerfile
 create mode 100644 bootstrap/dists/debian7/bootstrap.sh
 create mode 100644 bootstrap/dists/debian7/packages.yml
 create mode 100644 bootstrap/dists/debian8/Dockerfile
 create mode 100644 bootstrap/dists/debian8/bootstrap.sh
 create mode 100644 bootstrap/dists/debian8/packages.yml
 create mode 100644 bootstrap/dists/debian9/Dockerfile
 create mode 100644 bootstrap/dists/debian9/bootstrap.sh
 create mode 100644 bootstrap/dists/debian9/packages.yml
 create mode 100644 bootstrap/dists/fedora28/Dockerfile
 create mode 100644 bootstrap/dists/fedora28/bootstrap.sh
 create mode 100644 bootstrap/dists/fedora28/packages.yml
 create mode 100644 bootstrap/dists/fedora29/Dockerfile
 create mode 100644 bootstrap/dists/fedora29/bootstrap.sh
 create mode 100644 bootstrap/dists/fedora29/packages.yml
 create mode 100644 bootstrap/dists/ubuntu1404/Dockerfile
 create mode 100644 bootstrap/dists/ubuntu1404/bootstrap.sh
 create mode 100644 bootstrap/dists/ubuntu1404/packages.yml
 create mode 100644 bootstrap/dists/ubuntu1604/Dockerfile
 create mode 100644 bootstrap/dists/ubuntu1604/bootstrap.sh
 create mode 100644 bootstrap/dists/ubuntu1604/packages.yml
 create mode 100644 bootstrap/dists/ubuntu1804/Dockerfile
 create mode 100644 bootstrap/dists/ubuntu1804/bootstrap.sh
 create mode 100644 bootstrap/dists/ubuntu1804/packages.yml
 create mode 100755 bootstrap/docker.py
 create mode 100755 bootstrap/template.py
 create mode 100644 python/samba/tests/samba_tool/dsacl.py


Changeset truncated at 500 lines:

diff --git a/bootstrap/READMD.md b/bootstrap/READMD.md
new file mode 100644
index 00000000000..313c2056007
--- /dev/null
+++ b/bootstrap/READMD.md
@@ -0,0 +1,71 @@
+# Samba Bootstrap
+
+A pure python3 module with CLI to bootstrap Samba envs for multiple distributions.
+
+## Features
+
+- manage Samba dependencies list for multiple distributions
+- render dependencies package list to boostrap shell scripts(apt, yum and dnf)
+- render Vagrantfile to provision vitual machines with bootstrap scripts
+- render Dockerfile to build docker images with bootstrap scripts
+- build/tag/push docker images
+
+## Supported Distributions
+
+deb: Debian 7|8|9, Ubuntu 1404|1604|1804
+rpm: CentOS 6|7, Fedora 28|29
+
+Easy to add more.
+
+## Usage
+
+Render files:
+
+    ./template.py --render
+
+By default, files are rendered into `files` directory in current dir.
+
+Build docker images:
+
+    ./docker.py --build
+
+Tag docker images:
+
+    ./docker.py --tag --prefix registry.gitlab.com/samba-team/samba
+
+Push docker images(you need to have permission):
+
+    docker login
+    ./docker.py --push --prefix registry.gitlab.com/samba-team/samba
+
+the prefix defaults to `registry.gitlab.com/samba-team/samba`, and you can
+override it with env var `SAMBA_DOCKER_IMAGE_NAME_PREFIX`.
+
+## User Stories
+
+As a gitlab-ci maintainer, I can use this tool to build the CI docker images.
+I can also automate it.
+
+As a Samba developer/tester, I can setup a Samba env very quickly.
+
+With Docker:
+
+    cd ~/samba
+    git clean -xdf
+    docker run -it -v $(pwd):/home/samba/samba samba-ubuntu1604:latest bash
+
+With Vagrant:
+
+    cd ./files/
+    vagrant up   # start all
+    vagrant up debian9  # start one
+    vagrant ssh debian9
+    vagrant destroy debian9  # destroy one
+    vagrant destroy  # destroy all
+
+Or a remote/cloud machine:
+
+    scp ./files/fedora29/bootstrap.sh USER at IP:
+    ssh USER at IP
+    sudo bash ./bootstrap.sh
+
diff --git a/bootstrap/config.py b/bootstrap/config.py
new file mode 100644
index 00000000000..3cb14556130
--- /dev/null
+++ b/bootstrap/config.py
@@ -0,0 +1,469 @@
+#!/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.
+
+Author: Joe Guo <joeg at catalyst.net.nz>
+"""
+import os
+from os.path import abspath, dirname, join
+HERE = abspath(dirname(__file__))
+# output dir for rendered files
+OUT = join(HERE, 'dists')
+
+
+# pkgs with same name in all packaging systems
+COMMON = [
+    'attr',
+    'autoconf',
+    'binutils',
+    'bison',
+    'ccache',
+    'curl',
+    'gcc',
+    'gdb',
+    'git',
+    'make',
+    'perl',
+    'psmisc',  # for pstree in test
+    'sudo',  # docker images has no sudo by default
+    'vim',
+    'wget',
+]
+
+
+# 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
+    ('lmdb-utils', 'lmdb-devel'),
+    ('nettle-dev', 'nettle-devel'),
+    ('zlib1g-dev', 'zlib-devel'),
+    ('libbsd-dev', 'libbsd-devel'),
+    ('libaio-dev', 'libaio-devel'),
+    ('libarchive-dev', 'libarchive-devel'),
+    ('libblkid-dev', 'libblkid-devel'),
+    ('libxml2-dev', 'libxml2-devel'),
+    ('libcap-dev', 'libpcap-devel'),
+    ('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'),
+    ('libdbus-1-dev', 'dbus-devel'),
+
+    # 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
+    ('', 'glibc-locale-source'),  # for localedef
+    ('bind9', 'bind'),
+    ('bind9utils', 'bind-utils'),
+    ('dnsutils', ''),
+    ('locate', 'mlocate'),
+    ('xsltproc', 'libxslt'),
+    ('krb5-kdc', 'krb5-workstation'),
+    ('apt-utils', 'yum-utils'),
+    ('pkg-config', 'pkgconfig'),
+    ('procps', 'procps-ng'),  # required for the free cmd in tests
+    ('lsb-core', 'redhat-lsb'),  # 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
+
+    # python
+    ('python-dev', 'python-devel'),
+    ('python-gpg', 'python2-gpg'),  # defaults to ubuntu/fedora latest
+    ('python-crypto', 'python-crypto'),
+    ('python-markdown', 'python-markdown'),
+    ('python-dnspython', 'python-dns'),
+
+    ('python3-dev', 'python3-devel'),
+    ('python3-gpg', 'python3-gpg'),  # defaults to ubuntu/fedora latest
+    ('python3-crypto', 'python3-crypto'),
+    ('python3-markdown', 'python3-markdown'),
+    ('python3-dnspython', 'python3-dns'),
+
+    ('', 'libsemanage-python'),
+    ('', 'policycoreutils-python'),
+
+    # perl
+    ('libparse-yapp-perl', 'perl-Parse-Yapp'),
+    # not strict equivalents
+    ('perl-modules', 'perl-ExtUtils-MakeMaker'),
+    ('libjson-perl', 'perl-Test-Base'),
+
+    # 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'),
+    ('flex', ''),
+    ('', 'keyutils-libs-devel'),
+
+]
+
+
+DEB_PKGS = COMMON + [pkg for pkg, _ in PKGS if pkg]
+RPM_PKGS = COMMON + [pkg for _, pkg in PKGS if pkg]
+
+
+APT_BOOTSTRAP = r"""
+#!/bin/bash
+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
+
+# uncomment locale
+# this file doesn't exist on ubuntu1404 even locales installed
+if [ -f /etc/locale.gen ]; then
+    sed -i '/^#\s*en_US.UTF-8 UTF-8/s/^#\s*//' /etc/locale.gen
+fi
+
+locale-gen
+
+# update /etc/default/locale
+update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
+
+# set both for safe
+echo LC_ALL="en_US.UTF-8" >> /etc/environment
+echo LANG="en_US.UTF-8" >> /etc/environment
+"""
+
+
+YUM_BOOTSTRAP = r"""
+#!/bin/bash
+set -xueo pipefail
+
+yum -y -q update
+yum -y -q install epel-release
+yum -y -q update
+
+yum -y -q --verbose install \
+    {pkgs}
+
+yum clean all
+
+# gen locale
+localedef -c -i en_US -f UTF-8 en_US.UTF-8
+
+# no update-locale, diy
+# LC_ALL is not valid in this file
+echo LANG="en_US.UTF-8" > /etc/locale.conf
+
+# set both for safe
+echo LC_ALL="en_US.UTF-8" >> /etc/environment
+echo LANG="en_US.UTF-8" >> /etc/environment
+"""
+
+
+DNF_BOOTSTRAP = r"""
+#!/bin/bash
+set -xueo pipefail
+
+dnf -y -q update
+
+dnf -y -q --verbose install \
+    {pkgs}
+
+dnf clean all
+
+# gen locale
+localedef -c -i en_US -f UTF-8 en_US.UTF-8
+
+# no update-locale, diy
+# LC_ALL is not valid in this file
+echo LANG="en_US.UTF-8" > /etc/locale.conf
+
+# set both for safe
+echo LC_ALL="en_US.UTF-8" >> /etc/environment
+echo LANG="en_US.UTF-8" >> /etc/environment
+"""
+
+
+DOCKERFILE = r"""
+FROM {docker_image}
+
+# we will use this image to run ci, these ENV vars are important
+ENV CC="ccache gcc"
+
+ADD bootstrap.sh /tmp/bootstrap.sh
+# need root permission, do it before USER samba
+RUN bash /tmp/bootstrap.sh
+
+# make test can not work with root, so we have to create a new user
+RUN useradd -m -s /bin/bash samba && \
+    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
+ENV USER=samba LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
+"""
+
+# 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"
+    end
+"""
+
+# global Vagrantfile with snippets for all dists
+VAGRANTFILE_GLOBAL = r"""
+Vagrant.configure("2") do |config|
+    config.ssh.insert_key = false
+
+{vagrantfile_snippets}
+
+end
+"""
+
+
+DEB_DISTS = {
+    'debian7': {
+        'docker_image': 'debian:7',
+        'vagrant_box': 'debian/wheezy64',
+        'replace': {
+            'libgnutls28-dev': 'libgnutls-dev',
+            'libsystemd-dev': '',  # not available, remove
+            'lmdb-utils': '',  # not available, remove
+            'liblmdb-dev': '',  # not available, remove
+            'python-gpg': 'python-gpgme',
+            'python3-gpg': '',  # no python3 gpg pkg available, remove
+            'language-pack-en': '',   # included in locales
+        }
+    },
+    'debian8': {
+        'docker_image': 'debian:8',
+        'vagrant_box': 'debian/jessie64',
+        'replace': {
+            'python-gpg': 'python-gpgme',
+            'python3-gpg': 'python3-gpgme',
+            'language-pack-en': '',   # included in locales
+        }
+    },
+    'debian9': {
+        'docker_image': 'debian:9',
+        'vagrant_box': 'debian/stretch64',
+        'replace': {
+            'language-pack-en': '',   # included in locales
+        }
+    },
+    'ubuntu1404': {
+        'docker_image': 'ubuntu:14.04',
+        'vagrant_box': 'ubuntu/trusty64',
+        'replace': {
+            'libsystemd-dev': '',  # remove
+            'libgnutls28-dev': 'libgnutls-dev',
+            'python-gpg': 'python-gpgme',
+            'python3-gpg': 'python3-gpgme',
+            'lmdb-utils': 'lmdb-utils/trusty-backports',
+            'liblmdb-dev': 'liblmdb-dev/trusty-backports',
+        }
+    },
+    'ubuntu1604': {
+        'docker_image': 'ubuntu:16.04',
+        'vagrant_box': 'ubuntu/xenial64',
+        'replace': {
+            'python-gpg': 'python-gpgme',
+            'python3-gpg': 'python3-gpgme',
+        }
+    },
+    'ubuntu1804': {
+        'docker_image': 'ubuntu:18.04',
+        'vagrant_box': 'ubuntu/bionic64',
+    },
+}
+
+
+RPM_DISTS = {
+    'centos6': {
+        'docker_image': 'centos:6',
+        'vagrant_box': 'centos/6',
+        'bootstrap': YUM_BOOTSTRAP,
+        'replace': {
+            'python3-devel': 'python34-devel',
+            'python2-gpg': 'pygpgme',
+            'python3-gpg': '',  # no python3-gpg yet
+            '@development-tools': '"@Development Tools"',  # add quotes
+            'glibc-langpack-en': '',  # included in glibc-common
+            'glibc-locale-source': '',  # included in glibc-common
+            'procps-ng': 'procps',  # centos6 still use old name
+            # update perl core modules on centos
+            # fix: Can't locate Archive/Tar.pm in @INC
+            'perl': 'perl-core',
+        }
+    },
+    'centos7': {
+        'docker_image': 'centos:7',
+        'vagrant_box': 'centos/7',
+        'bootstrap': YUM_BOOTSTRAP,
+        'replace': {
+            'python3-devel': 'python34-devel',
+            # although python36-devel is available
+            # after epel-release installed
+            # however, all other python3 pkgs are still python34-ish
+            'python2-gpg': 'pygpgme',
+            'python3-gpg': '',  # no python3-gpg yet
+            '@development-tools': '"@Development Tools"',  # add quotes
+            'glibc-langpack-en': '',  # included in glibc-common
+            'glibc-locale-source': '',  # included in glibc-common
+            # update perl core modules on centos
+            # fix: Can't locate Archive/Tar.pm in @INC
+            'perl': 'perl-core',
+        }
+    },
+    'fedora28': {
+        'docker_image': 'fedora:28',
+        'vagrant_box': 'fedora/28-cloud-base',
+        'bootstrap': DNF_BOOTSTRAP,
+    },
+    'fedora29': {
+        'docker_image': 'fedora:29',
+        'vagrant_box': 'fedora/29-cloud-base',
+        'bootstrap': DNF_BOOTSTRAP,
+    },
+}
+
+
+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']
+
+        # 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]


-- 
Samba Shared Repository



More information about the samba-cvs mailing list