[Xfce4-commits] <moka:master> Refactor checksum generation. Generate checkum files for fat tarballs.
Jannis Pohlmann
noreply at xfce.org
Thu Jan 13 21:22:01 CET 2011
Updating branch refs/heads/master
to a82cd678753d990b0f780ce19f24d1389d909bad (commit)
from b9b55d7715857bc6759c451bd15ce6f05a72ebbb (commit)
commit a82cd678753d990b0f780ce19f24d1389d909bad
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Thu Jan 13 21:20:29 2011 +0100
Refactor checksum generation. Generate checkum files for fat tarballs.
lib/models/archive.rb | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/lib/models/archive.rb b/lib/models/archive.rb
index 368ed43..63cde1a 100755
--- a/lib/models/archive.rb
+++ b/lib/models/archive.rb
@@ -132,7 +132,9 @@ module Moka
File.makedirs(target_dir) unless File.directory?(target_dir)
File.delete(fat_tarball) if File.file?(fat_tarball)
- system("cd #{release_dir} && flock --timeout=5 #{fat_tarball} tar cjf #{fat_tarball} #{source_dir}")
+ if system("cd #{release_dir} && flock --timeout=5 #{fat_tarball} tar cjf #{fat_tarball} #{source_dir}")
+ update_tarball_checksums(fat_tarball)
+ end
end
end
@@ -225,26 +227,32 @@ module Moka
File.move(source_file, target_file)
File.chmod(0664, target_file)
end
+
+ update_tarball_checksums(target_file)
+
+ project_branch_update(branch)
+ end
+
+ def update_tarball_checksums(tarball)
+ basename = File.basename(tarball)
- open("#{target_file}.md5", File::CREAT|File::TRUNC|File::RDWR) do |file|
+ open("#{tarball}.md5", File::CREAT|File::TRUNC|File::RDWR) do |file|
begin
file.flock(File::LOCK_EX)
- file.puts "#{Digest::MD5.file(target_file)} #{basename}"
+ file.puts "#{Digest::MD5.file(tarball)} #{basename}"
ensure
file.flock(File::LOCK_UN)
end
end
- open("#{target_file}.sha1", File::CREAT|File::TRUNC|File::RDWR) do |file|
+ open("#{tarball}.sha1", File::CREAT|File::TRUNC|File::RDWR) do |file|
begin
file.flock(File::LOCK_EX)
- file.puts "#{Digest::SHA1.file(target_file)} #{basename}"
+ file.puts "#{Digest::SHA1.file(tarball)} #{basename}"
ensure
file.flock(File::LOCK_UN)
end
end
-
- project_branch_update(branch)
end
def project_release_from_tarball(project, tarball)
More information about the Xfce4-commits
mailing list