| |
@@ -14,6 +14,7 @@
|
| |
# along with this program; if not, see <https://gnu.org/licenses/>.
|
| |
|
| |
|
| |
+ import copy
|
| |
import os
|
| |
import time
|
| |
import json
|
| |
@@ -168,7 +169,18 @@
|
| |
compose.log_info("[BEGIN] %s" % msg)
|
| |
|
| |
path = compose.paths.compose.metadata("composeinfo.json")
|
| |
- ci.dump(path)
|
| |
+ # make a copy of composeinfo and modify the copy
|
| |
+ # if any path in variant paths doesn't exist or just an empty
|
| |
+ # dir, set it to None, then it won't be dumped.
|
| |
+ ci_copy = copy.deepcopy(ci)
|
| |
+ for variant in ci_copy.variants.variants.values():
|
| |
+ for field in variant.paths._fields:
|
| |
+ field_paths = getattr(variant.paths, field)
|
| |
+ for arch, dirpath in field_paths.iteritems():
|
| |
+ dirpath = os.path.join(compose.paths.compose.topdir(), dirpath)
|
| |
+ if not (os.path.isdir(dirpath) and os.listdir(dirpath)):
|
| |
+ field_paths[arch] = None
|
| |
+ ci_copy.dump(path)
|
| |
|
| |
compose.log_info("[DONE ] %s" % msg)
|
| |
|
| |
Do not create empty skeleton dirs for empty variants which we do for rpm
variants in some phases (some others already have the check):
1. createiso phase
2. extra_files phase
3. gather phase
These empty variants will have empty paths in metadata.
FIXES: #497
Signed-off-by: Qixiang Wan qwan@redhat.com