Opened 2 years ago

Closed 2 years ago

#29558 closed enhancement (fixed)

Autogenerated parts of installation guide

Reported by: jhpalmieri Owned by:
Priority: blocker Milestone: sage-9.1
Component: documentation Keywords:
Cc: mkoeppe, dimpase, embray Merged in:
Authors: John Palmieri, Matthias Koeppe Reviewers: Matthias Koeppe, John Palmieri
Report Upstream: N/A Work issues:
Branch: 8f064f4 (Commits, GitHub, GitLab) Commit: 8f064f475195ae3561a26c41c0cdd13a10cfc06d
Dependencies: Stopgaps:

Status badges

Description

  • Add a homebrew section, which requires producing good autogenerated homebrew files
  • Clean up the cygwin autogenerated files

Change History (23)

comment:1 follow-up: Changed 2 years ago by jhpalmieri

Regarding a homebrew section: I am having problems with figuring out how to autogenerate the files homebrew.txt and homebrew-optional.txt. If I just add homebrew to the list of SYSTEMs in src/doc/bootstrap, I end up with this for homebrew.txt:

    $ brew install boost freetype gcc gd git gmp gpatch gsl libmpc libpng mpfi mpfr openblas pcre pkg-config ppl python3 r readline sqlite xz yasm zeromq zlib
# Afterwards: 
# To automatically take care of homebrew messages regarding 
# keg-only packages for the current shell session:
# $ source /Users/palmieri/Desktop/Sage_stuff/git/sage/.homebrew-build-env
# Add this to your shell profile if you want it to persist between shell sessions.

I really just want the first line, and then I can add the rest by hand. Along the same lines, the files for cygwin are a little broken. cygwin.txt looks like

    $ # first install apt-cyg from https://github.com/transcode-open/apt-cyg
apt-cyg install R binutils bzip2 cddlib-devel cddlib-tools curl findutils gcc-core gcc-core gcc-fortran gcc-fortran gcc-g++ gcc-g++ git glpk libatomic_ops-devel libboost-devel libbz2-devel libcrypt-devel libcurl-devel libffi-devel libflint-devel libfreetype-devel libgd-devel libglpk-devel libgmp-devel libgsl-devel libiconv-devel liblapack-devel liblzma-devel libmpc-devel libmpfr-devel libncurses-devel libntl-devel libopenblas libpcre-devel libreadline-devel libsqlite3-devel libtirpc-devel libzmq-devel m4 make patch perl perl-ExtUtils-MakeMaker python37 python37-devel python37-urllib tar which xz yasm zlib-devel

and the resulting output in the installation guide doesn't look perfect.

Is the URL https://github.com/transcode-open/apt-cyg stable enough that it should just be included in the text? Then we would really want this to just say $ apt-cyg install R ....

comment:2 Changed 2 years ago by jhpalmieri

  • Branch set to u/jhpalmieri/homebrew

comment:3 Changed 2 years ago by jhpalmieri

  • Commit set to 155965f08f45f714ae3aa193642f46c3b3ff5eb3

Here is a very rough draft, but it has the flaws mentioned in comment:1.


New commits:

155965ftrac 29558: first draft

comment:4 Changed 2 years ago by mkoeppe

build/bin/sage-print-system-package-command could certainly be made more flexible in what it prints in order to support prettier output.

comment:5 Changed 2 years ago by jhpalmieri

I'm not a whiz at shell scripts. My current attempt works, but maybe there are better ways:

  • build/bin/sage-print-system-package-command

    diff --git a/build/bin/sage-print-system-package-command b/build/bin/sage-print-system-package-command
    index 7802d447df..38b7966bcd 100755
    a b if [ -n "$system_packages" ]; then 
    2626            ;;
    2727        homebrew*:install)
    2828            echo "brew install $system_packages"
    29             echo "# Afterwards: "
     29            if [ -z "$SAGE_STRIP_COMMENTS" ]; then
     30                echo "# Afterwards: "
     31            fi
    3032            ;;
    3133        slackware*:install)
    3234            echo "sudo slackpkg install $system_packages"
    3335            ;;
    3436        cygwin*:install)
    35             echo "# first install apt-cyg from https://github.com/transcode-open/apt-cyg"
     37            if [ -z "$SAGE_STRIP_COMMENTS" ]; then
     38                echo "# first install apt-cyg from https://github.com/transcode-open/apt-cyg"
     39            fi
    3640            echo "apt-cyg install $system_packages"
    3741            ;;
    3842        *)
    39             echo "# $command the following packages: $system_packages"
     43            if [ -z "$SAGE_STRIP_COMMENTS" ]; then
     44                echo "# $command the following packages: $system_packages"
     45            fi
    4046            ;;
    4147    esac
    4248fi
    4349# Messages that should go out even if not packages need to be installed
    4450case $system:$command in
    4551    homebrew*:install)
    46         echo "# To automatically take care of homebrew messages regarding "
    47         echo "# keg-only packages for the current shell session:"
    48         [ -n "$SAGE_ROOT" ] || SAGE_ROOT=.
    49         echo "# $ source $SAGE_ROOT/.homebrew-build-env"
    50         echo "# Add this to your shell profile if you want it to persist between shell sessions."
     52        if [ -z "$SAGE_STRIP_COMMENTS" ]; then
     53            echo "# To automatically take care of homebrew messages regarding "
     54            echo "# keg-only packages for the current shell session:"
     55            [ -n "$SAGE_ROOT" ] || SAGE_ROOT=.
     56            echo "# $ source $SAGE_ROOT/.homebrew-build-env"
     57            echo "# Add this to your shell profile if you want it to persist between shell sessions."
     58        fi
    5159        ;;
    5260esac
  • src/doc/bootstrap

    diff --git a/src/doc/bootstrap b/src/doc/bootstrap
    index 3ac1f5b767..283798635b 100755
    a b for SYSTEM in arch debian fedora cygwin homebrew; do 
    4646        fi
    4747    done
    4848    echo >&2 $0:$LINENO: installing "$OUTPUT_DIR"/$SYSTEM.txt and "$OUTPUT_DIR"/$SYSTEM-optional.txt
    49     echo "$PROMPT$(sage-print-system-package-command $SYSTEM install $(echo $(echo $SYSTEM_PACKAGES | xargs -n 1 echo | sort)))" > "$OUTPUT_DIR"/$SYSTEM.txt
    50     echo "$PROMPT$(sage-print-system-package-command $SYSTEM install $(echo $(echo $OPTIONAL_SYSTEM_PACKAGES | xargs -n 1 echo | sort)))" > "$OUTPUT_DIR"/$SYSTEM-optional.txt
     49    echo "$PROMPT$(SAGE_STRIP_COMMENTS=yes sage-print-system-package-command $SYSTEM install $(echo $(echo $SYSTEM_PACKAGES | xargs -n 1 echo | sort)))" > "$OUTPUT_DIR"/$SYSTEM.txt
     50    echo "$PROMPT$(SAGE_STRIP_COMMENTS=yes sage-print-system-package-command $SYSTEM install $(echo $(echo $OPTIONAL_SYSTEM_PACKAGES | xargs -n 1 echo | sort)))" > "$OUTPUT_DIR"/$SYSTEM-optional.txt
    5151done

comment:6 Changed 2 years ago by git

  • Commit changed from 155965f08f45f714ae3aa193642f46c3b3ff5eb3 to 66c07d82db0246bec89dac3af61a3b22371e2736

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

66c07d8trac 29558: first draft

comment:7 Changed 2 years ago by jhpalmieri

(No changes to sage-print-system-package-command in the branch yet, just minor changes.)

comment:8 Changed 2 years ago by mkoeppe

For sage-print-system-package-command, maybe better to split install into prepare and install and setup-env or something like this, instead of using an environment variable

comment:9 Changed 2 years ago by mkoeppe

I'll give it a shot

comment:10 Changed 2 years ago by mkoeppe

  • Branch changed from u/jhpalmieri/homebrew to u/mkoeppe/homebrew

comment:11 Changed 2 years ago by mkoeppe

  • Commit changed from 66c07d82db0246bec89dac3af61a3b22371e2736 to 272f01bcafb3645399e22e4b8a631b31240f8c76

Take a look if this version works for you


New commits:

deb84cdsage-print-system-package-command: More options, update uses
a832dbcsrc/doc/bootstrap: Initialize OPTIONAL_SYSTEM_PACKAGES
272f01bbuild/bin/sage-spkg: Update use of sage-print-system-package-command

comment:12 Changed 2 years ago by mkoeppe

  • Cc embray added

comment:13 in reply to: ↑ 1 ; follow-up: Changed 2 years ago by mkoeppe

Replying to jhpalmieri:

Is the URL https://github.com/transcode-open/apt-cyg stable enough that it should just be included in the text? Then we would really want this to just say $ apt-cyg install R ....

I don't really know. @embray added this part.

comment:14 in reply to: ↑ 13 Changed 2 years ago by jhpalmieri

Replying to mkoeppe:

Replying to jhpalmieri:

Is the URL https://github.com/transcode-open/apt-cyg stable enough that it should just be included in the text? Then we would really want this to just say $ apt-cyg install R ....

I don't really know. @embray added this part.

I realized this actually doesn't matter: the document already includes instructions for installing apt-cyg.

comment:15 Changed 2 years ago by mkoeppe

  • Priority changed from major to blocker

comment:16 follow-up: Changed 2 years ago by jhpalmieri

  • Priority changed from blocker to major

Did the addition of the line

OPTIONAL_SYSTEM_PACKAGES=

cut down on the repetitions in the commands? I'm not seeing nearly as much as I did before, and I can't figure out why.

comment:17 Changed 2 years ago by jhpalmieri

  • Priority changed from major to blocker

comment:18 Changed 2 years ago by jhpalmieri

  • Branch changed from u/mkoeppe/homebrew to u/jhpalmieri/homebrew

comment:19 Changed 2 years ago by jhpalmieri

  • Commit changed from 272f01bcafb3645399e22e4b8a631b31240f8c76 to 8f064f475195ae3561a26c41c0cdd13a10cfc06d

I'm happy with this. How about you?


New commits:

8f064f4trac 29558: correct some markup, change the date at end of file

comment:20 Changed 2 years ago by jhpalmieri

  • Authors set to John Palmieri, Matthias Koeppe
  • Reviewers set to Matthias Koeppe, John Palmieri
  • Status changed from new to needs_review

comment:21 in reply to: ↑ 16 Changed 2 years ago by mkoeppe

Replying to jhpalmieri:

Did the addition of the line

OPTIONAL_SYSTEM_PACKAGES=

cut down on the repetitions in the commands? I'm not seeing nearly as much as I did before, and I can't figure out why.

Yes, that's right. I actually had thought that was fixed before.

comment:22 Changed 2 years ago by mkoeppe

  • Status changed from needs_review to positive_review

Looks good to me.

comment:23 Changed 2 years ago by vbraun

  • Branch changed from u/jhpalmieri/homebrew to 8f064f475195ae3561a26c41c0cdd13a10cfc06d
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.