summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/MDV/Distribconf.pm7
-rw-r--r--lib/MDV/Distribconf/Build.pm24
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/MDV/Distribconf.pm b/lib/MDV/Distribconf.pm
index 0eb5529..ce37230 100644
--- a/lib/MDV/Distribconf.pm
+++ b/lib/MDV/Distribconf.pm
@@ -440,11 +440,16 @@ sub getvalue {
$default =~ s![/ ]+!_!g;
last;
};
+ /^productid$/ and do {
+ return join(',', map { "$_=" . $distrib->getvalue(undef, $_, '') }
+ qw(vendor distribution type version branch release arch product));
+ };
/^path$/ and return $media;
/^root$/ and return $distrib->{root};
/^mediacfg_version$/ and
return $distrib->{cfg}->val('media_info', 'mediacfg_version') || 1;
/^VERSION$/ and do { $default = 'VERSION'; last };
+ /^product.id$/ and do { $default = 'product.id'; last };
/^product$/ and do { $default = 'Download'; last };
/^(MD5SUM|depslist.ordered|compss|provides)$/
and do { $default = $_; last };
@@ -467,7 +472,7 @@ sub getpath {
$distrib->mediaexists($media) or return;
$var ||= ""; # Avoid undef value
my $val = $distrib->getvalue($media, $var);
- $var =~ /^(?:root|VERSION|(?:media|info)dir)$/ and return $val;
+ $var =~ /^(?:root|VERSION|product\.id|(?:media|info)dir)$/ and return $val;
my $thispath = $var eq 'path' ? $distrib->{mediadir} : $distrib->{infodir};
if ($distrib->getvalue(undef, 'mediacfg_version') >= 2) {
return $thispath . '/' . $val;
diff --git a/lib/MDV/Distribconf/Build.pm b/lib/MDV/Distribconf/Build.pm
index 756ddb8..7983ca3 100644
--- a/lib/MDV/Distribconf/Build.pm
+++ b/lib/MDV/Distribconf/Build.pm
@@ -308,6 +308,30 @@ sub write_version {
return 1;
}
+=item $distrib->write_productid($productid)
+
+Write the productid file. Returns 0 on error, 1 on success.
+
+=cut
+
+sub write_productid {
+ my ($distrib, $productid) = @_;
+ my $h_productid;
+ if (ref($productid) eq 'GLOB') {
+ $h_productid = $productid;
+ } else {
+ $productid ||= $distrib->getfullpath(undef, 'product.id');
+ open($h_productid, ">", $productid) or return 0;
+ }
+
+ print $h_productid $distrib->getvalue(undef, 'productid') . "\n";
+
+ if (ref($productid) ne 'GLOB') {
+ close($h_productid);
+ }
+
+ return 1;
+}
1;