Author: jsuchome
Date: Fri Aug 10 12:56:18 2007
New Revision: 40167
URL: http://svn.opensuse.org/viewcvs/yast?rev=40167&view=rev
Log:
- licenses written to /license.tar.gz (F302018)
- enable adding EXTRA_PROV file
- CLI option for info.txt and EXTRA_PROV
- SHA1 sums of EXTRA_PROV, info.txt, license.tar.gz to content
- 2.15.19
Modified:
trunk/add-on-creator/VERSION
trunk/add-on-creator/package/yast2-add-on-creator.changes
trunk/add-on-creator/src/AddOnCreator.ycp
trunk/add-on-creator/src/add-on-creator.ycp
trunk/add-on-creator/src/complex.ycp
trunk/add-on-creator/src/helps.ycp
Modified: trunk/add-on-creator/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/VERSION?rev=40167&r1=40166&r2=40167&view=diff
==============================================================================
--- trunk/add-on-creator/VERSION (original)
+++ trunk/add-on-creator/VERSION Fri Aug 10 12:56:18 2007
@@ -1 +1 @@
-2.15.18
+2.15.19
Modified: trunk/add-on-creator/package/yast2-add-on-creator.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/package/yast2-add-on-creator.changes?rev=40167&r1=40166&r2=40167&view=diff
==============================================================================
--- trunk/add-on-creator/package/yast2-add-on-creator.changes (original)
+++ trunk/add-on-creator/package/yast2-add-on-creator.changes Fri Aug 10 12:56:18 2007
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Fri Aug 10 12:47:53 CEST 2007 - jsuchome@suse.cz
+
+- licenses written to /license.tar.gz (F302018)
+- enable adding EXTRA_PROV file
+- CLI option for info.txt and EXTRA_PROV
+- SHA1 sums of EXTRA_PROV, info.txt, license.tar.gz to content
+- 2.15.19
+
+-------------------------------------------------------------------
Tue Aug 7 11:22:00 CEST 2007 - jsuchome@suse.cz
- licenses of packages merged into EULA.txt (F302018)
Modified: trunk/add-on-creator/src/AddOnCreator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/AddOnCreator.ycp?rev=40167&r1=40166&r2=40167&view=diff
==============================================================================
--- trunk/add-on-creator/src/AddOnCreator.ycp (original)
+++ trunk/add-on-creator/src/AddOnCreator.ycp Fri Aug 10 12:56:18 2007
@@ -543,6 +543,12 @@
// the contents of info.txt file
global string info = "";
+// the contents of EXTRA_PROV file
+global string extra_prov = "";
+
+// path to the file with EXTRA_PROV data
+global string extra_prov_file = "";
+
// the contents of nextmedia file
global string nextmedia = "";
@@ -754,6 +760,7 @@
return true;
}
+// proposal for ARCH.* values (of content file)
// FIXME this won't work for other architectures...
global string ValueForArchitecture (string arch_dir) {
@@ -902,6 +909,7 @@
// read the license files
string license_path = dir_path + "/media.1/license.zip";
out = $[];
+ // license.zip is obsolete
if (FileUtils::Exists (license_path))
{
SCR::Execute (.target.bash_output,
@@ -909,13 +917,21 @@
out = (map) SCR::Execute (.target.bash_output,
sformat ("ls -A1 %1/license*.txt 2>/dev/null", tmpdir));
}
+ else if (FileUtils::Exists (dir_path + "/license.tar.gz"))
+ {
+ SCR::Execute (.target.bash_output,
+ sformat ("/bin/tar -zxf %1/license.tar.gz -C %2", dir_path,tmpdir));
+ out = (map) SCR::Execute (.target.bash_output,
+ sformat ("ls -A1 %1/license*.txt 2>/dev/null", tmpdir));
+ }
else if (FileUtils::IsDirectory (dir_path + "/media.1/license") == true)
{
- license_path = dir_path + "/media.1/license";
out = (map) SCR::Execute (.target.bash_output,
sformat ("ls -A1 %1/media.1/license/license*.txt 2>/dev/null",
dir_path));
}
+ // extract license.txt from EULA.txt
+ // (no other need to read EULA, it should be just license.txt + packages)
else if (FileUtils::Exists (dir_path + "/EULA.txt"))
{
SCR::Execute (.target.bash,
@@ -955,6 +971,14 @@
// FIXME autorun
+ // read the info.txt
+ string info_path = dir_path + "/media.1/info.txt";
+ if (FileUtils::Exists (info_path))
+ {
+ info = (string) SCR::Read (.target.string, info_path);
+ if (info == nil) info = "";
+ }
+
// read the content of media.n dirs
out = (map) SCR::Execute (.target.bash_output,
sformat ("ls -A1 -d %1/media.* 2>/dev/null", dir_path));
@@ -1264,7 +1288,9 @@
return true;
}
-// generate the package descriptions using create_package_descr
+/**
+ * Generate the package descriptions using create_package_descr
+ */
global boolean GeneratePackageDescriptions () {
if (!FileUtils::Exists ("/usr/bin/create_package_descr")) return false;
@@ -1276,7 +1302,11 @@
}
-// write the package descriptions edited by user
+/**
+ * Write the package descriptions edited by user
+ * @path descr_path full path to directory with package descriptions (DESCRDIR)
+ * @path map with package descriptions
+ */
global boolean WritePackageDescriptions (string descr_path, map descr) {
if (!FileUtils::Exists (descr_path)) return false;
@@ -1296,11 +1326,20 @@
cmd = sformat ("/bin/cp %1/packages.DU '%2'", tmpdir, descr_path);
SCR::Execute (.target.bash, cmd, $["LANG":"C"]);
}
+
+
+ if (extra_prov_file != "" && FileUtils::Exists (extra_prov_file))
+ extra_prov = (string) SCR::Read (.target.string, extra_prov_file);
+
+ if (extra_prov != "" && extra_prov != nil)
+ SCR::Write (.target.string, descr_path + "/EXTRA_PROV",extra_prov);
+
return ret;
}
/**
* Generate ARCHIVES.gz, INDEX.gz and ls-lR.gz
+ * @param base_path path to base output directory
*/
global boolean GenerateArchiveFiles (string base_path)
{
@@ -1401,51 +1440,75 @@
return true;
}
-// write license.txt files in media.1 dir
-global boolean WriteLicensesFiles (string media_path, map files){
+/**
+ * Write the text of available licenses to correct places
+ * @path descr_path full path to directory with package descriptions (DESCRDIR)
+ * @param base_path full path to base output directory
+ * @patram files map of license files and their contents ($[ name : content ])
+ */
+global boolean WriteLicensesFiles (string descr_path, string base_path, map files)
+{
- if (!FileUtils::Exists (media_path))
+ if (!FileUtils::Exists (base_path))
+ {
+ y2warning ("no %1 directory exists...", base_path);
return false;
+ }
boolean ret = true;
string cmd = "";
foreach (string file, string cont, files, {
if (cont != "")
{
- if (!FileUtils::Exists (media_path +"/license"))
- SCR::Execute (.target.mkdir, media_path +"/license");
integer pos = findlastof (file, ".");
if (pos == nil || substring (file, pos) != ".txt")
file = file + ".txt";
cmd = cmd + " " + file;
- ret = ret &&
- SCR::Write (.target.string, media_path +"/license/"+ file,cont);
+ ret = ret && SCR::Write (.target.string, tmpdir + "/"+ file ,cont);
if (file == "license.txt")
SCR::Write (.target.string, tmpdir + "/EULA.txt", cont);
}
});
+ // tar + gzip the licenses into one file
+ if (ret && cmd != "")
+ {
+ cmd = sformat ("cd %1; tar -czf %2/license.tar.gz license*.txt",
+ tmpdir, base_path);
+ map out = (map) SCR::Execute (.target.bash_output, cmd);
+ if (out["stderr"]:"" != "")
+ {
+ y2warning ("%1 returned %2", cmd, out);
+ ret = false;
+ }
+ }
+ // merge the license of packages into EULA.txt
if (!FileUtils::Exists (tmpdir + "/EULA.txt"))
SCR::Execute (.target.bash, sformat ("touch %1/EULA.txt", tmpdir));
if (FileUtils::Exists ("/usr/bin/packages2eula.pl"))
{
SCR::Execute (.target.bash_output, sformat(
"/usr/bin/packages2eula.pl -p %1/packages.en -o %2/EULA.txt 2>/dev/null"
- , full_descr_path, tmpdir));
+ , descr_path, tmpdir));
}
if (FileUtils::GetSize (tmpdir + "/EULA.txt") > 0)
SCR::Execute (.target.bash, sformat ("cp %1/EULA.txt %2/", tmpdir,
- base_output_path));
+ base_path));
return ret;
}
/**
* Write all files with patterns definitions
- * TODO use agent...
+ * @path descr_path full path to directory with package descriptions (DESCRDIR)
+ * @param base_path path to base output directory
*/
-global boolean WritePatterns (string base_path) {
+global boolean WritePatterns (string descr_path, string base_path) {
- if (!FileUtils::Exists (base_path)) return false;
+ if (!FileUtils::Exists (base_path) || !FileUtils::Exists (descr_path))
+ {
+ y2warning ("%1 or %2 directory not available...",base_path, descr_path);
+ return false;
+ }
boolean ret = true;
list<string> names = [];
@@ -1479,10 +1542,10 @@
file = file + sformat ("+%1:\n%2\n-%1:\n", key, val);
}
});
- SCR::Write (.target.string, full_descr_path + "/" + filename, file);
+ SCR::Write (.target.string, descr_path + "/" + filename, file);
});
if (names != [])
- ret = SCR::Write (.target.string, full_descr_path + "/patterns",
+ ret = SCR::Write (.target.string, descr_path + "/patterns",
mergestring (names, "\n"));
return ret;
}
@@ -1701,6 +1764,18 @@
SCR::Execute (.target.bash, command, $["LANG" : "C"]);
});
+ // sha1sums of the rest of interesting files
+ foreach (string file, [ "installation.xml", "license.tar.gz", "media.1/info.txt"],
+ {
+ if (FileUtils::Exists (base_path + "/" + file))
+ {
+ out = (map) SCR::Execute (.target.bash_output,
+ sformat ("cd '%1' && sha1sum -- %2", base_path, String::Quote (file)), $["LANG" : "C"]);
+ string command = sformat ("echo 'HASH SHA1 %1' >> '%2/content'",
+ deletechars (out["stdout"]:"", "\n"), base_path);
+ SCR::Execute (.target.bash, command, $["LANG" : "C"]);
+ }
+ });
return true;
}
@@ -1744,7 +1819,6 @@
deletechars (out["stdout"]:"", "\n"), base_path);
SCR::Execute (.target.bash, command, $["LANG" : "C"]);
});
-
// sign the packages
if (resign_packages)
{
@@ -1939,12 +2013,12 @@
WriteMediaFiles (base_output_path, media_files, nextmedia);
- if (info != "")
+ if (info != "" && info != nil)
SCR::Write (.target.string, full_media_paths[0]:"" + "/info.txt", info);
Progress::NextStage();
- WritePatterns (base_output_path);
+ WritePatterns (full_descr_path, base_output_path);
Progress::NextStage();
@@ -1952,7 +2026,7 @@
WritePackageDescriptions (full_descr_path, packages_descr);
- WriteLicensesFiles (full_media_paths[0]:"", license_files);
+ WriteLicensesFiles (full_descr_path, base_output_path, license_files);
WriteWorkflow (base_output_path, workflow_path, y2update_packages, y2update_path);
Modified: trunk/add-on-creator/src/add-on-creator.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/add-on-creator.ycp?rev=40167&r1=40166&r2=40167&view=diff
==============================================================================
--- trunk/add-on-creator/src/add-on-creator.ycp (original)
+++ trunk/add-on-creator/src/add-on-creator.ycp Fri Aug 10 12:56:18 2007
@@ -50,12 +50,12 @@
void ReportMissingFile (string file) {
// error message, %1 is path
- Report::Error (sformat (_("File %1 does not exists"), file));
+ Report::Error (sformat (_("File %1 does not exist."), file));
}
void ReportMissingDir (string dir) {
// error message, %1 is path
- Report::Error (sformat (_("Directory %1 does not exists"), dir));
+ Report::Error (sformat (_("Directory %1 does not exist."), dir));
}
// helper for parsing command line data regarding iso creation
@@ -188,19 +188,55 @@
}
ParseISOData (options);
- if (haskey (options, "license"))
+ if (haskey (options, "info"))
{
- string file = options["license"]:"";
- if (!FileUtils::Exists ("/usr/bin/unzip"))
+ string file = options["info"]:"";
+ if (FileUtils::Exists (file))
{
- // error message, missing tool
- Report::Error (_("/usr/bin/unzip does not exists"));
+ string info = (string) SCR::Read (.target.string, file);
+ if (info != nil)
+ AddOnCreator::info = info;
}
- else if (FileUtils::Exists (file))
+ else
+ ReportMissingFile (file);
+ }
+ if (haskey (options, "extra_prov"))
+ {
+ string file = options["extra_prov"]:"";
+ if (FileUtils::Exists (file))
{
+ string extra = (string) SCR::Read (.target.string, file);
+ if (extra != nil)
+ AddOnCreator::extra_prov = extra;
+ }
+ else
+ ReportMissingFile (file);
+ }
+ if (haskey (options, "license"))
+ {
+ string file = options["license"]:"";
+ if (FileUtils::Exists (file))
+ {
+ integer pos = findlastof (file, ".");
string tmpdir = Directory::tmpdir;
- SCR::Execute (.target.bash_output,
- sformat ("/usr/bin/unzip -o %1 -d %2", file, tmpdir));
+ if (substring (file, pos) == ".zip")
+ {
+ if (!FileUtils::Exists ("/usr/bin/unzip"))
+ {
+ // error message, missing tool
+ Report::Error (_("/usr/bin/unzip does not exists"));
+ }
+ else
+ {
+ SCR::Execute (.target.bash_output,
+ sformat ("/usr/bin/unzip -o %1 -d %2", file, tmpdir));
+ }
+ }
+ else // let's try to unzip without checking file name and type...
+ {
+ SCR::Execute (.target.bash_output,
+ sformat ("/bin/tar -zxf %1 -C %2", file, tmpdir));
+ }
map out = (map) SCR::Execute (.target.bash_output,
sformat ("ls -A1 %1/license*.txt 2>/dev/null", tmpdir));
foreach (string f, splitstring(out["stdout"]:"", "\n"), {
@@ -452,7 +488,17 @@
],
"license" : $[
// command line help text for 'license' option
- "help" : _("Path to file with license texts (license.zip)"),
+ "help" : _("Path to file with license texts (license.zip or license.tar.gz)"),
+ "type" : "string",
+ ],
+ "info" : $[
+ // command line help text for 'info' option
+ "help" : _("Path to file with 'info' text (media.1/info.txt)"),
+ "type" : "string",
+ ],
+ "extra_prov" : $[
+ // command line help text for 'extra_prov' option
+ "help" : _("Path to file with additional dependencies (EXTRA_PROV)"),
"type" : "string",
],
"addon_dir" : $[
@@ -466,14 +512,14 @@
"patterns_dir", "output_dir", "create_iso", "iso_name", "gpg_key",
"passphrase", "passphrase_file", "workflow", "y2update",
"y2update_packages_dir", "license", "do_not_sign", "iso_output_dir",
- "resign_packages",
+ "resign_packages", "info", "extra_prov"
],
"clone" : [ "existing", "generate_descriptions", "content",
"package_descriptions_dir", "patterns_dir", "output_dir",
"create_iso", "iso_name",
"gpg_key", "passphrase", "passphrase_file", "workflow", "y2update",
"y2update_packages_dir", "license", "do_not_sign", "iso_output_dir",
- "resign_packages",
+ "resign_packages", "info", "extra_prov",
],
"sign" : [ "addon_dir", "gpg_key", "passphrase",
"passphrase_file", "create_iso", "iso_name", "iso_output_dir",
Modified: trunk/add-on-creator/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/complex.ycp?rev=40167&r1=40166&r2=40167&view=diff
==============================================================================
--- trunk/add-on-creator/src/complex.ycp (original)
+++ trunk/add-on-creator/src/complex.ycp Fri Aug 10 12:56:18 2007
@@ -1082,7 +1082,7 @@
// table header
_("Package")), []
),
- `VSpacing (0.5),
+ `VSpacing (0.4),
`Table (`id(`description), `opt(`notify), `header(
// table header 1/2
_("Attribute"),
@@ -1095,7 +1095,15 @@
`PushButton (`id(`edit), `opt(`key_F7), Label::EditButton ()),
`HStretch ()
),
- `VSpacing (0.5)
+ `VSpacing (0.4),
+ `HBox (
+ // textentry label
+ `TextEntry (`id (`extra_prov), _("Location of the File with Additional &Dependencies"), AddOnCreator::extra_prov_file),
+ `VBox (
+ `Label (""),
+ `PushButton (`id (`browse), Label::BrowseButton ())
+ )
+ )
), `HSpacing ());
Wizard::SetContentsButtons(caption, contents, HELPS["packages"]:"",
@@ -1241,8 +1249,29 @@
}
UI::SetFocus (`id(`description));
}
+ else if (ret == `browse)
+ {
+ string file = UI::AskForExistingFile (
+ AddOnCreator::rpm_path, "",
+ // popup for file selection dialog
+ _("Choose the Path to EXTRA_PROV File")
+ );
+ if (file != nil)
+ UI::ChangeWidget (`id (`extra_prov), `Value, file);
+ }
else if(ret == `next) {
AddOnCreator::packages_descr = descr;
+ string extra = (string) UI::QueryWidget (`id (`extra_prov), `Value);
+ if (extra != "" && !FileUtils::Exists (extra))
+ {
+ // error popup
+ Report::Error (sformat(_("The file '%1' does not exist.
+Choose another one."), extra));
+ UI::SetFocus (`id (`extra_prov));
+ continue;
+ }
+ else
+ AddOnCreator::extra_prov_file = extra;
break;
}
else if (ret == `back) {
Modified: trunk/add-on-creator/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on-creator/src/helps.ycp?rev=40167&r1=40166&r2=40167&view=diff
==============================================================================
--- trunk/add-on-creator/src/helps.ycp (original)
+++ trunk/add-on-creator/src/helps.ycp Fri Aug 10 12:56:18 2007
@@ -95,7 +95,10 @@
_("<p>Use <b>Add Language</b> to add a description file for a new language. The list of available languages is read from the <b>LINGUAS</b> value of the <tt>content</tt> file. Import an existing file with package descriptions with <b>Import</b>. Delete the description file with <b>Delete</b>.</p>") +
// help text for package description files, cont.
- _("<p>Use <b>Add</b> and <b>Edit</b> in the second table to modify description entries for the selected package.</p>"),
+ _("<p>Use <b>Add</b> and <b>Edit</b> in the second table to modify description entries for the selected package.</p>") +
+
+ // help text for package description files, cont.
+ _("<p>Optionally, choose the path for the file providing <b>Additional Package Dependencies</b> (EXTRA_PROV).</p>"),
// help text for patterns
"patterns" : _("<p>Here, create and edit the patterns for the add-on product.</p>") +
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org