aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--genhdlist236
2 files changed, 36 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index ad45760..7669ae2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
- genhdlist2:
+ o with --versioned, create "versioned" metadata
o add xml header to xml files generated
- gendistrib:
o if "xml-info" is set in media.cfg, pass --xml-info to genhdlist2
diff --git a/genhdlist2 b/genhdlist2
index 98e20e5..1d78a94 100644
--- a/genhdlist2
+++ b/genhdlist2
@@ -14,7 +14,7 @@ sub usage () {
}
sub main() {
- my %options = (xml_info => 'auto');
+ my %options = (xml_info => 'auto', versioned => 'auto');
GetOptions(
'clean' => \$options{no_incremental},
@@ -27,6 +27,7 @@ sub main() {
'allow-empty-media' => \$options{allow_empty_media},
'file-deps=s' => \$options{file_deps},
'xml-info!' => \$options{xml_info},
+ 'versioned!' => \$options{versioned},
'media_info-dir=s' => \$options{media_info_dir},
'h|help' => sub { usage(); exit 0 },
'q|quiet' => sub { $options{verbose} = -1 },
@@ -107,6 +108,10 @@ sub do_it {
print "replacing $media_info_dir/$name with $name.tmp\n" if $verbose >= 0;
rename "$media_info_dir/$name.tmp", "$media_info_dir/$name" or die "rename $media_info_dir/$name failed: $!\n";
}
+ my $existed = remove_versioned_media_info($media_info_dir);
+ if ($options{versioned} && ($options{versioned} ne 'auto' || $existed)) {
+ push @media_info_files, generate_versioned_media_info($media_info_dir, \@media_info_files);
+ }
generate_md5sum($media_info_dir, \@media_info_files) if !$options{no_md5sum};
}
}
@@ -342,6 +347,31 @@ sub build_synthesis {
}
}
+sub remove_versioned_media_info {
+ my ($media_info_dir) = @_;
+
+ my @l = grep { /^\d{8}-\d{6}-/ && -l "$media_info_dir/$_" } all($media_info_dir) or return;
+
+ foreach (@l) {
+ print "removing previous versioned $_\n" if $verbose > 0;
+ unlink "$media_info_dir/$_";
+ }
+ 1;
+}
+
+sub generate_versioned_media_info {
+ my ($media_info_dir, $media_info_files) = @_;
+
+ require POSIX;
+ my $version = POSIX::strftime("%Y%m%d-%H%M%S", gmtime);
+
+ map {
+ print "creating versioned media_info $_: $version-$_\n" if $verbose > 0;
+ symlink $_, "$media_info_dir/$version-$_";
+ "$version-$_";
+ } @$media_info_files;
+}
+
sub generate_md5sum {
my ($media_info_dir, $media_info_files) = @_;
print "updating $media_info_dir/MD5SUM\n" if $verbose >= 0;
@@ -535,6 +565,10 @@ Write hdlist/synthesis in this directory instead of <dir>/media_info
Force to generate xml info. By default genhdlist2 will only regenerate xml info files already there in media_info/
+=item B<--versioned>
+
+Force to generate versioned media info.
+
=item B<-v>
Be verbose. Use one more B<-v> to get even more verbose.