Ajout infos debian
authorcyril robert <Cyril Robert crobert@inverse.ca>
Wed, 20 Jan 2010 15:55:56 +0000 (10:55 -0500)
committercyril robert <Cyril Robert crobert@inverse.ca>
Wed, 20 Jan 2010 15:55:56 +0000 (10:55 -0500)
13 files changed:
Scripts/MakeDeb/Makefile [new file with mode: 0644]
Scripts/MakeDeb/debian/.changelog.swp [new file with mode: 0644]
Scripts/MakeDeb/debian/auf-make-deb.debhelper.log [new file with mode: 0644]
Scripts/MakeDeb/debian/auf-make-deb/DEBIAN/control [new file with mode: 0644]
Scripts/MakeDeb/debian/auf-make-deb/DEBIAN/md5sums [new file with mode: 0644]
Scripts/MakeDeb/debian/auf-make-deb/usr/bin/auf_make_deb [new file with mode: 0755]
Scripts/MakeDeb/debian/auf-make-deb/usr/share/doc/auf-make-deb/changelog.gz [new file with mode: 0644]
Scripts/MakeDeb/debian/changelog [new file with mode: 0644]
Scripts/MakeDeb/debian/compat [new file with mode: 0644]
Scripts/MakeDeb/debian/control [new file with mode: 0644]
Scripts/MakeDeb/debian/dirs [new file with mode: 0644]
Scripts/MakeDeb/debian/files [new file with mode: 0644]
Scripts/MakeDeb/debian/rules [new file with mode: 0755]

diff --git a/Scripts/MakeDeb/Makefile b/Scripts/MakeDeb/Makefile
new file mode 100644 (file)
index 0000000..2c67333
--- /dev/null
@@ -0,0 +1,8 @@
+APPDIR = $(DESTDIR)/usr/bin
+clean:
+       rm -f *.py[co] */*.py[co]
+install:
+       mkdir -p $(APPDIR)
+       cp make_deb.py $(APPDIR)/auf_make_deb
+uninstall:
+       rm -f $(APPDIR)/auf_make_deb
diff --git a/Scripts/MakeDeb/debian/.changelog.swp b/Scripts/MakeDeb/debian/.changelog.swp
new file mode 100644 (file)
index 0000000..b5237bc
Binary files /dev/null and b/Scripts/MakeDeb/debian/.changelog.swp differ
diff --git a/Scripts/MakeDeb/debian/auf-make-deb.debhelper.log b/Scripts/MakeDeb/debian/auf-make-deb.debhelper.log
new file mode 100644 (file)
index 0000000..c6ebce7
--- /dev/null
@@ -0,0 +1,14 @@
+dh_prep
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_pysupport
+dh_link
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_shlibdeps
+dh_gencontrol
+dh_md5sums
+dh_builddeb
diff --git a/Scripts/MakeDeb/debian/auf-make-deb/DEBIAN/control b/Scripts/MakeDeb/debian/auf-make-deb/DEBIAN/control
new file mode 100644 (file)
index 0000000..e910e87
--- /dev/null
@@ -0,0 +1,11 @@
+Package: auf-make-deb
+Version: 0.1
+Architecture: all
+Maintainer: Cyril Robert <cyril.robert@auf.org>
+Installed-Size: 40
+Depends: python (>= 2.6)
+Section: python
+Priority: extra
+Homepage: http://git.auf.org/?p=cyril.git;a=tree;f=Scripts/MakeDeb;hb=HEAD
+Description: Script facile pour generer un .deb a partir
+ d'un module python ou d'une app Django.
diff --git a/Scripts/MakeDeb/debian/auf-make-deb/DEBIAN/md5sums b/Scripts/MakeDeb/debian/auf-make-deb/DEBIAN/md5sums
new file mode 100644 (file)
index 0000000..153b11b
--- /dev/null
@@ -0,0 +1,2 @@
+c96ed0b6376c82542453dfaa91da9359  usr/share/doc/auf-make-deb/changelog.gz
+8a11d94ae2606a9901b1f30600e28b04  usr/bin/auf_make_deb
diff --git a/Scripts/MakeDeb/debian/auf-make-deb/usr/bin/auf_make_deb b/Scripts/MakeDeb/debian/auf-make-deb/usr/bin/auf_make_deb
new file mode 100755 (executable)
index 0000000..82cba4a
--- /dev/null
@@ -0,0 +1,178 @@
+from glob import glob
+import shutil, os, sys
+
+control_template = """Source: %s
+Section: python
+Priority: extra
+Maintainer: %s <%s>
+Build-Depends: debhelper (>= 7), python-support
+Standards-Version: 3.8.0
+Homepage: %s
+
+Package: %s
+Architecture: all
+Depends: python (>= 2.6)%s
+Description: %s
+"""
+
+rules_template = """#!/usr/bin/make -f
+# -*- makefile -*-
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       touch configure-stamp
+build: build-stamp
+build-stamp: configure-stamp  
+       dh_testdir
+       $(MAKE)
+       touch $@
+clean: 
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       dh_clean 
+install: build
+       dh_testdir
+       dh_testroot
+       dh_prep
+       dh_installdirs
+       $(MAKE) DESTDIR=$(CURDIR)/debian/%s install
+binary-arch: build install
+       # rien
+binary-indep: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_pysupport
+       dh_link
+       dh_compress -X.js
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+binary: binary-indep
+.PHONY: build clean binary-indep binary install configure
+"""
+
+dirs_template = """usr/share/pyshared/%s
+"""
+
+makefile_template = """APPDIR = $(DESTDIR)/usr/share/pyshared/%s
+clean:
+       rm -f *.py[co] */*.py[co]
+install:
+       mkdir -p $(APPDIR)
+%s     
+uninstall:
+       rm -rf $(APPDIR)
+"""
+
+postinst_template = """#!/bin/sh
+set -e
+case "$1" in
+    configure)
+    ln -s /usr/share/pyshared/%s /usr/lib/python2.6/dist-packages/%s
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    rm -f /usr/lib/python2.6/dist-packages/%s
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+exit 0
+"""
+
+compat_template = "7\n"
+
+
+def read_parameters ():
+    data = {}
+    print "Auteur: ",
+    data['author'] = sys.stdin.readline ().strip ()
+    print "Courriel: ",
+    data['email'] = sys.stdin.readline ().strip ()
+    print "URL: ",
+    data['homepage'] = sys.stdin.readline ().strip ()
+    print "Dependances supplementaires: ",
+    data['extradeps'] = sys.stdin.readline ().strip ()
+    print "Description: ",
+    data['description'] = sys.stdin.readline ().strip ()
+    print 
+    return data
+
+def write_file (filename, content):
+    fd = open (filename, "w")
+    fd.write (content)
+    fd.close ()
+
+def usage ():
+    print "Usage: python %s <dossier>" % sys.argv[0]
+
+if __name__ == '__main__':
+    if len (sys.argv) < 2:
+        usage ()
+        sys.exit (-1)
+
+    localpath = sys.argv[1]
+    if localpath.endswith("/"):
+        localpath = localpath[0:-1]
+    package = localpath.replace ("-", "_")
+    debpackage = package.replace ("_", "-")
+
+    print "Configuration pour le paquet", debpackage
+    p = read_parameters ()
+    
+    path = "/tmp/%s" % package
+    if os.path.exists (path):
+        shutil.rmtree (path)
+    shutil.copytree (localpath, path)
+
+    os.makedirs ("%s/debian/" % path)
+
+    control = control_template % \
+            (debpackage, p['author'], p['email'], p['homepage'], \
+            debpackage, p['extradeps'], p['description'])
+    write_file ("%s/debian/control" % path, control)
+
+    rules = rules_template % (debpackage)
+    write_file ("%s/debian/rules" % path, rules)
+
+    dirs = dirs_template % (package)
+    write_file ("%s/debian/dirs" % path, dirs)
+
+    compat = compat_template
+    write_file ("%s/debian/compat" % path, compat)
+
+    postinst = postinst_template % (package, package, package)
+    write_file ("%s/debian/postinst" % path, postinst)
+
+    blacklist = ("debian", "DEBIAN", "Makefile", "build-stamp", "configure-stamp")
+    copy = ""
+    for i in glob (localpath + "/*.py"):
+        file = os.path.basename (i)
+        if file not in blacklist:
+            copy += "\tcp -r %s $(APPDIR)\n" % file
+    makefile = makefile_template % (package, copy)
+    write_file ("%s/Makefile" % path, makefile)
+
+    os.rename ("%s/changelog.txt" % path, "%s/debian/changelog" % path)
+
+    old = os.getcwd ()
+    os.chdir (path)
+    os.system ("debuild")
+
+    files = glob ("/tmp/%s*.deb" % package.replace("_", "-"))
+    if len (files) == 1:
+        shutil.copy (files[0], old)
+        print "\n\n%s ecrit." % os.path.basename (files[0])
+    else:
+        print "\n\nTrop de .deb dans /tmp : ", files
+
diff --git a/Scripts/MakeDeb/debian/auf-make-deb/usr/share/doc/auf-make-deb/changelog.gz b/Scripts/MakeDeb/debian/auf-make-deb/usr/share/doc/auf-make-deb/changelog.gz
new file mode 100644 (file)
index 0000000..5c9e31a
Binary files /dev/null and b/Scripts/MakeDeb/debian/auf-make-deb/usr/share/doc/auf-make-deb/changelog.gz differ
diff --git a/Scripts/MakeDeb/debian/changelog b/Scripts/MakeDeb/debian/changelog
new file mode 100644 (file)
index 0000000..cbb47f3
--- /dev/null
@@ -0,0 +1,4 @@
+auf-make-deb (0.1) stable; urgency=low
+    * Initial version
+
+ -- Cyril Robert <cyril.robert@auf.org>  Tue, 19 Jan 2010 16:47:11 -0500
diff --git a/Scripts/MakeDeb/debian/compat b/Scripts/MakeDeb/debian/compat
new file mode 100644 (file)
index 0000000..4d446d8
--- /dev/null
@@ -0,0 +1,2 @@
+7
+
diff --git a/Scripts/MakeDeb/debian/control b/Scripts/MakeDeb/debian/control
new file mode 100644 (file)
index 0000000..adee3e9
--- /dev/null
@@ -0,0 +1,13 @@
+Source: auf-make-deb
+Section: python
+Priority: extra
+Maintainer: Cyril Robert <cyril.robert@auf.org>
+Build-Depends: debhelper (>= 7), python-support
+Standards-Version: 3.8.0
+Homepage: http://git.auf.org/?p=cyril.git;a=tree;f=Scripts/MakeDeb;hb=HEAD
+
+Package: auf-make-deb
+Architecture: all
+Depends: python (>= 2.6)
+Description: Script facile pour generer un .deb a partir 
+ d'un module python ou d'une app Django.
diff --git a/Scripts/MakeDeb/debian/dirs b/Scripts/MakeDeb/debian/dirs
new file mode 100644 (file)
index 0000000..e772481
--- /dev/null
@@ -0,0 +1 @@
+usr/bin
diff --git a/Scripts/MakeDeb/debian/files b/Scripts/MakeDeb/debian/files
new file mode 100644 (file)
index 0000000..f257603
--- /dev/null
@@ -0,0 +1 @@
+auf-make-deb_0.1_all.deb python extra
diff --git a/Scripts/MakeDeb/debian/rules b/Scripts/MakeDeb/debian/rules
new file mode 100755 (executable)
index 0000000..f89d8de
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       touch configure-stamp
+build: build-stamp
+build-stamp: configure-stamp  
+       dh_testdir
+       $(MAKE)
+       touch $@
+clean: 
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       dh_clean 
+install: build
+       dh_testdir
+       dh_testroot
+       dh_prep
+       dh_installdirs
+       $(MAKE) DESTDIR=$(CURDIR)/debian/auf-make-deb install
+binary-arch: build install
+       # rien
+binary-indep: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_pysupport
+       dh_link
+       dh_compress -X.js
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+binary: binary-indep
+.PHONY: build clean binary-indep binary install configure