From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Becze Subject: Re: rav1e AV1 encoder Date: Fri, 21 Feb 2020 04:15:43 -0500 Message-ID: <9e81d5d5-1f2a-3c6d-5f99-c001d1a03b7f@riseup.net> References: <20200220224353.GA28976@jasmine.lan> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------AEDDA50DD21D83AC71CB67FB" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42321) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j54PZ-0001cJ-8p for guix-devel@gnu.org; Fri, 21 Feb 2020 04:15:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j54PT-0001ZV-S3 for guix-devel@gnu.org; Fri, 21 Feb 2020 04:15:50 -0500 Received: from mx1.riseup.net ([198.252.153.129]:43750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j54PT-0001T6-DX for guix-devel@gnu.org; Fri, 21 Feb 2020 04:15:47 -0500 In-Reply-To: <20200220224353.GA28976@jasmine.lan> Content-Language: en-US List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: Leo Famulari , guix-devel@gnu.org This is a multi-part message in MIME format. --------------AEDDA50DD21D83AC71CB67FB Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 2/20/20 5:43 PM, Leo Famulari wrote: > Should they be added to (gnu packages crates-io)? yep! > And if so, should it > be done as a single commit? Or one-by-one? One-by-one unfortunately > It's 258 new packages, and > figuring out the order they should be added in seems... too hard. They should be alphanumeric > The c-bindgen and cargo-c packages could go in (gnu packages rust-apps). > > What about updating them later? Will `guix refresh` handle it? guix refresh should handle them. But currently it should do thing recursively so keep that in mind. I have a small tool I have been working will make the new packages easier to commit.... its very much WIP but if I would appreciate any feedback. Attached is sort2.scm and merge.scm sort2.scm will sort a files exported packages alphanumerically. merge.scm will merge exported packages of two files into a single file creating a git commit for every new or updated package. Here is my work flow, 1) Import the package using `guix import crate -r mypackage > mypackage.scm` 2) Sort the packages, `guile -s ./sort2.scm mypackage.scm > mypackage.scm` (you will probably also want to sort crates-io.scm, i think some packages may be out-of-order now) 3) merge mypackages.scm and crates-io.scm `guile -s ./merge.scm ./mypackage.scm ./crates-io.scm` 4) check that the git log looks correct and that everything still runs! :D -Martin --------------AEDDA50DD21D83AC71CB67FB Content-Type: text/x-scheme; charset=UTF-8; name="merge.scm" Content-Disposition: attachment; filename="merge.scm" Content-Transfer-Encoding: quoted-printable (use-modules (guix utils)) (use-modules (guix build utils)) (use-modules (ice-9 binary-ports)) (use-modules (ice-9 match)) (use-modules (srfi srfi-1)) (use-modules (srfi srfi-9)) (use-modules (srfi srfi-71)) (define-record-type (make-iter-pos port name str version eof?) iter-pos? (port iter-pos-port) (name iter-pos-name) (str iter-pos-str) (version iter-pos-version) (eof? iter-pos-eof?)) (define-values (a-filename b-filename) (match (command-line) ((self a-file b-file) (values a-file b-file)))) (define (peek-operation port proc) (let ((org-pos (ftell port))) (call-with-values proc=09 (lambda vals (seek port org-pos SEEK_SET) (apply values vals))))) (define (peek-rest port) (peek-operation port (=CE=BB =E2=88=85 (get-bytevector-all port)))) (define a-port (open-input-file a-filename)) (define out-port (open-io-file b-filename)) (define b-port (open-bytevector-input-port (peek-rest out-port))) (define (git-commit msg) (sync) (invoke "git" "commit" "-a" "-m" msg)) (define (git-commit-new-package a) (define name (iter-pos-name a)) (git-commit (string-append "gnu: Add " name "\n\n* gnu/packages/" b-filename " (" name "): New varible."))) (define (git-commit-update-package a) (let ((name (iter-pos-name a)) (version (iter-pos-version a))) (git-commit (string-append "gnu: " name ": Upgrade to " version "\n\n* gnu/packa= ges/" b-filename " (" name "): Upgrade to " version)))) (define (file-iter port) (=CE=BB =E2=88=85 (let* ((start (ftell port)) (sexp (read port)) (end (ftell port)) (str (begin (seek port start SEEK_SET) (get-bytevector-n port (- end start)))) (name version (match sexp (('define-public name (or ('package ('name _) ('version version) . _) ('let _ ('package ('name _) ('version version) . _)))) (values (symbol->string name) version)) (_ (values #f #f)))) (eof? (eof-object? sexp))) (make-iter-pos port name str version eof?)))) (define* (insert-before a b out #:optional replace) (let ((a-str (iter-pos-str a)) (b-str (iter-pos-str b)) (b-rest (peek-rest (iter-pos-port b)))) (put-bytevector out-port a-str) (peek-operation out-port (=CE=BB =E2=88=85=20 (unless replace (put-bytevector out-port b-str)) ;; read the rest of port-b (put-bytevector out-port b-rest))))) (define (merge-iter a-iter b-iter out-port) (let lp ((a (a-iter)) (b (b-iter))) (unless (iter-pos-eof? a) (let ((a-name (iter-pos-name a)) (b-name (iter-pos-name b)) (a-str (iter-pos-str a)) (b-str (iter-pos-str b))) (cond ((not b-name) (begin (put-bytevector out-port (iter-pos-str b)) (lp a (b-iter)))) ((string? a-name b-name) (lp a (b-iter))) (#t (begin ;; else the names are equal ;; make sure the action are idenpotent (unless (equal? b-str a-str) (insert-before a b out-port #t) (git-commit-update-package a)) (lp (a-iter) (b-iter))))))))) (merge-iter (file-iter a-port) (file-iter b-port) out-port) --------------AEDDA50DD21D83AC71CB67FB Content-Type: text/x-scheme; charset=UTF-8; name="sort2.scm" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sort2.scm" (use-modules (ice-9 pretty-print)) (use-modules (ice-9 binary-ports)) (use-modules (ice-9 match)) (define filename (match (command-line) ((self file) file))) (define* (package-list port #:optional (init '())) (let ((start (ftell port)) (sexp (read port)) (end (ftell port))) (if (eof-object? sexp) init (package-list port (cons (list start end sexp) init))))) (define out-port (current-output-port)) (define port (open-file filename "r")) (define packages (package-list port)) (define sorted-packages (sort-list packages (match-lambda* (((_ _ ('define-public names _)) ...) (apply stringstring names))) (_ #t)))) (define (write-packages packages in-port out-port) (for-each (match-lambda ((start end _) (let* ((len (- end start))) (seek in-port start SEEK_SET) (put-bytevector out-port (get-bytevector-n port len))))) packages)) (write-packages sorted-packages port out-port) --------------AEDDA50DD21D83AC71CB67FB--