* remove empty dirs
* give warning instead of error for file conflicts (temporary kludge)
This commit is contained in:
@@ -155,7 +155,8 @@ class Install(AtomicOperation):
|
|||||||
if ctx.filesdb.has_file(file.path):
|
if ctx.filesdb.has_file(file.path):
|
||||||
pkg, existing_file = ctx.filesdb.get_file(file.path)
|
pkg, existing_file = ctx.filesdb.get_file(file.path)
|
||||||
if pkg != self.pkginfo.name:
|
if pkg != self.pkginfo.name:
|
||||||
raise Error(_('Trying to overwrite an existing file: %s') % file.path)
|
#raise Error(_('Trying to overwrite an existing file: %s') % file.path)
|
||||||
|
ctx.ui.warning(_('Trying to overwrite an existing file: %s') % file.path)
|
||||||
|
|
||||||
def check_reinstall(self):
|
def check_reinstall(self):
|
||||||
"check reinstall, confirm action, and schedule reinstall"
|
"check reinstall, confirm action, and schedule reinstall"
|
||||||
@@ -402,13 +403,12 @@ class Remove(AtomicOperation):
|
|||||||
if os.path.isfile(fpath):
|
if os.path.isfile(fpath):
|
||||||
os.rename(fpath, fpath + ".oldconfig")
|
os.rename(fpath, fpath + ".oldconfig")
|
||||||
else:
|
else:
|
||||||
# check if file is removed manually.
|
|
||||||
# And we don't remove directories!
|
|
||||||
# TODO: remove directory if there is nothing under it?
|
|
||||||
if os.path.isfile(fpath) or os.path.islink(fpath):
|
if os.path.isfile(fpath) or os.path.islink(fpath):
|
||||||
os.unlink(fpath)
|
os.unlink(fpath)
|
||||||
|
elif os.path.isdir(fpath) and os.listdir(fpath)==[]:
|
||||||
|
os.rmdir(fpath) # remove directory if there is nothing under it
|
||||||
else:
|
else:
|
||||||
ctx.ui.warning(_('Not removing non-file, non-link %s') % fpath)
|
ctx.ui.warning(_('Not removing non-file, non-link %s') % fpath, True)
|
||||||
|
|
||||||
remove_file = staticmethod(remove_file)
|
remove_file = staticmethod(remove_file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user