Subject: Re: [bug#40178] [PATCH 2/2] gnu: Remove qemu-minimal-2.10.

From: Marius Bakke <[email-masked]>
Date: Sun, 22 Mar 2020 15:22:44 +0100

Leo Famulari <[email-masked]> writes:

> * gnu/packages/virtualization.scm (qemu-minimal-2.10): Remove variable.
> * gnu/packages/debug.scm (qemu-for-american-fuzzy-lop): New variable.
> (american-fuzzy-lop)[inputs]: Remove custom-qemu and add
> qemu-for-american-fuzzy-lop.
> [arguments]: Adjust reference to QEMU in the 'install-qemu' phase.

Thanks for this.  A couple of suggestions:

> -             ;; afl only supports using a single afl-qemu-trace executable, so
> -             ;; we only build qemu for the native target.

Perhaps preserve this comment close to the (let ((machine ...))) line?

> +         (add-after 'install 'install-info
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             ;; Install the Info manual, unless Texinfo is missing.
> +             (when (assoc-ref inputs "texinfo")
> +               (let* ((out  (assoc-ref outputs "out"))
> +                      (dir (string-append out "/share/info")))
> +                 (invoke "make" "info")
> +                 (for-each (lambda (info)
> +                             (install-file info dir))
> +                           (find-files "." "\\.info"))))
> +             #t))
> +         ;; Create a wrapper for Samba. This allows QEMU to use Samba without
> +         ;; pulling it in as an input. Note that you need to explicitly install
> +         ;; Samba in your Guix profile for Samba support.
> +         (add-after 'install-info 'create-samba-wrapper
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let* ((out    (assoc-ref %outputs "out"))
> +                    (libexec (string-append out "/libexec")))
> +               (call-with-output-file "samba-wrapper"
> +                 (lambda (port)
> +                   (format port "#!/bin/sh
> +exec smbd $@")))
> +               (chmod "samba-wrapper" #o755)
> +               (install-file "samba-wrapper" libexec))
> +             #t))
> +         (add-before 'configure 'prevent-network-configuration
> +           (lambda _
> +             ;; Prevent the build from trying to use git to fetch from the net.
> +             (substitute* "Makefile"
> +               (("@./config.status")
> +                "")) #t))

I think we can remove all the phases above for simplicity.

> +    (native-inputs
> +     `(("python-2" ,python-2) ; QEMU 2 needs Python 2
> +       ("glib:bin" ,glib "bin")
> +       ("perl" ,perl)
> +       ("flex" ,flex)
> +       ("bison" ,bison)
> +       ("pkg-config" ,pkg-config)
> +       ("texinfo" ,texinfo)))

As well as the texinfo input.

> +    (inputs
> +     `(("afl-source" ,(package-source american-fuzzy-lop))
> +       ("alsa-lib" ,alsa-lib)
> +       ("attr" ,attr)
> +       ("glib" ,glib)
> +       ("libaio" ,libaio)
> +       ("libattr" ,attr)
> +       ("libcap" ,libcap)
> +       ("libjpeg" ,libjpeg-turbo)
> +       ("libpng" ,libpng)
> +       ("ncurses" ,ncurses)
> +       ("pixman" ,pixman)
> +       ("util-linux" ,util-linux)
> +       ("zlib" ,zlib)))

It's good to keep a list of explicit inputs here instead of having to
delete any new inputs to 'qemu-minimal'.  However...

> +    (home-page "https://www.qemu.org")
> +    (synopsis "Machine emulator and virtualizer (without GUI)")
> +    (description
> +     "QEMU is a generic machine emulator and virtualizer.
> +
> +When used as a machine emulator, QEMU can run OSes and programs made for one
> +machine (e.g. an ARM board) on a different machine---e.g., your own PC.  By
> +using dynamic translation, it achieves very good performance.
> +
> +When used as a virtualizer, QEMU achieves near native performances by
> +executing the guest code directly on the host CPU.  QEMU supports
> +virtualization when executing under the Xen hypervisor or using
> +the KVM kernel module in Linux.  When using KVM, QEMU can virtualize x86,
> +server and embedded PowerPC, and S390 guests.")
> +    ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
> +    (license license:gpl2)
> +    ;; Several tests fail on MIPS.
> +    (supported-systems (delete "mips64el-linux" %supported-systems))))))

This section can be removed, as it gets inherited and does not affect
the derivation.

In any case LGTM, too!