On 2020-05-31 16:44 +0530, Pirate Praveen wrote:
> 
> This is a known issue, node-npm-run is temporary and used to create
> node-npm-run-5.0.1 with uscan and uupdate.
> node-npm-run should be deleted to avoid confusion.

OK. Attached is a patch to do this.

I don't write python so this may be less than idiomatic.

I decided to use 'did we cd into the new dir' as the 'it worked, so
the temp dir can be binned' test. You could test whether uupdate ran OK instead.

This is a bit fiddly because the cd is hidden inside a function which
does not pass back any status.

> > node-npm-run-5.0.1/debian/changelog had an extra copy of the stanza for
> > the same version:
> 
> This is added by uupdate.

OK, this is clearly wrong in terms of making a clean package. There
doesn't appear to be a uupdate command for 'don't make a new changelog
entry on update', not a debchange 'remove an entry' option. So after a
bit of thought the neatest way to deal with this seems to be to just
copy the original changelog-made-from-template into the final package
dir, then remove the original temp dir.

If we do this immediately after the chdir into the new dir then we can
be sure that uupdate worked and the new dir was created, so the old
one is no longer wanted.

debdiff attached, but the core of it is:
@@ -100,6 +100,9 @@ class Npm2Deb(object):
 
             new_dir = '%s-%s' % (self.debian_name, self.upstream_version)
             utils.change_dir('../%s' % new_dir)
+            # copy over non-duplicate changelog
+            _os.rename('../%s/debian/changelog' % self.debian_name, 'debian/ch
angelog')
+            _rmtree('../%s' % self.debian_name) 
             self.run_buildpackage()
             self.edit_changelog()
 
(And change changelog template to say 'medium' as the default is no
longer 'low', unless you really do want all these packages to be
'low')

> > node-npm-run (5.0.1-1) UNRELEASED; urgency=medium
> > 
> >   *
> > 
> >  -- Wookey <[email protected]>  Sat, 30 May 2020 16:09:20 +0000
> > 
> > node-npm-run (5.0.1-1) UNRELEASED; urgency=low
> > 
> >   * Initial release (Closes: #nnnn)
> > 
> >  -- Wookey <[email protected]>  Sat, 30 May 2020 16:09:11 +0000


If you don't like the above approach for some reason then the
edit_changelog function could be made to tidy up if there are two
matching stanzas. Something along the lines of the below, but that
need saving the output of processes, and maybe copying result in/out
of pipes, which seems overkill, and is beyond my python-foo in the time
available.

Psuedocode for what needs doing:
        # remove spurious repeat changelog entry if present
        _call(
            'parsechangelog --all | grep " %s (%s-1)" | wc -l' % self.name, 
self.upstream_version, shell=True)
        if result = 2
        _call(
            "sed -i '1-6 d' debian/changelog", shell=True)

Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/
diff -Nru npm2deb-0.3.0/debian/changelog npm2deb-0.3.0/debian/changelog
--- npm2deb-0.3.0/debian/changelog	2020-04-30 15:06:06.000000000 +0100
+++ npm2deb-0.3.0/debian/changelog	2020-06-01 03:51:22.000000000 +0100
@@ -1,3 +1,10 @@
+npm2deb (0.3.0-4.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Remove initial directory if uupdate succeeds (Closes: #961873)
+
+ -- Wookey <[email protected]>  Mon, 01 Jun 2020 02:51:22 +0000
+
 npm2deb (0.3.0-4) unstable; urgency=medium
 
   * Team upload
diff -Nru npm2deb-0.3.0/debian/patches/fix-961873-cleanup-initial-debian-dir.patch npm2deb-0.3.0/debian/patches/fix-961873-cleanup-initial-debian-dir.patch
--- npm2deb-0.3.0/debian/patches/fix-961873-cleanup-initial-debian-dir.patch	1970-01-01 01:00:00.000000000 +0100
+++ npm2deb-0.3.0/debian/patches/fix-961873-cleanup-initial-debian-dir.patch	2020-06-01 03:51:22.000000000 +0100
@@ -0,0 +1,25 @@
+Description: Remove initial temporary debian dir if uupdate succeeds
+Author: Wookey <[email protected]>
+Bug-Debian: https://bugs.debian.org/961873
+Last-Update: 2020-06-01
+
+--- npm2deb-0.3.0.orig/npm2deb/__init__.py
++++ npm2deb-0.3.0/npm2deb/__init__.py
+@@ -100,6 +100,9 @@ class Npm2Deb(object):
+ 
+             new_dir = '%s-%s' % (self.debian_name, self.upstream_version)
+             utils.change_dir('../%s' % new_dir)
++            # copy over non-duplicate changelog
++            _os.rename('../%s/debian/changelog' % self.debian_name, 'debian/changelog')
++            _rmtree('../%s' % self.debian_name) 
+             self.run_buildpackage()
+             self.edit_changelog()
+ 
+--- npm2deb-0.3.0.orig/npm2deb/templates.py
++++ npm2deb-0.3.0/npm2deb/templates.py
+@@ -1,4 +1,4 @@
+-CHANGELOG = """%(debian_name)s (%(version)s-1) UNRELEASED; urgency=low
++CHANGELOG = """%(debian_name)s (%(version)s-1) UNRELEASED; urgency=medium
+ 
+   * Initial release (Closes: #nnnn)
+ 
diff -Nru npm2deb-0.3.0/debian/patches/series npm2deb-0.3.0/debian/patches/series
--- npm2deb-0.3.0/debian/patches/series	2020-04-30 15:04:16.000000000 +0100
+++ npm2deb-0.3.0/debian/patches/series	2020-06-01 03:51:22.000000000 +0100
@@ -2,3 +2,4 @@
 switch-install-to-pkg-js-tools.diff
 switch-to-debhelper-compat.diff
 fix-warnings.diff
+fix-961873-cleanup-initial-debian-dir.patch
diff -Nru npm2deb-0.3.0/debian/source/include-binaries npm2deb-0.3.0/debian/source/include-binaries

Attachment: signature.asc
Description: PGP signature

-- 
Pkg-javascript-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel

Reply via email to