From e63abc1b4bb939f8499a6449320327a80054e99a Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 7 Apr 2010 03:56:43 -0700 Subject: [PATCH] Added debian packaging support. --- debian_me/control | 12 +++++ debian_me/copyright | 11 +++++ debian_me/dirs | 3 ++ debian_me/dupeguru_me.desktop | 10 ++++ debian_me/rules | 86 +++++++++++++++++++++++++++++++++++ debian_pe/control | 12 +++++ debian_pe/copyright | 11 +++++ debian_pe/dirs | 3 ++ debian_pe/dupeguru_pe.desktop | 9 ++++ debian_pe/rules | 86 +++++++++++++++++++++++++++++++++++ debian_se/control | 12 +++++ debian_se/copyright | 11 +++++ debian_se/dirs | 3 ++ debian_se/dupeguru_se.desktop | 9 ++++ debian_se/rules | 86 +++++++++++++++++++++++++++++++++++ package.py | 48 +++++++++++++++++-- 16 files changed, 408 insertions(+), 4 deletions(-) create mode 100644 debian_me/control create mode 100644 debian_me/copyright create mode 100644 debian_me/dirs create mode 100644 debian_me/dupeguru_me.desktop create mode 100755 debian_me/rules create mode 100644 debian_pe/control create mode 100644 debian_pe/copyright create mode 100644 debian_pe/dirs create mode 100644 debian_pe/dupeguru_pe.desktop create mode 100755 debian_pe/rules create mode 100644 debian_se/control create mode 100644 debian_se/copyright create mode 100644 debian_se/dirs create mode 100644 debian_se/dupeguru_se.desktop create mode 100755 debian_se/rules diff --git a/debian_me/control b/debian_me/control new file mode 100644 index 00000000..a8056cce --- /dev/null +++ b/debian_me/control @@ -0,0 +1,12 @@ +Source: dupeguru-me +Section: devel +Priority: extra +Maintainer: Virgil Dupras +Build-Depends: debhelper (>= 7) +Standards-Version: 3.8.1 +Homepage: http://www.hardcoded.net + +Package: dupeguru-me +Architecture: any +Depends: python (>= 2.6), python-qt4 (>= 4.6) +Description: dupeGuru Music Edition diff --git a/debian_me/copyright b/debian_me/copyright new file mode 100644 index 00000000..7c76e796 --- /dev/null +++ b/debian_me/copyright @@ -0,0 +1,11 @@ +Copyright 2010 Hardcoded Software Inc. (http://www.hardcoded.net) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of Hardcoded Software Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + * If the source code has been published less than two years ago, any redistribution, in whole or in part, must retain full licensing functionality, without any attempt to change, obscure or in other ways circumvent its intent. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/debian_me/dirs b/debian_me/dirs new file mode 100644 index 00000000..5ab1c347 --- /dev/null +++ b/debian_me/dirs @@ -0,0 +1,3 @@ +usr/local/bin +usr/local/share +usr/share/applications diff --git a/debian_me/dupeguru_me.desktop b/debian_me/dupeguru_me.desktop new file mode 100644 index 00000000..dffac2b6 --- /dev/null +++ b/debian_me/dupeguru_me.desktop @@ -0,0 +1,10 @@ + +[Desktop Entry] +Encoding=UTF-8 +Name=dupeGuru Music Edition +Comment=Find duplicate songs in your collection. +Exec=dupeguru_me +Icon=/usr/local/share/dupeguru_me/dgme_logo_128.png +Terminal=false +Type=Application +Categories=Utility diff --git a/debian_me/rules b/debian_me/rules new file mode 100755 index 00000000..393c5313 --- /dev/null +++ b/debian_me/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + chmod +x src/start.py + cp -R src/ $(CURDIR)/debian/tmp/usr/local/share/dupeguru_me + cp $(CURDIR)/debian/dupeguru_me.desktop $(CURDIR)/debian/tmp/usr/share/applications + ln -s /usr/local/share/dupeguru_me/start.py $(CURDIR)/debian/tmp/usr/local/bin/dupeguru_me + + +# Build architecture-independent files here. +binary-indep: install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install + dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian_pe/control b/debian_pe/control new file mode 100644 index 00000000..9ba5993b --- /dev/null +++ b/debian_pe/control @@ -0,0 +1,12 @@ +Source: dupeguru-pe +Section: devel +Priority: extra +Maintainer: Virgil Dupras +Build-Depends: debhelper (>= 7) +Standards-Version: 3.8.1 +Homepage: http://www.hardcoded.net + +Package: dupeguru-pe +Architecture: any +Depends: python (>= 2.6), python-qt4 (>= 4.6), python-imaging (>= 1.1.6) +Description: dupeGuru Picture Edition diff --git a/debian_pe/copyright b/debian_pe/copyright new file mode 100644 index 00000000..7c76e796 --- /dev/null +++ b/debian_pe/copyright @@ -0,0 +1,11 @@ +Copyright 2010 Hardcoded Software Inc. (http://www.hardcoded.net) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of Hardcoded Software Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + * If the source code has been published less than two years ago, any redistribution, in whole or in part, must retain full licensing functionality, without any attempt to change, obscure or in other ways circumvent its intent. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/debian_pe/dirs b/debian_pe/dirs new file mode 100644 index 00000000..5ab1c347 --- /dev/null +++ b/debian_pe/dirs @@ -0,0 +1,3 @@ +usr/local/bin +usr/local/share +usr/share/applications diff --git a/debian_pe/dupeguru_pe.desktop b/debian_pe/dupeguru_pe.desktop new file mode 100644 index 00000000..b1e276ab --- /dev/null +++ b/debian_pe/dupeguru_pe.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=dupeGuru Picture Edition +Comment=Find duplicate pictures in your library. +Exec=dupeguru_pe +Icon=/usr/local/share/dupeguru_pe/dgpe_logo_128.png +Terminal=false +Type=Application +Categories=Utility diff --git a/debian_pe/rules b/debian_pe/rules new file mode 100755 index 00000000..9967283b --- /dev/null +++ b/debian_pe/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + chmod +x src/start.py + cp -R src/ $(CURDIR)/debian/tmp/usr/local/share/dupeguru_pe + cp $(CURDIR)/debian/dupeguru_pe.desktop $(CURDIR)/debian/tmp/usr/share/applications + ln -s /usr/local/share/dupeguru_pe/start.py $(CURDIR)/debian/tmp/usr/local/bin/dupeguru_pe + + +# Build architecture-independent files here. +binary-indep: install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install + dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian_se/control b/debian_se/control new file mode 100644 index 00000000..e7235229 --- /dev/null +++ b/debian_se/control @@ -0,0 +1,12 @@ +Source: dupeguru-se +Section: devel +Priority: extra +Maintainer: Virgil Dupras +Build-Depends: debhelper (>= 7) +Standards-Version: 3.8.1 +Homepage: http://www.hardcoded.net + +Package: dupeguru-se +Architecture: any +Depends: python (>= 2.6), python-qt4 (>= 4.6) +Description: dupeGuru diff --git a/debian_se/copyright b/debian_se/copyright new file mode 100644 index 00000000..7c76e796 --- /dev/null +++ b/debian_se/copyright @@ -0,0 +1,11 @@ +Copyright 2010 Hardcoded Software Inc. (http://www.hardcoded.net) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of Hardcoded Software Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + * If the source code has been published less than two years ago, any redistribution, in whole or in part, must retain full licensing functionality, without any attempt to change, obscure or in other ways circumvent its intent. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/debian_se/dirs b/debian_se/dirs new file mode 100644 index 00000000..5ab1c347 --- /dev/null +++ b/debian_se/dirs @@ -0,0 +1,3 @@ +usr/local/bin +usr/local/share +usr/share/applications diff --git a/debian_se/dupeguru_se.desktop b/debian_se/dupeguru_se.desktop new file mode 100644 index 00000000..777c76a9 --- /dev/null +++ b/debian_se/dupeguru_se.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=dupeGuru +Comment=Find duplicate files. +Exec=dupeguru_se +Icon=/usr/local/share/dupeguru_se/dgse_logo_128.png +Terminal=false +Type=Application +Categories=Utility diff --git a/debian_se/rules b/debian_se/rules new file mode 100755 index 00000000..747d011b --- /dev/null +++ b/debian_se/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + chmod +x src/start.py + cp -R src/ $(CURDIR)/debian/tmp/usr/local/share/dupeguru_se + cp $(CURDIR)/debian/dupeguru_se.desktop $(CURDIR)/debian/tmp/usr/share/applications + ln -s /usr/local/share/dupeguru_se/start.py $(CURDIR)/debian/tmp/usr/local/bin/dupeguru_se + + +# Build architecture-independent files here. +binary-indep: install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install + dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/package.py b/package.py index 724abde4..37309cb6 100644 --- a/package.py +++ b/package.py @@ -10,11 +10,12 @@ import sys import os import os.path as op +import compileall import shutil import yaml -from hsutil.build import build_dmg, add_to_pythonpath, print_and_do +from hsutil.build import build_dmg, add_to_pythonpath, print_and_do, copy_packages, build_debian_changelog def package_cocoa(edition): app_path = { @@ -24,7 +25,7 @@ def package_cocoa(edition): }[edition] build_dmg(app_path, '.') -def package_qt(edition): +def package_windows(edition): # On Windows, PyInstaller is used to build an exe (py2exe creates a very bad looking icon) # The release version is outdated. Use at least r672 on http://svn.pyinstaller.org/trunk if sys.platform != "win32": @@ -64,6 +65,40 @@ def package_qt(edition): os.remove('installer_tmp.aip') os.chdir(op.join('..', '..')) +def package_debian(edition): + add_to_pythonpath('qt') + add_to_pythonpath(op.join('qt', edition)) + from app import DupeGuru + + if op.exists('build'): + shutil.rmtree('build') + ed = lambda s: s.format(edition) + destpath = op.join('build', 'dupeguru-{0}-{1}'.format(edition, DupeGuru.VERSION)) + srcpath = op.join(destpath, 'src') + help_src = ed('help_{0}') + os.makedirs(destpath) + shutil.copytree(ed('qt/{0}'), srcpath) + packages = ['hsutil', 'hsgui', 'core', ed('core_{0}'), 'qtlib', 'qt/base'] + if edition == 'me': + packages.append('hsmedia') + copy_packages(packages, srcpath) + # We also have to copy the Send2Trash package + import send2trash + pkg_path = op.dirname(send2trash.__file__) + shutil.copytree(pkg_path, op.join(srcpath, 'send2trash')) + shutil.copytree(ed('debian_{0}'), op.join(destpath, 'debian')) + yaml_path = op.join(help_src, 'changelog.yaml') + changelog_dest = op.join(destpath, 'debian', 'changelog') + project_name = ed('dupeguru-{0}') + from_version = {'se': '2.9.2', 'me': '5.7.2', 'pe': '1.8.5'}[edition] + build_debian_changelog(yaml_path, changelog_dest, project_name, from_version=from_version) + help_name = {'se': 'dupeguru_help', 'me': 'dupeguru_me_help', 'pe': 'dupeguru_pe_help'}[edition] + shutil.copytree(op.join(help_src, help_name), op.join(srcpath, 'help')) + shutil.copy(op.join('images', ed('dg{0}_logo_128.png')), srcpath) + compileall.compile_dir(srcpath) + os.chdir(destpath) + os.system("dpkg-buildpackage") + def main(): conf = yaml.load(open('conf.yaml')) edition = conf['edition'] @@ -76,7 +111,12 @@ def main(): if ui == 'cocoa': package_cocoa(edition) elif ui == 'qt': - package_qt(edition) + if sys.platform == "win32": + package_windows(edition) + elif sys.platform == "linux2": + package_debian(edition) + else: + print "Qt packaging only works under Windows or Linux." if __name__ == '__main__': - main() \ No newline at end of file + main()