Virgil Dupras avatar Virgil Dupras committed 2de47b2

Improved Debian packaging.

Comments (0)

Files changed (4)

 aebef66cb902754d56482c0d01ac19f7d6ebad11 cocoalib
-7eceed0d676bb69f4187b61da9256358840576dd hscommon
+ad29321d6b4186a8367930e53ef5de59b77752ef hscommon
 48131959afaba0f50ef8014fd6adf83012915b5b qtlib
+#!/usr/bin/make -f
+
+all:
+	dh_prep  
+	dh_installdirs
+	chmod +x src/run.py
+	cp -R src/ $(CURDIR)/debian/pdfmasher/usr/share/pdfmasher
+	cp $(CURDIR)/debian/pdfmasher.desktop $(CURDIR)/debian/pdfmasher/usr/share/applications
+	ln -s /usr/share/pdfmasher/run.py $(CURDIR)/debian/pdfmasher/usr/bin/pdfmasher
 #!/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/pdfmasher/usr/share/pdfmasher
-	cp $(CURDIR)/debian/pdfmasher.desktop $(CURDIR)/debian/pdfmasher/usr/share/applications
-	ln -s /usr/share/pdfmasher/run.py $(CURDIR)/debian/pdfmasher/usr/bin/pdfmasher
-
-
-# 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
+%:
+	dh $@
 from argparse import ArgumentParser
 
 from hscommon.build import (copy_packages, build_debian_changelog, copy_qt_plugins, print_and_do,
-    get_module_version, setup_package_argparser, package_cocoa_app_in_dmg)
+    get_module_version, setup_package_argparser, package_cocoa_app_in_dmg, move)
 from hscommon.plat import ISLINUX, ISWINDOWS
 
 def parse_args():
     parser = ArgumentParser()
     setup_package_argparser(parser)
+    parser.add_argument('--source', action='store_true', dest='source_pkg',
+        help="Build only a source debian package (Linux only).")
     return parser.parse_args()
 
 def package_windows(dev):
         os.remove('installer_tmp.aip')
     
 
-def package_debian():
+def package_debian(source_pkg):
     app_version = get_module_version('core')
     destpath = op.join('build', 'pdfmasher-{}'.format(app_version))
     if op.exists(destpath):
     shutil.copy('run.py', op.join(srcpath, 'run.py'))
     copy_packages(['qt', 'ebooks', 'hscommon', 'core', 'qtlib', 'pdfminer', 'ply', 'jobprogress', 'markdown', 'cssutils', 'encutils'], srcpath)
     shutil.copytree('debian', op.join(destpath, 'debian'))
+    move(op.join(destpath, 'debian', 'Makefile'), op.join(destpath, 'Makefile'))
     build_debian_changelog(op.join('help', 'changelog'), op.join(destpath, 'debian', 'changelog'),
         'pdfmasher', from_version='0.1.0')
     shutil.copytree(op.join('build', 'help'), op.join(srcpath, 'help'))
     shutil.copy(op.join('images', 'logo_small.png'), srcpath)
     compileall.compile_dir(srcpath)
     os.chdir(destpath)
-    os.system("dpkg-buildpackage")
+    cmd = "dpkg-buildpackage"
+    if source_pkg:
+        cmd += " -S"
+    os.system(cmd)
 
 def main():
     args = parse_args()
         if ISWINDOWS:
             package_windows(dev)
         elif ISLINUX:
-            package_debian()
+            package_debian(args.source_pkg)
         else:
             print("Qt packaging only works under Windows or Linux.")
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.