use long RPM fields

This commit is contained in:
Jörg Prante 2023-09-28 22:22:28 +02:00
parent d0bbd3b1a9
commit ae06711ddc
4 changed files with 17 additions and 12 deletions

View file

@ -1,5 +1,5 @@
group = org.xbib
name = rpm
version = 3.0.1
version = 3.0.2
org.gradle.warning.mode = ALL

View file

@ -1152,22 +1152,27 @@ public class RpmBuilder {
format.getHeader().createEntry(HeaderTag.REQUIRENAME, getStringList(requires));
format.getHeader().createEntry(HeaderTag.REQUIREVERSION, getVersions(requires));
format.getHeader().createEntry(HeaderTag.REQUIREFLAGS, getFlags(requires));
if (obsoletes.size() > 0) {
if (!obsoletes.isEmpty()) {
format.getHeader().createEntry(HeaderTag.OBSOLETENAME, getStringList(obsoletes));
format.getHeader().createEntry(HeaderTag.OBSOLETEVERSION, getVersions(obsoletes));
format.getHeader().createEntry(HeaderTag.OBSOLETEFLAGS, getFlags(obsoletes));
}
if (conflicts.size() > 0) {
if (!conflicts.isEmpty()) {
format.getHeader().createEntry(HeaderTag.CONFLICTNAME, getStringList(conflicts));
format.getHeader().createEntry(HeaderTag.CONFLICTVERSION, getVersions(conflicts));
format.getHeader().createEntry(HeaderTag.CONFLICTFLAGS, getFlags(conflicts));
}
if (provides.size() > 0) {
if (!provides.isEmpty()) {
format.getHeader().createEntry(HeaderTag.PROVIDENAME, getStringList(provides));
format.getHeader().createEntry(HeaderTag.PROVIDEVERSION, getVersions(provides));
format.getHeader().createEntry(HeaderTag.PROVIDEFLAGS, getFlags(provides));
}
format.getHeader().createEntry(HeaderTag.SIZE, contents.getTotalSize());
long totalSize = contents.getTotalSize();
if (totalSize == (int) totalSize) {
format.getHeader().createEntry(HeaderTag.SIZE, (int) totalSize);
} else {
format.getHeader().createEntry(HeaderTag.LONGSIZE, totalSize);
}
if (contents.size() > 0) {
format.getHeader().createEntry(HeaderTag.DIRNAMES, contents.getDirNames());
format.getHeader().createEntry(HeaderTag.DIRINDEXES, contents.getDirIndexes());

View file

@ -1,10 +1,9 @@
package org.xbib.rpm.header;
/**
*
*/
public enum HeaderTag implements EntryType {
SIGNATURES(62, INT32_ENTRY, IntegerList.class, "_signatures"),
IMMUTABLE(63, INT32_ENTRY, IntegerList.class, "_immutable"),
NAME(1000, STRING_ENTRY, String.class, "name"),
VERSION(1001, STRING_ENTRY, String.class, "version"),
RELEASE(1002, STRING_ENTRY, String.class, "release"),
@ -95,10 +94,11 @@ public enum HeaderTag implements EntryType {
OBSOLETEFLAGS(1114, INT32_ENTRY, IntegerList.class, "obsoleteflags"),
OBSOLETEVERSION(1115, STRING_LIST_ENTRY, StringList.class, "obsoleteversion"),
FILEDIGESTALGOS(1177, INT32_ENTRY, IntegerList.class, "filedigestalgos"),
SIGNATURES(0x0000003e, INT32_ENTRY, IntegerList.class, "_signatures"),
IMMUTABLE(0x0000003f, INT32_ENTRY, IntegerList.class, "_immutable"),
DISTURL( 1123, STRING_ENTRY, String.class,"disturl"),
DISTTAG( 1155, STRING_ENTRY, String.class,"disttag"),
ORIGFILENAMES(5007, STRING_ENTRY, String.class, "origfilenames"),
LONGFILESIZES(5008, INT64_ENTRY, LongList.class, "longfilesizes"),
LONGSIZE(5009, INT64_ENTRY, LongList.class, "longsize"),
BUGURL( 5012, STRING_ENTRY, String.class,"bugurl"),
ENCODING( 5062, STRING_ENTRY, String.class,"encoding"),
PAYLOADDIGEST( 5092, STRING_LIST_ENTRY, StringList.class,"payloaddigest"),

View file

@ -352,8 +352,8 @@ public class Contents {
*
* @return the size of all files included in the archive
*/
public int getTotalSize() {
int total = 0;
public long getTotalSize() {
long total = 0;
try {
for (Object object : sources.values()) {
if (object instanceof Path) {