lib/gem2rpm.rb in gem2rpm-0.8.1 vs lib/gem2rpm.rb in gem2rpm-0.8.2
- old
+ new
@@ -13,11 +13,11 @@
if HAS_REMOTE_INSTALLER
require 'rubygems/remote_installer'
end
module Gem2Rpm
- Gem2Rpm::VERSION = "0.8.1"
+ Gem2Rpm::VERSION = "0.8.2"
if HAS_REMOTE_INSTALLER
def self.find_download_url(name, version)
installer = Gem::RemoteInstaller.new
dummy, download_path = installer.find_gem_to_install(name, "=#{version}")
@@ -56,17 +56,18 @@
# Returns the email address of the packager (i.e., the person running
# gem2spec). Taken from RPM macros if present, constructed from system
# username and hostname otherwise.
def Gem2Rpm.packager()
- packager = `rpmdev-packager`.chomp
+ packager = `rpmdev-packager`.chomp rescue ''
if packager.empty?
- packager = `rpm --eval '%{packager}'`.chomp
+ packager = `rpm --eval '%{packager}'`.chomp rescue ''
end
if packager.empty? or packager == '%{packager}'
- packager = "#{Etc::getpwnam(Etc::getlogin).gecos} <#{Etc::getlogin}@#{Socket::gethostname}>"
+ passwd_entry = Etc::getpwnam(Etc::getlogin)
+ packager = "#{(passwd_entry && passwd_entry.gecos) || Etc::getlogin } <#{Etc::getlogin}@#{Socket::gethostname}>"
end
packager
end