Skip to content

Commit

Permalink
Merge branch 'openSUSE:master' into unlock-keyring
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdva authored Mar 11, 2022
2 parents 87b1e24 + f4626dd commit 3a04adf
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 42 deletions.
19 changes: 19 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
0.177.0
-

0.176.0
- add -F option to osc submitreq
- add --verbose option to build command
- fix getbinaries command to fetch also multibuild packages
- fix getbinaries -M/--multibuild-package option usage
- skip fetching metadata and logs in the getbinaries command
- do not download a bdep with a hdrmd5 from the api by default
- re-download file from API when hdrmd5 doesn't match
- honor --download-api-only option
- remove Windows from the supported operating systems
- fix license in setup.py
- add py3.10 and py3.11 to the classifiers in setup.py
- use the latest version of COPYING file from gnu.org
- fix crash on terminal resize during download
- do not fail with a traceback in case of a config error
- preserve oscrc symlink when writing conf file
- escape % character in binary download URLs
- fix printing paths to built debian packages

0.175.0
- do not crash when running "osc search --binary --verbose foo"
Expand Down
3 changes: 2 additions & 1 deletion osc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,8 @@ def main(apiurl, opts, argv):
http_debug = config['http_debug'],
modules = bi.modules,
enable_cpio = not opts.disable_cpio_bulk_download,
cookiejar=cookiejar)
cookiejar=cookiejar,
download_api_only=opts.download_api_only)

if not opts.trust_all_projects:
# implicitly trust the project we are building for
Expand Down
28 changes: 23 additions & 5 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,8 @@ def do_meta(self, subcmd, opts, *args):

@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
@cmdln.option('-F', '--file', metavar='FILE',
help='read log message from FILE, \'-\' denotes standard input.')
@cmdln.option('-r', '--revision', metavar='REV',
help='specify a certain source revision ID (the md5 sum) for the source package')
@cmdln.option('-s', '--supersede', metavar='REQUEST_ID',
Expand Down Expand Up @@ -1257,6 +1259,14 @@ def _check_service(root):

if opts.message:
opts.message = str(opts.message.encode().decode('unicode_escape'))
elif opts.file:
if opts.file == '-':
opts.message = sys.stdin.read()
else:
try:
opts.message = open(opts.file).read()
except:
sys.exit('could not open file \'%s\'.' % opts.file)

myreqs = []
if opts.supersede:
Expand Down Expand Up @@ -4653,8 +4663,6 @@ def do_checkout(self, subcmd, opts, *args):
prj_dir = opts.output_dir if opts.output_dir else project
if not opts.output_dir and conf.config['checkout_no_colon']:
prj_dir = prj_dir.replace(':', '/')
if sys.platform[:3] == 'win':
prj_dir = prj_dir.replace(':', ';')
if os.path.exists(prj_dir):
sys.exit('osc: project directory \'%s\' already exists' % prj_dir)

Expand Down Expand Up @@ -7429,8 +7437,9 @@ def do_wipebinaries(self, subcmd, opts, *args):
help='do not show downloading progress')
@cmdln.option('-d', '--destdir', default='./binaries', metavar='DIR',
help='destination directory')
@cmdln.option('-M', '--multibuild-package', action='append',
help='get binaries from specified multibuild package')
@cmdln.option('-M', '--multibuild-package', metavar="FLAVOR", action='append',
help='Get binaries from the specified flavor of a multibuild package.'
' It is meant for use from a package checkout when it is not possible to specify package:flavor.')
@cmdln.option('--sources', action="store_true",
help='also fetch source packages')
@cmdln.option('--debug', action="store_true",
Expand Down Expand Up @@ -7460,6 +7469,9 @@ def do_getbinaries(self, subcmd, opts, *args):
package = None
binary = None

if opts.multibuild_package and ((len(args) > 2) or (len(args) <= 2 and is_project_dir(os.getcwd()))):
self.optparser.error("The -M/--multibuild-package option can be only used from a package checkout.")

if len(args) < 1 and is_package_dir('.'):
self.print_repos()

Expand Down Expand Up @@ -7498,7 +7510,7 @@ def do_getbinaries(self, subcmd, opts, *args):


if package is None:
package = meta_get_packagelist(apiurl, project)
package = meta_get_packagelist(apiurl, project, deleted=0)
else:
if opts.multibuild_package:
packages = []
Expand Down Expand Up @@ -7526,6 +7538,12 @@ def do_getbinaries(self, subcmd, opts, *args):
for i in binaries:
if binary != None and binary != i.name:
continue
# skip metadata (unless explicitly specified as the `FILE` (== `binary`) argument)
if not binary and i.name.startswith("_"):
continue
# skip logs (unless explicitly specified as the `FILE` (== `binary`) argument)
if not binary and i.name.endswith(".log"):
continue
# skip source rpms
if not opts.sources and (i.name.endswith('src.rpm') or i.name.endswith('sdeb')):
continue
Expand Down
19 changes: 8 additions & 11 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from __future__ import print_function

__version__ = '0.176.git'
__version__ = '0.177.git'

# __store_version__ is to be incremented when the format of the working copy
# "store" changes in an incompatible way. Please add any needed migration
Expand Down Expand Up @@ -3449,6 +3449,11 @@ def meta_get_packagelist(apiurl, prj, deleted=None, expand=False):
query = {}
if deleted:
query['deleted'] = 1
elif deleted in (False, 0):
# HACK: Omitted 'deleted' and 'deleted=0' produce different results.
# By explicit 'deleted=0', we also get multibuild packages listed.
# See: https://github.com/openSUSE/open-build-service/issues/9715
query['deleted'] = 0
if expand:
query['expand'] = 1

Expand Down Expand Up @@ -4082,8 +4087,6 @@ def _get_linux_distro():

def get_default_editor():
system = platform.system()
if system == 'Windows':
return 'notepad'
if system == 'Linux':
dist = _get_linux_distro()
if dist == 'debian':
Expand All @@ -4095,8 +4098,6 @@ def get_default_editor():

def get_default_pager():
system = platform.system()
if system == 'Windows':
return 'less'
if system == 'Linux':
dist = _get_linux_distro()
if dist == 'debian':
Expand Down Expand Up @@ -5061,12 +5062,8 @@ def checkout_package(apiurl, project, package,

if not prj_dir:
prj_dir = olddir
else:
if sys.platform[:3] == 'win':
prj_dir = prj_dir[:2] + prj_dir[2:].replace(':', ';')
else:
if conf.config['checkout_no_colon']:
prj_dir = prj_dir.replace(':', '/')
elif conf.config['checkout_no_colon']:
prj_dir = prj_dir.replace(':', '/')

root_dots = '.'
if conf.config['checkout_rooted']:
Expand Down
20 changes: 18 additions & 2 deletions osc/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class Fetcher:
def __init__(self, cachedir='/tmp', api_host_options={}, urllist=[],
http_debug=False, cookiejar=None, offline=False,
enable_cpio=True, modules=[]):
enable_cpio=True, modules=[], download_api_only=False):
# set up progress bar callback
self.progress_obj = None
if sys.stdout.isatty():
Expand All @@ -43,6 +43,7 @@ def __init__(self, cachedir='/tmp', api_host_options={}, urllist=[],
self.offline = offline
self.cpio = {}
self.enable_cpio = enable_cpio
self.download_api_only = download_api_only

self.gr = OscFileGrabber(progress_obj=self.progress_obj)

Expand Down Expand Up @@ -195,6 +196,8 @@ def dirSetup(self, pac):
sys.exit(1)

def _build_urllist(self, buildinfo, pac):
if self.download_api_only:
return []
urllist = self.urllist
key = '%s/%s' % (pac.project, pac.repository)
project_repo_url = buildinfo.urls.get(key)
Expand All @@ -220,7 +223,6 @@ def run(self, buildinfo):
if not i.name.startswith('container:') and i.pacsuffix != 'rpm':
continue
if i.hdrmd5:
from .util import packagequery
if i.name.startswith('container:'):
hdrmd5 = dgst(i.fullfilename)
else:
Expand Down Expand Up @@ -252,6 +254,20 @@ def run(self, buildinfo):
prefix = '[%d/%d] ' % (done, needed)
self.fetch(i, prefix=prefix)

if not os.path.isfile(i.fullfilename):
# if the file wasn't downloaded and cannot be found on disk,
# mark it for downloading from the API
self.__add_cpio(i)
else:
# if the checksum of the downloaded package doesn't match,
# delete it and mark it for downloading from the API
hdrmd5 = packagequery.PackageQuery.queryhdrmd5(i.fullfilename)
if not hdrmd5 or hdrmd5 != i.hdrmd5:
print('%s/%s: attempting download from api, since the hdrmd5 did not match'
% (i.project, i.name))
os.unlink(i.fullfilename)
self.__add_cpio(i)

except KeyboardInterrupt:
print('Cancelled by user (ctrl-c)')
print('Exiting.')
Expand Down
31 changes: 8 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,12 @@
from distutils.command import build, install_data
import gzip
import os.path
import sys

import setuptools

import osc.core
from osc import commandline

# optional support for py2exe
try:
import py2exe

HAVE_PY2EXE = True
except:
HAVE_PY2EXE = False


class build_osc(build.build, object):
"""
Expand Down Expand Up @@ -90,17 +81,8 @@ def finalize_options(self):
self.data_files = data_files


addparams = {}
if HAVE_PY2EXE:
addparams['console'] = [
{'script': 'osc-wrapper.py', 'dest_base': 'osc', 'icon_resources': [(1, 'osc.ico')]}]
addparams['zipfile'] = 'shared.lib'
addparams['options'] = {'py2exe': {'optimize': 0, 'compressed': True,
'packages': ['xml.etree', 'StringIO', 'gzip']}}

data_files = []
if sys.platform[:3] != 'win':
data_files.append((os.path.join('share', 'man', 'man1'), ['osc.1.gz']))
data_files.append((os.path.join('share', 'man', 'man1'), ['osc.1.gz']))

with open("README") as fh:
long_description = fh.read()
Expand All @@ -113,8 +95,8 @@ def finalize_options(self):
long_description_content_type="text/plain",
author='openSUSE project',
author_email='opensuse-buildservice@opensuse.org',
license='GPL',
platforms=['Linux', 'Mac OSX', 'Windows XP/2000/NT', 'Windows 95/98/ME', 'FreeBSD'],
license='GPLv2+',
platforms=['Linux', 'MacOS X', 'FreeBSD'],
keywords=['openSUSE', 'SUSE', 'RPM', 'build', 'buildservice'],
url='http://en.opensuse.org/openSUSE:OSC',
download_url='https://github.com/openSUSE/osc',
Expand All @@ -129,7 +111,9 @@ def finalize_options(self):
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Operating System :: OS Independent",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: BSD :: FreeBSD",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
Expand All @@ -138,6 +122,8 @@ def finalize_options(self):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Build Tools",
"Topic :: System :: Archiving :: Packaging",
],
Expand All @@ -149,5 +135,4 @@ def finalize_options(self):
'build_docs': build_docs,
'install_data': install_data
},
**addparams
)

0 comments on commit 3a04adf

Please sign in to comment.