| |
@@ -5891,21 +5891,21 @@
|
| |
raise koji.GenericError("Unexpected cross-volume content: %s" % checkdir)
|
| |
|
| |
# First copy the build dir(s)
|
| |
- dir_moves = []
|
| |
old_binfo = binfo.copy()
|
| |
binfo['volume_id'] = volinfo['id']
|
| |
binfo['volume_name'] = volinfo['name']
|
| |
olddir = koji.pathinfo.build(old_binfo)
|
| |
- if os.path.exists(olddir):
|
| |
- newdir = koji.pathinfo.build(binfo)
|
| |
- dir_moves.append([olddir, newdir])
|
| |
- for olddir, newdir in dir_moves:
|
| |
- # Remove old symlink if copying to base volume
|
| |
- if volinfo['name'] == 'DEFAULT' or volinfo['name'] is None:
|
| |
- if os.path.islink(newdir):
|
| |
- os.unlink(newdir)
|
| |
- koji.ensuredir(os.path.dirname(newdir))
|
| |
- shutil.copytree(olddir, newdir, symlinks=True)
|
| |
+ newdir = koji.pathinfo.build(binfo)
|
| |
+ if not os.path.exists(olddir):
|
| |
+ raise koji.GenericError(f"Build directory missing: {olddir}")
|
| |
+ if not os.path.isdir(olddir):
|
| |
+ raise koji.GenericError(f"Not a directory: {olddir}")
|
| |
+ # Remove old symlink if copying to base volume
|
| |
+ if volinfo['name'] == 'DEFAULT' or volinfo['name'] is None:
|
| |
+ if os.path.islink(newdir):
|
| |
+ os.unlink(newdir)
|
| |
+ koji.ensuredir(os.path.dirname(newdir))
|
| |
+ shutil.copytree(olddir, newdir, symlinks=True)
|
| |
|
| |
# Second, update the db
|
| |
koji.plugin.run_callbacks('preBuildStateChange', attribute='volume_id',
|
| |
@@ -5917,8 +5917,7 @@
|
| |
set_tag_update(tag['id'], 'VOLUME_CHANGE')
|
| |
|
| |
# Third, delete the old content
|
| |
- for olddir, newdir in dir_moves:
|
| |
- koji.util.rmtree(olddir)
|
| |
+ koji.util.rmtree(olddir)
|
| |
|
| |
# Fourth, maintain a symlink if appropriate
|
| |
if volinfo['name'] and volinfo['name'] != 'DEFAULT':
|
| |
setBuildVolume
will pass to later stage and traceback on undefinednewdir
.