Browse Source

enhance deb building

pull/101/head
Antonio SJ Musumeci 10 years ago
parent
commit
ab68ac0cb1
  1. 39
      Makefile
  2. 3
      debian/rules
  3. 2
      tools/cppfind
  4. 73
      tools/git2debcl

39
Makefile

@ -81,10 +81,16 @@ CFLAGS = -g -Wall \
-DWRITE_BUF=$(WRITE_BUF)
LDFLAGS = $(shell $(PKGCONFIG) fuse --libs)
BINDIR = $(PREFIX)/usr/bin
MANDIR = $(PREFIX)/usr/share/man/man1
INSTALLBINDIR = $(DESTDIR)$(BINDIR)
INSTALLMANDIR = $(DESTDIR)$(MANDIR)
PREFIX = /usr/local
EXEC_PREFIX = $(PREFIX)
DATAROOTDIR = $(PREFIX)/share
DATADIR = $(DATAROOTDIR)
BINDIR = $(EXEC_PREFIX)/bin
MANDIR = $(DATAROOTDIR)/man
MAN1DIR = $(MANDIR)/man1
INSTALLBINDIR = $(DESTDIR)$(BINDIR)
INSTALLMAN1DIR = $(DESTDIR)$(MAN1DIR)
ifeq ($(XATTR_AVAILABLE),0)
$(warning "xattr not available: disabling")
@ -104,7 +110,10 @@ clonepath: $(TARGET)
$(LN) -s $< $@
changelog:
$(GIT) log --pretty --numstat --summary | git2cl > ChangeLog
$(GIT2DEBCL) --name $(TARGET) > ChangeLog
authors:
$(GIT) log --format='%aN <%aE>' | sort -f | uniq > AUTHORS
obj/obj-stamp:
$(MKDIR) -p obj
@ -116,7 +125,7 @@ obj/%.o: src/%.cpp
clean:
$(RM) -rf obj
$(RM) -f "$(TARGET)" "$(MANPAGE)" clonepath
$(FIND) -name "*~" -delete
$(FIND) . -name "*~" -delete
distclean: clean
$(GIT) clean -fd
@ -130,7 +139,7 @@ install-clonepath: clonepath
$(CP) -a $< "$(INSTALLBINDIR)/$<"
install-man: $(MANPAGE)
$(INSTALL) -v -m 0644 -D "$(MANPAGE)" "$(INSTALLMANDIR)/$(MANPAGE)"
$(INSTALL) -v -m 0644 -D "$(MANPAGE)" "$(INSTALLMAN1DIR)/$(MANPAGE)"
install-strip: install-base
$(STRIP) "$(INSTALLBINDIR)/$(TARGET)"
@ -144,14 +153,14 @@ uninstall-clonepath:
$(RM) -f "$(INSTALLBINDIR)/clonepath"
uninstall-man:
$(RM) -f "$(INSTALLMANDIR)/$(MANPAGE")
$(RM) -f "$(INSTALLMAN1DIR)/$(MANPAGE)"
$(MANPAGE): README.md
$(PANDOC) -s -t man -o $(MANPAGE) README.md
man: $(MANPAGE)
tarball: clean changelog man
tarball: clean man changelog authors
$(eval VERSION := $(shell $(GIT) describe --always --tags --dirty))
$(eval FILENAME := $(TARGET)-$(VERSION))
$(eval TMPDIR := $(shell $(MKTEMP) --tmpdir -d .$(FILENAME).XXXXXXXX))
@ -160,10 +169,14 @@ tarball: clean changelog man
$(TAR) --exclude=.git -cz -C $(TMPDIR) -f ../$(FILENAME).tar.gz $(FILENAME)
$(RM) -rf $(TMPDIR)
deb:
$(eval VERSION := $(shell $(GIT) describe --always --tags --dirty))
$(GIT2DEBCL) $(TARGET) $(VERSION) > debian/changelog
$(GIT) buildpackage --git-ignore-new
debian-changelog:
$(GIT2DEBCL) --name $(TARGET) > debian/changelog
deb: debian-changelog
dpkg-buildpackage
unsigned-deb: debian-changelog
dpkg-buildpackage -uc -us
.PHONY: all clean install help

3
debian/rules

@ -6,3 +6,6 @@
%:
dh $@
override_dh_auto_install:
$(MAKE) PREFIX=$(CURDIR)/debian/mergerfs/usr install

2
tools/cppfind

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
FUSE_CFLAGS=$(pkg-config --cflags fuse)

73
tools/git2debcl

@ -24,35 +24,78 @@
import sys
import subprocess
import argparse
packagename = sys.argv[1]
version = sys.argv[2]
def git_tags():
args = ["git", "tag", '-l']
tags = subprocess.check_output(args)
tags = tags.split()
tags.reverse()
return tags
args = ["git", "tag", '-l']
tags = subprocess.check_output(args)
tags = tags.split()
tags.reverse()
def git_log(fromtag,totag):
args = ['git','log','--no-merges','--oneline',fromtag+'...'+totag]
return subprocess.check_output(args).strip().split('\n')
if version in tags:
def git_author_and_time(tag):
args = ['git','log','-1','--format=-- %an <%ae> %cD',tag]
return subprocess.check_output(args).strip()
def git_version():
args = ['git','describe','--always','--tags','--dirty']
return subprocess.check_output(args).strip()
def find_distrib_codename(f):
for line in f:
(key,value) = line.partition('=')[::2]
if key == 'DISTRIB_CODENAME':
return value.strip()
def guess_distribution():
try:
with open('/etc/upstream-release/lsb-release') as f:
return find_distrib_codename(f)
except:
try:
with open('/etc/lsb-release') as f:
return find_distrib_codename(f)
except:
return 'unknown'
parser = argparse.ArgumentParser(description='Generated debian/changelog from git log')
parser.add_argument('--name',type=str,help='Name of package',required=True)
parser.add_argument('--version',type=str,help='Place in git history to include upto',default='::guess::')
parser.add_argument('--distro',type=str,help='Distribution name',default='::guess::')
parser.add_argument('--urgency',type=str,help='Urgency',default='medium')
args = parser.parse_args()
if args.distro == '::guess::':
args.distro = guess_distribution()
if args.version == '::guess::':
args.version = git_version()
tags = git_tags()
if args.version in tags:
idx = tags.index(version)
tags = tags[idx:]
tags = zip(tags,tags)
else:
tags = zip(tags,tags)
tags.insert(0,(version,'HEAD'))
tags.insert(0,(args.version,'HEAD'))
tag = tags[0]
for prev in tags[1:]:
print packagename, "("+tag[0]+")", "trusty;", "urgency=medium"
print
print('%s (%s) %s; urgency=%s\n' % (args.name,tag[0],args.distro,args.urgency))
args = ['git','log','--no-merges','--oneline',tag[1]+'...'+prev[1]]
for line in subprocess.check_output(args).strip().split('\n'):
lines = git_log(tag[1],prev[1])
for line in lines:
print " * " + line
print
args = ['git','log','-1','--format=-- %an <%ae> %cD',tag[1]]
authorandtime = subprocess.check_output(args).strip()
print ' ' + authorandtime + '\n'
authorandtime = git_author_and_time(tag[1])
print(' %s\n' % authorandtime)
tag = prev
Loading…
Cancel
Save