mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 17:46:17 +01:00
- cleanup the new "meta mode" a bit
currently it isn't possible to change from "meta mode" to "normal" mode (except with some dirty hacks..)
This commit is contained in:
parent
4c168a2428
commit
f023578cf2
35
osc/core.py
35
osc/core.py
@ -755,12 +755,11 @@ class Project:
|
|||||||
|
|
||||||
class Package:
|
class Package:
|
||||||
"""represent a package (its directory) and read/keep/write its metadata"""
|
"""represent a package (its directory) and read/keep/write its metadata"""
|
||||||
def __init__(self, workingdir, progress_obj=None, limit_size=None, meta=None):
|
def __init__(self, workingdir, progress_obj=None, limit_size=None):
|
||||||
self.dir = workingdir
|
self.dir = workingdir
|
||||||
self.absdir = os.path.abspath(self.dir)
|
self.absdir = os.path.abspath(self.dir)
|
||||||
self.storedir = os.path.join(self.absdir, store)
|
self.storedir = os.path.join(self.absdir, store)
|
||||||
self.progress_obj = progress_obj
|
self.progress_obj = progress_obj
|
||||||
self.meta = meta
|
|
||||||
self.limit_size = limit_size
|
self.limit_size = limit_size
|
||||||
if limit_size and limit_size == 0:
|
if limit_size and limit_size == 0:
|
||||||
self.limit_size = None
|
self.limit_size = None
|
||||||
@ -847,16 +846,13 @@ class Package:
|
|||||||
self.write_conflictlist()
|
self.write_conflictlist()
|
||||||
|
|
||||||
def write_meta_mode(self):
|
def write_meta_mode(self):
|
||||||
|
# XXX: the "elif" is somehow a contradiction (with current and the old implementation
|
||||||
|
# it's not possible to "leave" the metamode again) (except if you modify pac.meta
|
||||||
|
# which is really ugly:) )
|
||||||
if self.meta:
|
if self.meta:
|
||||||
fname = os.path.join(self.storedir, '_meta_mode')
|
store_write_string(self.absdir, '_meta_mode', '')
|
||||||
f = open(fname, 'w')
|
elif self.ismetamode():
|
||||||
f.write(str("true"))
|
os.unlink(os.path.join(self.storedir, '_meta_mode'))
|
||||||
f.close()
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
os.unlink(os.path.join(self.storedir, '_meta_mode'))
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def write_sizelimit(self):
|
def write_sizelimit(self):
|
||||||
if self.size_limit and self.size_limit <= 0:
|
if self.size_limit and self.size_limit <= 0:
|
||||||
@ -1142,7 +1138,7 @@ class Package:
|
|||||||
self.in_conflict = read_inconflict(self.dir)
|
self.in_conflict = read_inconflict(self.dir)
|
||||||
self.linkrepair = os.path.isfile(os.path.join(self.storedir, '_linkrepair'))
|
self.linkrepair = os.path.isfile(os.path.join(self.storedir, '_linkrepair'))
|
||||||
self.size_limit = read_sizelimit(self.dir)
|
self.size_limit = read_sizelimit(self.dir)
|
||||||
self.meta = read_meta_mode(self.dir)
|
self.meta = self.ismetamode()
|
||||||
|
|
||||||
# gather unversioned files, but ignore some stuff
|
# gather unversioned files, but ignore some stuff
|
||||||
self.excluded = [ i for i in os.listdir(self.dir)
|
self.excluded = [ i for i in os.listdir(self.dir)
|
||||||
@ -1175,6 +1171,10 @@ class Package:
|
|||||||
"""tells us if the link is frozen."""
|
"""tells us if the link is frozen."""
|
||||||
return os.path.isfile(os.path.join(self.storedir, '_frozenlink'))
|
return os.path.isfile(os.path.join(self.storedir, '_frozenlink'))
|
||||||
|
|
||||||
|
def ismetamode(self):
|
||||||
|
"""tells us if the package is in meta mode"""
|
||||||
|
return os.path.isfile(os.path.join(self.storedir, '_meta_mode'))
|
||||||
|
|
||||||
def get_pulled_srcmd5(self):
|
def get_pulled_srcmd5(self):
|
||||||
pulledrev = None
|
pulledrev = None
|
||||||
for line in open(os.path.join(self.storedir, '_pulled'), 'r'):
|
for line in open(os.path.join(self.storedir, '_pulled'), 'r'):
|
||||||
@ -1959,17 +1959,6 @@ def read_tobedeleted(dir):
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
def read_meta_mode(dir):
|
|
||||||
r = None
|
|
||||||
fname = os.path.join(dir, store, '_meta_mode')
|
|
||||||
|
|
||||||
if os.path.exists(fname):
|
|
||||||
r = open(fname).readline()
|
|
||||||
|
|
||||||
if r is None or not r == "true":
|
|
||||||
return None
|
|
||||||
return 1
|
|
||||||
|
|
||||||
def read_sizelimit(dir):
|
def read_sizelimit(dir):
|
||||||
r = None
|
r = None
|
||||||
fname = os.path.join(dir, store, '_size_limit')
|
fname = os.path.join(dir, store, '_size_limit')
|
||||||
|
Loading…
Reference in New Issue
Block a user