def calc_cookie_fp(f)
chksum = Solv::Chksum.new(Solv::REPOKEY_TYPE_SHA256)
+ chksum.add("1.1")
chksum.add_fp(f)
return chksum.raw
end
return chksum.raw
end
+ def calc_cookie_ext(f, cookie)
+ chksum = Solv::Chksum.new(Solv::REPOKEY_TYPE_SHA256)
+ chksum.add("1.1")
+ chksum.add(cookie)
+ chksum.add_fstat(f.fileno) if f
+ extcookie = chksum.raw()
+ extcookie[0] = 1 if extcookie[0] == 0
+ return extcookie
+ end
+
def cachepath(ext = nil)
path = @name.sub(/^\./, '_')
path += ext ? "_#{ext}.solvx" : '.solv'
return true
end
- def genextcookie(f)
- chksum = Solv::Chksum.new(Solv::REPOKEY_TYPE_SHA256)
- chksum.add(@cookie)
- if f
- s = f.stat()
- chksum.add(s.dev.to_s)
- chksum.add(s.ino.to_s)
- chksum.add(s.size.to_s)
- chksum.add(s.mtime.to_s)
- end
- @extcookie = chksum.raw()
- @extcookie[0] = 1 if @extcookie[0] == 0
- end
-
def writecachedrepo(ext, info = nil)
begin
Dir::mkdir("/var/cache/solv", 0755) unless FileTest.directory?("/var/cache/solv")
Solv::xfclose(sf)
f.sysseek(0, IO::SEEK_END)
if @type != 'system' && !ext
- genextcookie(f) unless @extcookie
+ @extcookie = calc_cookie_ext(f, @cookie) unless @extcookie
f.syswrite(@extcookie)
end
f.syswrite(ext ? @extcookie : @cookie)