Skip to content

Commit

Permalink
Merge pull request #87 from yakhatape/add_filedevice_flags_RPM
Browse files Browse the repository at this point in the history
add: tags tagFileDevices - 1095
  • Loading branch information
jarondl authored Apr 13, 2024
2 parents c2247cb + 0ba6556 commit 60c43da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ func (r *RPM) writeFileIndexes(h *index) {
h.Add(tagFileFlags, EntryUint32(r.fileflags))

inodes := make([]int32, len(r.dirindexes))
devices := make([]int32, len(r.dirindexes))
digestAlgo := make([]int32, len(r.dirindexes))
verifyFlags := make([]int32, len(r.dirindexes))
fileRDevs := make([]int16, len(r.dirindexes))
Expand All @@ -479,12 +480,16 @@ func (r *RPM) writeFileIndexes(h *index) {
for ii := range inodes {
// is inodes just a range from 1..len(dirindexes)? maybe different with hard links
inodes[ii] = int32(ii + 1)
// is devices number from which the file was copied
// from rpm original tools https://github.com/rpm-software-management/rpm/blob/c167ef8bdaecdd2e306ec896c919607ba9cceb6f/build/files.c#L1226
devices[ii] = int32(1)
digestAlgo[ii] = hashAlgoSHA256
// With regular files, it seems like we can always enable all of the verify flags
verifyFlags[ii] = int32(-1)
fileRDevs[ii] = int16(1)
}
h.Add(tagFileINodes, EntryInt32(inodes))
h.Add(tagFileDevices, EntryInt32(devices))
h.Add(tagFileDigestAlgo, EntryInt32(digestAlgo))
h.Add(tagFileVerifyFlags, EntryInt32(verifyFlags))
h.Add(tagFileRDevs, EntryInt16(fileRDevs))
Expand Down
1 change: 1 addition & 0 deletions tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const (
tagPreunProg = 0x043f // 1087
tagPostunProg = 0x0440 // 1088
tagObsoletes = 0x0442 // 1090
tagFileDevices = 0x0447 // 1095
tagVerifyScriptProg = 0x0443 // 1091
tagFileINodes = 0x0448 // 1096
tagFileLangs = 0x0449 // 1097
Expand Down

0 comments on commit 60c43da

Please sign in to comment.