libabigail/tools/fedabipkgdiff

1598 lines
54 KiB
Plaintext
Raw Normal View History

Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- Mode: Python
#
# Copyright (C) 2013-2016 Red Hat, Inc.
#
# This file is part of the GNU Application Binary Interface Generic
# Analysis and Instrumentation Library (libabigail). This library 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, or (at your option) any
# later version.
#
# This library 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; see the file COPYING-GPLV3. If
# not, see <http:#www.gnu.org/licenses/>.
#
# Author: Chenxiong Qi
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
from __future__ import print_function
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
import argparse
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
import functools
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
import glob
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
import logging
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
import mimetypes
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
import os
import re
import shutil
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
import six
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
import subprocess
import sys
from collections import namedtuple
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
from itertools import chain
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
import xdg.BaseDirectory
import rpm
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
import koji
# @file
#
# You might have known that abipkgdiff is a command line tool to compare two
# RPM packages to find potential differences of ABI. This is really useful for
# Fedora packagers and developers. Usually, excpet the RPM packages built
# locally, if a packager wants to compare RPM packages he just built with
# specific RPM packages that were already built and availabe in Koji,
# fedabipkgdiff is the right tool for him.
#
# With fedabipkgdiff, packager is able to specify certain criteria to tell
# fedabipkgdiff which RPM packages he wants to compare, then fedabipkgdiff will
# find them, download them, and boom, run the abipkgdiff for you.
#
# Currently, fedabipkgdiff returns 0 if everything works well, otherwise, 1 if
# something wrong.
koji_config = koji.read_config('koji')
DEFAULT_KOJI_SERVER = koji_config['server']
DEFAULT_KOJI_TOPURL = koji_config['topurl']
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
# The working directory where to hold all data including downloaded RPM
# packages Currently, it's not configurable and hardcode here. In the future
# version of fedabipkgdiff, I'll make it configurable by users.
HOME_DIR = os.path.join(xdg.BaseDirectory.xdg_cache_home,
os.path.splitext(os.path.basename(__file__))[0])
Make fedabipkgdiff consistent with Libabigail's other tests In the libabigail project, almost all the tests for the tools follow a similar pattern. The test contains a set of input files to compare. The result of the comparison is thus compared to a set of reference comparison result. This approach is already documented in the CONTRIBUTING file. There are several interesting properties with this scheme. First, it capture the behaviour of the tools, including what is shown to the user. Second, it eases the job of a hacker who wants to add a new test for a new behaviour of a given tool. The user just has to provide: 1/ A new reference output of the new use case of the tool (that is easily constructed by using the tool itself and saving its output) and add an entry to array of entries that describe what to compare 2/ A new set of inputs to the tool And voila. Unfortunately, fedabipkgdiff tests don't follow this scheme. That make them surprising to hackers who read the source code of the existing tests, at very least. Also, the fedabipkgdiff tests were only unit tests. They were not testing the tool as used by users in general. This patch makes the fedabipkgdiff tests follow the general approach of the tests of the other Libabigail tools. The patch first craetes a program names tests/mockfedabipkgdiff. It's a wrapper around tools/fedabipkgdiff. It overloads the Koji client of fedabipkgdiff with a fake Koji client that gets the Fedora packages locally, from tests/data/test-fedabipkgdiff/packages. In other words, mockfedabipkgdiff is fedabipkgdiff without going to the network. I believe that in the future, tests/mockfedabipkgdiff should be killed when fedabipkgdiff is able to cache a local description of a local partial view of a Koji repository, along with the build packages that were already downloaded. That way, calling fedabipkgdiff twice with the same set of option should make the tool perform correctly without going to the netword on the second invocation. We should be able to save the local partial view of the Koji repository under e.g, tests/data/test-fedabipkgdiff/local-koji and tell fedabipkgdiff to use that, instead of using the network. But we are not there yet. So for now, I am using mockfedabipkgdiff. Then, tests/runtestfedabipkdiff.py.in has been re-written to use tests/mockfedabipkgdiff and to look like what is described in CONTRIBUTING as far as how Libabigail tools' tests are organized: mockfedabipkgdiff is called to perform a comparison. The result of the comparison is then compared (using GNU diff) to a reference comparison result file. Please note that tests/runtestfedabipkdiff.py is relatively fast for the moment. But when it contains much more tests and start becoming slow, then we'll need to change the code to run several comparisons in parallel, just like we do today in tests/test-diff-filter.cc. At that point, I believe I'll just re-write this in C++, just like tests/test-diff-filter.cc because that will allow us to have true concurrent code based on the abigail:workers API. For now, I am keeping this in Python also because I think that keeps Chenxiong happy ;-) To be sure that fedabipkgdiff (and its underlying abipkgdiff) are really comparing all the packages they are supposed to compare and also all the binaries in those packages, I have added a new --show-identical-binaries to abipkgdiff and fedabipkgdiff. That option shows the name of the binaries (and packages) that are compared, *even if* the ABI of those binaries are identical. Because otherwise, today, if two binaries (or packages) have the same ABI, nothing is displayed. For instance, here is the result of comparing a package against itself, using this new --show-identical-binaries options: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ./build/tools/abipkgdiff --show-identical-binaries dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: ================ changes of 'dbus-binding-tool'=============== No ABI change detected ================ end of changes of 'dbus-binding-tool'=============== ================ changes of 'libdbus-glib-1.so.2.1.0'=============== No ABI change detected ================ end of changes of 'libdbus-glib-1.so.2.1.0'=============== dodji@adjoa:patches$ And here is what this command before that patch would do: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ../master/build/tools/abipkgdiff dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: dodji@adjoa:patches$ The rest of the patch is mostly new test inputs material and the necessary adjustments following all the changes above. * configure.ac: Do not require Python dependencies itertools, unittest and StringIO anymore as they are not used anymore. Require new module tempfile now. Generate new executable script tests/mockfedabipkgdiff from tests/mockfedabipkgdiff.in. * doc/manuals/abipkgdiff.rst: Add doc for new option --show-identical-binaries to abipkgdiff * doc/manuals/fedabipkgdiff.rst: Add doc for new options --show-identical-binaries to fedabipkgdiff. * tools/abipkgdiff.cc (options::show_identical_binaries): New data member. (options::options): Initialize new data member. (display_usage): Add a new help string for the new --show-identical-binaries option. (parse_command_line): Parse the newq --show-identical-binaries command line switch. (pthread_routine_compare): When the comparison of two binaries is empty, if --show-identical-binaries was provided, then emit some output saying the comparison did yield the empty set. * tools/fedabipkgdiff (DEFAULT_ABIPKGDIFF): Store the default path to abipkgdiff in this new global variable. Naming this default path is useful because it can then be cleanly overloaded when using mock.patch. (build_path_to_abipkgdiff): Return the new DEFAULT_ABIPKGDIFF global variable. (cmd): Parse the new --show-identical-binaries command line switch. * tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt: New reference output. * tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt: Likewise. * tests/mockfedabipkgdiff.in: New uninstalled script template. * tests/runtestfedabipkgdiff.py.in (counter) (temp_file_or_dir_prefix, UtilsTest, RPMTest, LocalRPMTest) (RunAbipkgdiffTest, GetPackageLatestBuildTest, DownloadRPMTest) (BrewListRPMsTest, AssertionHelper, MockGlobalConfig) (BUILT_ABIPKGDIFF, CompareABIFromCommandLineTest): Remove these classes, global variables and functions. (FEDABIPKGDIFF, TEST_SRC_DIR, TEST_BUILD_DIR, INPUT_DIR) (OUTPUT_DIR, FEDABIPKGDIFF_TEST_SPECS): New global variables. (ensure_output_dir_created, run_fedabipkgdiff_tests, main): New functions. * tests/test-diff-pkg.cc (in_out_specs): Add tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt to the set of reference outputs to consider. * tests/Makefile.am: Add non-installed script mockfedabipkgdiff to source distribution. Also added tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt, tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt and tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt to source distribution. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-06 09:51:13 +00:00
DEFAULT_ABIPKGDIFF = 'abipkgdiff'
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
# Mask for determining if underlying fedabipkgdiff succeeds or not.
# This is for when the compared ABIs are equal
ABIDIFF_OK = 0
# This bit is set if there an application error.
ABIDIFF_ERROR = 1
# This bit is set if the tool is invoked in an non appropriate manner.
ABIDIFF_USAGE_ERROR = 1 << 1
# This bit is set if the ABIs being compared are different.
ABIDIFF_ABI_CHANGE = 1 << 2
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
# Used to construct abipkgdiff command line argument, package and associated
# debuginfo package
# fedabipkgdiff runs abipkgdiff in this form
#
# abipkgdiff \
# --d1 /path/to/package1-debuginfo.rpm \
# --d2 /path/to/package2-debuginfo.rpm \
# /path/to/package1.rpm \
# /path/to/package2.rpm
#
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
# ComparisonHalf is a three-elements tuple in format
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
#
# (package1.rpm, [package1-debuginfo.rpm..] package1-devel.rpm)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
#
# - the first element is the subject representing the package to
# compare. It's a dict representing the RPM we are interested in.
# That dict was retrieved from Koji XMLRPC API.
# - the rest are ancillary packages used for the comparison. So, the
# second one is a vector containing the needed debuginfo packages
# (yes there can be more than one), and the last one is the package
# containing API of the ELF shared libraries carried by subject.
# All the packages are dicts representing RPMs and those dicts were
# retrieved fromt he KOji XMLRPC API.
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
#
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
# So, before calling abipkgdiff, fedabipkgdiff must prepare and pass
# the following information
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
#
# (/path/to/package1.rpm, [/paths/to/package1-debuginfo.rpm ..] /path/to/package1-devel.rpm)
# (/path/to/package2.rpm, [/paths/to/package2-debuginfo.rpm ..] /path/to/package1-devel.rpm)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
#
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
ComparisonHalf = namedtuple('ComparisonHalf',
['subject', 'ancillary_debug', 'ancillary_devel'])
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
global_config = None
pathinfo = None
session = None
# There is no way to configure the log format so far. I hope I would have time
# to make it available so that if fedabipkgdiff is scheduled and run by some
# service, the logs logged into log file is muc usable.
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
logging.basicConfig(format='[%(levelname)s] %(message)s', level=logging.CRITICAL)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
logger = logging.getLogger(os.path.basename(__file__))
class KojiPackageNotFound(Exception):
"""Package is not found in Koji"""
class PackageNotFound(Exception):
"""Package is not found locally"""
class RpmNotFound(Exception):
"""RPM is not found"""
class NoBuildsError(Exception):
"""No builds returned from a method to select specific builds"""
class NoCompleteBuilds(Exception):
"""No complete builds for a package
This is a serious problem, nothing can be done if there is no complete
builds for a package.
"""
class InvalidDistroError(Exception):
"""Invalid distro error"""
class CannotFindLatestBuildError(Exception):
"""Cannot find latest build from a package"""
class SetCleanCacheAction(argparse._StoreTrueAction):
"""Custom Action making clean-cache as bundle of clean-cache-before and clean-cache-after"""
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, 'clean_cache_before', self.const)
setattr(namespace, 'clean_cache_after', self.const)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
def is_distro_valid(distro):
"""Adjust if a distro is valid
Currently, check for Fedora and RHEL.
:param str distro: a string representing a distro value.
:return: True if distro is the one specific to Fedora, like fc24, el7.
"rtype: bool
"""
return re.match(r'^(fc|el)\d{1,2}$', distro) is not None
def get_distro_from_string(str):
"""Get the part of a string that designates the Fedora distro version number
For instance, when passed the string '2.3.fc12', this function
returns the string 'fc12'.
:param str the string to consider
:return: The sub-string of the parameter that represents the
Fedora distro version number, or None if the parameter does not
contain such a sub-string.
"""
m = re.match(r'(.*)((fc|el)\d{1,2})(.*)', str)
if not m:
return None
distro = m.group(2)
return distro
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
def match_nvr(s):
"""Determine if a string is a N-V-R"""
return re.match(r'^([^/]+)-(.+)-(.+)$', s) is not None
def match_nvra(s):
"""Determine if a string is a N-V-R.A"""
return re.match(r'^([^/]+)-(.+)-(.+)\.(.+)$', s) is not None
def is_rpm_file(filename):
"""Return if a file is a RPM"""
return os.path.isfile(filename) and \
mimetypes.guess_type(filename)[0] == 'application/x-rpm'
def cmp_nvr(left, right):
"""Compare function for sorting a sequence of NVRs
This is the compare function used in sorted function to sort builds so that
fedabipkgdiff is able to select the latest build. Return value follows the
rules described in the part of paramter cmp of sorted documentation.
:param str left: left nvr to compare.
:param str right: right nvr to compare.
:return: -1, 0, or 1 that represents left is considered smaller than,
equal to, or larger than the right individually.
:rtype: int
"""
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
left_nvr = koji.parse_NVR(left['nvr'])
right_nvr = koji.parse_NVR(right['nvr'])
return rpm.labelCompare(
(left_nvr['epoch'], left_nvr['version'], left_nvr['release']),
(right_nvr['epoch'], right_nvr['version'], right_nvr['release']))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
def log_call(func):
"""A decorator that logs a method invocation
Method's name and all arguments, either positional or keyword arguments,
will be logged by logger.debug. Also, return value from the decorated
method will be logged just after the invocation is done.
This decorator does not catch any exception thrown from the decorated
method. If there is any exception thrown from decorated method, you can
catch them in the caller and obviously, no return value is logged.
:param callable func: a callable object to decorate
"""
def proxy(*args, **kwargs):
logger.debug('Call %s, args: %s, kwargs: %s',
func.__name__,
args if args else '',
kwargs if kwargs else '')
result = func(*args, **kwargs)
logger.debug('Result from %s: %s', func.__name__, result)
return result
return proxy
def delete_download_cache():
"""Delete download cache directory"""
download_dir = get_download_dir()
if global_config.dry_run:
print('DRY-RUN: Delete cached downloaded RPM packages at {0}'.format(download_dir))
else:
logger.debug('Delete cached downloaded RPM packages at {0}'.format(download_dir))
shutil.rmtree(download_dir)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
class RPM(object):
"""Wrapper around an RPM descriptor received from Koji
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
The RPM descriptor that is returned from Koji XMLRPC API is a
dict. This wrapper class makes it eaiser to access all these
properties in the way of object.property.
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
"""
def __init__(self, rpm_info):
"""Initialize a RPM object
:param dict rpm_info: a dict representing an RPM descriptor
received from the Koji API, either listRPMs or getRPM
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
"""
self.rpm_info = rpm_info
def __str__(self):
"""Return the string representation of this RPM
Return the string representation of RPM information returned from Koji
directly so that RPM can be treated in same way.
"""
return str(self.rpm_info)
def __getattr__(self, name):
"""Access RPM information in the way of object.property
:param str name: the property name to access.
:raises AttributeError: if name is not one of keys of RPM information.
"""
if name in self.rpm_info:
return self.rpm_info[name]
else:
raise AttributeError('No attribute name {0}'.format(name))
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
def is_peer(self, another_rpm):
fedabipkgdiff refuses to compare packages with the same release number I tried to run: fedabipkgdiff vte291-0.39.1-1.fc22.x86_64 vte291-0.39.90-1.fc22.x86_64 And it wouldn't work :-( The program considers the two packages as not being "peers". This has to do with the RPM.is_peer method which considers the two package as not being "peers", just because they have the same release number (1.fc22). They should be considered peers, though, because they have the same name but different {version, release} pairs. This patch fixes the RPM.is_peer method and adds the aforementioned packages to the regression test suite for good measure. * tools/fedabipkgdiff (RPM.is_peer): Update comment. Fix logic. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm: New test input file. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt: Likewise. * tests/data/Makefile.am: Add the new test input data to source distribution. * tests/mockfedabipkgdiff.in: Update the package and build information to add the new vte291-0.39.1-1.fc22.x86_64.rpm and vte291-0.39.90-1.fc22.x86_64.rpm packages (as well as their devel and debuginfo packages) into the "mock" Koji build database. * tests/runtestfedabipkgdiff.py.in: Make this test harness run over the two aforementioned packages. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-23 22:28:12 +00:00
"""Determine if this is the peer of a given rpm.
Here is what "peer" means.
Consider a package P for which the tripplet Name, Version,
Release is made of the values {N,V,R}. Then, consider a
package P' for which the similar tripplet is {N', V', R'}.
P' is a peer of P if N == N', and either V != V' or R != R'.
given package with a given NVR is another package with a N'V'
"""
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return self.name == another_rpm.name and \
self.arch == another_rpm.arch and \
fedabipkgdiff refuses to compare packages with the same release number I tried to run: fedabipkgdiff vte291-0.39.1-1.fc22.x86_64 vte291-0.39.90-1.fc22.x86_64 And it wouldn't work :-( The program considers the two packages as not being "peers". This has to do with the RPM.is_peer method which considers the two package as not being "peers", just because they have the same release number (1.fc22). They should be considered peers, though, because they have the same name but different {version, release} pairs. This patch fixes the RPM.is_peer method and adds the aforementioned packages to the regression test suite for good measure. * tools/fedabipkgdiff (RPM.is_peer): Update comment. Fix logic. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm: New test input file. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt: Likewise. * tests/data/Makefile.am: Add the new test input data to source distribution. * tests/mockfedabipkgdiff.in: Update the package and build information to add the new vte291-0.39.1-1.fc22.x86_64.rpm and vte291-0.39.90-1.fc22.x86_64.rpm packages (as well as their devel and debuginfo packages) into the "mock" Koji build database. * tests/runtestfedabipkgdiff.py.in: Make this test harness run over the two aforementioned packages. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-23 22:28:12 +00:00
not (self.version == another_rpm.version
and self.release == another_rpm.release)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@property
def nvra(self):
"""Return a RPM's N-V-R-A representation
An example: libabigail-1.0-0.8.rc4.1.fc23.x86_64
"""
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
nvra, _ = os.path.splitext(self.filename)
return nvra
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@property
def filename(self):
"""Return a RPM file name
An example: libabigail-1.0-0.8.rc4.1.fc23.x86_64.rpm
"""
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return os.path.basename(pathinfo.rpm(self.rpm_info))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@property
def is_debuginfo(self):
"""Check if the name of the current RPM denotes a debug info package"""
return koji.is_debuginfo(self.rpm_info['name'])
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
@property
def is_devel(self):
"""Check if the name of current RPM denotes a development package"""
return self.rpm_info['name'].endswith('-devel')
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@property
def download_url(self):
"""Get the URL from where to download this RPM"""
build = session.getBuild(self.build_id)
return os.path.join(pathinfo.build(build), pathinfo.rpm(self.rpm_info))
@property
def downloaded_file(self):
"""Get a pridictable downloaded file name with absolute path"""
# arch should be removed from the result returned from PathInfo.rpm
filename = os.path.basename(pathinfo.rpm(self.rpm_info))
return os.path.join(get_download_dir(), filename)
@property
def is_downloaded(self):
"""Check if this RPM was already downloaded to local disk"""
return os.path.exists(self.downloaded_file)
class LocalRPM(RPM):
"""Representing a local RPM
Local RPM means the one that could be already downloaded or built from
where I can find it
"""
def __init__(self, filename):
"""Initialize local RPM with a filename
:param str filename: a filename pointing to a RPM file in local
disk. Note that, this file must not exist necessarily.
"""
self.local_filename = filename
self.rpm_info = koji.parse_NVRA(os.path.basename(filename))
@property
def downloaded_file(self):
"""Return filename of this RPM
Returned filename is just the one passed when initializing this RPM.
:return: filename of this RPM
:rtype: str
"""
return self.local_filename
@property
def download_url(self):
raise NotImplementedError('LocalRPM has no URL to download')
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
def _find_rpm(self, rpm_filename):
"""Search an RPM from the directory of the current instance of LocalRPM
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
:param str rpm_filename: filename of rpm to find, for example
foo-devel-0.1-1.fc24.
:return: an instance of LocalRPM representing the found rpm, or None if
no RPM was found.
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
"""
search_dir = os.path.dirname(os.path.abspath(self.local_filename))
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
filename = os.path.join(search_dir, rpm_filename)
return LocalRPM(filename) if os.path.exists(filename) else None
@log_call
def find_debuginfo(self):
"""Find debuginfo RPM package from a directory"""
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
filename = \
'%(name)s-debuginfo-%(version)s-%(release)s.%(arch)s.rpm' % \
self.rpm_info
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
return self._find_rpm(filename)
@log_call
def find_devel(self):
"""Find development package from a directory"""
filename = \
'%(name)s-devel-%(version)s-%(release)s.%(arch)s.rpm' % \
self.rpm_info
return self._find_rpm(filename)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
class RPMCollection(object):
"""Collection of RPMs
This is a simple collection containing RPMs collected from a
directory on the local filesystem or retrieved from Koji.
A collection can contain one or more sets of RPMs. Each set of
RPMs being for a particular architecture.
For a given architecture, a set of RPMs is made of one RPM and its
ancillary RPMs. An ancillary RPM is either a debuginfo RPM or a
devel RPM.
So a given RPMCollection would (informally) look like:
{
i686 => {foo.i686.rpm, foo-debuginfo.i686.rpm, foo-devel.i686.rpm}
x86_64 => {foo.x86_64.rpm, foo-debuginfo.x86_64.rpm, foo-devel.x86_64.rpm,}
}
"""
def __init__(self, rpms=None):
# Mapping from arch to a list of rpm_infos.
# Note that *all* RPMs of the collections are present in this
# map; that is the RPM to consider and its ancillary RPMs.
self.rpms = {}
# Mapping from arch to another mapping containing index of debuginfo
# and development package
# e.g.
# self.ancillary_rpms = {'i686', {'debuginfo': foo-debuginfo.rpm,
# 'devel': foo-devel.rpm}}
self.ancillary_rpms = {}
if rpms:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
for rpm in rpms:
self.add(rpm)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
@classmethod
def gather_from_dir(cls, rpm_file, all_rpms=None):
"""Gather RPM collection from local directory"""
dir_name = os.path.dirname(os.path.abspath(rpm_file))
filename = os.path.basename(rpm_file)
nvra = koji.parse_NVRA(filename)
rpm_files = glob.glob(os.path.join(
dir_name, '*-%(version)s-%(release)s.%(arch)s.rpm' % nvra))
rpm_col = cls()
if all_rpms:
selector = lambda rpm: True
else:
selector = lambda rpm: local_rpm.is_devel or \
local_rpm.is_debuginfo or local_rpm.filename == filename
found_debuginfo = 1
for rpm_file in rpm_files:
local_rpm = LocalRPM(rpm_file)
if local_rpm.is_debuginfo:
found_debuginfo <<= 1
if found_debuginfo == 4:
raise RuntimeError(
'Found more than one debuginfo package in '
'this directory. At the moment, fedabipkgdiff '
'is not able to deal with this case. '
'Please create two separate directories and '
'put an RPM and its ancillary debuginfo and '
'devel RPMs in each directory.')
if selector(local_rpm):
rpm_col.add(local_rpm)
return rpm_col
def add(self, rpm):
"""Add a RPM into this collection"""
self.rpms.setdefault(rpm.arch, []).append(rpm)
devel_debuginfo_default = {'debuginfo': None, 'devel': None}
if rpm.is_debuginfo:
self.ancillary_rpms.setdefault(
rpm.arch, devel_debuginfo_default)['debuginfo'] = rpm
if rpm.is_devel:
self.ancillary_rpms.setdefault(
rpm.arch, devel_debuginfo_default)['devel'] = rpm
def rpms_iter(self, arches=None, default_behavior=True):
"""Iterator of RPMs to go through RPMs with specific arches"""
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
arches = sorted(self.rpms.keys())
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
for arch in arches:
for _rpm in self.rpms[arch]:
yield _rpm
def get_sibling_debuginfo(self, rpm):
"""Get sibling debuginfo package of given rpm"""
if rpm.arch not in self.ancillary_rpms:
return None
return self.ancillary_rpms[rpm.arch].get('debuginfo')
def get_sibling_devel(self, rpm):
"""Get sibling devel package of given rpm"""
if rpm.arch not in self.ancillary_rpms:
return None
return self.ancillary_rpms[rpm.arch].get('devel')
def get_peer_rpm(self, rpm):
"""Get peer rpm of rpm from this collection"""
if rpm.arch not in self.rpms:
return None
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
for _rpm in self.rpms[rpm.arch]:
if _rpm.is_peer(rpm):
return _rpm
return None
def get_all_debuginfo_rpms(self, rpm_info):
"""Return a list of descriptors of all the debuginfo RPMs associated
to a given RPM.
:param: dict rpm_info a dict representing an RPM. This was
received from the Koji API, either from listRPMs or getRPM.
:return: a list of dicts containing RPM descriptors (dicts)
for the debuginfo RPMs associated to rpm_info
:retype: dict
"""
rpm_infos = self.rpms[rpm_info.arch]
result = []
for r in rpm_infos:
if r.is_debuginfo:
result.append(r)
return result
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
def generate_comparison_halves(rpm_col1, rpm_col2):
"""Iterate RPM collection and peer's to generate comparison halves"""
for _rpm in rpm_col1.rpms_iter():
if _rpm.is_debuginfo:
continue
if _rpm.is_devel and not global_config.check_all_subpackages:
continue
if global_config.self_compare:
rpm2 = _rpm
else:
rpm2 = rpm_col2.get_peer_rpm(_rpm)
if rpm2 is None:
logger.warning('Peer RPM of {0} is not found.'.format(_rpm.filename))
continue
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
debuginfo_list1 = []
debuginfo_list2 = []
# If this is a *devel* package we are looking at, then get all
# the debug info packages associated to with the main package
# and stick them into the resulting comparison half.
if _rpm.is_devel:
debuginfo_list1 = rpm_col1.get_all_debuginfo_rpms(_rpm)
else:
debuginfo_list1.append(rpm_col1.get_sibling_debuginfo(_rpm))
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
devel1 = rpm_col1.get_sibling_devel(_rpm)
if global_config.self_compare:
debuginfo_list2 = debuginfo_list1
devel2 = devel1
else:
if rpm2.is_devel:
debuginfo_list2 = rpm_col2.get_all_debuginfo_rpms(rpm2)
else:
debuginfo_list2.append(rpm_col2.get_sibling_debuginfo(rpm2))
devel2 = rpm_col2.get_sibling_devel(rpm2)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
yield (ComparisonHalf(subject=_rpm,
ancillary_debug=debuginfo_list1,
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
ancillary_devel=devel1),
ComparisonHalf(subject=rpm2,
ancillary_debug=debuginfo_list2,
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
ancillary_devel=devel2))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
class Brew(object):
"""Interface to Koji XMLRPC API with enhancements specific to fedabipkgdiff
kojihub XMLRPC APIs are well-documented in koji's source code. For more
details information, please refer to class RootExports within kojihub.py.
For details of APIs used within fedabipkgdiff, refer to from line
https://pagure.io/koji/blob/master/f/hub/kojihub.py#_7835
"""
def __init__(self, baseurl):
"""Initialize Brew
:param str baseurl: the kojihub URL to initialize a session, that is
used to access koji XMLRPC APIs.
"""
self.session = koji.ClientSession(baseurl)
@log_call
def listRPMs(self, buildID=None, arches=None, selector=None):
"""Get list of RPMs of a build from Koji
Call kojihub.listRPMs to get list of RPMs. Return selected RPMs without
changing each RPM information.
A RPM returned from listRPMs contains following keys:
- id
- name
- version
- release
- nvr (synthesized for sorting purposes)
- arch
- epoch
- payloadhash
- size
- buildtime
- build_id
- buildroot_id
- external_repo_id
- external_repo_name
- metadata_only
- extra
:param int buildID: id of a build from which to list RPMs.
:param arches: to restrict to list RPMs with specified arches.
:type arches: list or tuple
:param selector: called to determine if a RPM should be selected and
included in the final returned result. Selector must be a callable
object and accepts one parameter of a RPM.
:type selector: a callable object
:return: a list of RPMs, each of them is a dict object
:rtype: list
"""
if selector:
assert hasattr(selector, '__call__'), 'selector must be callable.'
rpms = self.session.listRPMs(buildID=buildID, arches=arches)
if selector:
rpms = [rpm for rpm in rpms if selector(rpm)]
return rpms
@log_call
def getRPM(self, rpminfo):
"""Get a RPM from koji
Call kojihub.getRPM, and returns the result directly without any
change.
When not found a RPM, koji.getRPM will return None, then
this method will raise RpmNotFound error immediately to claim what is
happening. I want to raise fedabipkgdiff specific error rather than
koji's GenericError and then raise RpmNotFound again, so I just simply
don't use strict parameter to call koji.getRPM.
:param rpminfo: rpminfo may be a N-V-R.A or a map containing name,
version, release, and arch. For example, file-5.25-5.fc24.x86_64, and
`{'name': 'file', 'version': '5.25', 'release': '5.fc24', 'arch':
'x86_64'}`.
:type rpminfo: str or dict
:return: a map containing RPM information, that contains same keys as
method `Brew.listRPMs`.
:rtype: dict
:raises RpmNotFound: if a RPM cannot be found with rpminfo.
"""
rpm = self.session.getRPM(rpminfo)
if rpm is None:
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
raise RpmNotFound('Cannot find RPM {0}'.format(rpminfo))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
return rpm
@log_call
def listBuilds(self, packageID, state=None, topone=None,
selector=None, order_by=None, reverse=None):
"""Get list of builds from Koji
Call kojihub.listBuilds, and return selected builds without changing
each build information.
By default, only builds with COMPLETE state are queried and returns
afterwards.
:param int packageID: id of package to list builds from.
:param int state: build state. There are five states of a build in
Koji. fedabipkgdiff only cares about builds with COMPLETE state. If
state is omitted, builds with COMPLETE state are queried from Koji by
default.
:param bool topone: just return the top first build.
:param selector: a callable object used to select specific subset of
builds. Selector will be called immediately after Koji returns queried
builds. When each call to selector, a build is passed to
selector. Return True if select current build, False if not.
:type selector: a callable object
:param str order_by: the attribute name by which to order the builds,
for example, name, version, or nvr.
:param bool reverse: whether to order builds reversely.
:return: a list of builds, even if there is only one build.
:rtype: list
:raises TypeError: if selector is not callable, or if order_by is not a
string value.
"""
if state is None:
state = koji.BUILD_STATES['COMPLETE']
if selector is not None and not hasattr(selector, '__call__'):
raise TypeError(
'{0} is not a callable object.'.format(str(selector)))
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
if order_by is not None and not isinstance(order_by, six.string_types):
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
raise TypeError('order_by {0} is invalid.'.format(order_by))
builds = self.session.listBuilds(packageID=packageID, state=state)
if selector is not None:
builds = [build for build in builds if selector(build)]
if order_by is not None:
# FIXME: is it possible to sort builds by using opts parameter of
# listBuilds
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
if order_by == 'nvr':
if six.PY2:
builds = sorted(builds, cmp=cmp_nvr, reverse=reverse)
else:
builds = sorted(builds,
key=functools.cmp_to_key(cmp_nvr),
reverse=reverse)
else:
builds = sorted(
builds, key=lambda b: b[order_by], reverse=reverse)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if topone:
builds = builds[0:1]
return builds
@log_call
def getPackage(self, name):
"""Get a package from Koji
:param str name: a package name.
:return: a mapping containing package information. For example,
`{'id': 1, 'name': 'package'}`.
:rtype: dict
"""
package = self.session.getPackage(name)
if package is None:
package = self.session.getPackage(name.rsplit('-', 1)[0])
if package is None:
raise KojiPackageNotFound(
'Cannot find package {0}.'.format(name))
return package
@log_call
def getBuild(self, buildID):
"""Get a build from Koji
Call kojihub.getBuild. Return got build directly without change.
:param int buildID: id of build to get from Koji.
:return: the found build. Return None, if not found a build with
buildID.
:rtype: dict
"""
return self.session.getBuild(buildID)
@log_call
def get_rpm_build_id(self, name, version, release, arch=None):
"""Get build ID that contains a RPM with specific nvra
If arch is not omitted, a RPM can be identified by its N-V-R-A.
If arch is omitted, name is used to get associated package, and then
to get the build.
Example:
>>> brew = Brew('url to kojihub')
>>> brew.get_rpm_build_id('httpd', '2.4.18', '2.fc24')
>>> brew.get_rpm_build_id('httpd', '2.4.18', '2.fc25', 'x86_64')
:param str name: name of a rpm
:param str version: version of a rpm
:param str release: release of a rpm
:param arch: arch of a rpm
:type arch: str or None
:return: id of the build from where the RPM is built
:rtype: dict
:raises KojiPackageNotFound: if name is not found from Koji if arch
is None.
"""
if arch is None:
package = self.getPackage(name)
selector = lambda item: item['version'] == version and \
item['release'] == release
builds = self.listBuilds(packageID=package['id'],
selector=selector)
if not builds:
raise NoBuildsError(
'No builds are selected from package {0}.'.format(
package['name']))
return builds[0]['build_id']
else:
rpm = self.getRPM({'name': name,
'version': version,
'release': release,
'arch': arch,
})
return rpm['build_id']
@log_call
def get_package_latest_build(self, package_name, distro):
"""Get latest build from a package, for a particular distro.
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Example:
>>> brew = Brew('url to kojihub')
>>> brew.get_package_latest_build('httpd', 'fc24')
:param str package_name: from which package to get the latest build
:param str distro: which distro the latest build belongs to
:return: the found build
:rtype: dict or None
:raises NoCompleteBuilds: if there is no latest build of a package.
"""
package = self.getPackage(package_name)
selector = lambda item: item['release'].find(distro) > -1
builds = self.listBuilds(packageID=package['id'],
selector=selector,
order_by='nvr',
reverse=True)
if not builds:
# So we found no build which distro string exactly matches
# the 'distro' parameter.
#
# Now lets try to get builds which distro string are less
# than the value of the 'distro' parameter. This is for
# cases when, for instance, the build of package foo that
# is present in current Fedora 27 is foo-1.fc26. That
# build originates from Fedora 26 but is being re-used in
# Fedora 27. So we want this function to pick up that
# foo-1.fc26, even though we want the builds of foo that
# match the distro string fc27.
selector = lambda build: get_distro_from_string(build['release']) and \
get_distro_from_string(build['release']) <= distro
builds = self.listBuilds(packageID=package['id'],
selector=selector,
order_by='nvr',
reverse=True);
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if not builds:
raise NoCompleteBuilds(
'No complete builds of package {0}'.format(package_name))
return builds[0]
@log_call
def select_rpms_from_a_build(self, build_id, package_name, arches=None,
select_subpackages=None):
"""Select specific RPMs within a build
RPMs could be filtered be specific criterias by the parameters.
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
By default, fedabipkgdiff requires the RPM package, as well as
its associated debuginfo and devel packages. These three
packages are selected, and noarch and src are excluded.
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
:param int build_id: from which build to select rpms.
:param str package_name: which rpm to select that matches this name.
:param arches: which arches to select. If arches omits, rpms with all
arches except noarch and src will be selected.
:type arches: list, tuple or None
:param bool select_subpackages: indicate whether to select all RPMs
with specific arch from build.
:return: a list of RPMs returned from listRPMs
:rtype: list
"""
excluded_arches = ('noarch', 'src')
def rpms_selector(package_name, excluded_arches):
return lambda rpm: \
rpm['arch'] not in excluded_arches and \
(rpm['name'] == package_name or
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
rpm['name'].endswith('-debuginfo') or
rpm['name'].endswith('-devel'))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if select_subpackages:
selector = lambda rpm: rpm['arch'] not in excluded_arches
else:
selector = rpms_selector(package_name, excluded_arches)
rpm_infos = self.listRPMs(buildID=build_id,
arches=arches,
selector=selector)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return RPMCollection((RPM(rpm_info) for rpm_info in rpm_infos))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@log_call
def get_latest_built_rpms(self, package_name, distro, arches=None):
"""Get RPMs from latest build of a package
:param str package_name: from which package to get the rpms
:param str distro: which distro the rpms belong to
:param arches: which arches the rpms belong to
:type arches: str or None
:return: the selected RPMs
:rtype: list
"""
latest_build = self.get_package_latest_build(package_name, distro)
# Get rpm and debuginfo rpm from each arch
return self.select_rpms_from_a_build(latest_build['build_id'],
package_name,
arches=arches)
@log_call
def get_session():
"""Get instance of Brew to talk with Koji"""
return Brew(global_config.koji_server)
@log_call
def get_download_dir():
"""Return the directory holding all downloaded RPMs
If directory does not exist, it is created automatically.
:return: path to directory holding downloaded RPMs.
:rtype: str
"""
download_dir = os.path.join(HOME_DIR, 'downloads')
if not os.path.exists(download_dir):
os.makedirs(download_dir)
return download_dir
@log_call
def download_rpm(url):
"""Using curl to download a RPM from Koji
Currently, curl is called and runs in a spawned process. pycurl would be a
good way instead. This would be changed in the future.
:param str url: URL of a RPM to download.
:return: True if a RPM is downloaded successfully, False otherwise.
:rtype: bool
"""
cmd = 'curl --location --silent {0} -o {1}'.format(
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
url, os.path.join(get_download_dir(),
os.path.basename(url)))
if global_config.dry_run:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
print('DRY-RUN: {0}'.format(cmd))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
return
return_code = subprocess.call(cmd, shell=True)
if return_code > 0:
logger.error('curl fails with returned code: %d.', return_code)
return False
return True
@log_call
def download_rpms(rpms):
"""Download RPMs
:param list rpms: list of RPMs to download.
"""
def _download(rpm):
if rpm.is_downloaded:
logger.debug('Reuse %s', rpm.downloaded_file)
else:
logger.debug('Download %s', rpm.download_url)
download_rpm(rpm.download_url)
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
for rpm in rpms:
_download(rpm)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@log_call
def build_path_to_abipkgdiff():
"""Build the path to the 'abipkgidiff' program to use.
The path to 'abipkgdiff' is either the argument of the
--abipkgdiff command line option, or the path to 'abipkgdiff' as
found in the $PATH environment variable.
:return: str a string representing the path to the 'abipkgdiff'
command.
"""
if global_config.abipkgdiff:
return global_config.abipkgdiff
Make fedabipkgdiff consistent with Libabigail's other tests In the libabigail project, almost all the tests for the tools follow a similar pattern. The test contains a set of input files to compare. The result of the comparison is thus compared to a set of reference comparison result. This approach is already documented in the CONTRIBUTING file. There are several interesting properties with this scheme. First, it capture the behaviour of the tools, including what is shown to the user. Second, it eases the job of a hacker who wants to add a new test for a new behaviour of a given tool. The user just has to provide: 1/ A new reference output of the new use case of the tool (that is easily constructed by using the tool itself and saving its output) and add an entry to array of entries that describe what to compare 2/ A new set of inputs to the tool And voila. Unfortunately, fedabipkgdiff tests don't follow this scheme. That make them surprising to hackers who read the source code of the existing tests, at very least. Also, the fedabipkgdiff tests were only unit tests. They were not testing the tool as used by users in general. This patch makes the fedabipkgdiff tests follow the general approach of the tests of the other Libabigail tools. The patch first craetes a program names tests/mockfedabipkgdiff. It's a wrapper around tools/fedabipkgdiff. It overloads the Koji client of fedabipkgdiff with a fake Koji client that gets the Fedora packages locally, from tests/data/test-fedabipkgdiff/packages. In other words, mockfedabipkgdiff is fedabipkgdiff without going to the network. I believe that in the future, tests/mockfedabipkgdiff should be killed when fedabipkgdiff is able to cache a local description of a local partial view of a Koji repository, along with the build packages that were already downloaded. That way, calling fedabipkgdiff twice with the same set of option should make the tool perform correctly without going to the netword on the second invocation. We should be able to save the local partial view of the Koji repository under e.g, tests/data/test-fedabipkgdiff/local-koji and tell fedabipkgdiff to use that, instead of using the network. But we are not there yet. So for now, I am using mockfedabipkgdiff. Then, tests/runtestfedabipkdiff.py.in has been re-written to use tests/mockfedabipkgdiff and to look like what is described in CONTRIBUTING as far as how Libabigail tools' tests are organized: mockfedabipkgdiff is called to perform a comparison. The result of the comparison is then compared (using GNU diff) to a reference comparison result file. Please note that tests/runtestfedabipkdiff.py is relatively fast for the moment. But when it contains much more tests and start becoming slow, then we'll need to change the code to run several comparisons in parallel, just like we do today in tests/test-diff-filter.cc. At that point, I believe I'll just re-write this in C++, just like tests/test-diff-filter.cc because that will allow us to have true concurrent code based on the abigail:workers API. For now, I am keeping this in Python also because I think that keeps Chenxiong happy ;-) To be sure that fedabipkgdiff (and its underlying abipkgdiff) are really comparing all the packages they are supposed to compare and also all the binaries in those packages, I have added a new --show-identical-binaries to abipkgdiff and fedabipkgdiff. That option shows the name of the binaries (and packages) that are compared, *even if* the ABI of those binaries are identical. Because otherwise, today, if two binaries (or packages) have the same ABI, nothing is displayed. For instance, here is the result of comparing a package against itself, using this new --show-identical-binaries options: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ./build/tools/abipkgdiff --show-identical-binaries dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: ================ changes of 'dbus-binding-tool'=============== No ABI change detected ================ end of changes of 'dbus-binding-tool'=============== ================ changes of 'libdbus-glib-1.so.2.1.0'=============== No ABI change detected ================ end of changes of 'libdbus-glib-1.so.2.1.0'=============== dodji@adjoa:patches$ And here is what this command before that patch would do: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ../master/build/tools/abipkgdiff dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: dodji@adjoa:patches$ The rest of the patch is mostly new test inputs material and the necessary adjustments following all the changes above. * configure.ac: Do not require Python dependencies itertools, unittest and StringIO anymore as they are not used anymore. Require new module tempfile now. Generate new executable script tests/mockfedabipkgdiff from tests/mockfedabipkgdiff.in. * doc/manuals/abipkgdiff.rst: Add doc for new option --show-identical-binaries to abipkgdiff * doc/manuals/fedabipkgdiff.rst: Add doc for new options --show-identical-binaries to fedabipkgdiff. * tools/abipkgdiff.cc (options::show_identical_binaries): New data member. (options::options): Initialize new data member. (display_usage): Add a new help string for the new --show-identical-binaries option. (parse_command_line): Parse the newq --show-identical-binaries command line switch. (pthread_routine_compare): When the comparison of two binaries is empty, if --show-identical-binaries was provided, then emit some output saying the comparison did yield the empty set. * tools/fedabipkgdiff (DEFAULT_ABIPKGDIFF): Store the default path to abipkgdiff in this new global variable. Naming this default path is useful because it can then be cleanly overloaded when using mock.patch. (build_path_to_abipkgdiff): Return the new DEFAULT_ABIPKGDIFF global variable. (cmd): Parse the new --show-identical-binaries command line switch. * tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt: New reference output. * tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt: Likewise. * tests/mockfedabipkgdiff.in: New uninstalled script template. * tests/runtestfedabipkgdiff.py.in (counter) (temp_file_or_dir_prefix, UtilsTest, RPMTest, LocalRPMTest) (RunAbipkgdiffTest, GetPackageLatestBuildTest, DownloadRPMTest) (BrewListRPMsTest, AssertionHelper, MockGlobalConfig) (BUILT_ABIPKGDIFF, CompareABIFromCommandLineTest): Remove these classes, global variables and functions. (FEDABIPKGDIFF, TEST_SRC_DIR, TEST_BUILD_DIR, INPUT_DIR) (OUTPUT_DIR, FEDABIPKGDIFF_TEST_SPECS): New global variables. (ensure_output_dir_created, run_fedabipkgdiff_tests, main): New functions. * tests/test-diff-pkg.cc (in_out_specs): Add tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt to the set of reference outputs to consider. * tests/Makefile.am: Add non-installed script mockfedabipkgdiff to source distribution. Also added tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt, tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt and tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt to source distribution. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-06 09:51:13 +00:00
return DEFAULT_ABIPKGDIFF
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
def format_debug_info_pkg_options(option, debuginfo_list):
"""Given a list of debug info package descriptors return an option
string that looks like:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
option dbg.rpm1 option dbgrpm2 ...
:param: list debuginfo_list a list of instances of the RPM class
representing the debug info rpms to use to construct the option
string.
:return: str a string representing the option string that
concatenate the 'option' parameter before the path to each RPM
contained in 'debuginfo_list'.
"""
options = []
for dbg_pkg in debuginfo_list:
if dbg_pkg and dbg_pkg.downloaded_file:
options.append(' {0} {1}'.format(option, dbg_pkg.downloaded_file))
return ' '.join(options) if options else ''
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@log_call
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
def abipkgdiff(cmp_half1, cmp_half2):
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
"""Run abipkgdiff against found two RPM packages
Construct and execute abipkgdiff to get ABI diff
abipkgdiff \
--d1 package1-debuginfo --d2 package2-debuginfo \
package1-rpm package2-rpm
Output to stdout or stderr from abipkgdiff is not captured. abipkgdiff is
called synchronously. fedabipkgdiff does not return until underlying
abipkgdiff finishes.
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
:param ComparisonHalf cmp_half1: the first comparison half.
:param ComparisonHalf cmp_half2: the second comparison half.
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
:return: return code of underlying abipkgdiff execution.
:rtype: int
"""
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
abipkgdiff_tool = build_path_to_abipkgdiff()
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
suppressions = ''
if global_config.suppr:
suppressions = '--suppressions {0}'.format(global_config.suppr)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
if global_config.no_devel_pkg:
devel_pkg1 = ''
devel_pkg2 = ''
else:
if cmp_half1.ancillary_devel is None:
msg = 'Development package for {0} does not exist.'.format(cmp_half1.subject.filename)
if global_config.error_on_warning:
raise RuntimeError(msg)
else:
devel_pkg1 = ''
logger.warning('{0} Ignored.'.format(msg))
else:
devel_pkg1 = '--devel-pkg1 {0}'.format(cmp_half1.ancillary_devel.downloaded_file)
if cmp_half2.ancillary_devel is None:
msg = 'Development package for {0} does not exist.'.format(cmp_half2.subject.filename)
if global_config.error_on_warning:
raise RuntimeError(msg)
else:
devel_pkg2 = ''
logger.warning('{0} Ignored.'.format(msg))
else:
devel_pkg2 = '--devel-pkg2 {0}'.format(cmp_half2.ancillary_devel.downloaded_file)
if cmp_half1.ancillary_debug is None:
msg = 'Debuginfo package for {0} does not exist.'.format(cmp_half1.subject.filename)
if global_config.error_on_warning:
raise RuntimeError(msg)
else:
debuginfo_pkg1 = ''
logger.warning('{0} Ignored.'.format(msg))
else:
debuginfo_pkg1 = format_debug_info_pkg_options("--d1", cmp_half1.ancillary_debug)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
if cmp_half2.ancillary_debug is None:
msg = 'Debuginfo package for {0} does not exist.'.format(cmp_half2.subject.filename)
if global_config.error_on_warning:
raise RuntimeError(msg)
else:
debuginfo_pkg2 = ''
logger.warning('{0} Ignored.'.format(msg))
else:
debuginfo_pkg2 = format_debug_info_pkg_options("--d2", cmp_half2.ancillary_debug);
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
cmd = [
abipkgdiff_tool,
suppressions,
Make fedabipkgdiff consistent with Libabigail's other tests In the libabigail project, almost all the tests for the tools follow a similar pattern. The test contains a set of input files to compare. The result of the comparison is thus compared to a set of reference comparison result. This approach is already documented in the CONTRIBUTING file. There are several interesting properties with this scheme. First, it capture the behaviour of the tools, including what is shown to the user. Second, it eases the job of a hacker who wants to add a new test for a new behaviour of a given tool. The user just has to provide: 1/ A new reference output of the new use case of the tool (that is easily constructed by using the tool itself and saving its output) and add an entry to array of entries that describe what to compare 2/ A new set of inputs to the tool And voila. Unfortunately, fedabipkgdiff tests don't follow this scheme. That make them surprising to hackers who read the source code of the existing tests, at very least. Also, the fedabipkgdiff tests were only unit tests. They were not testing the tool as used by users in general. This patch makes the fedabipkgdiff tests follow the general approach of the tests of the other Libabigail tools. The patch first craetes a program names tests/mockfedabipkgdiff. It's a wrapper around tools/fedabipkgdiff. It overloads the Koji client of fedabipkgdiff with a fake Koji client that gets the Fedora packages locally, from tests/data/test-fedabipkgdiff/packages. In other words, mockfedabipkgdiff is fedabipkgdiff without going to the network. I believe that in the future, tests/mockfedabipkgdiff should be killed when fedabipkgdiff is able to cache a local description of a local partial view of a Koji repository, along with the build packages that were already downloaded. That way, calling fedabipkgdiff twice with the same set of option should make the tool perform correctly without going to the netword on the second invocation. We should be able to save the local partial view of the Koji repository under e.g, tests/data/test-fedabipkgdiff/local-koji and tell fedabipkgdiff to use that, instead of using the network. But we are not there yet. So for now, I am using mockfedabipkgdiff. Then, tests/runtestfedabipkdiff.py.in has been re-written to use tests/mockfedabipkgdiff and to look like what is described in CONTRIBUTING as far as how Libabigail tools' tests are organized: mockfedabipkgdiff is called to perform a comparison. The result of the comparison is then compared (using GNU diff) to a reference comparison result file. Please note that tests/runtestfedabipkdiff.py is relatively fast for the moment. But when it contains much more tests and start becoming slow, then we'll need to change the code to run several comparisons in parallel, just like we do today in tests/test-diff-filter.cc. At that point, I believe I'll just re-write this in C++, just like tests/test-diff-filter.cc because that will allow us to have true concurrent code based on the abigail:workers API. For now, I am keeping this in Python also because I think that keeps Chenxiong happy ;-) To be sure that fedabipkgdiff (and its underlying abipkgdiff) are really comparing all the packages they are supposed to compare and also all the binaries in those packages, I have added a new --show-identical-binaries to abipkgdiff and fedabipkgdiff. That option shows the name of the binaries (and packages) that are compared, *even if* the ABI of those binaries are identical. Because otherwise, today, if two binaries (or packages) have the same ABI, nothing is displayed. For instance, here is the result of comparing a package against itself, using this new --show-identical-binaries options: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ./build/tools/abipkgdiff --show-identical-binaries dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: ================ changes of 'dbus-binding-tool'=============== No ABI change detected ================ end of changes of 'dbus-binding-tool'=============== ================ changes of 'libdbus-glib-1.so.2.1.0'=============== No ABI change detected ================ end of changes of 'libdbus-glib-1.so.2.1.0'=============== dodji@adjoa:patches$ And here is what this command before that patch would do: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ../master/build/tools/abipkgdiff dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: dodji@adjoa:patches$ The rest of the patch is mostly new test inputs material and the necessary adjustments following all the changes above. * configure.ac: Do not require Python dependencies itertools, unittest and StringIO anymore as they are not used anymore. Require new module tempfile now. Generate new executable script tests/mockfedabipkgdiff from tests/mockfedabipkgdiff.in. * doc/manuals/abipkgdiff.rst: Add doc for new option --show-identical-binaries to abipkgdiff * doc/manuals/fedabipkgdiff.rst: Add doc for new options --show-identical-binaries to fedabipkgdiff. * tools/abipkgdiff.cc (options::show_identical_binaries): New data member. (options::options): Initialize new data member. (display_usage): Add a new help string for the new --show-identical-binaries option. (parse_command_line): Parse the newq --show-identical-binaries command line switch. (pthread_routine_compare): When the comparison of two binaries is empty, if --show-identical-binaries was provided, then emit some output saying the comparison did yield the empty set. * tools/fedabipkgdiff (DEFAULT_ABIPKGDIFF): Store the default path to abipkgdiff in this new global variable. Naming this default path is useful because it can then be cleanly overloaded when using mock.patch. (build_path_to_abipkgdiff): Return the new DEFAULT_ABIPKGDIFF global variable. (cmd): Parse the new --show-identical-binaries command line switch. * tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt: New reference output. * tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt: Likewise. * tests/mockfedabipkgdiff.in: New uninstalled script template. * tests/runtestfedabipkgdiff.py.in (counter) (temp_file_or_dir_prefix, UtilsTest, RPMTest, LocalRPMTest) (RunAbipkgdiffTest, GetPackageLatestBuildTest, DownloadRPMTest) (BrewListRPMsTest, AssertionHelper, MockGlobalConfig) (BUILT_ABIPKGDIFF, CompareABIFromCommandLineTest): Remove these classes, global variables and functions. (FEDABIPKGDIFF, TEST_SRC_DIR, TEST_BUILD_DIR, INPUT_DIR) (OUTPUT_DIR, FEDABIPKGDIFF_TEST_SPECS): New global variables. (ensure_output_dir_created, run_fedabipkgdiff_tests, main): New functions. * tests/test-diff-pkg.cc (in_out_specs): Add tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt to the set of reference outputs to consider. * tests/Makefile.am: Add non-installed script mockfedabipkgdiff to source distribution. Also added tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt, tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt and tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt to source distribution. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-06 09:51:13 +00:00
'--show-identical-binaries' if global_config.show_identical_binaries else '',
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
'--no-default-suppression' if global_config.no_default_suppr else '',
'--dso-only' if global_config.dso_only else '',
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
debuginfo_pkg1,
debuginfo_pkg2,
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
devel_pkg1,
devel_pkg2,
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
cmp_half1.subject.downloaded_file,
cmp_half2.subject.downloaded_file,
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
]
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
cmd = [s for s in cmd if s != '']
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.dry_run:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
print('DRY-RUN: {0}'.format(' '.join(cmd)))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
return
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
logger.debug('Run: %s', ' '.join(cmd))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
print('Comparing the ABI of binaries between {0} and {1}:'.format(
cmp_half1.subject.filename, cmp_half2.subject.filename))
print()
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
proc = subprocess.Popen(' '.join(cmd), shell=True,
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True)
# So we could have done: stdout, stderr = proc.communicate()
# But then the documentatin of proc.communicate says:
#
# Note: The data read is buffered in memory, so do not use this
# method if the data size is large or unlimited. "
#
# In practice, we are seeing random cases where this
# proc.communicate() function does *NOT* terminate and seems to be
# in a deadlock state. So we are avoiding it altogether. We are
# then busy looping, waiting for the spawn process to finish, and
# then we get its output.
#
while True:
if proc.poll() != None:
break
stdout = ''.join(proc.stdout.readlines())
stderr = ''.join(proc.stderr.readlines())
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
is_ok = proc.returncode == ABIDIFF_OK
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
is_internal_error = proc.returncode & ABIDIFF_ERROR or proc.returncode & ABIDIFF_USAGE_ERROR
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
has_abi_change = proc.returncode & ABIDIFF_ABI_CHANGE
if is_internal_error:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
six.print_(stderr, file=sys.stderr)
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
elif is_ok or has_abi_change:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
print(stdout)
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
return proc.returncode
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@log_call
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
def run_abipkgdiff(rpm_col1, rpm_col2):
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
"""Run abipkgdiff
If one of the executions finds ABI differences, the return code is the
return code from abipkgdiff.
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
:param RPMCollection rpm_col1: a collection of RPMs
:param RPMCollection rpm_col2: same as rpm_col1
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
:return: exit code of the last non-zero returned from underlying abipkgdiff
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
:rtype: int
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
"""
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return_codes = [
abipkgdiff(cmp_half1, cmp_half2) for cmp_half1, cmp_half2
in generate_comparison_halves(rpm_col1, rpm_col2)]
return max(return_codes) if return_codes else 0
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@log_call
def diff_local_rpm_with_latest_rpm_from_koji():
"""Diff against local rpm and remove latest rpm
This operation handles a local rpm and debuginfo rpm and remote ones
located in remote Koji server, that has specific distro specificed by
argument --from.
1/ Suppose the packager has just locally built a package named
foo-3.0.fc24.rpm. To compare the ABI of this locally build package with the
latest stable package from Fedora 23, one would do:
fedabipkgdiff --from fc23 ./foo-3.0.fc24.rpm
"""
from_distro = global_config.from_distro
if not is_distro_valid(from_distro):
raise InvalidDistroError('Invalid distro {0}'.format(from_distro))
local_rpm_file = global_config.NVR[0]
if not os.path.exists(local_rpm_file):
raise ValueError('{0} does not exist.'.format(local_rpm_file))
local_rpm = LocalRPM(local_rpm_file)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
rpm_col1 = session.get_latest_built_rpms(local_rpm.name,
from_distro,
arches=local_rpm.arch)
rpm_col2 = RPMCollection.gather_from_dir(local_rpm_file)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.clean_cache_before:
delete_download_cache()
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
download_rpms(rpm_col1.rpms_iter())
result = run_abipkgdiff(rpm_col1, rpm_col2)
if global_config.clean_cache_after:
delete_download_cache()
return result
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@log_call
def diff_latest_rpms_based_on_distros():
"""abipkgdiff rpms based on two distros
2/ Suppose the packager wants to see how the ABIs of the package foo
evolved between fedora 19 and fedora 22. She would thus type the command:
fedabipkgdiff --from fc19 --to fc22 foo
"""
from_distro = global_config.from_distro
to_distro = global_config.to_distro
if not is_distro_valid(from_distro):
raise InvalidDistroError('Invalid distro {0}'.format(from_distro))
if not is_distro_valid(to_distro):
raise InvalidDistroError('Invalid distro {0}'.format(to_distro))
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
package_name = global_config.NVR[0]
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
rpm_col1 = session.get_latest_built_rpms(package_name,
distro=global_config.from_distro)
rpm_col2 = session.get_latest_built_rpms(package_name,
distro=global_config.to_distro)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.clean_cache_before:
delete_download_cache()
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
download_rpms(chain(rpm_col1.rpms_iter(), rpm_col2.rpms_iter()))
result = run_abipkgdiff(rpm_col1, rpm_col2)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.clean_cache_after:
delete_download_cache()
return result
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
@log_call
def diff_two_nvras_from_koji():
"""Diff two nvras from koji
The arch probably omits, that means febabipkgdiff will diff all arches. If
specificed, the specific arch will be handled.
3/ Suppose the packager wants to compare the ABI of two packages designated
by their name and version. She would issue a command like this:
fedabipkgdiff foo-1.0.fc19 foo-3.0.fc24
fedabipkgdiff foo-1.0.fc19.i686 foo-1.0.fc24.i686
"""
left_rpm = koji.parse_NVRA(global_config.NVR[0])
right_rpm = koji.parse_NVRA(global_config.NVR[1])
if is_distro_valid(left_rpm['arch']) and \
is_distro_valid(right_rpm['arch']):
nvr = koji.parse_NVR(global_config.NVR[0])
params1 = (nvr['name'], nvr['version'], nvr['release'], None)
nvr = koji.parse_NVR(global_config.NVR[1])
params2 = (nvr['name'], nvr['version'], nvr['release'], None)
else:
params1 = (left_rpm['name'],
left_rpm['version'],
left_rpm['release'],
left_rpm['arch'])
params2 = (right_rpm['name'],
right_rpm['version'],
right_rpm['release'],
right_rpm['arch'])
build_id = session.get_rpm_build_id(*params1)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
rpm_col1 = session.select_rpms_from_a_build(
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
build_id, params1[0], arches=params1[3],
select_subpackages=global_config.check_all_subpackages)
build_id = session.get_rpm_build_id(*params2)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
rpm_col2 = session.select_rpms_from_a_build(
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
build_id, params2[0], arches=params2[3],
select_subpackages=global_config.check_all_subpackages)
if global_config.clean_cache_before:
delete_download_cache()
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
download_rpms(chain(rpm_col1.rpms_iter(), rpm_col2.rpms_iter()))
result = run_abipkgdiff(rpm_col1, rpm_col2)
if global_config.clean_cache_after:
delete_download_cache()
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return result
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
@log_call
def self_compare_rpms_from_distro():
"""Compare ABI between same package from a distro
Doing ABI comparison on self package should return no
ABI change and hence return code should be 0. This is useful
to ensure that functionality of libabigail itself
didn't break. This utility can be invoked like this:
fedabipkgdiff --self-compare -a --from fc25 foo
"""
from_distro = global_config.from_distro
if not is_distro_valid(from_distro):
raise InvalidDistroError('Invalid distro {0}'.format(from_distro))
package_name = global_config.NVR[0]
rpm_col1 = session.get_latest_built_rpms(package_name,
distro=global_config.from_distro)
if global_config.clean_cache_before:
delete_download_cache()
download_rpms(rpm_col1.rpms_iter())
result = run_abipkgdiff(rpm_col1, rpm_col1)
if global_config.clean_cache_after:
delete_download_cache()
return result
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
@log_call
def diff_from_two_rpm_files(from_rpm_file, to_rpm_file):
"""Diff two RPM files"""
rpm_col1 = RPMCollection.gather_from_dir(from_rpm_file)
rpm_col2 = RPMCollection.gather_from_dir(to_rpm_file)
if global_config.clean_cache_before:
delete_download_cache()
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
download_rpms(chain(rpm_col1.rpms_iter(), rpm_col2.rpms_iter()))
result = run_abipkgdiff(rpm_col1, rpm_col2)
if global_config.clean_cache_after:
delete_download_cache()
return result
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
def build_commandline_args_parser():
parser = argparse.ArgumentParser(
description='Compare ABI of shared libraries in RPM packages from the '
'Koji build system')
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
parser.add_argument(
'NVR',
nargs='*',
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
help='RPM package N-V-R, N-V-R-A, N, or local RPM '
'file names with relative or absolute path.')
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
parser.add_argument(
'--dry-run',
required=False,
dest='dry_run',
action='store_true',
help='Don\'t actually do the work. The commands that should be '
'run will be sent to stdout.')
parser.add_argument(
'--from',
required=False,
metavar='DISTRO',
dest='from_distro',
help='baseline Fedora distribution name, for example, fc23')
parser.add_argument(
'--to',
required=False,
metavar='DISTRO',
dest='to_distro',
help='Fedora distribution name to compare against the baseline, for '
'example, fc24')
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
parser.add_argument(
'-a',
'--all-subpackages',
required=False,
action='store_true',
dest='check_all_subpackages',
help='Check all subpackages instead of only the package specificed in '
'command line.')
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
parser.add_argument(
'--dso-only',
required=False,
action='store_true',
dest='dso_only',
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
help='Compare the ABI of shared libraries only. If this option is not '
Bug 20085 - Add --dso-only option to fedabipkgdiff abipkgdiff supports --dso-only to compare only ABI of shared libraries instead of all binaries. So, with adding this option to fedabipkgdiff, its user is also able to let fedabipkgdiff compare ABI of shared libraries, or not. * tools/fedabipkgdiff: Do not import shlex anymore. (ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR) (ABIDIFF_ABI_CHANGE): New global constant variables. (abipkgdiff): Pass the --dso-only option to the abipkgdiff command line tool, if that option was passed to fedabipkgdiff. Build this abipkgdiff command invocation from an array of strings, rather than from formatting a string. This makes us get rid of the shlex module. Fix typo in dry-run logged string. If there was an internal error reported by abipkgdiff, report it to stderr. (build_commandline_args_parser): Parse the --dso-only command line option. * tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo in initializing this global variable. (test_data_dir): New global variable, that is used to reference tests/data/test-fedabipkgdiff/. (RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix typo. (Mockglobalconfig.{koji_topdir, dso_only}): New data members. (GetPackageLatestBuildTest.{test_get_latest_one, test_cannot_find_a_latest_build_with_invalid_distro, test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}): Fix typo. (BrewListRPMsTest.test_select_specific_rpms): Fix typo. (RunAbipkgdiffWithDSOOnlyOptionTest): New test case class. * doc/manuals/fedabipkgdiff.rst: update document for this new --dso-only option. * tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm. * tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: New symbolic link to test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm. * tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so that this data directory and all things within it can be included in tarball. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-20 16:23:02 +00:00
'provided, the tool compares the ABI of all ELF binaries.')
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
parser.add_argument(
'--debug',
required=False,
action='store_true',
dest='debug',
help='show debug output')
parser.add_argument(
'--traceback',
required=False,
action='store_true',
dest='show_traceback',
help='show traceback when there is an exception thrown.')
parser.add_argument(
'--server',
required=False,
metavar='URL',
dest='koji_server',
default=DEFAULT_KOJI_SERVER,
help='URL of koji XMLRPC service. Default is {0}'.format(
DEFAULT_KOJI_SERVER))
parser.add_argument(
'--topurl',
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
required=False,
metavar='URL',
dest='koji_topurl',
default=DEFAULT_KOJI_TOPURL,
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
help='URL for RPM files access')
parser.add_argument(
'--abipkgdiff',
required=False,
metavar='ABIPKGDIFF',
dest='abipkgdiff',
default='',
help="The path to the 'abipkgtool' command to use. "
"By default use the one found in $PATH.")
parser.add_argument(
'--suppressions',
required=False,
metavar='SUPPR',
dest='suppr',
default='',
help='The suppression specification file to use during comparison')
Bug 20180 - Support system-wide suppression specifications This patch adds support for loading system and user level suppression specifications for libabigail tools. At launch time, relevant libabigail tools (abidiff, abipkgdiff fedabipkgdiff for now) read the default system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE, if set, or from the file $libdir/libabigail/default.abignore. Then it reads the user system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE, if set, or from the file $HOME/.abignore. The content of the user system suppression file is merged with the content of default system suppression file. That content is also merged with the content of the suppression specification files that might be provided by the --suppressions command line option of the invoked tools. The resulting set of all these suppression specifications is thus used to filter the ABI change reports that are emitted. abidiff, abipkgdiff and abipkgdiff gain a --no-default-suppression option to avoid loading any of these default suppression specification files. The patch also installs a default.abignore file into $(pkglibdir). Note that on x86_64, that directory is /usr/lib64/libabigail. Now we just need to think about the content of that default.abignore file. * doc/manuals/abidiff.rst: Document the default suppression scheme, its interaction with the --supprs option and the new --no-default option. * doc/manuals/abipkgdiff.rst: Likewise. * doc/manuals/fedabipkgdiff.rst: Likewise. * configure.ac: Generate the tests/runtestdefaultsupprs.py file from the new tests/runtestdefaultsupprs.py.in template. * default.abignore: New file. * Makefile.am: Add it to source distribution. * src/Makefile.am: Define the ABIGAIL_ROOT_SYSTEM_LIBDIR preprocessor macro that is set the value of the $libdir autotools macro. * include/abg-tools-utils.h: Update copyright years. (get_system_libdir, get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Declare new functions * src/abg-tools-utils.cc (get_system_libdir) (get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Define new functions. (is_regular_file): Amend this so that it return true for symlinks to regular files too. (is_dir): Amend this so that it returns true for symlinks to directories too. * tools/abidiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (display_usage): Display a new help string for the new --no-default-suppression command line option. (parse_command_line): Parse this new command line option. (set_diff_context_from_opts): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/abipkgdiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (parse_command_line): Parse the new --no-default-suppression command line option. (main): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/fedabipkgdiff (abipkgdiff): Add --no-default-suppression to the invocation of abipkgdiff if it was provided on the command line. (build_commandline_args_parser): Parse the new --no-default-suppression command line option. * tests/runtestdefaultsupprs.py.in: New test harness template. * tests/Makefile.am: Add the new runtestdefaultsupprs.py to the set of tests. * tests/data/test-default-supprs/test0-type-suppr-0.suppr: New test input. * tests/data/test-default-supprs/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v0.o: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v1.o: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir-report-0.txt: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir1: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir2: Likewise. * tests/data/Makefile.am: Add new the new tests input above to Makefile.am. * tests/runtestcanonicalizetypes.sh.in: Pass --no-default-suppression to abidiff invocations. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-30 08:37:48 +00:00
parser.add_argument(
'--no-default-suppression',
required=False,
action='store_true',
dest='no_default_suppr',
help='Do not load default suppression specifications')
Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages This patch makes fedabipkgdiff compare the ABI of two packages by taking into account their associated devel packages, along with their debug info packages. Taking devel packages into account makes the tool report changes about types that are defined in public header files only. This helps decrease the amount of change reports about types not defined in public headers. This is now the default behaviour. However, if the user provides the new --no-devel-pkg command line option, then the devel package is not taken into account during the ABI comparison. * doc/manuals/fedabipkgdiff.rst: Add documentation for the new --no-devel-pkg command line option, as well as for the new default behaviour of taking devel packages into account during ABI comparison. * tools/fedabipkgdiff (PkgInfo): Add new attribute devel_package. (RPM.is_devel): New property to determine if rpm is a development package. (LocalRPM._find_rpm): New method to find a specific rpm. (LocalRPM.find_debuginfo): Use new method _find_rpm to find debuginfo package. (LocalRPM.find_devel): New method to find an associated development package. (Brew.select_rpms_from_a_build): RPMs selector method is changed to select development package also. (abipkgdiff): Construct and run abipkgdiff with and without --devel-pkg[12] options. (magic_construct): Construct PkgInfo with development package. (run_abipkgdiff): Run abipkgdiff against rpms with development packages. (diff_local_rpm_with_latest_rpm_from_koji): Find development package, and call method abipkgdiff with development package. (build_commandline_args_parser): add new option --no-devel-pkg. * tests/runtestfedabipkgdiff.py.in (packages): Add new package nss-util. (builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14 and nss-util-3.24.0-2.0.fc25. (rpms): Add new associated rpms of the two new builds. (AssertionHelper.assert_functions_changes_summary): New method to match and assert functions changes summary. (AssertionHelper.assert_abi_comparison_result): Changed to support to help assert functions changes summary. (MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New fake options with default value for running tests. (RPMTest.setUp): add new development package for running test case. (RPMTest.test_is_devel): New test to test is_devel property. (RunAbipkgdiffTest.setUp): Add new development packages for running test case. (RunAbipkgdiffTest.{test_all_success, test_all_failure, test_partial_failure}): Mock global config. (RunAbipkgdiffWithDSOOnlyOptionTest): Removed. (CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg): New test to test fedabipkgdiff with or without --no-devel-pkg option. * tests/data/Makefile.am: Add new rpms. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/ x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. * tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/ x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running tests. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-06 13:38:28 +00:00
parser.add_argument(
'--no-devel-pkg',
required=False,
action='store_true',
dest='no_devel_pkg',
help='Do not compare ABI with development package')
Make fedabipkgdiff consistent with Libabigail's other tests In the libabigail project, almost all the tests for the tools follow a similar pattern. The test contains a set of input files to compare. The result of the comparison is thus compared to a set of reference comparison result. This approach is already documented in the CONTRIBUTING file. There are several interesting properties with this scheme. First, it capture the behaviour of the tools, including what is shown to the user. Second, it eases the job of a hacker who wants to add a new test for a new behaviour of a given tool. The user just has to provide: 1/ A new reference output of the new use case of the tool (that is easily constructed by using the tool itself and saving its output) and add an entry to array of entries that describe what to compare 2/ A new set of inputs to the tool And voila. Unfortunately, fedabipkgdiff tests don't follow this scheme. That make them surprising to hackers who read the source code of the existing tests, at very least. Also, the fedabipkgdiff tests were only unit tests. They were not testing the tool as used by users in general. This patch makes the fedabipkgdiff tests follow the general approach of the tests of the other Libabigail tools. The patch first craetes a program names tests/mockfedabipkgdiff. It's a wrapper around tools/fedabipkgdiff. It overloads the Koji client of fedabipkgdiff with a fake Koji client that gets the Fedora packages locally, from tests/data/test-fedabipkgdiff/packages. In other words, mockfedabipkgdiff is fedabipkgdiff without going to the network. I believe that in the future, tests/mockfedabipkgdiff should be killed when fedabipkgdiff is able to cache a local description of a local partial view of a Koji repository, along with the build packages that were already downloaded. That way, calling fedabipkgdiff twice with the same set of option should make the tool perform correctly without going to the netword on the second invocation. We should be able to save the local partial view of the Koji repository under e.g, tests/data/test-fedabipkgdiff/local-koji and tell fedabipkgdiff to use that, instead of using the network. But we are not there yet. So for now, I am using mockfedabipkgdiff. Then, tests/runtestfedabipkdiff.py.in has been re-written to use tests/mockfedabipkgdiff and to look like what is described in CONTRIBUTING as far as how Libabigail tools' tests are organized: mockfedabipkgdiff is called to perform a comparison. The result of the comparison is then compared (using GNU diff) to a reference comparison result file. Please note that tests/runtestfedabipkdiff.py is relatively fast for the moment. But when it contains much more tests and start becoming slow, then we'll need to change the code to run several comparisons in parallel, just like we do today in tests/test-diff-filter.cc. At that point, I believe I'll just re-write this in C++, just like tests/test-diff-filter.cc because that will allow us to have true concurrent code based on the abigail:workers API. For now, I am keeping this in Python also because I think that keeps Chenxiong happy ;-) To be sure that fedabipkgdiff (and its underlying abipkgdiff) are really comparing all the packages they are supposed to compare and also all the binaries in those packages, I have added a new --show-identical-binaries to abipkgdiff and fedabipkgdiff. That option shows the name of the binaries (and packages) that are compared, *even if* the ABI of those binaries are identical. Because otherwise, today, if two binaries (or packages) have the same ABI, nothing is displayed. For instance, here is the result of comparing a package against itself, using this new --show-identical-binaries options: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ./build/tools/abipkgdiff --show-identical-binaries dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: ================ changes of 'dbus-binding-tool'=============== No ABI change detected ================ end of changes of 'dbus-binding-tool'=============== ================ changes of 'libdbus-glib-1.so.2.1.0'=============== No ABI change detected ================ end of changes of 'libdbus-glib-1.so.2.1.0'=============== dodji@adjoa:patches$ And here is what this command before that patch would do: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ../master/build/tools/abipkgdiff dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: dodji@adjoa:patches$ The rest of the patch is mostly new test inputs material and the necessary adjustments following all the changes above. * configure.ac: Do not require Python dependencies itertools, unittest and StringIO anymore as they are not used anymore. Require new module tempfile now. Generate new executable script tests/mockfedabipkgdiff from tests/mockfedabipkgdiff.in. * doc/manuals/abipkgdiff.rst: Add doc for new option --show-identical-binaries to abipkgdiff * doc/manuals/fedabipkgdiff.rst: Add doc for new options --show-identical-binaries to fedabipkgdiff. * tools/abipkgdiff.cc (options::show_identical_binaries): New data member. (options::options): Initialize new data member. (display_usage): Add a new help string for the new --show-identical-binaries option. (parse_command_line): Parse the newq --show-identical-binaries command line switch. (pthread_routine_compare): When the comparison of two binaries is empty, if --show-identical-binaries was provided, then emit some output saying the comparison did yield the empty set. * tools/fedabipkgdiff (DEFAULT_ABIPKGDIFF): Store the default path to abipkgdiff in this new global variable. Naming this default path is useful because it can then be cleanly overloaded when using mock.patch. (build_path_to_abipkgdiff): Return the new DEFAULT_ABIPKGDIFF global variable. (cmd): Parse the new --show-identical-binaries command line switch. * tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt: New reference output. * tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt: Likewise. * tests/mockfedabipkgdiff.in: New uninstalled script template. * tests/runtestfedabipkgdiff.py.in (counter) (temp_file_or_dir_prefix, UtilsTest, RPMTest, LocalRPMTest) (RunAbipkgdiffTest, GetPackageLatestBuildTest, DownloadRPMTest) (BrewListRPMsTest, AssertionHelper, MockGlobalConfig) (BUILT_ABIPKGDIFF, CompareABIFromCommandLineTest): Remove these classes, global variables and functions. (FEDABIPKGDIFF, TEST_SRC_DIR, TEST_BUILD_DIR, INPUT_DIR) (OUTPUT_DIR, FEDABIPKGDIFF_TEST_SPECS): New global variables. (ensure_output_dir_created, run_fedabipkgdiff_tests, main): New functions. * tests/test-diff-pkg.cc (in_out_specs): Add tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt to the set of reference outputs to consider. * tests/Makefile.am: Add non-installed script mockfedabipkgdiff to source distribution. Also added tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt, tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt and tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt to source distribution. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-06 09:51:13 +00:00
parser.add_argument(
'--show-identical-binaries',
required=False,
action='store_true',
dest='show_identical_binaries',
help='Show information about binaries whose ABI are identical')
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
parser.add_argument(
'--error-on-warning',
required=False,
action='store_true',
dest='error_on_warning',
help='Raise error instead of warning')
parser.add_argument(
'--clean-cache',
required=False,
action=SetCleanCacheAction,
dest='clean_cache',
default=None,
help='A convenient way to clean cache without specifying '
'--clean-cache-before and --clean-cache-after at same time')
parser.add_argument(
'--clean-cache-before',
required=False,
action='store_true',
dest='clean_cache_before',
default=None,
help='Clean cache before ABI comparison')
parser.add_argument(
'--clean-cache-after',
required=False,
action='store_true',
dest='clean_cache_after',
default=None,
help='Clean cache after ABI comparison')
parser.add_argument(
'--self-compare',
required=False,
action='store_true',
dest='self_compare',
default=None,
help='ABI comparison on same package')
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
return parser
def main():
parser = build_commandline_args_parser()
args = parser.parse_args()
global global_config
global_config = args
global pathinfo
pathinfo = koji.PathInfo(topdir=global_config.koji_topurl)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
global session
session = get_session()
if global_config.debug:
logger.setLevel(logging.DEBUG)
logger.debug(args)
if global_config.from_distro and global_config.self_compare and \
global_config.NVR:
return self_compare_rpms_from_distro()
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.from_distro and global_config.to_distro is None and \
global_config.NVR:
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return diff_local_rpm_with_latest_rpm_from_koji()
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
if global_config.from_distro and global_config.to_distro and \
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
global_config.NVR:
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return diff_latest_rpms_based_on_distros()
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
if global_config.from_distro is None and global_config.to_distro is None:
if len(global_config.NVR) > 1:
left_one = global_config.NVR[0]
right_one = global_config.NVR[1]
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
if is_rpm_file(left_one) and is_rpm_file(right_one):
return diff_from_two_rpm_files(left_one, right_one)
both_nvr = match_nvr(left_one) and match_nvr(right_one)
both_nvra = match_nvra(left_one) and match_nvra(right_one)
if both_nvr or both_nvra:
return diff_two_nvras_from_koji()
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
six.print_('Unknown arguments. Please refer to --help.', file=sys.stderr)
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
return 1
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if __name__ == '__main__':
try:
Bug 20380 - Compare two local RPMs Bug 20270 is also fixed. This patch allows developer to compare two local RPMs in form fedabipkgdiff some/place/foo.rpm another/place/bar.rpm But, network is still needed to talk with Koji. This patch also introduces new terms for libabigail, that is the subject, ancillary package, and comparison half. Subject represents a package that is subject of the ABI comparison, a subject could be a RPM and maybe it would be a DEB or some other kind of "package". A subject may have several ancillary packages that are used to compare the subject. Generally, a subject may have devel, debuginfo, or both. * configure.ac: add dependent mimetype module. * doc/manuals/fedabipkgdiff.rst: Update to add document for the new use case of comparing two local RPMs. * tests/data/Makefile.am: Include new RPMs for tests. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.100.2-2.fc20.x86_64.rpm: New RPM for running test. * tests/data/test-fedabipkgdiff/dbus-glib/dbus-glib-0.106-1.fc23.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.12.6-1.fc14.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/nss-util/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: Likewise. * tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt: Rename filename by adding .rpm extension. * tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt: New reference output for testing comparing local RPMs. * tests/data/test-fedabipkgdiff/test6-missing-devel-debuginfo-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt: New reference output for testing comparison without non-existent debuginfo or development package. * tests/runtestfedabipkgdiff.py.in (FEDABIPKGDIFF_TEST_SPECS): Rename filename for test4. Add two new test cases. (run_fedabipkgdiff_tests): Remove semicolon and trailing whitespaces. (main): Likewise. (ensure_output_dir_created): Likewise. * tools/fedabipkgdiff: Require some new modules. Fix of return code. (PkgInfo): Renamed to ComparisonHalf. (match_nvr): New method to determine if a string matches format of N-V-R. (match_nvra): New method to determine if a string matches format of N-V-R.A. (is_rpm_file): New method to guess if a file is a RPM file. (RPM.is_peer): New method to determine if current RPM is a peer of another. (RPM.filename): Use Koji module API to construct the filename. (RPM.nvra): Get nvra from filename instead of constructing manually that is duplicated with Koji module API. (RPMCollection): New class to represent a set of RPMs. (generate_pkg_info_pair_for_abipkgdiff): New method working as a generator to yeild comparison halves for running abipkgdiff. (Brew.getRPM): Fix string format with incorrect argument. (Brew.select_rpms_from_a_build): Return instance of RPMCollection. (abipkgdiff): If there is no debuginfo or development package, just ignore it and leave a warning. If --error-on-warning is specified, raise an exception instead. Arguments are modified to represent the new name ComparisonHalf, and relative docstring is also updated. (magic_construct): Removed. (run_abipkgdiff): Rewrite. (make_rpms_usable_for_abipkgdiff): Removed. (diff_local_rpm_with_latest_rpm_from_koji): Rewrite by using RPMCollection. (diff_latest_rpms_based_on_distros): Likewise. (diff_two_nvras_from_koji): Likewise. (diff_from_two_rpm_files): New method to compare two local RPMs. (build_commandline_args_parser): Add new option --error-on-warning. (main): Add support to compare local RPMs. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-11 13:48:00 +00:00
sys.exit(main())
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
except KeyboardInterrupt:
if global_config is None:
raise
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.debug:
logger.debug('Terminate by user')
else:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
six.print_('Terminate by user', file=sys.stderr)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.show_traceback:
raise
else:
sys.exit(2)
except Exception as e:
if global_config is None:
raise
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.debug:
logger.debug(str(e))
else:
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2 This patch makes fedabipkgdiff Python 3 compatible. All tests written in Python are updated and compatible with Python 3 as well. The patch looks for a Python 3 interperter. If it finds one then it runs the tests using that interpreter. Otherwise it just tries to use the Python 2 interpreter. This behaviour can be disabled by the new --disable-python3 option. * configure.ac: Add new option --enable-python3. Add new test runner file tests/runtestdefaultsupprs-py3 and tests/runtestfedabipkgdiffpy3.sh. Add required six Python module. * tests/Makefile.am: Add new test files tests/runtestdefaultsupprspy3.sh and tests/runtestfedabipkgdiffpy3.sh accordingly. * tests/mockfedabipkgdiff.in: Convert print statement to six.print_. Replace call to function filter with list comprehension. Replace basestring with six.string_types. * tests/runtestdefaultsupprspy3.sh.in: New shell script to run test runtestdefaultsupprs with Python 3. * tests/runtestdefaultsupprs.py.in: Repalce a few tabs with proper number of spaces which is detected by Python 3 interpreter. * tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run test runtestfedabipkgdiff with Python 3. * tests/runtestfedabipkgdiff.py.in: Use python from env in shebang instead of a fixed path to a Python interpreter. * tools/fedabipkgdiff: Globally replace print statement with a function call to print which is available by importing print_function from __future__ module. Use six.print_ to output string to stderr instead. Convert function call to map to for-loop. (cmp_nvr): Change argument to handle a Koji build mapping instead of only the nvr. (Brew.listBuilds): use the new cmp_nvr to sort builds. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-25 07:34:59 +00:00
six.print_(str(e), file=sys.stderr)
Bug 19428 - New fedabipkgdiff utility fedabipkgdiff is a convenient way to compare the ABI of Fedora packages easily. The first version of fedabipkgdiff introduced by this patch lets users perform operations like: fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm fedabipkgdiff --from fc23 --to fc24 foo fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24 fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686 fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24 * autoconf-archive/ax_compare_version.m4: New file copied from the autoconf-archive project. * autoconf-archive/ax_prog_python_version.m4: Likewise. * autoconf-archive/ax_python_module.m4: Likewise. * Makefile.am: Add the new files above to the source distribution. * configure.ac: Include the new m4 macros from the autoconf archive. Add a new --enable-fedabipkgdiff option. Update the report at the end of the configure process to show the status of the fedabipkgdiff feature. Add check for prerequisite python modules argparse, glob, logging, os, re, shlex, subprocess, sys, itertools, urlparse, itertools, shutil, unittest, xdg, koji and mock. These are necessary for the unit test of fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the build directory, from the tests/runtestfedabipkgdiff.py.in input file. * tools/Makefile.am: Include the fedabipkgdiff to the source distribution and install it if the "fedabipkgdiff" feature is enabled. * tests/Makefile.am: Rename runtestfedabipkgdiff.sh into runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in autoconf template file in here. * tests/runtestfedabipkgdiff.py.in: New unit test file. * tools/fedabipkgdiff: New fedabipkgdiff tool. * doc/manuals/fedabipkgdiff.rst: New manual. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
if global_config.show_traceback:
raise
else:
sys.exit(1)