[Pkg-javascript-commits] [npm2deb] 01/01: automates upto dpkg-buildpackage
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Wed Nov 2 17:11:07 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository npm2deb.
commit 8cded06b6ca093f3aa98d32968527b2bed46e69d
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Wed Nov 2 22:40:04 2016 +0530
automates upto dpkg-buildpackage
---
debian/changelog | 2 +
debian/patches/0006-more-automation.patch | 137 ++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 140 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 72de3f2..db841a6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ npm2deb (0.2.5-4) UNRELEASED; urgency=medium
[ Suhail P ]
* Fix dependency version formats (convert ^ to >=) (Closes: #840207)
+ * Automate upto deb file creation (add uscan, uupdate and dpkg-buildpackage)
+ (Closes: #840174)
-- Pirate Praveen <praveen at debian.org> Sat, 29 Oct 2016 19:45:20 +0530
diff --git a/debian/patches/0006-more-automation.patch b/debian/patches/0006-more-automation.patch
new file mode 100644
index 0000000..93ce6b1
--- /dev/null
+++ b/debian/patches/0006-more-automation.patch
@@ -0,0 +1,137 @@
+From f496bbfd8398b0ec0e3501780350a626a3271bbe Mon Sep 17 00:00:00 2001
+From: Suhail P <psuhailp at gmail.com>
+Date: Wed, 2 Nov 2016 08:58:04 +0000
+Subject: [PATCH 1/4] automating uscan and uupdate
+
+---
+ npm2deb/__init__.py | 19 ++++++++++++++-----
+ npm2deb/scripts.py | 38 +++++++++++++++++++++++++++++---------
+ 2 files changed, 43 insertions(+), 14 deletions(-)
+
+Index: npm2deb/npm2deb/__init__.py
+===================================================================
+--- npm2deb.orig/npm2deb/__init__.py
++++ npm2deb/npm2deb/__init__.py
+@@ -4,6 +4,7 @@ from dateutil import tz as _tz
+ from shutil import rmtree as _rmtree
+ from urllib.request import urlopen as _urlopen
+ from subprocess import getstatusoutput as _getstatusoutput
++from subprocess import call as _call
+ import os as _os
+ import re as _re
+
+@@ -85,6 +86,63 @@ class Npm2Deb(object):
+ utils.change_dir('..')
+ self.create_itp_bug()
+
++ def initiate_build(self ,saved_path):
++ """
++ Try building deb package after creating required files using start().
++ 'uscan', 'uupdate' and 'dpkg-buildpackage' are run if debian/watch is OK.
++ """
++ uscan_info = self.test_uscan()
++ if uscan_info[0] == 0:
++ self.run_uscan()
++
++ remote_file_name = uscan_info[1].split(' ')[-1].split('/')[-1].replace('v','')
++ tar_file_name = '%s-%s' % (self.debian_name, remote_file_name)
++ self.run_uupdate(tar_file_name)
++
++ compression_format = _re.search('\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))', tar_file_name).group(0)
++ new_dir_name = tar_file_name.replace(compression_format, '')
++ utils.change_dir('../%s' % new_dir_name)
++ self.run_buildpackage()
++
++ debian_path = "%s/%s/debian" % (self.name, new_dir_name)
++ print ('\nRemember, your new source directory is %s/%s' % (self.name, new_dir_name))
++
++ else:
++ debian_path = "%s/%s/debian" % (self.name, self.debian_name)
++
++ print("""
++This is not a crystal ball, so please take a look at auto-generated files.\n
++You may want fix first these issues:\n""")
++
++ utils.change_dir(saved_path)
++ _call('/bin/grep --color=auto FIX_ME -r %s/*' % debian_path, shell=True)
++
++ if uscan_info[0] != 0:
++ print ("\nUse uscan to get orig source files. Fix debian/watch and then run\
++ \n$ uscan --download-current-version\n")
++
++
++ def run_buildpackage(self):
++ print ("\nBuilding the binary package")
++ _call('dpkg-source -b .', shell=True)
++ _call('dpkg-buildpackage', shell=True)
++
++ def run_uupdate(self, tar_file):
++ print ('\nCreating debian source package...')
++ _call('uupdate -b ../%s' % tar_file, shell=True)
++
++ def run_uscan(self):
++ print ('\nDownloading source tarball file using debian/watch file...')
++ _os.system('uscan --download-current-version')
++
++ def test_uscan(self):
++ info = _getstatusoutput('uscan --watchfile "debian/watch" '
++ '--package "{}" '
++ '--upstream-version 0 --no-download'
++ .format(self.debian_name))
++ return info
++
++
+ def create_itp_bug(self):
+ utils.debug(1, "creating wnpp bug template")
+ utils.create_file('%s_itp.mail' % self.debian_name, self.get_ITP())
+@@ -118,11 +176,9 @@ class Npm2Deb(object):
+
+ utils.create_debian_file('watch', content)
+ # test watch with uscan, raise exception if status is not 0
+- info = _getstatusoutput('uscan --watchfile "debian/watch" '
+- '--package "{}" '
+- '--upstream-version 0 --no-download'
+- .format(self.debian_name))
+- if info[0] != 0:
++ uscan_info = self.test_uscan()
++
++ if uscan_info[0] != 0:
+ raise ValueError
+
+ except ValueError:
+@@ -330,6 +386,7 @@ class Npm2Deb(object):
+ self._get_json_version()
+ self._get_json_license()
+
++
+ def download(self):
+ utils.debug(1, "downloading %s via npm" % self.name)
+ info = _getstatusoutput('npm install "%s"' % self.name)
+Index: npm2deb/npm2deb/scripts.py
+===================================================================
+--- npm2deb.orig/npm2deb/scripts.py
++++ npm2deb/npm2deb/scripts.py
+@@ -274,20 +274,13 @@ def create(args):
+ _utils.create_dir(npm2deb.name)
+ _utils.change_dir(npm2deb.name)
+ npm2deb.start()
+- _utils.change_dir(saved_path)
++ _utils.change_dir(npm2deb.debian_name)
++ npm2deb.initiate_build(saved_path)
++
+ except OSError as os_error:
+ print(str(os_error))
+ exit(1)
+
+- debian_path = "%s/%s/debian" % (npm2deb.name, npm2deb.debian_name)
+-
+- print("""
+-This is not a crystal ball, so please take a look at auto-generated files.\n
+-You may want fix first these issues:\n""")
+- _call('/bin/grep --color=auto FIX_ME -r %s/*' % debian_path, shell=True)
+- print ("\nUse uscan to get orig source files. Fix debian/watch and then run\
+- \n$ uscan --download-current-version\n")
+-
+ _show_mapper_warnings()
+
+
diff --git a/debian/patches/series b/debian/patches/series
index 16bc8dc..dd97b88 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
0003-fix-crash.patch
0004-bump-standards.patch
0005-fix-dependency-format.patch
+0006-more-automation.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/npm2deb.git
More information about the Pkg-javascript-commits
mailing list