diff --git a/contrib/rh-bkr/bkr.py b/contrib/rh-bkr/bkr.py index 35c42ec2c3..30a3e3233b 100755 --- a/contrib/rh-bkr/bkr.py +++ b/contrib/rh-bkr/bkr.py @@ -548,6 +548,7 @@ class CmdSubmit(CmdBase): self.parser = argparse.ArgumentParser(prog=sys.argv[0] + " " + name, description='Submit job to beaker.') self.parser.add_argument('--no-test', action='store_true', help='do submit the job to beaker') self.parser.add_argument('--rpm', '-r', action='append', help='Filenames of RPMs. Supports (local) files, file://, jenkins://, brew://, brewtask:// and repo: URI schemes') + self.parser.add_argument('--build-id', '-b', help='Set to a git commit id or branch name of the upstream git repository of NM. If present, the script will build NM from source') self.parser.add_argument('--nitrate-tag', '-t', action='append', help='Query nitrate for tests having this tag. Output is appended to $TESTS. Specifying more then once combines them as AND') self.parser.add_argument('--nitrate-all', '-a', action='store_true', help='Query all nitrate tests') self.parser.add_argument('--nitrate-exclude-tag', '-T', action='append', help='Query nitrate for tests not having this tag. Output is appended to $TESTS. In combination with --nitrate-tag this blacklists cases (after selecting then)') @@ -718,6 +719,8 @@ class CmdSubmit(CmdBase): return 'rhel-7' # rhel-7.2 if re.match(r'^.*/NetworkManager-1.1.[0-9]+-[0-9]+\.[a-f0-9]+\.el7\.[^.]+\.rpm$', u): return 'master' # upstream 1.1 + if self.options.build_id: + return 'master' raise Exception("could not detect %s. Try setting as target branch GIT_TARGETBRANCH%s" % (key_name, ((" or "+key_name) if key_name != 'GIT_TARGETBRANCH' else ''))) @@ -826,6 +829,23 @@ class CmdSubmit(CmdBase): return 'selinux=0' return '' + def _get_var_for_BUILD_ID(self, key): + v = self._get_var('BUILD_ID') + if v is not None: + return v + if self.options.build_id: + return self.options.build_id + return '' + + def _get_var_for_RPM_LIST(self, key): + # RPM_LIST is provided by subs. If it is not, + # we want to fail gracefully if BUILD_ID is set. + # This avoids a warning. + v = self._get_var_for_BUILD_ID (key) + if v: + return '' + return None + DefaultReplacements = { 'WHITEBOARD' : 'Test NetworkManager', 'DISTRO_FAMILY' : 'RedHatEnterpriseLinux7', @@ -843,10 +863,14 @@ class CmdSubmit(CmdBase): 'UUID' : str(uuid.uuid4()), 'RESERVESYS' : _get_var_for_RESERVESYS, 'SELINUX_DISABLED' : _get_var_for_SELINUX_DISABLED, + 'BUILD_ID' : _get_var_for_BUILD_ID, + 'BUILD_TEST' : 'true', + 'BUILD_REPO' : 'git://anongit.freedesktop.org/NetworkManager/NetworkManager', 'CONF_LOGLEVEL' : 'DEBUG', 'CONF_DHCP' : 'dhclient', 'CONF_DEBUG' : 'RLIMIT_CORE,fatal-warnings', 'GIT_URL' : 'http://code.engineering.redhat.com/gerrit/desktopqe/NetworkManager', + 'RPM_LIST' : _get_var_for_RPM_LIST, } def _process_line_get(self, key, replacements): if key in replacements: diff --git a/contrib/rh-bkr/job01.xml b/contrib/rh-bkr/job01.xml index 10bd9109b5..76d79a39b4 100644 --- a/contrib/rh-bkr/job01.xml +++ b/contrib/rh-bkr/job01.xml @@ -17,7 +17,7 @@ abrt-addon-ccpp libreport-rhel-bugzilla %end -%post --log=/dev/console +%post --log=/dev/console --erroronfail set -x set -e @@ -42,16 +42,81 @@ level=$CONF_LOGLEVEL domains=ALL EOF -# Drop whatever NetworkManager is there. It could be that the distibution -# ships older one than we're testing and the following yum install won't -# update it. -rpm -qa |grep NetworkManager |xargs rpm -e --nodeps - -yum install -y yum $RPM_LIST - #A workaround for rdma machine post-deploy script woes, suggested by honli sed -e '/^\s*linux16\s*\/vmlinuz/ s/$/ $SELINUX_DISABLED/' -i /boot/grub2/grub.cfg || : rm -f /etc/sysconfig/network-scripts/ifcfg-mlx* + +for r in $RPM_LIST; do + yum downgrade -y $$r || yum install -y $$r +done + +if [[ -n "$BUILD_ID" ]]; then + + yum install -y git rpm-build valgrind dbus-devel dbus-glib-devel wireless-tools-devel glib2-devel gobject-introspection-devel gettext-devel pkgconfig libnl3-devel 'perl(XML::Parser)' 'perl(YAML)' automake ppp-devel nss-devel dhclient readline-devel audit-libs-devel gtk-doc libudev-devel libuuid-devel libgudev1-devel vala-tools iptables bluez-libs-devel systemd libsoup-devel libndp-devel ModemManager-glib-devel newt-devel /usr/bin/dbus-launch pygobject3-base dbus-python libselinux-devel polkit-devel teamd-devel + + mkdir /tmp/nm-build + cd /tmp/nm-build + + git clone "$BUILD_REPO" + cd "./NetworkManager/" + git checkout "$BUILD_ID" + + # for the tests, let's load some modules: + modprobe ip_gre + + if [[ "$BUILD_TEST" != "" ]]; then + NOCONFIGURE=yes ./autogen.sh + + ./configure \ + --enable-maintainer-mode \ + --enable-more-warnings=error \ + --prefix=/opt/test \ + --sysconfdir=/etc \ + --enable-gtk-doc \ + --enable-more-asserts \ + --with-more-asserts=100 \ + --enable-more-logging \ + --enable-compile-warnings=yes\ + --with-valgrind=no \ + --enable-concheck \ + --enable-wimax \ + --enable-ifcfg-rh \ + --enable-ifcfg-suse \ + --enable-ifupdown \ + --enable-ifnet \ + --enable-vala=yes \ + --enable-polkit=yes \ + --with-nmtui=yes \ + --with-modem-manager-1 \ + --with-suspend-resume=systemd \ + --enable-teamdctl=yes \ + --enable-tests=root \ + --with-netconfig=yes \ + --with-crypto=nss \ + --with-session-tracking=systemd \ + --with-consolekit=yes \ + --with-systemd-logind=yes \ + --with-consolekit=yes + + make -j4 + make check -k + fi + + ./contrib/fedora/rpm/build_clean.sh -c + + pushd "./contrib/fedora/rpm/latest/RPMS/$ARCH/" + for p in $$(ls -1 ./*.rpm | sed 's#.*\(NetworkManager.*\)-1\.[0-9]\..*#\1#'); do + rpm -e --nodeps $$p || true + done + yum install -y ./*.rpm + popd + + # ensure that the expected NM is installed. + COMMIT_ID="$$(git rev-parse --verify HEAD | sed 's/^\(.\{10\}\).*/\1/')" + yum list installed NetworkManager | grep -q -e "\.$$COMMIT_ID\." + + echo "BUILD '$BUILD_ID' COMPLETE" +fi %end ]]>