From 24c90a358706acefdd538fb86efbd0e4b0712929 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 19 Jul 2018 19:32:58 +0300 Subject: [PATCH] dist: redhat: fix up bad file ownership of rpms/srpms mock outputs files owned by root. This causes attempts by scripts that want to junk the working directory (typically continuous integration) to fail on permission errors. Fixup those permissions after the fact. Message-Id: <20180719163258.4393-1-avi@scylladb.com> (cherry picked from commit b4d983b45abd1f3dc4bb00b684e2fb9a52047385) --- dist/redhat/build_rpm.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dist/redhat/build_rpm.sh b/dist/redhat/build_rpm.sh index 5df7607..6135f08 100755 --- a/dist/redhat/build_rpm.sh +++ b/dist/redhat/build_rpm.sh @@ -76,5 +76,12 @@ SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE) git archive --format=tar --prefix=scylla-jmx-$SCYLLA_VERSION/ HEAD -o build/scylla-jmx-$VERSION.tar pystache dist/redhat/scylla-jmx.spec.mustache "{ \"version\": \"$SCYLLA_VERSION\", \"release\": \"$SCYLLA_RELEASE\" }" > build/scylla-jmx.spec +# mock generates files owned by root, fix this up +fix_ownership() { + sudo chown "$(id -u):$(id -g)" -R "$@" +} + sudo mock --buildsrpm --root=$TARGET --resultdir=`pwd`/build/srpms --spec=build/scylla-jmx.spec --sources=build/scylla-jmx-$VERSION.tar +fix_ownership build/srpms sudo mock --rebuild --root=$TARGET --resultdir=`pwd`/build/rpms build/srpms/scylla-jmx-$VERSION*.src.rpm +fix_ownership build/rpms