Skip to content

Commit

Permalink
ndctl: rpm spec file fixes for koji
Browse files Browse the repository at this point in the history
1/ Update genspec to place the commit id directly in the spec file
   rather than running git live to retrieve the current HEAD.

2/ Update BuildRequires

With these updates koji can successfully build ndctl.

http://koji.fedoraproject.org/koji/taskinfo?taskID=10479814

Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
djbw committed Jul 25, 2015
1 parent 791e213 commit 27792e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion contrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ OBJS=$(SRCS:.c=.o)
PROG=genspec
SPEC_IN=ndctl.spec.in
SPEC=$(SPEC_IN:.in=)
COMMIT_ID=git log --pretty=format:"%h" -n 1

all: $(SPEC)

$(SPEC) : $(SPEC_IN) $(PROG)
cat $(SPEC_IN) | $(dir $(PROG))$(PROG) > $@
cat $(SPEC_IN) | $(dir $(PROG))$(PROG) `$(COMMIT_ID)` > $@

$(PROG) : $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -o $@
Expand Down
9 changes: 8 additions & 1 deletion contrib/genspec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
#include <string.h>
#include "../config.h"

int main(void)
int main(int argc, char **argv)
{
char buf[1024];

if (argc != 2) {
fprintf(stderr, "commit id must be specified\n");
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]);
else
fprintf(stdout, "%s", buf);

Expand Down
5 changes: 4 additions & 1 deletion contrib/ndctl.spec.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%global gitcommit %(git log --pretty=format:"%h" -n 1)
%global gitcommit

# (hack stolen from systemd.spec)
# We ship a .pc file but don't want to have a dep on pkg-config. We
Expand All @@ -23,6 +23,9 @@ Source0: https://github.com/pmem/ndctl/archive/%{name}-%{version}.tar.gz
BuildRequires: libtool
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: systemd-devel
BuildRequires: libuuid-devel
BuildRequires: kmod-devel

%description
Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
Expand Down

0 comments on commit 27792e1

Please sign in to comment.