File osc-plugin-install.spec of Package osc-plugin-install

#
# spec file for package osc-plugin
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (C) 2012,2013, jw@suse.de, Novell Inc., openSUSE.org
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


# Define just "test" as a package in _multibuild file to distinguish test
# instructions here
%if "@BUILD_FLAVOR@" == ""
%define _test 0
%define name_ext %nil
%else
%define _test 1
%define name_ext -test
%endif

%define         orig_name osc-plugin-install
Name:           %{orig_name}%{?name_ext}
Version:        0.26
Release:        0
Summary:        Plugin to make package installation easier
License:        GPL-2.0-only OR GPL-3.0-only
Group:          Development/Tools/Other
Url:            https://github.com/openSUSE/%{name}
Source:         https://raw.githubusercontent.com/openSUSE/%{name}/master/osc-install.py
%if 0%{?_test}
BuildRequires:  %{orig_name}
BuildRequires:  expect
%if 0%{?suse_version} >= 1330
BuildRequires:  python-certifi
%endif
%else
# Needed for directory ownership
BuildRequires:  osc
Requires:       osc
%if 0%{?!fedora_version:1} && 0%{?!centos_version:1} && 0%{?!scientificlinux_version:1} && 0%{?!rhel_version:1}
Recommends:     rpm-python rpmdevtools
%endif
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%define oscplugindir %{_prefix}/lib/osc-plugins

%description
This osc plugin extends osc with the subcommand 'osc install'.
The main effort of this plugin is to free the end-user of the sometimes tedious
task to look up the correct repository URL to be used with zypper.
Dependencies are resolved across projects, just as the online one-click mechanism 
would do. 
The plugin can also guess the best matching platform for your system.

Example usage:
 osc co PROJ PACK ; cd PACK
 do osc build ; vi ... ; osc ci ; osc results
 osc in

%prep

%build
%if 0%{?_test}
rpm -ql %{orig_name}
cat > test_osc_in << EOF
strace 2
spawn osc in --help
expect "Username: "
send "test"
expect "Password: "
send "foo"
expect "install a package after build via zypper in"
EOF
expect -f test_osc_in

%install
# disable debug packages in package test to prevent error about missing files
%define debug_package %{nil}
%else
%install
install -D -m0644 %{S:0} %{buildroot}%{oscplugindir}/osc-install.py

%files
%defattr(-, root, root)
# also glob for byte-compiled (pyc) and optimized byte-compiled (pyo)
# files (they are generated by fedora's brp-python-bytecompile script)
%{oscplugindir}/*.py*
%endif

%changelog