Bug#867680: osc: support both obs-build and vanilla build

2017-07-09 Thread Luca Boccassi
On Sun, 2017-07-09 at 07:52 +0200, Michal Čihař wrote:
> Hello

Hello Michal,

> Luca Boccassi píše v So 08. 07. 2017 v 13:56 +0100:
> > In Debian SUSE's "build" package is renamed to "obs-build", and so
> > osc
> > carries a patch to make it compatible.
> > 
> > Unfortunately the patch makes it incompatible with SUSE's version.
> > Very
> > often when doing development, upstream sources are used.
> > This is a constant cause of problems and confusion among many users
> > in
> > my workplace, myself included.
> > 
> > I have sent a patch upstream, which was just merged, to make osc
> > compatible with both obs-build and build. This will make things
> > much
> > easier for users:
> > 
> > https://github.com/openSUSE/osc/pull/306
> > 
> > The patch is attached inline, and it would be great if it could be
> > used
> > in place of the existing one. It's adapted to apply on top of
> > 0.156.
> 
> I will anyway update the package, so maybe it's better to wait for
> upstream version with integrated your patch.

I do not know when 0.159 is going to be released.

In case you wish to apply the change on 0.158, the backported patch for
that version is inlined.

> > As a stretch goal, it would be nice if the Recommends could be
> > changed
> > from "obs-build" to "obs-build | build", so that things won't break
> > when using SUSE's upstream repository.
> 
> I'm not really sure about this - the build is really too generic
> package name. In the end this is only recommends, so it really
> doesn't
> force you to install obs-build if you know what you are doing with
> third party packages.

Yes it is very unfortunate that it is such a generic name.

On the other hand, there is no "build" binary package in the archive,
and it would be "second" choice, so it should not cause any problem nor
confusion, while solving issues that I have seen users experience in
the past couple of years.

Thanks!

Kind regards,
Luca Boccassi


From af5a38f4c8fd23159beff69a833529f0ad5ea868 Mon Sep 17 00:00:00 2001
From: Luca Boccassi 
Date: Fri, 7 Jul 2017 17:47:43 +0100
Subject: [PATCH] Add compatibility with Debian's obs-build

In Debian and Ubuntu build is renamed to obs-build for disambiguation
purposes.
Add a simple check to use the correct paths if running on Debian and
use /usr/bin/obs-build and /usr/lib/obs-build if so.
---
 osc/commandline.py | 8 +++-
 osc/conf.py| 6 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/osc/commandline.py b/osc/commandline.py
index 410199c..1e6b2fc 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -12,6 +12,7 @@ import sys
 import time
 import imp
 import inspect
+import os
 try:
 from urllib.parse import urlsplit
 from urllib.error import HTTPError
@@ -5867,7 +5868,12 @@ Please submit there instead, or use --nodevelproject to 
force direct submission.
 with tempfile.NamedTemporaryFile() as f:
 f.write(bc)
 f.flush()
-recipe = return_external('/usr/lib/build/queryconfig', 
'--dist', f.name, 'type')
+# some distros like Debian rename and move build to 
obs-build
+if not os.path.isfile('/usr/lib/build/queryconfig') and 
os.path.isfile('/usr/lib/obs-build/queryconfig'):
+queryconfig = '/usr/lib/obs-build/queryconfig'
+else:
+queryconfig = '/usr/lib/build/queryconfig'
+recipe = return_external(queryconfig, '--dist', f.name, 
'type')
 recipe = recipe.strip()
 if recipe == 'arch':
 recipe = 'PKGBUILD'
diff --git a/osc/conf.py b/osc/conf.py
index e49014d..2fd8e80 100644
--- a/osc/conf.py
+++ b/osc/conf.py
@@ -183,6 +183,12 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
 'vc-cmd': '/usr/lib/build/vc'
 }
 
+# some distros like Debian rename and move build to obs-build
+if not os.path.isfile('/usr/bin/build') and 
os.path.isfile('/usr/bin/obs-build'):
+DEFAULTS['build-cmd'] = '/usr/bin/obs-build'
+if not os.path.isfile('/usr/lib/build/vc') and 
os.path.isfile('/usr/lib/obs-build/vc'):
+DEFAULTS['vc-cmd'] = '/usr/lib/obs-build/vc'
+
 # being global to this module, this dict can be accessed from outside
 # it will hold the parsed configuration
 config = DEFAULTS.copy()
-- 
2.11.0


signature.asc
Description: This is a digitally signed message part


Bug#867680: osc: support both obs-build and vanilla build

2017-07-08 Thread Michal Čihař
Hello

Luca Boccassi píše v So 08. 07. 2017 v 13:56 +0100:
> In Debian SUSE's "build" package is renamed to "obs-build", and so
> osc
> carries a patch to make it compatible.
> 
> Unfortunately the patch makes it incompatible with SUSE's version.
> Very
> often when doing development, upstream sources are used.
> This is a constant cause of problems and confusion among many users
> in
> my workplace, myself included.
> 
> I have sent a patch upstream, which was just merged, to make osc
> compatible with both obs-build and build. This will make things much
> easier for users:
> 
> https://github.com/openSUSE/osc/pull/306
> 
> The patch is attached inline, and it would be great if it could be
> used
> in place of the existing one. It's adapted to apply on top of 0.156.

I will anyway update the package, so maybe it's better to wait for
upstream version with integrated your patch.

> As a stretch goal, it would be nice if the Recommends could be
> changed
> from "obs-build" to "obs-build | build", so that things won't break
> when using SUSE's upstream repository.

I'm not really sure about this - the build is really too generic
package name. In the end this is only recommends, so it really doesn't
force you to install obs-build if you know what you are doing with
third party packages.

-- 
Michal Čihař | https://cihar.com/ | https://weblate.org/


signature.asc
Description: This is a digitally signed message part


Bug#867680: osc: support both obs-build and vanilla build

2017-07-08 Thread Luca Boccassi
Package: osc
Version: 0.156.0-1
Severity: wishlist
Tags: patch

Dear Maintainer,

In Debian SUSE's "build" package is renamed to "obs-build", and so osc
carries a patch to make it compatible.

Unfortunately the patch makes it incompatible with SUSE's version. Very
often when doing development, upstream sources are used.
This is a constant cause of problems and confusion among many users in
my workplace, myself included.

I have sent a patch upstream, which was just merged, to make osc
compatible with both obs-build and build. This will make things much
easier for users:

https://github.com/openSUSE/osc/pull/306

The patch is attached inline, and it would be great if it could be used
in place of the existing one. It's adapted to apply on top of 0.156.

As a stretch goal, it would be nice if the Recommends could be changed
from "obs-build" to "obs-build | build", so that things won't break
when using SUSE's upstream repository.

Thank you!

Kind regards,
Luca Boccassi


From 5f47b5ca7b689997646c9504dfc64cb419141d48 Mon Sep 17 00:00:00 2001
From: Luca Boccassi 
Date: Fri, 7 Jul 2017 17:47:43 +0100
Subject: [PATCH] Add compatibility with Debian's obs-build

In Debian and Ubuntu build is renamed to obs-build for disambiguation
purposes.
Add a simple check to use the correct paths if running on Debian and
use /usr/bin/obs-build and /usr/lib/obs-build if so.
---
 osc/conf.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/osc/conf.py b/osc/conf.py
index e49014d..2fd8e80 100644
--- a/osc/conf.py
+++ b/osc/conf.py
@@ -183,6 +183,12 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
 'vc-cmd': '/usr/lib/build/vc'
 }
 
+# some distros like Debian rename and move build to obs-build
+if not os.path.isfile('/usr/bin/build') and 
os.path.isfile('/usr/bin/obs-build'):
+DEFAULTS['build-cmd'] = '/usr/bin/obs-build'
+if not os.path.isfile('/usr/lib/build/vc') and 
os.path.isfile('/usr/lib/obs-build/vc'):
+DEFAULTS['vc-cmd'] = '/usr/lib/obs-build/vc'
+
 # being global to this module, this dict can be accessed from outside
 # it will hold the parsed configuration
 config = DEFAULTS.copy()
-- 
2.11.0


signature.asc
Description: This is a digitally signed message part