mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
Alter osc update operation's default behaviour.
Make update operation behave as checkout does and do not checkout linked packages from the same project (by default) during a project wide update.
This commit is contained in:
parent
7be66bc57a
commit
613e7b1a95
@ -4720,7 +4720,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
# (a) update all packages
|
||||
args += prj.pacs_have
|
||||
# (b) fetch new packages
|
||||
prj.checkout_missing_pacs(expand_link = not opts.unexpand_link)
|
||||
prj.checkout_missing_pacs(opts.expand_link, opts.unexpand_link)
|
||||
args.remove(arg)
|
||||
print_request_list(prj.apiurl, prj.name)
|
||||
|
||||
|
27
osc/core.py
27
osc/core.py
@ -683,18 +683,31 @@ class Project:
|
||||
store_write_apiurl(self.dir, apiurl)
|
||||
self.apiurl = store_read_apiurl(self.dir, defaulturl=False)
|
||||
|
||||
def checkout_missing_pacs(self, expand_link=False):
|
||||
def checkout_missing_pacs(self, expand_link=False, unexpand_link=False):
|
||||
for pac in self.pacs_missing:
|
||||
|
||||
if conf.config['do_package_tracking'] and pac in self.pacs_unvers:
|
||||
# pac is not under version control but a local file/dir exists
|
||||
msg = 'can\'t add package \'%s\': Object already exists' % pac
|
||||
raise oscerr.PackageExists(self.name, pac, msg)
|
||||
else:
|
||||
print('checking out new package %s' % pac)
|
||||
checkout_package(self.apiurl, self.name, pac, \
|
||||
pathname=getTransActPath(os.path.join(self.dir, pac)), \
|
||||
prj_obj=self, prj_dir=self.dir, expand_link=expand_link, progress_obj=self.progress_obj)
|
||||
|
||||
if not (expand_link or unexpand_link):
|
||||
try:
|
||||
m = show_files_meta(self.apiurl, self.name, pac)
|
||||
li = Linkinfo()
|
||||
li.read(ET.fromstring(''.join(m)).find('linkinfo'))
|
||||
if not li.haserror():
|
||||
if li.project == self.name:
|
||||
print('Skipping local linked package %s' % pac)
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
|
||||
print('checking out new package %s' % pac)
|
||||
checkout_package(self.apiurl, self.name, pac, \
|
||||
pathname=getTransActPath(os.path.join(self.dir, pac)), \
|
||||
prj_obj=self, prj_dir=self.dir,
|
||||
expand_link=expand_link or not unexpand_link, progress_obj=self.progress_obj)
|
||||
|
||||
def status(self, pac):
|
||||
exists = os.path.exists(os.path.join(self.absdir, pac))
|
||||
@ -930,7 +943,7 @@ class Project:
|
||||
else:
|
||||
print('unexpected state.. package \'%s\'' % pac)
|
||||
|
||||
self.checkout_missing_pacs(expand_link=not unexpand_link)
|
||||
self.checkout_missing_pacs(expand_link, unexpand_link)
|
||||
finally:
|
||||
self.write_packages()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user