OSDN Git Service

build: fix "make distcheck" failure
authorJim Meyering <meyering@redhat.com>
Mon, 9 Jan 2012 14:04:40 +0000 (15:04 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 9 Jan 2012 14:04:40 +0000 (15:04 +0100)
Ever since "make distcheck" began using sudo (i.e., running "make check"
as root, and then running it as non-root), the build-after-root would
often fail due to some derived files being owned by root.
This change adds a "chown -R $USER ." to restore order.
* Makefile.am (root-check): Run "chown -R $USER ." after sudo run.
(root_check): Rename variable from root-check, to avoid a warning
from automake about non-POSIX variable.

Makefile.am

index 39c1d01..ae252bd 100644 (file)
@@ -30,13 +30,13 @@ MAINTAINERCLEANFILES = parted.spec
 
 .PHONY: root-check
 root-check:
-       sudo $(MAKE) check
+       sudo sh -c '$(MAKE) check; t=$$?; chown -R $(USER) .; exit $$t'
 
 # Not everyone who runs "make distcheck" will want to or even
 # be able to run the root tests.  If you want to skip them,
 # run make like this: "make distcheck root-check="
-root-check ?= root-check
-distcheck-hook: $(root-check)
+root_check ?= root-check
+distcheck-hook: $(root_check)
        $(MAKE) my-distcheck
 
 ### ABI Checking scripts ###