Skip to content

Commit c2eb1dd

Browse files
committed
Print shortened ftype in package color listing
When listing the offending files, also show the file type, it may be handy. Trim it after the first space char but keep at least 10 chars, that should suffice as a hint to the user, and conveniently covers the ELF binary types (see the updated test).
1 parent 89c991c commit c2eb1dd

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

build/rpmfc.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,12 +1640,19 @@ rpmRC rpmfcApply(rpmfc fc)
16401640
return rc;
16411641
}
16421642

1643+
static string rpmfcPrettyFType(rpmfc fc, unsigned ix)
1644+
{
1645+
string ftype = fc->ftype[ix];
1646+
size_t len = ftype.find(' ', 10);
1647+
return ftype.substr(0, len);
1648+
}
1649+
16431650
static rpmRC rpmfcCheckPackageColor(rpmfc fc)
16441651
{
16451652
Package pkg = fc->pkg;
16461653
const char *a = headerGetString(pkg->header, RPMTAG_ARCH);
16471654
char *nvr;
1648-
string msg, bins;
1655+
string msg, type, bins;
16491656
unsigned ix;
16501657
int header_color = headerGetNumber(pkg->header, RPMTAG_HEADERCOLOR);
16511658
int arch_color = rpmGetArchColor(a);
@@ -1671,7 +1678,10 @@ static rpmRC rpmfcCheckPackageColor(rpmfc fc)
16711678
int color = fc->fcolor[ix];
16721679
if (!color || color == arch_color)
16731680
continue;
1681+
type = rpmfcPrettyFType(fc, ix);
16741682
bins += string(4, ' ') + fc->fn[ix].substr(fc->buildRoot.size());
1683+
if (!type.empty())
1684+
bins += " (" + type + ")";
16751685
bins += '\n';
16761686
}
16771687

tests/rpmbuild.at

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4110,8 +4110,8 @@ runroot rpmbuild -bb --quiet --target noarch /data/SPECS/hello2.spec
41104110
[1],
41114111
[],
41124112
[error: Arch dependent binaries in noarch package (hello2-1.0-1.noarch):
4113-
/usr/local/bin/hello
4114-
/usr/local/bin/hello2
4113+
/usr/local/bin/hello (ELF 64-bit)
4114+
/usr/local/bin/hello2 (ELF 64-bit)
41154115
])
41164116
RPMTEST_CLEANUP
41174117

@@ -4126,6 +4126,6 @@ runroot rpmbuild -bb --quiet --target x86_64 --with hello32 \
41264126
[0],
41274127
[],
41284128
[warning: Binaries not matching package arch (hello-1.0-1.x86_64):
4129-
/usr/local/bin/hello
4129+
/usr/local/bin/hello (ELF 32-bit)
41304130
])
41314131
RPMTEST_CLEANUP

0 commit comments

Comments
 (0)