From: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 49431@debbugs.gnu.org, Luis Felipe <luis.felipe.la@protonmail.com>
Subject: [bug#49431] [PATCH maintenance.git] nginx: berlin: Redirect old video URLs for each language.
Date: Fri, 9 Jul 2021 21:38:44 +0200 [thread overview]
Message-ID: <20210709193844.dk4e7q5nanqe7iz7@pelzflorian.localdomain> (raw)
In-Reply-To: <20210709070715.235m7qs3gicmms4w@pelzflorian.localdomain>
On Fri, Jul 09, 2021 at 09:15:04AM +0200, pelzflorian (Florian Pelz) wrote:
> From: Florian Pelz <pelzflorian@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
next prev parent reply other threads:[~2021-07-09 19:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-06 6:53 [bug#49431] [PATCH maintenance.git] nginx: berlin: Redirect old video URLs for each language pelzflorian (Florian Pelz)
2021-07-07 17:51 ` Luis Felipe via Guix-patches via
2021-07-08 13:53 ` Ludovic Courtès
2021-07-09 7:15 ` pelzflorian (Florian Pelz)
2021-07-09 19:38 ` pelzflorian (Florian Pelz) [this message]
2021-07-10 13:41 ` Ludovic Courtès
2021-07-10 10:27 ` Ludovic Courtès
2021-07-10 19:28 ` bug#49431: " pelzflorian (Florian Pelz)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210709193844.dk4e7q5nanqe7iz7@pelzflorian.localdomain \
--to=pelzflorian@pelzflorian.de \
--cc=49431@debbugs.gnu.org \
--cc=ludo@gnu.org \
--cc=luis.felipe.la@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).