From patchwork Fri Feb 15 20:06:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10815797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2ECA4922 for ; Fri, 15 Feb 2019 20:06:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 194BB2FB88 for ; Fri, 15 Feb 2019 20:06:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A5F42FF21; Fri, 15 Feb 2019 20:06:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 996052FB88 for ; Fri, 15 Feb 2019 20:06:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 562DB208AE3FB; Fri, 15 Feb 2019 12:06:24 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=ira.weiny@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A3422201B0459 for ; Fri, 15 Feb 2019 12:06:22 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Feb 2019 12:06:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,373,1544515200"; d="scan'208";a="133918583" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by FMSMGA003.fm.intel.com with ESMTP; 15 Feb 2019 12:06:22 -0800 From: ira.weiny@intel.com To: linux-nvdimm@lists.01.org, vishal.l.verma@intel.com Subject: [PATCH V2] ndctl: Generalized make-git-snapshot.sh Date: Fri, 15 Feb 2019 12:06:14 -0800 Message-Id: <20190215200614.30004-1-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190215192117.28605-1-ira.weiny@intel.com> References: <20190215192117.28605-1-ira.weiny@intel.com> MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP From: Ira Weiny make-git-snapshot.sh made an assumption of the git tree location. Furthermore, it assumed the user has an rpmbuild environment directory structure set up. Enhance the script to figure out where in what location it has been cloned and setup the rpmbuild tree if the user does not already have it. Signed-off-by: Ira Weiny --- Changes since V1 use rpmdev-setuptree make-git-snapshot.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/make-git-snapshot.sh b/make-git-snapshot.sh index 142419d623fe..513086b1f93d 100755 --- a/make-git-snapshot.sh +++ b/make-git-snapshot.sh @@ -2,10 +2,18 @@ set -e NAME=ndctl -REFDIR="$HOME/git/ndctl" # for faster cloning, if available + +pushd `dirname $0` +REFDIR=`pwd` +popd + UPSTREAM=$REFDIR #TODO update once we have a public upstream OUTDIR=$HOME/rpmbuild/SOURCES +if [ ! -d $OUTDIR ]; then + rpmdev-setuptree +fi + [ -n "$1" ] && HEAD="$1" || HEAD="HEAD" WORKDIR="$(mktemp -d --tmpdir "$NAME.XXXXXXXXXX")" @@ -14,7 +22,7 @@ trap 'rm -rf $WORKDIR' exit [ -d "$REFDIR" ] && REFERENCE="--reference $REFDIR" git clone $REFERENCE "$UPSTREAM" "$WORKDIR" -VERSION=$(./git-version) +VERSION=$($REFDIR/git-version) DIRNAME="ndctl-${VERSION}" git archive --remote="$WORKDIR" --format=tar --prefix="$DIRNAME/" HEAD | gzip > $OUTDIR/"ndctl-${VERSION}.tar.gz"