From patchwork Sat Sep 5 01:31:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7126911 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CA1B69F32B for ; Sat, 5 Sep 2015 01:37:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7470208AE for ; Sat, 5 Sep 2015 01:37:22 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id BC98F208A2 for ; Sat, 5 Sep 2015 01:37:21 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AE6F0182FAE; Fri, 4 Sep 2015 18:37:21 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ml01.01.org (Postfix) with ESMTP id 8C011182E35 for ; Fri, 4 Sep 2015 18:37:20 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 04 Sep 2015 18:37:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,471,1437462000"; d="scan'208";a="555636809" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.137]) by FMSMGA003.fm.intel.com with ESMTP; 04 Sep 2015 18:37:20 -0700 Subject: [PATCH 04/11] ndctl: update genspec to output per-distro flavored spec files From: Dan Williams To: linux-nvdimm@lists.01.org Date: Fri, 04 Sep 2015 21:31:38 -0400 Message-ID: <20150905013137.28464.90913.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20150905012538.28464.18136.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20150905012538.28464.18136.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-8-g92dd MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 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-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Red Hat environment prefers: ndctl, ndctl-libs, ndctl-devel The SUSE environment prefers: ndctl, libndctl3, libndctl-devel SUSE is more strict about the "License:" field. Finally, SUSE does not seem to ship a /usr/share/license directory, so suppress "%license" for SUSE. Signed-off-by: Dan Williams --- contrib/Makefile | 19 +++++++++++++------ contrib/genspec.c | 36 ++++++++++++++++++++++++++++++++---- contrib/ndctl.spec.in | 35 +++++++++++++++++++++-------------- contrib/rpmbuild.sh | 2 +- 4 files changed, 67 insertions(+), 25 deletions(-) diff --git a/contrib/Makefile b/contrib/Makefile index e5d786dfd914..958281765b9b 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -5,22 +5,29 @@ SRCS=genspec.c OBJS=$(SRCS:.c=.o) PROG=genspec SPEC_IN=ndctl.spec.in -SPEC=$(SPEC_IN:.in=) +RHEL_SPEC=rhel/$(SPEC_IN:.in=) +SLES_SPEC=sles/$(SPEC_IN:.in=) COMMIT_ID=git log --pretty=format:"%h" -n 1 -all: $(SPEC) +all: $(RHEL_SPEC) $(SLES_SPEC) -$(SPEC) : $(SPEC_IN) $(PROG) - cat $(SPEC_IN) | $(dir $(PROG))$(PROG) `$(COMMIT_ID)` > $@ +$(RHEL_SPEC) : $(SPEC_IN) $(PROG) + @mkdir -p rhel + cat $(SPEC_IN) | $(dir $(PROG))$(PROG) `$(COMMIT_ID)` rhel > $@ -$(PROG) : $(OBJS) +$(SLES_SPEC) : $(SPEC_IN) $(PROG) + @mkdir -p sles + cat $(SPEC_IN) | $(dir $(PROG))$(PROG) `$(COMMIT_ID)` sles > $@ + +$(PROG) : $(OBJS) Makefile $(CC) $(LDFLAGS) $(OBJS) -o $@ .c.o: $(CC) $(CFLAGS) $< -o $@ clean: - rm $(OBJS) $(PROG) $(SPEC) + rm $(OBJS) $(PROG) $(RHEL_SPEC) $(SLES_SPEC) + @rmdir rhel sles depend: .depend diff --git a/contrib/genspec.c b/contrib/genspec.c index 21d16b39ab0d..14f27c4b2224 100644 --- a/contrib/genspec.c +++ b/contrib/genspec.c @@ -2,22 +2,50 @@ #include #include "../config.h" +static char *lname[] = { + "ndctl-libs", "libndctl3", +}; + +static char *dname[] = { + "ndctl-devel", "libndctl-devel", +}; + +static int license[] = { + 1, 0, +}; + int main(int argc, char **argv) { + const char *commit = argv[1]; char buf[1024]; + int os; - if (argc != 2) { - fprintf(stderr, "commit id must be specified\n"); + if (argc != 3) { + fprintf(stderr, "commit id and OS must be specified\n"); return 1; } - while (fgets(buf, sizeof(buf), stdin)) + if (strcmp(argv[2], "rhel") == 0) + os = 0; + else if (strcmp(argv[2], "sles") == 0) + os = 1; + else + return 1; + + while (fgets(buf, sizeof(buf), stdin)) { if (strncmp("Version:", buf, 8) == 0) fprintf(stdout, "Version: %s\n", VERSION); else if (strncmp("%global gitcommit", buf, 17) == 0) - fprintf(stdout, "%%global gitcommit %s\n", argv[1]); + fprintf(stdout, "%%global gitcommit %s\n", commit); + else if (strncmp("%define lname", buf, 12) == 0) + fprintf(stdout, "%%define lname %s\n", lname[os]); + else if (strncmp("%define dname", buf, 12) == 0) + fprintf(stdout, "%%define dname %s\n", dname[os]); + else if (strncmp("%license", buf, 8) == 0 && !license[os]) + /* skip */; else fprintf(stdout, "%s", buf); + } return 0; } diff --git a/contrib/ndctl.spec.in b/contrib/ndctl.spec.in index cfe111525da4..9e64a44e97c6 100644 --- a/contrib/ndctl.spec.in +++ b/contrib/ndctl.spec.in @@ -1,10 +1,12 @@ %global gitcommit +%define lname +%define dname Name: ndctl Version: Release: 1%{?gitcommit:.git%{gitcommit}}%{?dist} Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory) -License: GPLv2 +License: GPL-2.0 URL: https://github.com/pmem/ndctl %if %{defined gitcommit} @@ -17,6 +19,7 @@ Source0: https://github.com/pmem/ndctl/archive/%{name}-%{version}.tar.gz BuildRequires: libtool BuildRequires: autoconf BuildRequires: automake +BuildRequires: pkgconfig BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(libkmod) @@ -28,21 +31,21 @@ platform NVDIMM resources like those defined by the ACPI 6.0 NFIT (NVDIMM Firmware Interface Table). -%package devel -Summary: Development files for %{name} -License: LGPLv2.1 and BSD and MIT -Requires: %{name}%{?_isa} = %{version}-%{release} +%package -n %dname +Summary: Development files for libndctl +License: LGPL-2.1+ +Requires: %{lname}%{?_isa} = %{version}-%{release} -%description devel +%description -n %dname The %{name}-devel package contains libraries and header files for developing applications that use %{name}. -%package libs -Summary: %{name} libraries -License: LGPLv2.1 and BSD and MIT +%package -n %lname +Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory) +License: LGPL-2.1+ -%description libs +%description -n %lname Libraries for %{name} @@ -63,21 +66,25 @@ make %{?_smp_mflags} find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' -%post libs -p /sbin/ldconfig +%post -n %lname -p /sbin/ldconfig -%postun libs -p /sbin/ldconfig +%postun -n %lname -p /sbin/ldconfig %files %license licenses/GPLv2 licenses/BSD-MIT licenses/CC0 %{_bindir}/ndctl -%files libs +%files -n %lname %doc README.md %license COPYING licenses/BSD-MIT licenses/CC0 %{_libdir}/libndctl.so.* -%files devel +%files -n %dname %license COPYING %{_includedir}/ndctl/ %{_libdir}/libndctl.so %{_libdir}/pkgconfig/libndctl.pc + +%changelog +* Mon Aug 03 2015 dan.j.williams@intel.com +- Initial rpm release diff --git a/contrib/rpmbuild.sh b/contrib/rpmbuild.sh index 8926bdefb86b..97def14bd965 100755 --- a/contrib/rpmbuild.sh +++ b/contrib/rpmbuild.sh @@ -1,4 +1,4 @@ #!/bin/bash $(dirname $0)/make-git-snapshot.sh make -C $(dirname $0) -rpmbuild -bb $(dirname $0)/ndctl.spec +rpmbuild -bb $(dirname $0)/rhel/ndctl.spec