diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-09-23 09:15:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-09-23 09:15:59 +0000 |
commit | 408265f669cc0de04c60c4df85a6533387532ece (patch) | |
tree | 8f52fe1922a61f0514277cb6ae6395c444b80184 | |
parent | 9d96465d1a4bc510232598aa18beee6f57d8ad2e (diff) | |
download | rpmtools-408265f669cc0de04c60c4df85a6533387532ece.tar rpmtools-408265f669cc0de04c60c4df85a6533387532ece.tar.gz rpmtools-408265f669cc0de04c60c4df85a6533387532ece.tar.bz2 rpmtools-408265f669cc0de04c60c4df85a6533387532ece.tar.xz rpmtools-408265f669cc0de04c60c4df85a6533387532ece.zip |
- genhdlist2:
o with --versioned, create "versioned" metadata
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | genhdlist2 | 36 |
2 files changed, 36 insertions, 1 deletions
@@ -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 @@ -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. |