mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-23 22:58:53 +02:00
- work around ruby on rails issue, which swallows '+' signs in filenames in PUT
requests [#153725, 181593] - before committing, make sure that the working copy is up to date (added show_rev() function) - add 'commit' as subcommand alias for 'ci/checkin' - use os.path.abspath() in Project and Package classes
This commit is contained in:
17
osc/core.py
17
osc/core.py
@@ -62,12 +62,7 @@ class Project:
|
||||
"""represent a project directory, holding packages"""
|
||||
def __init__(self, dir):
|
||||
self.dir = dir
|
||||
if self.dir.startswith('/'):
|
||||
self.absdir = dir
|
||||
elif self.dir == os.curdir:
|
||||
self.absdir = os.getcwd()
|
||||
else:
|
||||
self.absdir = os.path.join(os.getcwd(), dir)
|
||||
self.absdir = os.path.abspath(dir)
|
||||
|
||||
self.name = store_read_project(self.dir)
|
||||
|
||||
@@ -107,6 +102,7 @@ class Package:
|
||||
"""represent a package (its directory) and read/keep/write its metadata"""
|
||||
def __init__(self, workingdir):
|
||||
self.dir = workingdir
|
||||
self.absdir = os.path.abspath(self.dir)
|
||||
self.storedir = os.path.join(self.dir, store)
|
||||
|
||||
check_store_version(self.dir)
|
||||
@@ -211,7 +207,9 @@ class Package:
|
||||
def put_source_file(self, n):
|
||||
import othermethods
|
||||
|
||||
u = makeurl(['source', self.prjname, self.name, n])
|
||||
# escaping '+' in the URL path (note: not in the URL query string) is
|
||||
# only a workaround for ruby on rails, which swallows it otherwise
|
||||
u = makeurl(['source', self.prjname, self.name, n.replace('+', '%2B')])
|
||||
othermethods.putfile(u, os.path.join(self.dir, n), username, password)
|
||||
|
||||
shutil.copy2(os.path.join(self.dir, n), os.path.join(self.storedir, n))
|
||||
@@ -806,6 +804,11 @@ def show_files_meta(prj, pac):
|
||||
return f.readlines()
|
||||
|
||||
|
||||
def show_upstream_rev(prj, pac):
|
||||
m = show_files_meta(prj, pac)
|
||||
return ET.parse(StringIO(''.join(m))).getroot().get('rev')
|
||||
|
||||
|
||||
def read_meta_from_spec(specfile):
|
||||
"""read Name, Summary and %description from spec file"""
|
||||
in_descr = False
|
||||
|
Reference in New Issue
Block a user