#28 add Makefiles
Closed 5 years ago by julian8628. Opened 5 years ago by julian8628.
julian8628/koji-tools makefile  into  master

file added
+12
@@ -0,0 +1,12 @@ 

+ *.pyc

+ *.pyo

+ koji-tools-[0-9]*.tar.gz

+ koji-tools-[0-9]*.tar.bz2

+ koji-tools-[0-9]*.src.rpm

+ koji-tools-[0-9]*[0-9]/

+ noarch/

+ *.swp

+ .idea

+ .DS_STORE

+ .vagrant

+ .gitreview

file added
+90
@@ -0,0 +1,90 @@ 

+ NAME=koji-tools

+ SPECFILE = $(firstword $(wildcard *.spec))

+ 

+ ifdef DIST

+ DIST_DEFINES := --define "dist $(DIST)"

+ endif

+ 

+ ifndef VERSION

+ VERSION := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{VERSION}\n" --specfile $(SPECFILE)| head -1)

+ endif

+ 

+ # the release of the package

+ ifndef RELEASE

+ RELEASE := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{RELEASE}\n" --specfile $(SPECFILE)| head -1)

+ endif

+ 

+ ifndef WORKDIR

+ WORKDIR := $(shell pwd)

+ endif

+ ## Override RPM_WITH_DIRS to avoid the usage of these variables.

+ ifndef SRCRPMDIR

+ SRCRPMDIR = $(WORKDIR)

+ endif

+ ifndef BUILDDIR

+ BUILDDIR = $(WORKDIR)

+ endif

+ ifndef RPMDIR

+ RPMDIR = $(WORKDIR)

+ endif

+ 

+ ## SOURCEDIR is special; it has to match the CVS checkout directory,-

+ ## because the CVS checkout directory contains the patch files. So it basically-

+ ## can't be overridden without breaking things. But we leave it a variable

+ ## for consistency, and in hopes of convincing it to work sometime.

+ ifndef SOURCEDIR

+ SOURCEDIR := $(shell pwd)

+ endif

+ 

+ # RPM with all the overrides in place;

+ ifndef RPM

+ RPM := $(shell if test -f /usr/bin/rpmbuild ; then echo rpmbuild ; else echo rpm ; fi)

+ endif

+ ifndef RPM_WITH_DIRS

+ RPM_WITH_DIRS = $(RPM) --define "_sourcedir $(SOURCEDIR)" \

+ 				    --define "_builddir $(BUILDDIR)" \

+ 			 	    --define "_srcrpmdir $(SRCRPMDIR)" \

+ 				    --define "_rpmdir $(RPMDIR)"

+ endif

+ 

+ _default:

+ 	@echo "read the makefile"

+ 

+ clean:

+ 	rm -f *.o *.so *.pyc *~ $(NAME)*.bz2 $(NAME)*.src.rpm

+ 	rm -rf $(NAME)-$(VERSION)

+ 

+ test-tarball:

+ 	@rm -rf .$(NAME)-$(VERSION)

+ 	@mkdir .$(NAME)-$(VERSION)

+ 	@cp -al [A-Za-z]* .$(NAME)-$(VERSION)

+ 	@mv .$(NAME)-$(VERSION) $(NAME)-$(VERSION)

+ 	tar --gzip --exclude '*.tar.gz' --exclude '*.rpm' --exclude '.#*' --exclude '.DS_Store' \

+ 	    --exclude-vcs -cpf $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)

+ 	@rm -rf $(NAME)-$(VERSION)

+ 

+ tarball: clean

+ 	@git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD | gzip > $(NAME)-$(VERSION).tar.gz

+ 

+ sources: tarball

+ 

+ srpm: tarball

+ 	$(RPM_WITH_DIRS) $(DIST_DEFINES) -bs $(SPECFILE)

+ 

+ rpm: tarball

+ 	$(RPM_WITH_DIRS) $(DIST_DEFINES) -bb $(SPECFILE)

+ 

+ test-rpm: tarball

+ 	$(RPM_WITH_DIRS) $(DIST_DEFINES) --define "testbuild 1" -bb $(SPECFILE)

+ 

+ SUBDIRS = src/bin

+ 

+ install:

+ 	@if [ "$(DESTDIR)" = "" ]; then \

+ 		echo " "; \

+ 		echo "ERROR: A destdir is required"; \

+ 		exit 1; \

+ 	fi

+ 

+ 	for d in $(SUBDIRS); do make DESTDIR=$(DESTDIR) \

+ 		-C $$d install; [ $$? = 0 ] || exit 1; done

file modified
+1 -1
@@ -25,7 +25,7 @@ 

  %install

  rm -rf $RPM_BUILD_ROOT

  install -d $RPM_BUILD_ROOT%{_bindir}

- install -pm 0755 src/bin/* $RPM_BUILD_ROOT%{_bindir}

+ install -pm 0755 src/bin/koji* $RPM_BUILD_ROOT%{_bindir}

  

  %clean

  rm -rf $RPM_BUILD_ROOT

file added
+22
@@ -0,0 +1,22 @@ 

+ ifndef BINDIR

+ BINDIR = /usr/bin

+ endif

+ 

+ FILES = koji*

+ 

+ _default:

+ 	@echo "nothing to make. try make install"

+ 

+ clean:

+ 	rm -f *.o *.so *.pyc *~

+ 

+ install:

+ 	@if [ "$(DESTDIR)" = "" ]; then \

+ 		echo " "; \

+ 		echo "ERROR: A destdir is required"; \

+ 		exit 1; \

+ 	fi

+ 

+ 	mkdir -p $(DESTDIR)$(BINDIR)

+ 	install -p -m 755 $(FILES) $(DESTDIR)$(BINDIR)

+ 

It is only for scripts, and doesn't include plugins

For what is it needed? tito packaging seems to be sufficient for me now.

3 new commits added

  • use gunzip instead of bzip2
  • gitignore
  • add Makefile
5 years ago

3 new commits added

  • use gunzip instead of bzip2
  • gitignore
  • add Makefile
5 years ago

I want to use some scripts (koji-ssl-admin) in docker container, which need to build rpm from sources or directly make install.
It's not certain, but I'm still figuring out how to do it.

tito build --rpm --test (maybe even with --install if run under root/sudo) should work for building rpm locally from checkout. I was wondering if we don't want to use setuptools here.

thanks for this command! I would cancel this PR

Pull-Request has been closed by julian8628

5 years ago