Accepting request 1058838 from home:dmach:branches:openSUSE:Tools

1.0.0b3
  - add create-pbuild-config (cpc) command which allows to create a working
    config for pbuild tool based on OBS server side data
  - branch: Add --disable-build option
  - linkpac: Add --disable-build option
  - linkpac: Fix linking a locked package by not copying the lock to the target package
  - sr: Do not error out on using an alias to apiurl
  - rq: Fix the -M/--mine option to show only requests created by the user
  - rq list: Avoid conflict between --all and --state options
  - rq list: Fix traceback when there's no search criteria
  - rq list -i: Enable forwarding requests to the parent projects
  - rq show: Improve output
  - sr accept: Enable forwarding requests to the parent projects
  - setlinkrev: Write a log message on setting a revision
  - buildhistory: Produce proper output using build_table() and a CSV writer
  - buildinfo: Bring the -d/--debug option back
  - build: Bring the --verbose' option back as --verbose-mode=MODE to avoid conflicts with global --verbose
  - service: Add verbose option for running local services
  - service: Fix manual run of source service
  - conf: Avoid crash when deleting a password
  - connection: Fix the '9 - review the server certificate' option in cert trust prompt
  - Handle uncompressed Debian packages
  - Fix osc add for github /archive/ URLs
  - Handle empty EDITOR=/PAGER= env variable properly
  - Mute ssl/tls deprecation warnings
  - Add "--extra-pkgs-from" ("-X") option to osc build.
  - Fix a scenario when OBS sends unexpected md5s
  - Replace core.findpacs() with Package.from_paths() and Package.from_paths_nofail()
  - Always list requests with 'new,review' states by default
  - Change get_request_collection() not to list declined requests by default
  - Add information about osc vc using the EDITOR envar to the help output
  - Improve argument handling in many commands
  - Implement Store class handling '.osc' dirs, migrate some code to it
  - Code cleanups
  - Deprecated:
    - core.get_request_list() function
    - core.store_write_apiurl() function
    - core.store_read_scmurl() function
    - core.store_read_apiurl() function
1.0.0b2
  - Support ssh-agent forwarding
  - ssh auth: Avoid password prompt when using TransientCredentialsManager
  - Properly handle missing ssh-keygen and ssh-add
  - Add ssh-keygen as a recommends for ssh MFA authentication
  - Print user and apiurl when prompting for a password
  - Pass apiurl to all auth handlers
  - Do not list declined requests by default
  - Fix 'osc up' on project level for scm packages
  - Lock cookiejar to prevent unnecessary signature auth
  - Process input with configurable project separators
  - Add project_separator to config file
  - Fix race condition in using .old directory in Serviceinfo.execute()
  - Send HTTP header Accept: application/xml
  - Print URLs and xpaths in debug rather than verbose mode
  - Inject no-op print() into http.client when http debugging is off
  - Reset "file current position" on errors in HTTP requests
  - Create ~/.config/osc/trusted-certs if not exists
  - conf: Convert defaults to their expected types
  - Document `build` repo selection logic
  - Add debug print for REPO (and desc just in case)
  - Shortened `build` help and add debug prints
  - Replace unmaintained cmdln.py with a custom code
  - Allow intermixing positional and optional args
  - Add global options to subcommands so they can be specified in any place
  - Remove the '-A' option from the 'maintainer' command
  - Replace the '-q/--hide-legend' option in 'prjresults' command with global '-q/--quiet' option
  - Remove duplicated --debug and --verbose options
  - Add version command to print the used version
  - Remove deprecated 'plaintext_passwd' config option
  - Remove deprecated 'GnomeKeyringCredentialsManager' and related code
  - Remove deprecated '--skip-validation' option from the 'commit' command
  - Remove deprecated '--oldpkg', '--oldprj' options from the 'rdiff' command
  - Remove deprecated subcommands 'create', 'list', 'log', 'show', 'decline', 'accept', 'delete', 'revoke' from the 'submitrequest' command
  - Remove deprecated '--seperate-requests' option from the 'submitrequest' command
  - Remove deprecated '--raw' option from the 'develproject' command
  - Remove deprecated '--maintained' option from the 'search' command
  - Remove deprecated 'rlog' command
  - Remove deprecated 'rprjresults' command
  - Remove deprecated 'rresults' command
  - Remove deprecated 'results_meta' command
  - Remove deprecated 'deleteprj' command
  - Remove deprecated 'deletepac' command
  - Remove deprecated 'editmeta' command
  - Remove deprecated Request.get_creator()
  - Remove PROJ_PACK.txt file, move its content to GitHub issue #1099
  - Remove TODO file, move its content to GitHub issue #1098
  - Remove fuse support
  - Remove unused run_bandit.sh
  - Remove obsolete osc_expand_link.pl
  - Remove unused icons
  - Replace imp with importlib
  - Move files from dist/ to contrib/
  - Move osc.fish under contrib/
  - Move python package metadata from setup.py to setup.cfg
  - Move __version__ from osc.core to osc
  - Fix resource warnings (unclosed files)
- 1.0.0b1
  - drop Python 2 support
  - switch http_request() to urllib3 and cryptography (drop M2Crypto dependency)
  - warn when using HTTP connection, Make HTTPS the default
  - add XDG compatible location for osc plugins
  - replace osc-wrapper.py with entry_points.
  - core: add functions for glob matching of multibuild flavors
  - fix multibuild packages in all osc commands where applicable
  - do not ask for login for -h,--help
  - move format_table() to util.helper
  - code cleanups

OBS-URL: https://build.opensuse.org/request/show/1058838
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/osc?expand=0&rev=376
This commit is contained in:
Marco Strigl 2023-01-18 11:09:07 +00:00 committed by Git OBS Bridge
parent a56c7d992d
commit 837721237b
11 changed files with 293 additions and 183 deletions

View File

@ -1,13 +1,13 @@
pkgname=osc pkgname=osc
pkgver=0.182.0 pkgver=1.0.0~b3
pkgrel=0 pkgrel=0
pkgdesc="Open Build Service client" pkgdesc="Command-line client for the Open Build Service"
arch=('x86_64') arch=('x86_64')
url="https://www.github.com/openSUSE/osc" url="https://www.github.com/openSUSE/osc"
license=('GPL-2.0+' 'GPL-2.0') license=('GPL-2.0+' 'GPL-2.0')
groups=('base-devel') groups=('base-devel')
depends=('python-m2crypto') depends=('python-cryptography' 'python-urllib3')
makedepends=('python-setuptools') makedepends=('python>=3.6' 'python-cryptography' 'python-setuptools' 'python-urllib3')
source=(osc-${pkgver}.tar.gz) source=(osc-${pkgver}.tar.gz)
md5sums=('SKIP') md5sums=('SKIP')
@ -20,5 +20,4 @@ package() {
msg "Installing osc ..." msg "Installing osc ..."
cd "${srcdir}"/osc-${pkgver} cd "${srcdir}"/osc-${pkgver}
python setup.py install --root="${pkgdir}/" --optimize=1 --prefix=/usr python setup.py install --root="${pkgdir}/" --optimize=1 --prefix=/usr
ln -s osc-wrapper.py ${pkgdir}/usr/bin/osc
} }

View File

@ -1,7 +1,7 @@
<services> <services>
<service name="tar_scm" mode="disabled"> <service name="tar_scm" mode="disabled">
<param name="version">0.182.0</param> <param name="version">1.0.0~b3</param>
<param name="revision">0.182.0</param> <param name="revision">1.0.0b3</param>
<param name="url">https://github.com/openSUSE/osc.git</param> <param name="url">https://github.com/openSUSE/osc.git</param>
<param name="scm">git</param> <param name="scm">git</param>
</service> </service>

View File

@ -1,4 +1,4 @@
osc (0.182.0-0) unstable; urgency=low osc (1.0.0~b3-0) unstable; urgency=low
- Update to 0.174.0: - Update to 0.174.0:
- fix password deletion via "osc config -d <apiurl> pass" - fix password deletion via "osc config -d <apiurl> pass"
- support changing the password store via "osc config <apiurl> - support changing the password store via "osc config <apiurl>

View File

@ -1,23 +1,33 @@
Source: osc Source: osc
Priority: extra Priority: extra
Maintainer: Adrian Schroeter <adrian@suse.de>, Rene Engelhard <rengelhard@suse.de> Maintainer: Adrian Schroeter <adrian@suse.de>
Build-Depends: debhelper (>= 10), dh-python, python3-all, python3-setuptools Build-Depends:
debhelper (>= 10),
dh-python,
python3-all (>=3.6),
python3-cryptography,
python3-setuptools,
python3-urllib3
Standards-Version: 3.7.1 Standards-Version: 3.7.1
Section: devel Section: devel
Package: osc Package: osc
Section: devel Section: devel
Architecture: all Architecture: any
Depends: ${shlibs:Depends}, Depends:
${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
${python3:Depends}, ${python3:Depends},
python3, python3-cryptography,
python3-urllib3,
build | obs-build build | obs-build
Recommends: python3-progressbar, Recommends:
bash-completion,
python3-progressbar,
python3-rpm, python3-rpm,
python3-keyring, python3-keyring,
python3-m2crypto, python3-keyring-keyutils,
bash-completion sudo,
Suggests: sudo xdg-utils
Description: Open Build Service Commander Description: Command-line client for the Open Build Service
Commandline client for the Open Build Service. OpenSUSE Commander is a command-line client for the Open Build Service.

View File

@ -1,2 +1 @@
README.md README.md
TODO

View File

@ -9,9 +9,9 @@ export PYBUILD_NAME=osc
override_dh_auto_install: override_dh_auto_install:
dh_auto_install dh_auto_install
install -Dm0644 dist/complete.csh debian/tmp/etc/profile.d/osc.csh install -Dm0644 contrib/complete.csh debian/tmp/etc/profile.d/osc.csh
install -Dm0644 dist/complete.sh debian/tmp/etc/bash_completion.d/osc.sh install -Dm0644 contrib/complete.sh debian/tmp/etc/bash_completion.d/osc.sh
install -Dm0755 dist/osc.complete debian/tmp/usr/lib/osc/complete install -Dm0755 contrib/osc.complete debian/tmp/usr/lib/osc/complete
override_dh_auto_test: override_dh_auto_test:

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bfad8b79ff8f34b9ed665dd1246f09ec69a3963593fc63d21c42ee5da9c230fe
size 381596

3
osc-1.0.0~b3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1e03344bb8eb686e183c544c1fd962c360e1526d2a1fd42dd0bc087b25dc57a3
size 375831

View File

@ -1,3 +1,116 @@
-------------------------------------------------------------------
Tue Jan 17 08:46:45 UTC 2023 - Daniel Mach <daniel.mach@suse.com>
1.0.0b3
- add create-pbuild-config (cpc) command which allows to create a working
config for pbuild tool based on OBS server side data
- branch: Add --disable-build option
- linkpac: Add --disable-build option
- linkpac: Fix linking a locked package by not copying the lock to the target package
- sr: Do not error out on using an alias to apiurl
- rq: Fix the -M/--mine option to show only requests created by the user
- rq list: Avoid conflict between --all and --state options
- rq list: Fix traceback when there's no search criteria
- rq list -i: Enable forwarding requests to the parent projects
- rq show: Improve output
- sr accept: Enable forwarding requests to the parent projects
- setlinkrev: Write a log message on setting a revision
- buildhistory: Produce proper output using build_table() and a CSV writer
- buildinfo: Bring the -d/--debug option back
- build: Bring the --verbose' option back as --verbose-mode=MODE to avoid conflicts with global --verbose
- service: Add verbose option for running local services
- service: Fix manual run of source service
- conf: Avoid crash when deleting a password
- connection: Fix the '9 - review the server certificate' option in cert trust prompt
- Handle uncompressed Debian packages
- Fix osc add for github /archive/ URLs
- Handle empty EDITOR=/PAGER= env variable properly
- Mute ssl/tls deprecation warnings
- Add "--extra-pkgs-from" ("-X") option to osc build.
- Fix a scenario when OBS sends unexpected md5s
- Replace core.findpacs() with Package.from_paths() and Package.from_paths_nofail()
- Always list requests with 'new,review' states by default
- Change get_request_collection() not to list declined requests by default
- Add information about osc vc using the EDITOR envar to the help output
- Improve argument handling in many commands
- Implement Store class handling '.osc' dirs, migrate some code to it
- Code cleanups
- Deprecated:
- core.get_request_list() function
- core.store_write_apiurl() function
- core.store_read_scmurl() function
- core.store_read_apiurl() function
1.0.0b2
- Support ssh-agent forwarding
- ssh auth: Avoid password prompt when using TransientCredentialsManager
- Properly handle missing ssh-keygen and ssh-add
- Add ssh-keygen as a recommends for ssh MFA authentication
- Print user and apiurl when prompting for a password
- Pass apiurl to all auth handlers
- Do not list declined requests by default
- Fix 'osc up' on project level for scm packages
- Lock cookiejar to prevent unnecessary signature auth
- Process input with configurable project separators
- Add project_separator to config file
- Fix race condition in using .old directory in Serviceinfo.execute()
- Send HTTP header Accept: application/xml
- Print URLs and xpaths in debug rather than verbose mode
- Inject no-op print() into http.client when http debugging is off
- Reset "file current position" on errors in HTTP requests
- Create ~/.config/osc/trusted-certs if not exists
- conf: Convert defaults to their expected types
- Document `build` repo selection logic
- Add debug print for REPO (and desc just in case)
- Shortened `build` help and add debug prints
- Replace unmaintained cmdln.py with a custom code
- Allow intermixing positional and optional args
- Add global options to subcommands so they can be specified in any place
- Remove the '-A' option from the 'maintainer' command
- Replace the '-q/--hide-legend' option in 'prjresults' command with global '-q/--quiet' option
- Remove duplicated --debug and --verbose options
- Add version command to print the used version
- Remove deprecated 'plaintext_passwd' config option
- Remove deprecated 'GnomeKeyringCredentialsManager' and related code
- Remove deprecated '--skip-validation' option from the 'commit' command
- Remove deprecated '--oldpkg', '--oldprj' options from the 'rdiff' command
- Remove deprecated subcommands 'create', 'list', 'log', 'show', 'decline', 'accept', 'delete', 'revoke' from the 'submitrequest' command
- Remove deprecated '--seperate-requests' option from the 'submitrequest' command
- Remove deprecated '--raw' option from the 'develproject' command
- Remove deprecated '--maintained' option from the 'search' command
- Remove deprecated 'rlog' command
- Remove deprecated 'rprjresults' command
- Remove deprecated 'rresults' command
- Remove deprecated 'results_meta' command
- Remove deprecated 'deleteprj' command
- Remove deprecated 'deletepac' command
- Remove deprecated 'editmeta' command
- Remove deprecated Request.get_creator()
- Remove PROJ_PACK.txt file, move its content to GitHub issue #1099
- Remove TODO file, move its content to GitHub issue #1098
- Remove fuse support
- Remove unused run_bandit.sh
- Remove obsolete osc_expand_link.pl
- Remove unused icons
- Replace imp with importlib
- Move files from dist/ to contrib/
- Move osc.fish under contrib/
- Move python package metadata from setup.py to setup.cfg
- Move __version__ from osc.core to osc
- Fix resource warnings (unclosed files)
- 1.0.0b1
- drop Python 2 support
- switch http_request() to urllib3 and cryptography (drop M2Crypto dependency)
- warn when using HTTP connection, Make HTTPS the default
- add XDG compatible location for osc plugins
- replace osc-wrapper.py with entry_points.
- core: add functions for glob matching of multibuild flavors
- fix multibuild packages in all osc commands where applicable
- do not ask for login for -h,--help
- move format_table() to util.helper
- code cleanups
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 8 11:53:22 UTC 2022 - Daniel Mach <daniel.mach@suse.com> Thu Sep 8 11:53:22 UTC 2022 - Daniel Mach <daniel.mach@suse.com>

10
osc.dsc
View File

@ -1,8 +1,14 @@
Format: 1.0 Format: 1.0
Source: osc Source: osc
Version: 0.182.0-0 Version: 1.0.0~b1-0
Binary: osc Binary: osc
Maintainer: Adrian Schroeter <adrian@suse.de> Maintainer: Adrian Schroeter <adrian@suse.de>
Architecture: any Architecture: any
Standards-Version: 3.7.1 Standards-Version: 3.7.1
Build-Depends: debhelper (>= 10), dh-python, python3-all, python3-setuptools Build-Depends:
debhelper (>= 10),
dh-python,
python3-all (>=3.6),
python3-cryptography,
python3-setuptools,
python3-urllib3

283
osc.spec
View File

@ -1,7 +1,7 @@
# #
# spec file for package osc # spec file for package osc
# #
# Copyright (c) 2022 SUSE LLC # Copyright (c) 2023 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,75 +16,84 @@
# #
%if 0%{?suse_version} >= 1500 || 0%{?fedora} >= 29 || 0%{?rhel} >= 7 || 0%{?mageia} >= 8
%bcond_without python3
%else
%bcond_with python3
%endif
%if %{with python3}
%define use_python python3 %define use_python python3
%define use_python_pkg python3
# else if with python3 %if 0%{?suse_version} && 0%{?suse_version} < 1500
%else # use python36 on SLE 12 and older
%define use_python python %define use_python python3.6
%define use_python_pkg python36
%endif %endif
%define version_unconverted 0.182.0 %define completion_dir_bash %{_datadir}/bash-completion/completions
%define completion_dir_csh %{_sysconfdir}/profile.d
%define completion_dir_fish %{_datadir}/fish/vendor_completions.d
%define osc_plugin_dir %{_prefix}/lib/osc-plugins %define osc_plugin_dir %{_prefix}/lib/osc-plugins
%define macros_file macros.osc # need to override python_sitelib because it is not set as we would expect on many distros
%if ! %{defined _rpmmacrodir} %define python_sitelib %(RPM_BUILD_ROOT= %{use_python} -Ic "import sysconfig; print(sysconfig.get_path('purelib'))")
%define _rpmmacrodir %{_sysconfdir}/rpm
%if 0%{?is_opensuse}
%define completion_dir_bash %{_sysconfdir}/bash_completion.d
%endif
# generate manpages on distros where argparse-manpage >= 3 is available
%if 0%{?suse_version} > 1500 || 0%{?fedora} >= 37
%bcond_without man
%else
%bcond_with man
%endif
%define argparse_manpage_pkg %{use_python_pkg}-argparse-manpage
%if 0%{?fedora}
%define argparse_manpage_pkg argparse-manpage
%endif %endif
Name: osc Name: osc
Version: 0.182.0 Version: 1.0.0~b3
Release: 0 Release: 0
Summary: Open Build Service Commander Summary: Command-line client for the Open Build Service
License: GPL-2.0-or-later License: GPL-2.0-or-later
Group: Development/Tools/Other Group: Development/Tools/Other
URL: https://github.com/openSUSE/osc URL: https://github.com/openSUSE/osc
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
%if 0%{?debian}
Source1: debian.dirs Source1: debian.dirs
Source2: debian.docs Source2: debian.docs
Source3: debian.osc.links
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: %{use_python}-devel
BuildRequires: %{use_python}-setuptools
BuildRequires: diffstat
%if 0%{?mandriva_version} || 0%{?mageia}
BuildRequires: python-rpm
Requires: python-rpm
%else
%if 0%{?suse_version} >= 1500 || 0%{?fedora} >= 32 || 0%{?rhel} >= 7
BuildRequires: %{use_python}-rpm
Requires: %{use_python}-rpm
%else
BuildRequires: rpm-python
Requires: rpm-python
%endif %endif
%endif
%if 0%{?suse_version} == 0 || 0%{?suse_version} >= 1120
BuildArch: noarch BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with man}
BuildRequires: %{argparse_manpage_pkg}
%endif %endif
Recommends: openssh BuildRequires: %{use_python_pkg}-cryptography
%if 0%{?suse_version} BuildRequires: %{use_python_pkg}-devel >= 3.6
Requires: %{use_python} BuildRequires: %{use_python_pkg}-rpm
Recommends: %{use_python}-progressbar BuildRequires: %{use_python_pkg}-setuptools
BuildRequires: %{use_python}-xml BuildRequires: %{use_python_pkg}-urllib3
Requires: %{use_python}-xml BuildRequires: diffstat
%if !%{with python3} && 0%{?suse_version} < 1020
BuildRequires: python-elementtree Requires: %{use_python_pkg}-cryptography
Requires: python-elementtree Requires: %{use_python_pkg}-rpm
%endif Requires: %{use_python_pkg}-urllib3
%if 0%{?suse_version} > 1000
# needed for showing download progressbars
Recommends: %{use_python_pkg}-progressbar
# needed for storing credentials in kwallet/gnome-keyring
Recommends: %{use_python_pkg}-keyring
Recommends: %{use_python_pkg}-keyring-keyutils
Recommends: build Recommends: build
Recommends: ca-certificates Recommends: ca-certificates
Recommends: diffstat Recommends: diffstat
Recommends: powerpc32 Recommends: powerpc32
Recommends: sudo Recommends: sudo
# These packages are needed for "osc add $URL"
# needed for `osc add <URL>`
Recommends: obs-service-recompress Recommends: obs-service-recompress
Recommends: obs-service-download_files Recommends: obs-service-download_files
Recommends: obs-service-format_spec_file Recommends: obs-service-format_spec_file
@ -93,133 +102,107 @@ Recommends: obs-service-set_version
Recommends: obs-service-source_validator Recommends: obs-service-source_validator
Recommends: obs-service-tar_scm Recommends: obs-service-tar_scm
Recommends: obs-service-verify_file Recommends: obs-service-verify_file
%if 0%{?fedora}
Recommends: openssh
%endif
%if 0%{?suse_version}
Recommends: openssh-common
%endif
# needed for `osc browse` that calls xdg-open
Recommends: xdg-utils Recommends: xdg-utils
# for osc >= 0.167.0 the newest build version is needed.
# Otherwise osc chroot might not work correctly.
Conflicts: build < 20200106
%endif
%endif
# needed for storing credentials in kwallet/gnome-keyring
%if 0%{?suse_version} > 1000 || 0%{?mandriva_version} || 0%{?mdkversion} || 0%{?fedora} >= 29 || 0%{?rhel} >= 8
%if %{with python3}
Recommends: python3-keyring
Recommends: python3-keyring-keyutils
%else
Recommends: python-keyring
Recommends: python-keyring-keyutils
%endif
%endif
%if 0%{?rhel} && 0%{?rhel} < 6
BuildRequires: python-elementtree
Requires: python-elementtree
%endif
%if 0%{?suse_version} || 0%{?mandriva_version} || 0%{?mageia}
%if 0%{?suse_version} >= 1315
BuildRequires: %{use_python}-M2Crypto > 0.19
BuildRequires: %{use_python}-chardet
Requires: %{use_python}-M2Crypto > 0.19
Requires: %{use_python}-chardet
%else
BuildRequires: python-m2crypto > 0.19
Requires: python-m2crypto > 0.19
%endif
%else
%if 0%{?fedora} >= 29 || 0%{?rhel} >= 7
BuildRequires: python3-m2crypto
Requires: python3-m2crypto
%else
BuildRequires: m2crypto > 0.19
Requires: m2crypto > 0.19
%endif
%endif
Provides: %{use_python}-osc Provides: %{use_python_pkg}-osc
%if %{with python3}
%define python_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%else
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
%description %description
Commandline client for the Open Build Service. OpenSUSE Commander is a command-line client for the Open Build Service.
See http://en.opensuse.org/openSUSE:OSC , as well as See http://en.opensuse.org/openSUSE:OSC, as well as
http://en.opensuse.org/openSUSE:Build_Service_Tutorial for a general http://en.opensuse.org/openSUSE:Build_Service_Tutorial
introduction. for a general introduction.
%prep %prep
%setup -q %autosetup -p1
%build %build
# the PATH hack/rewrite is needed for Fedora 20 builds, because /bin %{use_python} setup.py build
# is a symlink to /usr/bin and /bin precedes /usr/bin in PATH
# => a "wrong" interpreter line ("#!/bin/python") is constructed
# ("wrong", because no package provides "/bin/python").
PATH="/usr/bin:$PATH" CFLAGS="%{optflags}" %{use_python} setup.py build
cat << eom > %{macros_file} # write rpm macros
cat << EOF > macros.osc
%%osc_plugin_dir %{osc_plugin_dir} %%osc_plugin_dir %{osc_plugin_dir}
eom EOF
echo >> %{macros_file}
# build man page
%if %{with man}
PYTHONPATH=. argparse-manpage \
--output=osc.1 \
--format=single-commands-section \
--module=osc.commandline \
--function=get_parser \
--project-name=osc \
--prog=osc \
--description="OpenSUSE Commander" \
--author="Contributors to the osc project. See the project's GIT history for the complete list." \
--url="https://github.com/openSUSE/osc/"
%endif
%install %install
%{use_python} setup.py install --prefix=%{_prefix} --root=%{buildroot} %{use_python} setup.py install -O1 --skip-build --force --root %{buildroot} --prefix %{_prefix}
sed -i -E 's|#!.*python|#!%{_bindir}/%{use_python}|' osc-wrapper.py
ln -s osc-wrapper.py %{buildroot}/%{_bindir}/osc # create plugin dirs
mkdir -p %{buildroot}%{osc_plugin_dir} install -d %{buildroot}%{osc_plugin_dir}
mkdir -p %{buildroot}%{_localstatedir}/lib/osc-plugins install -d %{buildroot}%{_sharedstatedir}/osc-plugins
install -Dm0644 dist/complete.csh %{buildroot}%{_sysconfdir}/profile.d/osc.csh
%if 0%{?suse_version} # install completions
install -Dm0644 dist/complete.sh %{buildroot}%{_sysconfdir}/bash_completion.d/osc.sh install -Dm0755 contrib/osc.complete %{buildroot}%{_datadir}/osc/complete
%else install -Dm0644 contrib/complete.csh %{buildroot}%{completion_dir_csh}/osc.csh
install -Dm0644 dist/complete.sh %{buildroot}%{_sysconfdir}/profile.d/osc.sh install -Dm0644 contrib/complete.sh %{buildroot}%{completion_dir_bash}/osc.sh
%endif install -Dm0644 contrib/osc.fish %{buildroot}%{completion_dir_fish}/osc.fish
%if 0%{?suse_version} > 1110
install -Dm0755 dist/osc.complete %{buildroot}%{_prefix}/lib/osc/complete # install rpm macros
%else install -Dm0644 macros.osc %{buildroot}%{_rpmmacrodir}/macros.osc
install -Dm0755 dist/osc.complete %{buildroot}%{_libdir}/osc/complete
# install man page
%if %{with man}
install -Dm0644 osc.1 %{buildroot}%{_mandir}/man1/osc.1
%endif %endif
install -Dm644 osc.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/osc.fish
install -m644 %{macros_file} -D %{buildroot}%{_rpmmacrodir}/%{macros_file}
%if 0%{?suse_version} >= 1500
%check %check
%{use_python} setup.py test %{use_python} setup.py test
%endif
%clean
rm -rf %{buildroot}
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%if 0%{?suse_version} >= 1500
# docs
%license COPYING %license COPYING
%doc AUTHORS README.md TODO NEWS %doc AUTHORS README.md NEWS
%else %if %{with man}
%doc AUTHORS README.md TODO NEWS COPYING
%endif
%{_bindir}/osc*
%{python_sitelib}/*
%config %{_sysconfdir}/profile.d/osc.csh
%if 0%{?suse_version}
%config %{_sysconfdir}/bash_completion.d/osc.sh
%else
%config %{_sysconfdir}/profile.d/osc.sh
%endif
%{_rpmmacrodir}/%{macros_file}
%dir %{_localstatedir}/lib/osc-plugins
%{_mandir}/man1/osc.* %{_mandir}/man1/osc.*
%if 0%{?suse_version} > 1110
%{_prefix}/lib/osc
%else
%{_libdir}/osc
%endif %endif
# executables
%{_bindir}/*
# python modules
%{python_sitelib}/*
# rpm macros
%{_rpmmacrodir}/*
# plugins
%dir %{osc_plugin_dir}
%dir %{_sharedstatedir}/osc-plugins
# completions
%dir %{_datadir}/osc
%{_datadir}/osc/complete
%{completion_dir_bash}/*
%{completion_dir_csh}/*
%{completion_dir_fish}/*
# osc owns the dirs to avoid the "directories not owned by a package" build error
%dir %{_datadir}/fish %dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d %dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/osc.fish
%dir %{osc_plugin_dir}
%changelog %changelog