From 89f8214bcee864b2eb00c4cd73609fb224e73f9b Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 16 Jun 2012 07:35:23 -0700 Subject: [PATCH] Improved debian packaging by reducing metadata duplication in the project. --HG-- rename : debian_se/compat => debian/compat rename : debian_se/control => debian/control rename : debian_se/copyright => debian/copyright rename : debian_se/dirs => debian/dirs rename : debian_se/dupeguru_se.desktop => debian/dupeguru.desktop rename : debian_se/rules => debian/rules --- {debian_me => debian}/compat | 0 {debian_se => debian}/control | 6 +- {debian_me => debian}/copyright | 0 {debian_me => debian}/dirs | 0 .../dupeguru.desktop | 6 +- debian/me.json | 6 ++ debian/pe.json | 6 ++ {debian_se => debian}/rules | 8 +- debian/se.json | 6 ++ debian_me/control | 12 --- debian_me/dupeguru_me.desktop | 8 -- debian_me/rules | 87 ------------------- debian_pe/compat | 1 - debian_pe/control | 12 --- debian_pe/copyright | 11 --- debian_pe/dirs | 3 - debian_pe/dupeguru_pe.desktop | 8 -- debian_pe/rules | 87 ------------------- debian_se/compat | 1 - debian_se/copyright | 11 --- debian_se/dirs | 3 - package.py | 15 +++- 22 files changed, 39 insertions(+), 258 deletions(-) rename {debian_me => debian}/compat (100%) rename {debian_se => debian}/control (78%) rename {debian_me => debian}/copyright (100%) rename {debian_me => debian}/dirs (100%) rename debian_se/dupeguru_se.desktop => debian/dupeguru.desktop (56%) create mode 100644 debian/me.json create mode 100644 debian/pe.json rename {debian_se => debian}/rules (84%) create mode 100644 debian/se.json delete mode 100644 debian_me/control delete mode 100644 debian_me/dupeguru_me.desktop delete mode 100755 debian_me/rules delete mode 100644 debian_pe/compat delete mode 100644 debian_pe/control delete mode 100644 debian_pe/copyright delete mode 100644 debian_pe/dirs delete mode 100644 debian_pe/dupeguru_pe.desktop delete mode 100755 debian_pe/rules delete mode 100644 debian_se/compat delete mode 100644 debian_se/copyright delete mode 100644 debian_se/dirs diff --git a/debian_me/compat b/debian/compat similarity index 100% rename from debian_me/compat rename to debian/compat diff --git a/debian_se/control b/debian/control similarity index 78% rename from debian_se/control rename to debian/control index 57bf9ef3..0d8da046 100644 --- a/debian_se/control +++ b/debian/control @@ -1,4 +1,4 @@ -Source: dupeguru-se +Source: {pkgname} Section: devel Priority: extra Maintainer: Virgil Dupras @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 7) Standards-Version: 3.8.1 Homepage: http://www.hardcoded.net -Package: dupeguru-se +Package: {pkgname} Architecture: all Depends: python3 (>=3.2), python3-pyqt4 -Description: dupeGuru +Description: {longname} diff --git a/debian_me/copyright b/debian/copyright similarity index 100% rename from debian_me/copyright rename to debian/copyright diff --git a/debian_me/dirs b/debian/dirs similarity index 100% rename from debian_me/dirs rename to debian/dirs diff --git a/debian_se/dupeguru_se.desktop b/debian/dupeguru.desktop similarity index 56% rename from debian_se/dupeguru_se.desktop rename to debian/dupeguru.desktop index 13f74650..50f5f607 100644 --- a/debian_se/dupeguru_se.desktop +++ b/debian/dupeguru.desktop @@ -1,8 +1,8 @@ [Desktop Entry] -Name=dupeGuru +Name={longname} Comment=Find duplicate files. -Exec=dupeguru_se -Icon=/usr/share/dupeguru_se/dgse_logo_128.png +Exec={execname} +Icon={iconpath} Terminal=false Type=Application Categories=Utility; diff --git a/debian/me.json b/debian/me.json new file mode 100644 index 00000000..b7fc6205 --- /dev/null +++ b/debian/me.json @@ -0,0 +1,6 @@ +{ + "pkgname": "dupeguru-me", + "longname": "dupeGuru Music Edition", + "execname": "dupeguru_me", + "iconpath": "/usr/share/dupeguru_me/dgme_logo_128.png" +} \ No newline at end of file diff --git a/debian/pe.json b/debian/pe.json new file mode 100644 index 00000000..0faadffb --- /dev/null +++ b/debian/pe.json @@ -0,0 +1,6 @@ +{ + "pkgname": "dupeguru-pe", + "longname": "dupeGuru Picture Edition", + "execname": "dupeguru_pe", + "iconpath": "/usr/share/dupeguru_pe/dgpe_logo_128.png" +} \ No newline at end of file diff --git a/debian_se/rules b/debian/rules similarity index 84% rename from debian_se/rules rename to debian/rules index c71d3f3c..c18df5cc 100755 --- a/debian_se/rules +++ b/debian/rules @@ -42,10 +42,10 @@ install: build dh_installdirs chmod +x src/run.py - cp -R src/ $(CURDIR)/debian/dupeguru-se/usr/share/dupeguru_se - cp $(CURDIR)/debian/dupeguru_se.desktop $(CURDIR)/debian/dupeguru-se/usr/share/applications - mkdir $(CURDIR)/debian/dupeguru-se/usr/bin - ln -s /usr/share/dupeguru_se/run.py $(CURDIR)/debian/dupeguru-se/usr/bin/dupeguru_se + cp -R src/ $(CURDIR)/debian/{pkgname}/usr/share/{execname} + cp $(CURDIR)/debian/{execname}.desktop $(CURDIR)/debian/{pkgname}/usr/share/applications + mkdir $(CURDIR)/debian/{pkgname}/usr/bin + ln -s /usr/share/{execname}/run.py $(CURDIR)/debian/{pkgname}/usr/bin/{execname} # Build architecture-independent files here. diff --git a/debian/se.json b/debian/se.json new file mode 100644 index 00000000..80c7a636 --- /dev/null +++ b/debian/se.json @@ -0,0 +1,6 @@ +{ + "pkgname": "dupeguru-se", + "longname": "dupeGuru", + "execname": "dupeguru_se", + "iconpath": "/usr/share/dupeguru_se/dgse_logo_128.png" +} \ No newline at end of file diff --git a/debian_me/control b/debian_me/control deleted file mode 100644 index 1ab39bd3..00000000 --- a/debian_me/control +++ /dev/null @@ -1,12 +0,0 @@ -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: all -Depends: python3 (>=3.2), python3-pyqt4 -Description: dupeGuru Music Edition diff --git a/debian_me/dupeguru_me.desktop b/debian_me/dupeguru_me.desktop deleted file mode 100644 index 8afab61b..00000000 --- a/debian_me/dupeguru_me.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=dupeGuru Music Edition -Comment=Find duplicate songs in your collection. -Exec=dupeguru_me -Icon=/usr/share/dupeguru_me/dgme_logo_128.png -Terminal=false -Type=Application -Categories=Utility; diff --git a/debian_me/rules b/debian_me/rules deleted file mode 100755 index 8eb72a11..00000000 --- a/debian_me/rules +++ /dev/null @@ -1,87 +0,0 @@ -#!/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/run.py - cp -R src/ $(CURDIR)/debian/dupeguru-me/usr/share/dupeguru_me - cp $(CURDIR)/debian/dupeguru_me.desktop $(CURDIR)/debian/dupeguru-me/usr/share/applications - mkdir $(CURDIR)/debian/dupeguru-me/usr/bin - ln -s /usr/share/dupeguru_me/run.py $(CURDIR)/debian/dupeguru-me/usr/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/compat b/debian_pe/compat deleted file mode 100644 index 7f8f011e..00000000 --- a/debian_pe/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/debian_pe/control b/debian_pe/control deleted file mode 100644 index 7d8c820c..00000000 --- a/debian_pe/control +++ /dev/null @@ -1,12 +0,0 @@ -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: python3 (>=3.2), python3-pyqt4 -Description: dupeGuru Picture Edition diff --git a/debian_pe/copyright b/debian_pe/copyright deleted file mode 100644 index ed55be0c..00000000 --- a/debian_pe/copyright +++ /dev/null @@ -1,11 +0,0 @@ -Copyright 2012 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 deleted file mode 100644 index 5ab1c347..00000000 --- a/debian_pe/dirs +++ /dev/null @@ -1,3 +0,0 @@ -usr/local/bin -usr/local/share -usr/share/applications diff --git a/debian_pe/dupeguru_pe.desktop b/debian_pe/dupeguru_pe.desktop deleted file mode 100644 index 50310959..00000000 --- a/debian_pe/dupeguru_pe.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=dupeGuru Picture Edition -Comment=Find duplicate pictures in your library. -Exec=dupeguru_pe -Icon=/usr/share/dupeguru_pe/dgpe_logo_128.png -Terminal=false -Type=Application -Categories=Utility; diff --git a/debian_pe/rules b/debian_pe/rules deleted file mode 100755 index b823d902..00000000 --- a/debian_pe/rules +++ /dev/null @@ -1,87 +0,0 @@ -#!/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/run.py - cp -R src/ $(CURDIR)/debian/dupeguru-pe/usr/share/dupeguru_pe - cp $(CURDIR)/debian/dupeguru_pe.desktop $(CURDIR)/debian/dupeguru-pe/usr/share/applications - mkdir $(CURDIR)/debian/dupeguru-pe/usr/bin - ln -s /usr/share/dupeguru_pe/run.py $(CURDIR)/debian/dupeguru-pe/usr/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/compat b/debian_se/compat deleted file mode 100644 index 7f8f011e..00000000 --- a/debian_se/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/debian_se/copyright b/debian_se/copyright deleted file mode 100644 index ed55be0c..00000000 --- a/debian_se/copyright +++ /dev/null @@ -1,11 +0,0 @@ -Copyright 2012 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 deleted file mode 100644 index 5ab1c347..00000000 --- a/debian_se/dirs +++ /dev/null @@ -1,3 +0,0 @@ -usr/local/bin -usr/local/share -usr/share/applications diff --git a/package.py b/package.py index 5189089e..491e39ae 100644 --- a/package.py +++ b/package.py @@ -15,7 +15,7 @@ from argparse import ArgumentParser from hscommon.plat import ISWINDOWS, ISLINUX from hscommon.build import (build_dmg, add_to_pythonpath, print_and_do, copy_packages, - build_debian_changelog, copy_qt_plugins, get_module_version) + build_debian_changelog, copy_qt_plugins, get_module_version, filereplace, copy) def parse_args(): parser = ArgumentParser() @@ -99,10 +99,17 @@ def package_debian(edition): if edition == 'me': packages.append('hsaudiotag') copy_packages(packages, srcpath) - shutil.copytree(ed('debian_{0}'), op.join(destpath, 'debian')) + debdest = op.join(destpath, 'debian') + os.makedirs(debdest) + debopts = json.load(open(op.join('debian', ed('{}.json')))) + for fn in ['compat', 'copyright', 'dirs']: + copy(op.join('debian', fn), op.join(debdest, fn)) + for fn in ['control', 'rules']: + filereplace(op.join('debian', fn), op.join(debdest, fn), **debopts) + filereplace(op.join('debian', 'dupeguru.desktop'), op.join(debdest, ed('dupeguru_{}.desktop')), **debopts) changelogpath = op.join('help', ed('changelog_{}')) - changelog_dest = op.join(destpath, 'debian', 'changelog') - project_name = ed('dupeguru-{0}') + changelog_dest = op.join(debdest, 'changelog') + project_name = debopts['pkgname'] from_version = {'se': '2.9.2', 'me': '5.7.2', 'pe': '1.8.5'}[edition] build_debian_changelog(changelogpath, changelog_dest, project_name, from_version=from_version) shutil.copytree(op.join('build', 'help'), op.join(srcpath, 'help'))