[Pkg-javascript-commits] [npm2deb] 01/01: fix fakeupstream case

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Thu Nov 3 18:41:26 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 3d3cf4504029cdcb1c51e4fed90421d084ce29b7
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Fri Nov 4 00:09:18 2016 +0530

    fix fakeupstream case
---
 debian/changelog                                   |  3 +-
 debian/patches/0006-more-automation.patch          | 78 +++++++++++++---------
 ...007-install-files-section-of-package-json.patch |  4 +-
 3 files changed, 49 insertions(+), 36 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 08bc7d2..1d09973 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,11 +4,12 @@ npm2deb (0.2.5-4) UNRELEASED; urgency=medium
   * Bump standards version of generated packages to 3.9.8
   * Fix vcs url (Closes: #842741), typo in copyright (Closes: #842742)
     (thanks to Evgeni Golov)
+  * fakeupstream service can now return dist tarballs (Closes: #840967)
 
   [ Suhail P ]
   * Fix dependency version formats (convert ^ to >=) (Closes: #840207)
   * Automate up to deb file creation (add uscan, uupdate and dpkg-buildpackage)
-    (Closes: #840174)
+    (Closes: #840174) 
 
   [ Shanavas M ]
   * When package.json has a files section, install them (Closes: #841995)
diff --git a/debian/patches/0006-more-automation.patch b/debian/patches/0006-more-automation.patch
index 0b8ee65..d026d86 100644
--- a/debian/patches/0006-more-automation.patch
+++ b/debian/patches/0006-more-automation.patch
@@ -1,7 +1,7 @@
 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/7] automating uscan and uupdate
+Subject: [PATCH 1/8] automating uscan and uupdate
 
 ---
  npm2deb/__init__.py | 19 ++++++++++++++-----
@@ -24,11 +24,11 @@ Index: npm2deb/npm2deb/__init__.py
          self.debian_standards = STANDARDS_VERSION
          self.debian_debhelper = DEBHELPER
          self.noclean = False
-+        self.uscan_info = ''
++        self.upstream_watch = False
          if args:
              if 'upstream_license' in args and args['upstream_license']:
                  self.upstream_license = args['upstream_license']
-@@ -85,6 +87,82 @@ class Npm2Deb(object):
+@@ -85,6 +87,90 @@ class Npm2Deb(object):
          utils.change_dir('..')
          self.create_itp_bug()
  
@@ -37,54 +37,62 @@ Index: npm2deb/npm2deb/__init__.py
 +        Try building deb package after creating required files using start().
 +        'uscan', 'uupdate' and 'dpkg-buildpackage' are run if debian/watch is OK.
 +        """
-+        if self.uscan_info[0] == 0:
++        uscan_info = self.test_uscan()
++        if uscan_info[0] == 0:
 +            self.run_uscan()
-+            
-+            remote_file_name = self.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()
 +
++            for name in _os.listdir('..'):
++                orig_file = _re.search('%s_(\d.*)\.orig\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))' % self.debian_name, name)
++                if orig_file:
++                    orig_file = orig_file.group(0)
++                    break
++            self.run_uupdate(orig_file)
++
++            new_dir = orig_file[:orig_file.find('.orig')].replace('_','-')
++            utils.change_dir('../%s' % new_dir)
++            self.run_buildpackage()
 +            self.edit_changelog()
-+            
-+            debian_path = "%s/%s/debian" % (self.name, new_dir_name)
-+            print ('\nRemember, your new source directory is %s/%s' % (self.name, new_dir_name))
-+            
++
++            debian_path = "%s/%s/debian" % (self.name, new_dir)
++            print ('\nRemember, your new source directory is %s/%s' % (self.name, new_dir))
++
 +        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 self.uscan_info[0] != 0:
++        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")
 +
++        if self.upstream_watch:
++            print ("""
++*** Warning ***\nUsing fakeupstream to download npm dist tarballs, because upstream
++git repo is missing tags. Its better to ask upstream to tag their releases
++instead of using npm dist tarballs as dist tarballs may contain pre built files
++and may not include tests.""")
 +
 +    def edit_changelog(self):
 +        """
-+        This function is to remove extra line '* New upstream release' 
-+        from debian/changelog 
++        This function is to remove extra line '* New upstream release'
++        from debian/changelog
 +        """
 +        with open('debian/changelog', 'r') as f:
 +            data = f.read()
 +        f.close()
-+        
++
 +        data_list = data.split('\n')
 +        data_list.pop(3)
 +
 +        with open('debian/changelog', 'w') as f:
 +            f.write('\n'.join(data_list))
 +        f.close()
-+        
++
 +    def run_buildpackage(self):
 +        print ("\nBuilding the binary package")
 +        _call('dpkg-source -b .', shell=True)
@@ -99,19 +107,19 @@ Index: npm2deb/npm2deb/__init__.py
 +    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))
-+        self.uscan_info = info
++        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 +196,9 @@ class Npm2Deb(object):
+@@ -118,14 +204,13 @@ class Npm2Deb(object):
  
              utils.create_debian_file('watch', content)
              # test watch with uscan, raise exception if status is not 0
@@ -120,13 +128,17 @@ Index: npm2deb/npm2deb/__init__.py
 -                                    '--upstream-version 0 --no-download'
 -                                    .format(self.debian_name))
 -            if info[0] != 0:
-+            self.test_uscan()
-+            
-+            if self.uscan_info[0] != 0:
++            uscan_info = self.test_uscan()
++
++            if uscan_info[0] != 0:
                  raise ValueError
  
          except ValueError:
-@@ -330,6 +406,7 @@ class Npm2Deb(object):
++            self.upstream_watch = True
+             content = utils.get_watch('fakeupstream') % args
+             utils.create_debian_file('watch', content)
+ 
+@@ -330,6 +415,7 @@ class Npm2Deb(object):
          self._get_json_version()
          self._get_json_license()
  
@@ -145,7 +157,7 @@ Index: npm2deb/npm2deb/scripts.py
 -        _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)
diff --git a/debian/patches/0007-install-files-section-of-package-json.patch b/debian/patches/0007-install-files-section-of-package-json.patch
index 02ecb3a..ab77e95 100644
--- a/debian/patches/0007-install-files-section-of-package-json.patch
+++ b/debian/patches/0007-install-files-section-of-package-json.patch
@@ -15,7 +15,7 @@ Index: npm2deb/npm2deb/__init__.py
 ===================================================================
 --- npm2deb.orig/npm2deb/__init__.py
 +++ npm2deb/npm2deb/__init__.py
-@@ -229,11 +229,29 @@ You may want fix first these issues:\n""
+@@ -238,11 +238,29 @@ and may not include tests.""")
  
      def create_install(self):
          content = ''
@@ -48,7 +48,7 @@ Index: npm2deb/npm2deb/__init__.py
          # install main if not in a subpath
          if 'main' in self.json:
              main = self.json['main']
-@@ -241,12 +259,13 @@ You may want fix first these issues:\n""
+@@ -250,12 +268,13 @@ and may not include tests.""")
              if main == 'index':
                  main = 'index.js'
              if not main.find('/') > 0:

-- 
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