[2019-05-11 16:08] Jelmer Vernooij <[email protected]>
> On Sat, May 11, 2019 at 02:49:11PM +0000, Dmitry Bogatov wrote:
> > From 2789fed85a6088c85f8f37ba96984eb7f3d8e8ef Mon Sep 17 00:00:00 2001
> > From: Dmitry Bogatov <[email protected]>
> > Date: Fri, 10 May 2019 23:32:01 +0000
> > Subject: [PATCH] Make debian-watch-uses-insecure-uri more generic
> > 
> > Instead of using hard-coded list of hosts, that are known to support
> > https new implementation just replace "http://"; with "https://"; and
> > makes sure, that uscan report is same.
> Does lintian-brush still build successfully under e.g. sbuild with this patch?
> I suspect that this makes the test for debian-watch-uses-insecure-uri fail
> because it now needs internet access.

Good catch. What do you want me to do about it?

By the way, how does it come that "homepage-uses-insecure-uri" does not
fail in sbuild?

> This also seems to unconditionally run uscan, regardless of whether
> there are any http: URLs in debian/watch, slowing down lintian-brush
> in situations when there's nothing to fix. Could you perhaps grep for
> http: first?

Good idea.

From f1a994eae7b81f208a6973af4249918b87bd26ea Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <[email protected]>
Date: Fri, 10 May 2019 23:32:01 +0000
Subject: [PATCH] Make debian-watch-uses-insecure-uri more generic

Instead of using hard-coded list of hosts, that are known to support
https new implementation just replace "http://"; with "https://"; and
makes sure, that uscan report is same.
---
 fixers/debian-watch-uses-insecure-uri.sh | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/fixers/debian-watch-uses-insecure-uri.sh 
b/fixers/debian-watch-uses-insecure-uri.sh
index 85136b8..66c9dad 100755
--- a/fixers/debian-watch-uses-insecure-uri.sh
+++ b/fixers/debian-watch-uses-insecure-uri.sh
@@ -1,6 +1,20 @@
 #!/bin/sh
-perl -p -i -e 
's/http:\/\/code.launchpad.net\//https:\/\/code.launchpad.net\//' debian/watch
-perl -p -i -e 's/http:\/\/launchpad.net\//https:\/\/launchpad.net\//' 
debian/watch
-perl -p -i -e 's/http:\/\/ftp.gnu.org\//https:\/\/ftp.gnu.org\//' debian/watch
+test -r debian/watch        || exit 0
+grep 'http://' debian/watch || exit 0
+
+before=$(mktemp)
+after=$(mktemp)
+uscan --dehs > "${before}" 2>&1
+sed -i.bak s,http://,https://,g debian/watch
+uscan --dehs > "${after}" 2>&1
+
+# Make sure that reports are same up to http/https substitution in URL.
+sed -i s,http://,https://,g "${before}" "${after}"
+if cmp -s "${before}" "${after}" ; then
+       rm -f debian/watch.bak
+else
+       mv debian/watch.bak debian/watch
+fi
+rm -f "${before}" "${after}"
 echo "Use secure URI in debian/watch."
 echo "Fixed-Lintian-Tags: debian-watch-uses-insecure-uri"
-- 
        Note, that I send and fetch email in batch, once every 24 hours.
                 If matter is urgent, try https://t.me/kaction
                                                                             --

Reply via email to