GNU bug report logs - #49431
[PATCH maintenance.git] nginx: berlin: Redirect old video URLs for each language.

Previous Next

Package: guix-patches;

Reported by: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>

Date: Tue, 6 Jul 2021 06:54:02 UTC

Severity: normal

Tags: patch

Done: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49431 in the body.
You can then email your comments to 49431 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#49431; Package guix-patches. (Tue, 06 Jul 2021 06:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 06 Jul 2021 06:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: guix-patches <at> gnu.org
Cc: Luis Felipe <luis.felipe.la <at> protonmail.com>
Subject: [PATCH maintenance.git] nginx: berlin: Redirect old video URLs for
 each language.
Date: Tue, 6 Jul 2021 08:53:04 +0200
[Message part 1 (text/plain, inline)]
Hi guix,

a week ago Luis nicely redesigned how videos are displayed on the Guix
website
<https://lists.gnu.org/archive/html/guix-patches/2021-07/msg00005.html>.
(Because the old CSS stylesheets are cached by the browser, the
website displayed videos wrongly for a day though.)

This patch adds redirects for the guix website from the old video URLs
like

/LANG/videos/everyday-use-of-gnu-guix,-part-one/index.html
/LANG/videos/everyday-use-of-gnu-guix,-part-one/
/LANG/videos/everyday-use-of-gnu-guix,-part-one

to the new

/LANG/videos/2020/everyday-use-of-gnu-guix-part-one/

but maybe the patch is too ugly because that’s code duplication to
have three added redirections for each video.  Note that my old
videos page actually linked to
</LANG/videos/everyday-use-of-gnu-guix,-part-one/index.html> and not
</LANG/videos/everyday-use-of-gnu-guix,-part-one/> as usual.

Shall I push it as-is to guix/maintenance.git,

or do you think it would be better to rewrite the redirect procedure
to return a list to redirect every URL with suffixes

""
"/"
"/index.html"

and change guix.gnu.org-locations accordingly to flatten the location
list?

The patch was tested on a VM of berlin.scm with some services, file
systems and SSL removed and I’m confident it does what it should.

Regards,
Florian
[nginx-berlin-Redirect-old-video-URLs-for-each-language.patch (text/plain, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#49431; Package guix-patches. (Wed, 07 Jul 2021 17:53:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Luis Felipe <luis.felipe.la <at> protonmail.com>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: guix-patches <at> gnu.org
Subject: Re: [PATCH maintenance.git] nginx: berlin: Redirect old video URLs
 for each language.
Date: Wed, 07 Jul 2021 17:51:54 +0000
Hi Florian,


On Tuesday, July 6th, 2021 at 6:53 AM, pelzflorian (Florian Pelz) <pelzflorian <at> pelzflorian.de> wrote:

> This patch adds redirects for the guix website from the old video URLs
>
> like
>
> /LANG/videos/everyday-use-of-gnu-guix,-part-one/index.html
>
> /LANG/videos/everyday-use-of-gnu-guix,-part-one/
>
> /LANG/videos/everyday-use-of-gnu-guix,-part-one
>
> to the new
>
> /LANG/videos/2020/everyday-use-of-gnu-guix-part-one/
>
> but maybe the patch is too ugly because that’s code duplication to
>
> have three added redirections for each video. Note that my old
>
> videos page actually linked to
>
> </LANG/videos/everyday-use-of-gnu-guix,-part-one/index.html> and not
>
> </LANG/videos/everyday-use-of-gnu-guix,-part-one/> as usual.
>
> Shall I push it as-is to guix/maintenance.git,
>
> or do you think it would be better to rewrite the redirect procedure
>
> to return a list to redirect every URL with suffixes
>
> ""
>
> "/"
>
> "/index.html"
>
> and change guix.gnu.org-locations accordingly to flatten the location
>
> list?

I took a look at the patch, but I'm not familiar with the server-side of things, so there's not much I can say except that I trust your judgement on this :)

Thanks for taking care of it.




Information forwarded to guix-patches <at> gnu.org:
bug#49431; Package guix-patches. (Thu, 08 Jul 2021 13:54:01 GMT) Full text and rfc822 format available.

Message #11 received at 49431 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: 49431 <at> debbugs.gnu.org, Luis Felipe <luis.felipe.la <at> protonmail.com>
Subject: Re: bug#49431: [PATCH maintenance.git] nginx: berlin: Redirect old
 video URLs for each language.
Date: Thu, 08 Jul 2021 15:53:16 +0200
Hi,

"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> This patch adds redirects for the guix website from the old video URLs
> like
>
> /LANG/videos/everyday-use-of-gnu-guix,-part-one/index.html
> /LANG/videos/everyday-use-of-gnu-guix,-part-one/
> /LANG/videos/everyday-use-of-gnu-guix,-part-one
>
> to the new
>
> /LANG/videos/2020/everyday-use-of-gnu-guix-part-one/

[...]

>>From d52a189332aa014f9da88fa1ce1e38ffc107fa3b Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Sun, 4 Jul 2021 14:46:39 +0200
> Subject: [PATCH] nginx: berlin: Redirect old video URLs for each language.
>
> * hydra/nginx/berlin.scm (languages-to-accept): New list.  Move here
> the languages list from ...
> (%extra-content) ... here.  Use languages from 'languages-to-accept'.
> (guix.gnu.org-redirect-locations-for-lang): New procedure.  Add
> new video redirections.
> (guix.gnu.org-redirect-locations): New list.  Move here the
> old redirections.  Update old video redirections.
> (guix.gnu.org-other-locations): New list.  Move here the other nginx
> locations from ...
> (guix.gnu.org-locations): ... here.  Reimplement in terms of the above.

[...]

>     (redirect "/screenshots/xfce" "/$lang/screenshots/xfce/")
>     (redirect "/security" "/$lang/security/")
>     (redirect "/videos" "/$lang/videos/")
> -   (redirect "/videos/asking-for-help" "/$lang/videos/asking-for-help/")
> -   (redirect "/videos/everyday-use-of-gnu-guix,-part-one" "/$lang/videos/everyday-use-of-gnu-guix,-part-one/")
> -   (redirect "/videos/everyday-use-of-gnu-guix,-part-two" "/$lang/videos/everyday-use-of-gnu-guix,-part-two/")
> -   (redirect "/videos/installation-from-script" "/$lang/videos/installation-from-script/")
> -   (redirect "/videos/packaging,-part-one" "/$lang/videos/packaging,-part-one/")
> -   (redirect "/videos/packaging,-part-two" "/$lang/videos/packaging,-part-two/")
> -   (redirect "/videos/packaging,-part-three" "/$lang/videos/packaging,-part-three/")
> -
> +   (redirect "/videos/asking-for-help" "/$lang/videos/2020/asking-for-help/")
> +   (redirect "/videos/everyday-use-of-gnu-guix,-part-one" "/$lang/videos/2020/everyday-use-of-gnu-guix-part-one/")
> +   (redirect "/videos/everyday-use-of-gnu-guix,-part-two" "/$lang/videos/2020/everyday-use-of-gnu-guix-part-two/")
> +   (redirect "/videos/installation-from-script" "/$lang/videos/2020/installation-from-script/")
> +   (redirect "/videos/packaging,-part-one" "/$lang/videos/2020/packaging-part-one/")
> +   (redirect "/videos/packaging,-part-two" "/$lang/videos/2020/packaging-part-two/")
> +   (redirect "/videos/packaging,-part-three" "/$lang/videos/2020/packaging-part-three/")))

Shouldn’t we also redirect

  /$lang/videos/everyday-use-of-gnu-guix,-part-one/ -> /$lang/videos/2020/everyday-use-of-gnu-guix-part-one/

since the left-hand side here was the right-hand side of the previous
redirects?

Anyway, at first sight it LGTM!

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#49431; Package guix-patches. (Fri, 09 Jul 2021 07:16:01 GMT) Full text and rfc822 format available.

Message #14 received at 49431 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 49431 <at> debbugs.gnu.org, Luis Felipe <luis.felipe.la <at> protonmail.com>
Subject: Re: bug#49431: [PATCH maintenance.git] nginx: berlin: Redirect old
 video URLs for each language.
Date: Fri, 9 Jul 2021 09:15:04 +0200
[Message part 1 (text/plain, inline)]
Thank you two for your opinion, Luis and Ludo.

On Thu, Jul 08, 2021 at 03:53:16PM +0200, Ludovic Courtès wrote:
> Shouldn’t we also redirect
> 
>   /$lang/videos/everyday-use-of-gnu-guix,-part-one/ -> /$lang/videos/2020/everyday-use-of-gnu-guix-part-one/
> 
> since the left-hand side here was the right-hand side of the previous
> redirects?

Each valid $lang was handled further down, but my patch was confusing,
especially when somebody wants to add more redirections.  Find
attached a revised patch with per-language redirection in only one
place, namely new procedure
`guix.gnu.org-redirects-for-each-language'.

Do I need to add a copyright header?  I hereby license/declare my
patch CC0 <https://creativecommons.org/publicdomain/zero/1.0/>.

In the previous patch I had missed some cases without /LANG like

/videos/everyday-use-of-gnu-guix,-part-one/index.html -> /$lang/videos/2020/everyday-use-of-gnu-guix-part-one/

Redirecting was unnecessary for

/videos/everyday-use-of-gnu-guix,-part-one/ -> /$lang/videos/2020/everyday-use-of-gnu-guix-part-one/

which already gets taken care of by

/videos/everyday-use-of-gnu-guix,-part-one -> /$lang/videos/2020/everyday-use-of-gnu-guix-part-one/

thanks to nginx location normalization.

Shall I push and then wait until someone guix system reconfigures
berlin?

Regards,
Florian
[nginx-berlin-Redirect-old-video-URLs-for-each-language-v2.patch (text/plain, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#49431; Package guix-patches. (Fri, 09 Jul 2021 19:39:02 GMT) Full text and rfc822 format available.

Message #17 received at 49431 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 49431 <at> debbugs.gnu.org, Luis Felipe <luis.felipe.la <at> protonmail.com>
Subject: Re: [bug#49431] [PATCH maintenance.git] nginx: berlin: Redirect old
 video URLs for each language.
Date: Fri, 9 Jul 2021 21:38:44 +0200
On Fri, Jul 09, 2021 at 09:15:04AM +0200, pelzflorian (Florian Pelz) wrote:
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> > (guix.gnu.org-redirects-for-each-language): New procedure.  Add
> > new video redirections. […]
> > +(define (guix.gnu.org-redirects-for-each-language)
> > +  ;; These old URL request paths existed in many forms; without /LANG
> > +  ;; in front and with /LANG in front for each language.  Redirect
> > +  ;; each of them.
> > +  (define redirections
> > +    (list
> > +     (cons "/videos/everyday-use-of-gnu-guix,-part-one" "/videos/2020/everyday-use-of-gnu-guix-part-one/")
> > +     (cons "/videos/everyday-use-of-gnu-guix,-part-two" "/videos/2020/everyday-use-of-gnu-guix-part-two/")
> > +     (cons "/videos/system-graphical-installer" "/videos/2020/system-graphical-installer/")
> > +     (cons "/videos/asking-for-help" "/videos/2020/asking-for-help/")
> > +     (cons "/videos/installation-from-script" "/videos/2020/installation-from-script/")
> > +     (cons "/videos/packaging,-part-one" "/videos/2020/packaging-part-one/")
> > +     (cons "/videos/packaging,-part-two" "/videos/2020/packaging-part-two/")
> > +     (cons "/videos/packaging,-part-three" "/videos/2020/packaging-part-three/")))
> > +
> > +  (define (redirect-directory old new)
> > +    ;; Match nginx' behavior that request URLs with suffix "", "/"
> > +    ;; "/index.html" lead to the same file.  The suffix "/" is not taken
> > +    ;; care of here because it already gets normalized by nginx location
> > +    ;; handling.  The URLs in 'guix.gnu.org-redirect-locations' do not
> > +    ;; need this treatment, because they get an /index.html suffix
> > +    ;; through rewriting.
> > +    (let ((old-with-slashes-trimmed (string-trim-right old #\/)))
> > +      (list
> > +       (redirect old-with-slashes-trimmed new)
> > +       (redirect (string-append old-with-slashes-trimmed "/index.html") new))))
> > +
> > +  (define (guix.gnu.org-redirect-locations-for-lang lang)
> > +    (define (redirect-lang old new)
> > +      (redirect-directory (string-append "/" lang old)
> > +                          (string-append "/" lang new)))
> > +    (append-map redirect-lang (map car redirections) (map cdr redirections)))
> > +
> > +  (append
> > +   ;; Now all needed redirections are:
> > +   ;;
> > +   ;; 1) those without /LANG/ in front get redirected to /$lang/
> > +   (append-map redirect-directory
> > +               (map car redirections) ;old URLs without /LANG
> > +               ;; new URLs with /$lang prepended:
> > +               (map (compose (lambda (new-without-lang)
> > +                               (string-append "/$lang" new-without-lang))
> > +                             cdr)
> > +                    redirections))
> > +   ;; 2) those with /LANG/ in front get redirected to the same /LANG/
> > +   (append-map guix.gnu.org-redirect-locations-for-lang
> > +               (map car languages-to-accept))))
> Do I need to add a copyright header?  I hereby license/declare my
> patch CC0 <https://creativecommons.org/publicdomain/zero/1.0/>.
> […]
> Shall I push and then wait until someone guix system reconfigures
> berlin?

Sorry for again asking such general questions.  A better question
might be, should 'guix.gnu.org-redirects-for-each-language' go to a
separate Guile module with a copyright header (if yes, what could it
be named?), or remain in hydra/nginx/berlin.scm despite more complex
code, without licensing information?

Regards,
Florian




Information forwarded to guix-patches <at> gnu.org:
bug#49431; Package guix-patches. (Sat, 10 Jul 2021 10:28:01 GMT) Full text and rfc822 format available.

Message #20 received at 49431 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: 49431 <at> debbugs.gnu.org, Luis Felipe <luis.felipe.la <at> protonmail.com>
Subject: Re: bug#49431: [PATCH maintenance.git] nginx: berlin: Redirect old
 video URLs for each language.
Date: Sat, 10 Jul 2021 12:27:05 +0200
Hi,

"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> On Thu, Jul 08, 2021 at 03:53:16PM +0200, Ludovic Courtès wrote:
>> Shouldn’t we also redirect
>> 
>>   /$lang/videos/everyday-use-of-gnu-guix,-part-one/ -> /$lang/videos/2020/everyday-use-of-gnu-guix-part-one/
>> 
>> since the left-hand side here was the right-hand side of the previous
>> redirects?
>
> Each valid $lang was handled further down, but my patch was confusing,
> especially when somebody wants to add more redirections.  Find
> attached a revised patch with per-language redirection in only one
> place, namely new procedure
> `guix.gnu.org-redirects-for-each-language'.

OK.

> Do I need to add a copyright header?  I hereby license/declare my
> patch CC0 <https://creativecommons.org/publicdomain/zero/1.0/>.

Currently there’s no explicit license on this file,
hydra/nginx/berlin.scm.

There’s very little at stake for the sake of transparency, it might be
best to email guix-sysadmins so people who contribute to this file (and
to hydra/berlin.scm) agree on the license.  The default license in the
project would be GPLv3+, but these config files are “special”.

> Shall I push and then wait until someone guix system reconfigures
> berlin?

Yes, please!

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#49431; Package guix-patches. (Sat, 10 Jul 2021 13:42:01 GMT) Full text and rfc822 format available.

Message #23 received at 49431 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: 49431 <at> debbugs.gnu.org, Luis Felipe <luis.felipe.la <at> protonmail.com>
Subject: Re: [bug#49431] [PATCH maintenance.git] nginx: berlin: Redirect old
 video URLs for each language.
Date: Sat, 10 Jul 2021 15:41:43 +0200
Hi,

"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> Sorry for again asking such general questions.  A better question
> might be, should 'guix.gnu.org-redirects-for-each-language' go to a
> separate Guile module with a copyright header (if yes, what could it
> be named?), or remain in hydra/nginx/berlin.scm despite more complex
> code, without licensing information?

Let’s keep it in hydra/nginx/berlin.scm for now, and split in several
files later if we feel it’s becoming too messy.  (As for copyright, it’s
not even clear to me that a list of redirects is copyrightable per se
since it there’s only one way to do it.)

Ludo’.




Reply sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
You have taken responsibility. (Sat, 10 Jul 2021 19:30:02 GMT) Full text and rfc822 format available.

Notification sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
bug acknowledged by developer. (Sat, 10 Jul 2021 19:30:03 GMT) Full text and rfc822 format available.

Message #28 received at 49431-done <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 49431-done <at> debbugs.gnu.org, Luis Felipe <luis.felipe.la <at> protonmail.com>
Subject: Re: bug#49431: [PATCH maintenance.git] nginx: berlin: Redirect old
 video URLs for each language.
Date: Sat, 10 Jul 2021 21:28:32 +0200
On Sat, Jul 10, 2021 at 12:27:05PM +0200, Ludovic Courtès wrote:
> "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:
> > Do I need to add a copyright header?  I hereby license/declare my
> > patch CC0 <https://creativecommons.org/publicdomain/zero/1.0/>.
> 
> Currently there’s no explicit license on this file,
> hydra/nginx/berlin.scm.
> 
> There’s very little at stake for the sake of transparency, it might be
> best to email guix-sysadmins so people who contribute to this file (and
> to hydra/berlin.scm) agree on the license.  The default license in the
> project would be GPLv3+, but these config files are “special”.

I will send a mail with a patch there.  Thank you.


> > Shall I push and then wait until someone guix system reconfigures
> > berlin?
> 
> Yes, please!

Finally pushed as 2d6dc5e01aa32a01b345ba834e32bbf723e67077.  Old video
URLs will be redirected after guix system reconfigure.

Regards,
Florian




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 08 Aug 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 259 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.