From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mAQqOSg+22HFcAEAgWs5BA (envelope-from ) for ; Sun, 09 Jan 2022 20:57:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8Eb3NSg+22EHMgAAauVa8A (envelope-from ) for ; Sun, 09 Jan 2022 20:57:28 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B26A52E0F3 for ; Sun, 9 Jan 2022 20:57:27 +0100 (CET) Received: from localhost ([::1]:56898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6eJi-0000sH-CH for larch@yhetil.org; Sun, 09 Jan 2022 14:57:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6eJX-0000rt-U6 for guix-devel@gnu.org; Sun, 09 Jan 2022 14:57:15 -0500 Received: from mira.cbaines.net ([212.71.252.8]:36246) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6eJV-0004FE-PP; Sun, 09 Jan 2022 14:57:15 -0500 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 30ED927BBE9; Sun, 9 Jan 2022 19:57:12 +0000 (GMT) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 8b324080; Sun, 9 Jan 2022 19:57:11 +0000 (UTC) References: <9WnNh13AZ8NtRYwZoVwa_LCDFwz9jW8SovQKIc6W6puTg5PCKCHanjCH70cQJHfPv5ogOH3fUaCDxPJfAMwLnZhkllKi4mchBYpmEDkc2TQ=@protonmail.com> <87v8yt3nye.fsf_-_@gnu.org> User-agent: mu4e 1.6.10; emacs 27.2 From: Christopher Baines To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Having a package browser on guix.gnu.org Date: Sun, 09 Jan 2022 19:53:15 +0000 In-reply-to: <87v8yt3nye.fsf_-_@gnu.org> Message-ID: <8735lwbs2z.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org, kiasoc5@tutanota.com Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641758248; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=eyYER2zRfLE+WwcuqnvJTNoPURBXEZOurO70y2fC3pA=; b=j6GD/0mseXtGK/vjgLI5uhXSfgEgvh6EQWOL3zvrZh+XEJrEI/5+bZagYnP2L/Tqcsl8XE nbgKhwQw4uO0WkkEbMzv9eCauBjHf1tnvyKj0tQXgL2jDsJPC1I18ai8YE0L7BvBYqC/26 LzNTyfEXmzIM62ruLHFqpiynCvehBHfEKQtehxV03j//1bP/amIdA56ptvXYAkN11ItSc/ ROckpEb501Cw1ntzJGxNw690Bp4CN2uwamzmoRqbQur6AhEQZaYdlIEOjH744wnk3y3NNv 5o63vESSRu6dp+cwAsyeaLPX/+7wb9S9Wc8GzkFIbB7QxJHBMC3C3L/Cq3ZDaA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641758248; a=rsa-sha256; cv=none; b=CK9FZMpkVMWLuTKPHhdUPe4ThgvB9FL1j6jZK5eDXtYzuoAhkfD7UetXhSu7Br2aq1BSqr ZZ8dwhPJH+MSIxIJciG+aUYvH4aTVHRjS98eNZiYmYEdoA1XRcEzy823dfOiL0kM8/ow7O tisP5btczz/qOpETipNxcilmBDdDO6pzkFin7Idnen+XocTPPisACpEFIMUoGeo4OcdW/i HDZ9FzqBtAZZxU2wgE9nmUS+2JSGgm6Gu+OXAtl94uowNizNBzeno3Qz1DvjvV4Z178EEX FLcmXA3wEfZjZr+R8f6qThWTHs8D4/YJQQTDCojSbzBmqYFg1wYFRU7Ik3ZUvQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.21 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B26A52E0F3 X-Spam-Score: -5.21 X-Migadu-Scanner: scn1.migadu.com X-TUID: BQD6KnUhclT1 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Luis Felipe skribis: > >> But I wonder if it is possible now to make the packages part use any of = the Postgres databases that already exist and allow traditional search with= out JavaScript... > > Former Outreachy intern Danjela Lura, together with Chris Baines, had > started developing a JS-free package browsing interface: > > https://lists.gnu.org/archive/html/guix-devel/2020-07/msg00050.html > > Chris, could you tell us what the status is and what=E2=80=99s missing be= fore we > can use it on the web site? I think it's unchanged for a while now, I've attached what's probably the latest source code (there's not much to it). I think the remaining work is to settle on a direction in terms of the design and how to integrate it in to the website, and then deploy something for real. Personally, I'm in favour of a packages.guix.gnu.org domain which hosts the search page plus the package pages, and stopping generating package pages with haunt. I don't really have the time to try and move this forward myself, but I can try and support others. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=search.scm Content-Transfer-Encoding: quoted-printable Content-Description: search.scm #!/usr/local/bin/guile -s !# (use-modules (web server) (web request) (web response) (web uri) (sxml simple) (web client) (rnrs bytevectors) (srfi srfi-11) (srfi srfi-1) (ice-9 match) (json) (texinfo) (texinfo plain-text) (apps aux strings) (apps base templates theme) (apps base utils) (apps base types) (apps base templates components)) (define (templatize title body) `(html (head (title ,title)) (body ,@body))) (define* (respond #:optional body #:key (status 200) (title "Packages") (doctype "\n") (content-type-params '((charset . "utf-8"))) (content-type 'text/html) (extra-headers '()) (sxml (and body (templatize title body)))) (values (build-response #:code status #:headers `((content-type . (,content-type ,@content-type-params)) ,@extra-headers)) (lambda (port) (if sxml (begin (if doctype (display doctype port)) (sxml->xml sxml port)))))) (define (search-packages-page request body) (define uri-value (let ((uri (request-uri request))) (if (eqv? #f (uri-query uri)) "" (second (string-split (uri-query uri) #\=3D))))) (define response (let-values (((response-object body) (http-request (string-append "http://data.guix.gnu.org/repository/1/branch/master/latest-pro= cessed-revision/packages.json?locale=3Den_US.utf8&search_query=3D" uri-value "&field=3Dversion&field=3Dsynopsis&field=3Ddescriptio= n&after_name=3D&limit_results=3D30") #:method 'GET))) (json-string->scm (utf8->string body)))) (respond `((link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/package.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/item-preview.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/page.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/elements.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/common.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/messages.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/navbar.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/breadcrumbs.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/buttons.css"))) (link (@ (rel "stylesheet") (href "http://guix-website-test.cbaines.n= et/static/base/css/footer.css"))) (link (@ (rel "stylesheet") (href "https://stackpath.bootstrapcdn.com= /bootstrap/3.4.1/css/bootstrap.min.css") (integrity "sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAc= p1+c8xmyTe9GYg1l9a69psu") (crossorigin "anonymous"))) ,(navbar #:active-item "packages/search") (div (@ (class "package-info")) (div (@ (class "search-container") (style "display: block; text-align: center;")) (h1 "Packages") (form (@ (style "display: inline-block; margin-right auto; = text-align: left")) (input (@ (type "text") (placeholder "Search packages") (name "search"))) (button (@ (class "btn btn-primary pull-right") (type "submit")) '((span (@ (class "glyphicon glyphicon-search= ") (aria-hidden "true"))))))) ,@(match response ((packages _) (map (match-lambda ((description synopsis version name) (let ((package-name (cdr name)) (package-version (cdr version)) (package-synopsis (match synopsis ((synopsis locale plain html = source) (cdr source)))) (package-description (match description ((description locale plain= html source) (cdr source))))) `(a (@ (class "item-preview") (href ,(string-append "http://guix-website-test.= cbaines.net/packages/" (string-append package-nam= e "-" package-version)))) (h3 ,package-name " " ,package-version) (p (@ (class "item-summary")) ,(string-summarize (stexi->plain-text (texi-fragment->stexi package= -description)) 30) "=E2=80=A6"))))) (vector->list (cdr packages)))))) (footer "Made with " (span (@ (class "metta")) "=E2=99=A5") " by humans and powered by " (a (@ (class "link-yellow") (href ,(gnu-url "software/guile/"))) "GNU Guile") ". " (a (@ (class "link-yellow") (href "//git.savannah.gnu.org/cgit/guix/guix-artwork.git/tree= /website")) "Source code") " under the " (a (@ (class "link-yellow") (href ,(gnu-url "licenses/agpl-3.0.html"))) "GNU AGPL") ".")))) (run-server search-packages-page 'http '(#:port 8765)) --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmHbPhRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XfuIg/+M+4qQuj2VP3E9AvpgVs0nI2JgAVVAfYR 3tJO/YutmplsKYvawHLYqqfjJN6WKwPKWpTmERXvYv75IRfpzb5YXUXJtgLy4hez z+U2hJERsINus3yH5z/BhTGbRdYfIMND0hqyanmjHiAEIkSUBnSbyjfYxojEmzHg dYFwLUUfx1XRP/qYQJkkU04CaEYun3F+xMNLvGDcFos0Ii8V1+ls6ROmti6oQ4HG cXvHSpXZS3oZoIsxdfvjKwHDhG5uVANE7/yiEJu0HBcjctoEc3iJq9CPfSEyxQSu jpM3S+rKM2O0ftRM7XiPbERRbFflKpai3U2t/zq3D4C4R6OxPZUJZvo+i4PaNFJ2 xGrc2W3aS/SVqNa3Gmt//4vxLxpvKT1mX6dfMdWxnlsURp58PMJhdtTGfLj4MbDM mwBmmkXvvXKugyZutKlACY9lmOcj3p2xk375CXCZBgdpECbyRx1W/s/T8n8yXRDn U/DgKnPsnP3uQMz3Wv37ljhllflezycPCblu3m2H6jHNKf9ec2WTSa75gckEsxBx hU+cSE9mwqq/xWRwMUWIHUozz1kxRDpS4ytQpc14ObwgX0S6pLDXn8WTFsgwgM43 24nomfxqwkIkGhkm7vkYfGNVF04IYwZkdjZQDOHC+nI8DGYf+sEWniXhAFIl+RXT LHWmBaUCy50= =WzQP -----END PGP SIGNATURE----- --==-=-=--