linux-stable/tools
Will Chandler 81935f10e6 perf tools: Fix empty version number when building outside of a git repo
When perf is built in a full source tree that is not a git repository,
e.g. from a kernel source tarball, `perf version` will print empty tag
and commit strings:

  $ perf version
  perf version

Currently the tag version is only generated from the root Makefile when
building in a git repository. If PERF-VERSION-FILE has not been
generated and the source tree is not in a git repository, then
PERF-VERSION-GEN will return an empty version.

The problem can be reproduced with the following steps:

  $ wget https://git.kernel.org/torvalds/t/linux-6.0-rc7.tar.gz
  $ tar -xf linux-6.0-rc7.tar.gz && cd linux-6.0-rc7
  $ make -C tools/perf
  $ tools/perf/perf -v
  perf version

Builds from tarballs generated with `make perf-tar-src-pkg` are not
impacted by this issue as PERF-VERSION-FILE is included in the archive.

The perf RPM provided by Fedora for 5.18+ is experiencing this problem.
Package build logs[0] show that the build is attempting to fall back on
PERF-VERSION-FILE, but it is not present.

To resolve this, revert back to the previous logic of using the kernel
Makefile version if not in a git repository and PERF-VERSION-FILE does
not exist.

[0] https://kojipkgs.fedoraproject.org/packages/kernel-tools/5.19.4/200.fc36/data/logs/x86_64/build.log

Fixes: 7572733b84 ("perf tools: Fix version kernel tag")
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Will Chandler <wfc@wfchandler.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220930151157.529674-1-wfc@wfchandler.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-10-06 08:03:52 -03:00
..
accounting
arch tools headers cpufeatures: Sync with the kernel sources 2022-09-21 16:08:00 -03:00
bootconfig
bpf bpftool: Complete libbfd feature detection 2022-08-10 10:44:01 -03:00
build tools build: Display logical OR of a feature flavors 2022-10-04 08:55:19 -03:00
certs
cgroup
counter
debugging tools: Add new "test" taint to kernel-chktaint 2022-09-07 14:51:12 -06:00
edid
firewire
firmware
gpio
hv tools: hv: kvp: remove unnecessary (void*) conversions 2022-09-05 16:55:20 +00:00
iio
include perf branch: Add PERF_BR_NEW_ARCH_[N] map for BRBE on arm64 platform 2022-10-04 08:55:20 -03:00
io_uring
kvm/kvm_stat
laptop
leds
lib perf subcmd: Set environment variable "PREFIX" 2022-10-04 08:55:23 -03:00
memory-model tools/memory-model: Clarify LKMM's limitations in litmus-tests.txt 2022-08-31 05:15:31 -07:00
objtool objtool: Disable CFI warnings 2022-09-26 10:13:15 -07:00
pci
pcmcia
perf perf tools: Fix empty version number when building outside of a git repo 2022-10-06 08:03:52 -03:00
power ACPI: tools: pfrut: Do not initialize ret in main() 2022-09-03 20:36:02 +02:00
rcu
scripts
spi
testing lsm/stable-6.1 PR 20221003 2022-10-03 17:51:52 -07:00
thermal tools/thermal: Fix possible path truncations 2022-08-03 19:28:46 +02:00
time
tracing rtla: Consolidate and show all necessary libraries that failed for building 2022-08-10 12:03:02 -04:00
usb
verification rv/monitor: Add the wwnr monitor 2022-07-30 14:01:30 -04:00
virtio virtio_test: fixup for vq reset 2022-09-27 18:30:49 -04:00
vm - The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe 2022-08-05 16:32:45 -07:00
wmi
Makefile