Author: lslezak Date: Fri Nov 9 11:22:12 2007 New Revision: 41909 URL: http://svn.opensuse.org/viewcvs/yast?rev=41909&view=rev Log: - properly download /boot, /docu and slideshow files (#338625) Modified: trunk/product-creator/package/yast2-product-creator.changes trunk/product-creator/src/ProductCreator.ycp Modified: trunk/product-creator/package/yast2-product-creator.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/package/yast2-pro... ============================================================================== --- trunk/product-creator/package/yast2-product-creator.changes (original) +++ trunk/product-creator/package/yast2-product-creator.changes Fri Nov 9 11:22:12 2007 @@ -1,6 +1,7 @@ ------------------------------------------------------------------- Fri Nov 9 10:36:55 CET 2007 - lslezak@suse.cz +- properly download /boot, /docu and slideshow files (#338625) - install required package createrepo (#331530), install additional packages on PPC - fixed ISO image creation on PPC when the path contained spaces Modified: trunk/product-creator/src/ProductCreator.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/ProductCreato... ============================================================================== --- trunk/product-creator/src/ProductCreator.ycp (original) +++ trunk/product-creator/src/ProductCreator.ycp Fri Nov 9 11:22:12 2007 @@ -785,38 +785,64 @@ return true; } -boolean CopyDirectoryRec(integer srcid, integer mid, string src, string target) +boolean CopyDirectoryR(integer srcid, integer mid, string src, string target, boolean optional) { y2milestone("CopyDirectoryRec: srcid: %1, mid: %2, src: %3, target: %4", srcid, mid, src, target); - string local_dir = Pkg::SourceProvideDir(srcid, mid, src); + string local_dir = Pkg::SourceProvideDirectory(srcid, mid, src, optional, true); y2milestone("local_dir: %1", local_dir); if (local_dir == nil || local_dir == "") { - // an error message, %1 is the directory, %2 is URL of the source - Report::Error(sformat(_("Cannot read directory %1\nfrom source %2."), src, Pkg::SourceGeneralData(srcid)["url"]:"")); + if (!optional) + { + // an error message, %1 is the directory, %2 is URL of the source + Report::Error(sformat(_("Cannot read directory %1\nfrom source %2."), src, Pkg::SourceGeneralData(srcid)["url"]:"")); + } + return false; } return Exec(sformat("/bin/cp -a -f -- '%1' '%2'", String::Quote(local_dir), String::Quote(target))); } -boolean CopyDirectoryNonRec(integer srcid, integer mid, string src, string target) +boolean CopyDirectoryRec(integer srcid, integer mid, string src, string target) +{ + return CopyDirectoryR(srcid, mid, src, target, false); +} + +boolean CopyDirectoryRecOpt(integer srcid, integer mid, string src, string target) +{ + return CopyDirectoryR(srcid, mid, src, target, true); +} + +list<string> GetList(integer srcid, integer mid, string dir) { // get file list from directory.yast - string file_list = Pkg::SourceProvideOptionalFile(srcid, 1, "directory.yast"); + string file_list = Pkg::SourceProvideOptionalFile(srcid, mid, sformat("%1/directory.yast", dir)); if (file_list == nil || file_list == "") { y2error("directory.yast was not found, a YUM source?"); - return false; + return nil; } string f = (string)SCR::Read(.target.string, file_list); list<string> files = splitstring(f, "\n"); y2milestone("Remote objects: %1", files); + return files; +} + +boolean CopyDirectoryNonRec(integer srcid, integer mid, string src, string target) +{ + // get file list from directory.yast + list<string> files = GetList(srcid, mid, ""); + if (files == nil) + { + files = []; + } + files = filter(string file, files, {return !regexpmatch(file, "/$") && file != "";}); y2milestone("Remote files: %1", files); @@ -830,6 +856,44 @@ return true; } +boolean CopyDocu(integer srcid, string target) +{ + list<string> lst = GetList(srcid, 1, ""); + if (lst == nil) + { + lst = []; + } + + boolean ret = true; + + if (contains(lst, "docu/")) + { + y2milestone("Copying /docu subdirectory"); + Exec(sformat("/bin/mkdir -p '%1/docu'", String::Quote(target))); + + boolean r = CopyDirectoryRecOpt(srcid, 1, "/docu", target); + + if (!r) + { + list<string> files = [ + "docu/RELEASE-NOTES.en.html", "docu/RELEASE-NOTES.en.rtf" + ]; + + y2internal("Directory listing may be missing using fixed list: %1", files); + + foreach(string f, files, + { + CopyFile(srcid, 1, f, target + f); + } + ); + } + + ret = ret && r; + } + + return ret; +} + boolean CopyPPCBoot(integer srcid, string target) { return CopyDirectoryRec(srcid, 1, "/ppc", target) @@ -1124,6 +1188,9 @@ if (source == "") return false; + // copy /docu (release notes) when present + CopyDocu(id, skel_root); + y2milestone("source: %1", source); descr_dir = this_source["productData","descrdir"]:"suse/setup/descr"; @@ -1384,13 +1451,13 @@ string l_dirlist = Pkg::SourceProvideOptionalFile(source_id, 1, slidedir + "directory.yast"); if (l_dirlist != nil) { - string l_slidedir = Pkg::SourceProvideDir(source_id, 1, slidedir); + string l_slidedir = Pkg::SourceProvideDirectory(source_id, 1, slidedir, true, true); if (l_slidedir != nil && l_slidedir != "") { // copy slide show Exec(sformat("/bin/mkdir -p '%1/%2'", String::Quote(skel_root), String::Quote(slidedir))); - Exec(sformat("/bin/cp -a -- '%1/*' '%2/%3'", String::Quote(l_slidedir), String::Quote(skel_root), String::Quote(slidedir))); + Exec(sformat("/bin/cp -a -- '%1' '%2/%3'", String::Quote(l_slidedir), String::Quote(skel_root), String::Quote(datadir + "/setup/"))); } } else -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org