From de4dfbd4338822059de27e86a5d2ce3fcbc0e11e Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Wed, 29 May 2013 13:20:09 +0800 Subject: [PATCH] fix adding group/pattern files to repo Change-Id: I047b6d68e851dde94b63168b9f749e9d5093b42b --- common/repomaker.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/common/repomaker.py b/common/repomaker.py index c7f9a6e..fab5bd2 100644 --- a/common/repomaker.py +++ b/common/repomaker.py @@ -44,12 +44,14 @@ def collect(in_dir): archs = set() for fname in find_files(in_dir): ftype = fname.split('.')[-2] + basename = os.path.basename(fname) if ftype not in ("src", "noarch"): archs.add(ftype) is_debug = "-debugsource-" in fname or "-debuginfo-" in fname - is_group = fname.startswith("package-groups-") - is_imageconf = fname.startswith("image-configurations-") + is_group = basename.startswith("package-groups-") and not is_debug + is_imageconf = basename.startswith("image-configurations-") and \ + not is_debug files.append((fname, ftype, is_debug, is_group, is_imageconf)) return files, archs @@ -166,11 +168,14 @@ class RepoMaker(object): # For package-groups package update package groups and patterns if is_group: + repodata_dir = os.path.join(repo_dir, ftype, "packages", + "repodata") + if not os.path.exists(repodata_dir): + os.makedirs(repodata_dir) for filename in ("group.xml", "patterns.xml"): os.system("rpm2cpio %s | cpio -i --to-stdout "\ "./usr/share/package-groups/%s > %s" % \ - (fpath, filename, os.path.join(repo_dir, ftype, - "repodata", + (fpath, filename, os.path.join(repodata_dir, filename))) # get names and content of .ks files from rpm if is_imageconf: @@ -194,6 +199,11 @@ class RepoMaker(object): for _rtype, _rarch, rpath in dirs: # run createrepo os.system('createrepo --quiet %s' % rpath) + for filename in ("group.xml", "patterns.xml"): + metafile = os.path.join(rpath, "repodata", filename) + if os.path.exists(metafile): + os.system('modifyrepo %s %s' % (metafile, + os.path.join(rpath, "repodata"))) # sign if gpg_key is provided if gpg_key and os.path.exists(signer) and os.access(signer, os.X_OK): -- 2.7.4