21
by clem
packaging |
1 |
#!/usr/bin/env python
|
2 |
# -*- coding: utf-8 -*-
|
|
3 |
##
|
|
4 |
## Copyright (C) 2007 manatlan manatlan[at]gmail(dot)com
|
|
5 |
##
|
|
6 |
## This program is free software; you can redistribute it and/or modify
|
|
7 |
## it under the terms of the GNU General Public License as published
|
|
8 |
## by the Free Software Foundation; version 2 only.
|
|
9 |
##
|
|
10 |
## This program is distributed in the hope that it will be useful,
|
|
11 |
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
## GNU General Public License for more details.
|
|
14 |
##
|
|
15 |
import os |
|
16 |
import sys |
|
17 |
import shutil |
|
18 |
import time,string |
|
19 |
from glob import glob |
|
20 |
from datetime import datetime |
|
21 |
import socket # gethostname() |
|
22 |
||
27
by clem
Packaged mo files |
23 |
__version__ = "0.3-gtkvncviewer" |
21
by clem
packaging |
24 |
__author__ = "manatlan" |
25 |
__mail__ = "manatlan@gmail.com" |
|
26 |
||
27 |
"""
|
|
28 |
Known limitations :
|
|
29 |
- no distinctions between author and maintainer(packager)
|
|
30 |
||
31 |
depends on :
|
|
32 |
- dpkg-dev (dpkg-buildpackage)
|
|
33 |
- alien
|
|
34 |
- python
|
|
35 |
- fakeroot
|
|
36 |
||
27
by clem
Packaged mo files |
37 |
Modified to suit gtkvncviewer (https://launchpad.net/gtkvncviewer)
|
38 |
||
21
by clem
packaging |
39 |
"""
|
40 |
from subprocess import Popen,PIPE |
|
41 |
def run(cmds): |
|
42 |
p = Popen(cmds, shell=False,stdout=PIPE,stderr=PIPE) |
|
43 |
time.sleep(0.01) # to avoid "IOError: [Errno 4] Interrupted system call" |
|
44 |
out = string.join(p.stdout.readlines() ).strip() |
|
45 |
outerr = string.join(p.stderr.readlines() ).strip() |
|
46 |
return out |
|
47 |
||
48 |
def deb2rpm(file): |
|
49 |
txt=run(['alien','-r',file]) |
|
50 |
return txt.split(" generated")[0] |
|
51 |
||
52 |
class Py2debException(Exception): pass |
|
53 |
||
54 |
class Py2deb(object): |
|
55 |
"""
|
|
56 |
heavily based on technic described here :
|
|
57 |
http://wiki.showmedo.com/index.php?title=LinuxJensMakingDeb
|
|
58 |
"""
|
|
59 |
## STATICS
|
|
60 |
clear=False # clear build folder after py2debianization |
|
61 |
||
62 |
# http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
|
|
63 |
SECTIONS="admin, base, comm, contrib, devel, doc, editors, electronics, embedded, games, gnome, graphics, hamradio, interpreters, kde, libs, libdevel, mail, math, misc, net, news, non-free, oldlibs, otherosfs, perl, python, science, shells, sound, tex, text, utils, web, x11".split(", ") |
|
64 |
||
65 |
#http://www.debian.org/doc/debian-policy/footnotes.html#f69
|
|
66 |
ARCHS="all i386 ia64 alpha amd64 armeb arm hppa m32r m68k mips mipsel powerpc ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc darwin-i386 darwin-ia64 darwin-alpha darwin-amd64 darwin-armeb darwin-arm darwin-hppa darwin-m32r darwin-m68k darwin-mips darwin-mipsel darwin-powerpc darwin-ppc64 darwin-s390 darwin-s390x darwin-sh3 darwin-sh3eb darwin-sh4 darwin-sh4eb darwin-sparc freebsd-i386 freebsd-ia64 freebsd-alpha freebsd-amd64 freebsd-armeb freebsd-arm freebsd-hppa freebsd-m32r freebsd-m68k freebsd-mips freebsd-mipsel freebsd-powerpc freebsd-ppc64 freebsd-s390 freebsd-s390x freebsd-sh3 freebsd-sh3eb freebsd-sh4 freebsd-sh4eb freebsd-sparc kfreebsd-i386 kfreebsd-ia64 kfreebsd-alpha kfreebsd-amd64 kfreebsd-armeb kfreebsd-arm kfreebsd-hppa kfreebsd-m32r kfreebsd-m68k kfreebsd-mips kfreebsd-mipsel kfreebsd-powerpc kfreebsd-ppc64 kfreebsd-s390 kfreebsd-s390x kfreebsd-sh3 kfreebsd-sh3eb kfreebsd-sh4 kfreebsd-sh4eb kfreebsd-sparc knetbsd-i386 knetbsd-ia64 knetbsd-alpha knetbsd-amd64 knetbsd-armeb knetbsd-arm knetbsd-hppa knetbsd-m32r knetbsd-m68k knetbsd-mips knetbsd-mipsel knetbsd-powerpc knetbsd-ppc64 knetbsd-s390 knetbsd-s390x knetbsd-sh3 knetbsd-sh3eb knetbsd-sh4 knetbsd-sh4eb knetbsd-sparc netbsd-i386 netbsd-ia64 netbsd-alpha netbsd-amd64 netbsd-armeb netbsd-arm netbsd-hppa netbsd-m32r netbsd-m68k netbsd-mips netbsd-mipsel netbsd-powerpc netbsd-ppc64 netbsd-s390 netbsd-s390x netbsd-sh3 netbsd-sh3eb netbsd-sh4 netbsd-sh4eb netbsd-sparc openbsd-i386 openbsd-ia64 openbsd-alpha openbsd-amd64 openbsd-armeb openbsd-arm openbsd-hppa openbsd-m32r openbsd-m68k openbsd-mips openbsd-mipsel openbsd-powerpc openbsd-ppc64 openbsd-s390 openbsd-s390x openbsd-sh3 openbsd-sh3eb openbsd-sh4 openbsd-sh4eb openbsd-sparc hurd-i386 hurd-ia64 hurd-alpha hurd-amd64 hurd-armeb hurd-arm hurd-hppa hurd-m32r hurd-m68k hurd-mips hurd-mipsel hurd-powerpc hurd-ppc64 hurd-s390 hurd-s390x hurd-sh3 hurd-sh3eb hurd-sh4 hurd-sh4eb hurd-sparc".split(" ") |
|
67 |
||
68 |
# license terms taken from dh_make
|
|
69 |
LICENSES=["gpl","lgpl","bsd","artistic"] |
|
70 |
## ========
|
|
71 |
||
72 |
||
73 |
def __setitem__(self,path,files): |
|
74 |
||
75 |
if not type(files)==list: |
|
76 |
raise Py2debException("value of key path '%s' is not a list"%path) |
|
77 |
if not files: |
|
78 |
raise Py2debException("value of key path '%s' should'nt be empty"%path) |
|
79 |
if path.endswith("/"): |
|
80 |
raise Py2debException("key path '%s' malformed (shouldn't ends with '/')"%path) |
|
81 |
||
82 |
nfiles=[] |
|
83 |
for file in files: |
|
84 |
||
85 |
if ".." in file: |
|
86 |
raise Py2debException("file '%s' contains '..', please avoid that!"%file) |
|
87 |
||
88 |
||
89 |
if "|" in file: |
|
90 |
if file.count("|")!=1: |
|
91 |
raise Py2debException("file '%s' is incorrect (more than one pipe)"%file) |
|
92 |
||
93 |
file,nfile = file.split("|") |
|
94 |
else: |
|
95 |
nfile=file # same localisation |
|
96 |
||
97 |
if os.path.isdir(file): |
|
98 |
raise Py2debException("file '%s' is a folder, and py2deb refuse folders !"%file) |
|
99 |
||
100 |
if not os.path.isfile(file): |
|
101 |
raise Py2debException("file '%s' doesn't exist"%file) |
|
102 |
||
103 |
if file.startswith("/"): # if an absolute file is defined |
|
104 |
if file==nfile: # and not renamed (pipe trick) |
|
105 |
nfile=os.path.basename(file) # it's simply copied to 'path' |
|
106 |
||
30
by clem
Made .deb packages non-debian-native |
107 |
nfiles.append( (file,nfile) ) |
21
by clem
packaging |
108 |
|
109 |
nfiles.sort( lambda a,b :cmp(a[1],b[1])) #sort according new name (nfile) |
|
110 |
||
111 |
self.__files[path]=nfiles |
|
112 |
||
113 |
||
114 |
def __delitem__(self,k): |
|
115 |
del self.__files[k] |
|
116 |
||
117 |
def __init__(self, |
|
118 |
name, |
|
119 |
description="no description", |
|
120 |
license="gpl", |
|
121 |
depends="", |
|
122 |
section="utils", |
|
123 |
arch="all", |
|
124 |
||
125 |
url="", |
|
35
by Clement Lorteau
Made better packaging. |
126 |
author = "", |
127 |
mail = "" |
|
21
by clem
packaging |
128 |
):
|
129 |
||
130 |
self.name = name |
|
131 |
self.description = description |
|
132 |
self.license = license |
|
133 |
self.depends = depends |
|
134 |
self.section = section |
|
135 |
self.arch = arch |
|
136 |
self.url = url |
|
137 |
self.author = author |
|
138 |
self.mail = mail |
|
139 |
||
140 |
self.__files={} |
|
141 |
||
142 |
def __repr__(self): |
|
143 |
name = self.name |
|
144 |
license = self.license |
|
145 |
description = self.description |
|
146 |
depends = self.depends |
|
147 |
section = self.section |
|
148 |
arch = self.arch |
|
149 |
url = self.url |
|
150 |
author = self.author |
|
151 |
mail = self.mail |
|
152 |
||
153 |
paths=self.__files.keys() |
|
154 |
paths.sort() |
|
155 |
files=[] |
|
156 |
for path in paths: |
|
157 |
for file,nfile in self.__files[path]: |
|
158 |
#~ rfile=os.path.normpath( os.path.join(path,nfile) )
|
|
159 |
rfile=os.path.join(path,nfile) |
|
160 |
if nfile==file: |
|
161 |
files.append( rfile ) |
|
162 |
else: |
|
163 |
files.append( rfile + " (%s)"%file) |
|
164 |
||
165 |
files.sort() |
|
166 |
files = "\n".join(files) |
|
167 |
||
168 |
return """ |
|
169 |
FILES :
|
|
170 |
%(files)s
|
|
171 |
""" % locals() |
|
172 |
||
30
by clem
Made .deb packages non-debian-native |
173 |
def generate(self,version,changelog="",rpm=False,src=False, debrev="0"): |
21
by clem
packaging |
174 |
""" generate a deb of version 'version', with or without 'changelog', with or without a rpm
|
175 |
(in the current folder)
|
|
176 |
return a list of generated files
|
|
177 |
"""
|
|
178 |
if not sum([len(i) for i in self.__files.values()])>0: |
|
179 |
raise Py2debException("no files are defined") |
|
180 |
||
181 |
if not changelog: |
|
182 |
changelog="no changelog" |
|
183 |
||
184 |
name = self.name |
|
185 |
description = self.description |
|
186 |
license = self.license |
|
187 |
depends = self.depends |
|
188 |
section = self.section |
|
189 |
arch = self.arch |
|
190 |
url = self.url |
|
191 |
author = self.author |
|
192 |
mail = self.mail |
|
193 |
files=self.__files |
|
194 |
||
195 |
if section not in Py2deb.SECTIONS: |
|
196 |
raise Py2debException("section '%s' is unknown (%s)" % (section,str(Py2deb.SECTIONS))) |
|
197 |
||
198 |
if arch not in Py2deb.ARCHS: |
|
199 |
raise Py2debException("arch '%s' is unknown (%s)"% (arch,str(Py2deb.ARCHS))) |
|
200 |
||
201 |
if license not in Py2deb.LICENSES: |
|
202 |
raise Py2debException("License '%s' is unknown (%s)" % (license,str(Py2deb.LICENSES))) |
|
203 |
||
204 |
# create dates (buildDate,buildDateYear)
|
|
205 |
d=datetime.now() |
|
206 |
buildDate=d.strftime("%a, %d %b %Y %H:%M:%S +0000") |
|
207 |
buildDateYear=str(d.year) |
|
208 |
||
209 |
||
210 |
#clean description (add a space before each next lines)
|
|
211 |
description=description.replace("\r","").strip() |
|
212 |
description = "\n ".join(description.split("\n")) |
|
213 |
||
214 |
#clean changelog (add 2 spaces before each next lines)
|
|
215 |
changelog=changelog.replace("\r","").strip() |
|
216 |
changelog = "\n ".join(changelog.split("\n")) |
|
217 |
||
218 |
||
219 |
#TEMP = ".py2deb_build_folder"
|
|
220 |
TEMP = "packages" |
|
30
by clem
Made .deb packages non-debian-native |
221 |
DEST = os.path.join(TEMP,name+"-"+version) |
21
by clem
packaging |
222 |
DEBIAN = os.path.join(DEST,"debian") |
223 |
||
224 |
# let's start the process
|
|
225 |
try: |
|
39
by Clement Lorteau
Packaging now more Debian and Ubuntu policies compliant |
226 |
shutil.rmtree(DEST) |
21
by clem
packaging |
227 |
except: |
228 |
pass
|
|
229 |
||
230 |
os.makedirs(DEBIAN) |
|
231 |
try: |
|
232 |
rules=[] |
|
233 |
dirs=[] |
|
40
by Clement Lorteau
More Debian packaging. |
234 |
docs=[] |
41
by Clement Lorteau
More packaging. |
235 |
patches=[] |
21
by clem
packaging |
236 |
for path in files: |
237 |
for file,nfile in files[path]: |
|
238 |
if os.path.isfile(file): |
|
239 |
# it's a file
|
|
240 |
||
241 |
if file.startswith("/"): # if absolute path |
|
242 |
# we need to change dest
|
|
243 |
dest=os.path.join(DEST,nfile) |
|
244 |
else: |
|
245 |
dest=os.path.join(DEST,file) |
|
246 |
||
247 |
# copy file to be packaged
|
|
248 |
destDir = os.path.dirname(dest) |
|
249 |
if not os.path.isdir(destDir): |
|
250 |
os.makedirs(destDir) |
|
251 |
||
252 |
shutil.copy2(file,dest) |
|
253 |
||
254 |
ndir = os.path.join(path,os.path.dirname(nfile)) |
|
255 |
nname = os.path.basename(nfile) |
|
40
by Clement Lorteau
More Debian packaging. |
256 |
if ndir == "": |
257 |
pass
|
|
258 |
elif ndir == "_docs/": |
|
259 |
docs.append('%s\n' % (file)) |
|
41
by Clement Lorteau
More packaging. |
260 |
elif "patches" in ndir: |
261 |
patches.append('%s\n' % (file.replace("debian/patches/", ""))) |
|
40
by Clement Lorteau
More Debian packaging. |
262 |
else: |
263 |
rules.append('%s %s\n' % (file, ndir)) |
|
21
by clem
packaging |
264 |
|
265 |
# append a dir
|
|
266 |
dirs.append(ndir) |
|
267 |
||
268 |
else: |
|
269 |
raise Py2debException("unknown file '' "%file) # shouldn't be raised (because controlled before) |
|
270 |
||
40
by Clement Lorteau
More Debian packaging. |
271 |
#write package.install
|
272 |
open(os.path.join(DEBIAN,name+".install"),"w").write("".join(rules)) |
|
273 |
||
41
by Clement Lorteau
More packaging. |
274 |
#write patches list
|
275 |
if len(patches) != 0: |
|
276 |
open(os.path.join(DEBIAN,"patches/00list"),"w").write("".join(patches)) |
|
277 |
||
40
by Clement Lorteau
More Debian packaging. |
278 |
#write package.docs
|
279 |
if len(docs) != 0: |
|
280 |
open(os.path.join(DEBIAN,name+".docs"),"w").write("".join(docs)) |
|
21
by clem
packaging |
281 |
|
282 |
# make dirs right
|
|
283 |
dirs= [ i[1:] for i in set(dirs)] |
|
284 |
dirs.sort() |
|
285 |
||
286 |
#==========================================================================
|
|
287 |
# CREATE debian/dirs
|
|
288 |
#==========================================================================
|
|
35
by Clement Lorteau
Made better packaging. |
289 |
#open(os.path.join(DEBIAN,"dirs"),"w").write("\n".join(dirs)+"\n")
|
21
by clem
packaging |
290 |
|
291 |
#==========================================================================
|
|
292 |
# CREATE debian/changelog
|
|
293 |
#==========================================================================
|
|
35
by Clement Lorteau
Made better packaging. |
294 |
os.system("cp "+changelog+" "+DEBIAN+"/changelog") |
21
by clem
packaging |
295 |
|
296 |
#==========================================================================
|
|
297 |
# CREATE debian/compat
|
|
298 |
#==========================================================================
|
|
299 |
open(os.path.join(DEBIAN,"compat"),"w").write("5\n") |
|
300 |
||
301 |
#==========================================================================
|
|
302 |
# CREATE debian/control
|
|
303 |
#==========================================================================
|
|
304 |
txt="""Source: %(name)s |
|
305 |
Section: %(section)s |
|
306 |
Priority: optional
|
|
38
by Clement Lorteau
Packaging. |
307 |
Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
|
40
by Clement Lorteau
More Debian packaging. |
308 |
XSBC-Original-Maintainer: %(author)s <%(mail)s> |
21
by clem
packaging |
309 |
Standards-Version: 3.7.3
|
35
by Clement Lorteau
Made better packaging. |
310 |
XS-Python-Version: current
|
41
by Clement Lorteau
More packaging. |
311 |
Build-Depends: debhelper (>= 5.0.38)
|
312 |
Build-Depends-Indep: python-central (>= 0.5.6), dpatch
|
|
35
by Clement Lorteau
Made better packaging. |
313 |
Homepage: http://launchpad.net/gtkvncviewer
|
21
by clem
packaging |
314 |
|
315 |
Package: %(name)s |
|
316 |
Architecture: %(arch)s |
|
317 |
Depends: %(depends)s |
|
35
by Clement Lorteau
Made better packaging. |
318 |
XB-Python-Version: ${python:Versions}
|
21
by clem
packaging |
319 |
Description: %(description)s""" % locals() |
30
by clem
Made .deb packages non-debian-native |
320 |
open(os.path.join(DEBIAN,"control"),"w").write(txt+"\n") |
21
by clem
packaging |
321 |
|
322 |
#==========================================================================
|
|
323 |
# CREATE debian/copyright
|
|
324 |
#==========================================================================
|
|
325 |
copy={} |
|
326 |
copy["gpl"]=""" |
|
327 |
This package is free software; you can redistribute it and/or modify
|
|
328 |
it under the terms of the GNU General Public License as published by
|
|
329 |
the Free Software Foundation; either version 2 of the License, or
|
|
330 |
(at your option) any later version.
|
|
331 |
||
332 |
This package is distributed in the hope that it will be useful,
|
|
333 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
334 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
335 |
GNU General Public License for more details.
|
|
336 |
||
337 |
You should have received a copy of the GNU General Public License
|
|
338 |
along with this package; if not, write to the Free Software
|
|
339 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
340 |
||
341 |
On Debian systems, the complete text of the GNU General
|
|
342 |
Public License can be found in `/usr/share/common-licenses/GPL'.
|
|
343 |
"""
|
|
344 |
copy["lgpl"]=""" |
|
345 |
This package is free software; you can redistribute it and/or
|
|
346 |
modify it under the terms of the GNU Lesser General Public
|
|
347 |
License as published by the Free Software Foundation; either
|
|
348 |
version 2 of the License, or (at your option) any later version.
|
|
349 |
||
350 |
This package is distributed in the hope that it will be useful,
|
|
351 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
352 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
353 |
Lesser General Public License for more details.
|
|
354 |
||
355 |
You should have received a copy of the GNU Lesser General Public
|
|
356 |
License along with this package; if not, write to the Free Software
|
|
357 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
358 |
||
359 |
On Debian systems, the complete text of the GNU Lesser General
|
|
360 |
Public License can be found in `/usr/share/common-licenses/LGPL'.
|
|
361 |
"""
|
|
362 |
copy["bsd"]=""" |
|
363 |
Redistribution and use in source and binary forms, with or without
|
|
364 |
modification, are permitted under the terms of the BSD License.
|
|
365 |
||
366 |
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
367 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
368 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
369 |
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
370 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
371 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
372 |
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
373 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
374 |
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
375 |
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
376 |
SUCH DAMAGE.
|
|
377 |
||
378 |
On Debian systems, the complete text of the BSD License can be
|
|
379 |
found in `/usr/share/common-licenses/BSD'.
|
|
380 |
"""
|
|
381 |
copy["artistic"]=""" |
|
382 |
This program is free software; you can redistribute it and/or modify it
|
|
383 |
under the terms of the "Artistic License" which comes with Debian.
|
|
384 |
||
385 |
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
386 |
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
|
|
387 |
OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
388 |
||
389 |
On Debian systems, the complete text of the Artistic License
|
|
390 |
can be found in `/usr/share/common-licenses/Artistic'.
|
|
391 |
"""
|
|
392 |
||
393 |
txtLicense = copy[license] |
|
394 |
pv=__version__ |
|
35
by Clement Lorteau
Made better packaging. |
395 |
txt="""This package was debianized by %(author)s <%(mail)s> on |
21
by clem
packaging |
396 |
%(buildDate)s. |
397 |
||
398 |
Upstream Author: %(author)s <%(mail)s> |
|
399 |
||
400 |
Copyright: %(buildDateYear)s by %(author)s |
|
401 |
||
402 |
License:
|
|
403 |
||
404 |
%(txtLicense)s
|
|
405 |
||
406 |
The Debian packaging is (C) %(buildDateYear)s, %(author)s <%(mail)s> and |
|
407 |
is licensed under the GPL, see above.
|
|
408 |
||
409 |
""" % locals() |
|
410 |
open(os.path.join(DEBIAN,"copyright"),"w").write(txt) |
|
411 |
||
412 |
#==========================================================================
|
|
413 |
# CREATE debian/rules
|
|
414 |
#==========================================================================
|
|
415 |
txt="""#!/usr/bin/make -f |
|
416 |
# -*- makefile -*-
|
|
417 |
# Sample debian/rules that uses debhelper.
|
|
418 |
# This file was originally written by Joey Hess and Craig Small.
|
|
419 |
# As a special exception, when this file is copied by dh-make into a
|
|
420 |
# dh-make output file, you may use that output file without restriction.
|
|
421 |
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
|
41
by Clement Lorteau
More packaging. |
422 |
.NOTPARALLEL:
|
423 |
||
21
by clem
packaging |
424 |
|
425 |
build: build-stamp
|
|
426 |
||
35
by Clement Lorteau
Made better packaging. |
427 |
build-stamp:
|
21
by clem
packaging |
428 |
dh_testdir
|
429 |
touch build-stamp
|
|
430 |
||
41
by Clement Lorteau
More packaging. |
431 |
patch: patch-stamp
|
432 |
||
433 |
patch-stamp:
|
|
434 |
dpatch apply-all
|
|
435 |
dpatch cat-all >patch-stamp
|
|
436 |
||
437 |
unpatch:
|
|
438 |
dpatch deapply-all
|
|
439 |
rm -rf patch-stamp debian/patched
|
|
440 |
||
441 |
clean: clean-patched unpatch
|
|
442 |
||
443 |
clean-patched:
|
|
21
by clem
packaging |
444 |
dh_testdir
|
445 |
dh_testroot
|
|
35
by Clement Lorteau
Made better packaging. |
446 |
rm -f build-stamp
|
21
by clem
packaging |
447 |
dh_clean
|
448 |
||
449 |
install: build
|
|
450 |
dh_testdir
|
|
451 |
dh_testroot
|
|
452 |
dh_clean -k
|
|
453 |
dh_installdirs
|
|
40
by Clement Lorteau
More Debian packaging. |
454 |
dh_install
|
35
by Clement Lorteau
Made better packaging. |
455 |
|
41
by Clement Lorteau
More packaging. |
456 |
binary-arch: patch build install
|
35
by Clement Lorteau
Made better packaging. |
457 |
|
41
by Clement Lorteau
More packaging. |
458 |
binary-indep: patch build install
|
21
by clem
packaging |
459 |
dh_testdir
|
460 |
dh_testroot
|
|
35
by Clement Lorteau
Made better packaging. |
461 |
dh_pycentral
|
40
by Clement Lorteau
More Debian packaging. |
462 |
dh_installchangelogs CHANGELOG
|
21
by clem
packaging |
463 |
dh_installdocs
|
464 |
dh_installexamples
|
|
35
by Clement Lorteau
Made better packaging. |
465 |
dh_installman gtkvncviewer.1
|
21
by clem
packaging |
466 |
dh_link
|
467 |
dh_strip
|
|
468 |
dh_compress
|
|
469 |
dh_fixperms
|
|
470 |
dh_installdeb
|
|
471 |
dh_shlibdeps
|
|
472 |
dh_gencontrol
|
|
473 |
dh_md5sums
|
|
474 |
dh_builddeb
|
|
475 |
||
476 |
binary: binary-indep binary-arch
|
|
35
by Clement Lorteau
Made better packaging. |
477 |
.PHONY: build clean binary-indep binary-arch binary install
|
21
by clem
packaging |
478 |
""" % locals() |
479 |
open(os.path.join(DEBIAN,"rules"),"w").write(txt) |
|
480 |
os.chmod(os.path.join(DEBIAN,"rules"),0755) |
|
481 |
||
40
by Clement Lorteau
More Debian packaging. |
482 |
###
|
483 |
#GO
|
|
484 |
###
|
|
485 |
if not os.access('packages/%(name)s_%(version)s.orig.tar.gz' % locals(),os.F_OK): |
|
38
by Clement Lorteau
Packaging. |
486 |
os.system('cd packages ; tar -zcf %(name)s_%(version)s.orig.tar.gz * --exclude "%(name)s-%(version)s/debian"' % locals()) |
40
by Clement Lorteau
More Debian packaging. |
487 |
#raw_input("---")
|
21
by clem
packaging |
488 |
os.system('cd "%(DEST)s"; dpkg-buildpackage -S -rfakeroot' % locals()) |
489 |
os.system('rm -rf packages/gtkvncviewer') |
|
490 |
os.system('cd "%(TEMP)s"; sudo pbuilder build *.dsc' % locals()) |
|
491 |
os.system('sudo mv /var/cache/pbuilder/result/%(name)s*.deb %(TEMP)s' % locals()) |
|
30
by clem
Made .deb packages non-debian-native |
492 |
os.system('rm -rf %(DEST)s' % locals()) |
38
by Clement Lorteau
Packaging. |
493 |
if not os.access('packages/%(name)s_%(version)s.tar.gz' % locals(),os.F_OK): |
494 |
os.system('cd packages ; cp %(name)s_%(version)s.orig.tar.gz %(name)s-%(version)s.tar.gz' % locals()) |
|
21
by clem
packaging |
495 |
ret = 0 |
496 |
if ret!=0: |
|
497 |
raise Py2debException("buildpackage failed (see output)") |
|
498 |
||
499 |
l=glob("%(TEMP)s/%(name)s*.deb"%locals()) |
|
39
by Clement Lorteau
Packaging now more Debian and Ubuntu policies compliant |
500 |
if len(l)==0: |
21
by clem
packaging |
501 |
raise Py2debException("don't find builded deb") |
502 |
||
503 |
tdeb = l[0] |
|
504 |
deb = os.path.basename(tdeb) |
|
505 |
ret=[deb,] |
|
506 |
||
507 |
if rpm: |
|
508 |
rpm = deb2rpm(deb) |
|
509 |
ret.append(rpm) |
|
510 |
||
511 |
if src: |
|
31
by clem
Removed debian dir from .tar.gz packages |
512 |
l=glob("%(TEMP)s/%(name)s-%(version)s.tar.gz"%locals()) |
21
by clem
packaging |
513 |
if len(l)!=1: |
514 |
raise Py2debException("don't find source package tar.gz") |
|
515 |
||
516 |
tar = os.path.basename(l[0]) |
|
517 |
ret.append(tar) |
|
518 |
||
519 |
return ret |
|
520 |
||
521 |
finally: |
|
522 |
if Py2deb.clear: |
|
523 |
shutil.rmtree(TEMP) |
|
524 |
||
525 |
||
526 |
if __name__ == "__main__": |
|
527 |
try: |
|
528 |
os.chdir(os.path.dirname(sys.argv[0])) |
|
529 |
except: |
|
530 |
pass
|
|
531 |
||
532 |
os.system('rm *~') |
|
35
by Clement Lorteau
Made better packaging. |
533 |
changelog="CHANGELOG.ubuntu" |
21
by clem
packaging |
534 |
|
535 |
#description
|
|
536 |
p=Py2deb("gtkvncviewer") |
|
537 |
p.author="Clement Lorteau" |
|
538 |
p.mail="northern_lights@users.sourceforge.net" |
|
40
by Clement Lorteau
More Debian packaging. |
539 |
p.description="""Small GTK+ tool to connect to VNC servers |
540 |
This script provides a GUI for connecting to VNC servers. It remembers the
|
|
541 |
credentials of known servers, so connecting to a VNC server is just one
|
|
542 |
double-click away. Servers are shown in an icon view."""
|
|
47
by Clement Lorteau
Added send keys feature |
543 |
p.depends="${python:Depends}, python-gconf, python-glade2, python-gtk2, |
544 |
python-gnome2-desktop, python-gtk-vnc, dbus-x11" |
|
21
by clem
packaging |
545 |
p.license="gpl" |
546 |
p.section="utils" |
|
547 |
p.arch="all" |
|
548 |
||
549 |
#files
|
|
27
by clem
Packaged mo files |
550 |
usr_share_gtkvncviewer = ["gtkvncviewer.py", "data/gtkvncviewer.glade", "data/gtkvncviewer_14.png", "data/gtkvncviewer_64.png", "data/gtkvncviewer_128.png", "data/gtkvncviewer_192.png",] |
21
by clem
packaging |
551 |
p["/usr/bin"] = ["gtkvncviewer",] |
26
by clem
Moved stuff into data folder. |
552 |
p["/usr/share/applications"]=["data/gtkvncviewer.desktop",] |
40
by Clement Lorteau
More Debian packaging. |
553 |
p["_docs"]=["AUTHORS",] |
44
by Clement Lorteau
<server> automatically connects to server, Removed deprecated Encoding key in .desktop file |
554 |
p[""]=["gtkvncviewer.1","LICENSE", "CHANGELOG", "TODO"] |
555 |
#p["_patches"]=["debian/patches/01_remove_encoding_key_in_desktop_file.dpatch",]
|
|
21
by clem
packaging |
556 |
|
27
by clem
Packaged mo files |
557 |
#mo files
|
558 |
locale_dirs = os.listdir("locale") |
|
559 |
for i in range(len(locale_dirs)): |
|
560 |
dir = locale_dirs[i] |
|
561 |
to_add = "locale/"+dir+"/LC_MESSAGES/gtkvncviewer.mo" |
|
562 |
usr_share_gtkvncviewer.append(to_add) |
|
563 |
||
564 |
p["/usr/share/gtkvncviewer"] = usr_share_gtkvncviewer |
|
565 |
||
21
by clem
packaging |
566 |
print p |
567 |
raw_input("Press ENTER to generate the packages, or CTRL+C to cancel:") |
|
568 |
print "Generating..." |
|
569 |
||
35
by Clement Lorteau
Made better packaging. |
570 |
#debian
|
45
by Clement Lorteau
Auto hide/show toolbar when in fullscreen, Added feature to create desktop icons pointing to a server |
571 |
version="0.3" |
42
by Clement Lorteau
Fixed dependency in Debian package |
572 |
p.generate(version, changelog, rpm=False, src=True, debrev="0ubuntu1~ppa1") |
21
by clem
packaging |
573 |