Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom manual installation within a dedicated 'build' directory, in a proot-distro alias of Debian chroot, in a Termux host environment: require make install instructions, post-successful BAT test, and successful custom make #2946

Open
b9Joker108 opened this issue Apr 24, 2024 · 1 comment

Comments

@b9Joker108
Copy link

b9Joker108 commented Apr 24, 2024

Hi

First, I want to thank all the contributors to the source code of this project and all those who have filed issues, to make it better.

Second, I want to apologise for filing this issue and for being so nooby. I also note that as I have a conda initialised Python environment in the shells of this chroot through Miniforge3, that pyenv may very well be redundant. But, I would still like it installed and shell-initialised within this chroot, going forward.

Third, this is my distro spec:

╰─(base) ⠠⠵ cat /etc/*-release

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Fourth, this is my proot chroot spec:

╰─(base) ⠠⠵ uname -a

Linux localhost 6.2.1-PRoot-Distro #1 SMP PREEMPT Mon Dec 4 10:05:43 UTC 2023 aarch64 GNU/Linux

Fifth, I generated a successfull 'Makefile' in /src from executing 'configure' from within my custom 'build' directory.

Sixth, this is my successful bespoke manual make shell output from the build executed from within my custom 'build' directory:

(base) ╭─root at localhost in ~/.pyenv/build on master✘✘✘ 24-04-24 - 21:36:45
╰─(base) ⠠⠵ make -f /root/.pyenv/src/Makefile /root/.pyenv/build/libexec/pyenv-realpath.dylib

gcc -fPIC     -c -o realpath.o /root/.pyenv/src/realpath.c
mkdir -p /root/.pyenv/build/libexec
gcc -shared -Wl,-soname,/root/.pyenv/build/libexec/pyenv-realpath.dylib  -o /root/.pyenv/build/libexec/pyenv-realpath.dylib realpath.o

Seventh, this is the tweaked 'Makefile' from within /src:

CC = gcc
                                                                                                                                   CFLAGS =
LOCAL_CFLAGS =
DEFS =
LOCAL_DEFS =

CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) $(CFLAGS)

SHOBJ_CC = gcc
SHOBJ_CFLAGS = -fPIC
SHOBJ_LD = ${CC}
SHOBJ_LDFLAGS = -shared -Wl,-soname,$@
SHOBJ_XLDFLAGS =
SHOBJ_LIBS =
SHOBJ_STATUS = supported

.c.o:
        $(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) -c -o $@ $<

VPATH = /root/.pyenv/src

/root/.pyenv/build/libexec/pyenv-realpath.dylib: realpath.o
        mkdir -p /root/.pyenv/build/libexec
        $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)

clean:
        rm -f *.o /root/.pyenv/build/libexec/*.dylib

Eighth, as I could find no express instructions for a manual installation within the README.md or within the locally cloned repository, other than the rudimentary git clone instructions, I resolved to excavate the logic of the automated-installer project repository and scripts for illumination, and reverse engineer and wing-a-process on-the-fly, for my usecase. I elected to go the manual installation route to improve my shell and problem-solving skills, as I am writing a book on the circa eighteen (18) unique shells I have installed in my Termux host environment, and the many shells I similarly have installed within my circa nine (9) chroots, along with the acquisition of shell scripting skills, for these many shell dialects, to inform a written work directed to the newly digitally included, amongst the circa one third (1/3) , of the global population still digitally excluded, to bring them up-to-speed with the computational shell, if they so have the disposition, interest and inclination.

Ninth, just in case it may be helpful, here is the TAP output of executing BAT:

(base) ╭─root at localhost in ~/.pyenv/build on master✘✘✘ 24-04-24 - 19:47:16
╰─(base) ⠠⠵ ./bats/bin/bats --tap ../test

1..199
ok 1 commands
ok 2 commands --sh
ok 3 commands in path with spaces
ok 4 commands --no-sh
ok 5 command with no completion support
ok 6 command with completion support
ok 7 forwards extra arguments
ok 8 fails with invalid version
ok 9 fails with invalid version set from file
ok 10 completes with names of executables
ok 11 carries original IFS within hooks
ok 12 forwards all arguments
ok 13 sys.executable with system version (#98)
ok 14 PATH is not modified with system Python
ok 15 default
ok 16 read PYENV_ROOT/version
ok 17 set PYENV_ROOT/version
ok 18 fail setting invalid PYENV_ROOT/version
ok 19 without args shows summary of common commands
ok 20 invalid command
ok 21 shows help for a specific command
ok 22 replaces missing extended help with summary text
ok 23 extracts only usage
ok 24 multiline usage section
ok 25 multiline extended help section
ok 26 prints usage help given no argument
ok 27 prints list of hooks
ok 28 supports hook paths with spaces
ok 29 resolves relative paths
ok 30 resolves symlinks
ok 31 creates shims and versions directories
ok 32 auto rehash
ok 33 auto rehash for --path
ok 34 setup shell completions
ok 35 detect parent shell
ok 36 detect parent shell from script
ok 37 setup shell completions (fish)
ok 38 fish instructions
ok 39 shell detection for installer
ok 40 option to skip rehash
ok 41 adds shims to PATH
ok 42 adds shims to PATH (fish)
ok 43 removes existing shims from PATH
ok 44 removes existing shims from PATH (fish) # skip -- fish not installed
ok 45 adds shims to PATH with --no-push-path if they're not on PATH
ok 46 adds shims to PATH with --no-push-path if they're not on PATH (fish) # skip -- fish not installed
ok 47 doesn't change PATH with --no-push-path if shims are already on PATH
ok 48 doesn't change PATH with --no-push-path if shims are already on PATH (fish) # skip -- fish not installed
ok 49 outputs sh-compatible syntax
ok 50 outputs sh-compatible case syntax
ok 51 outputs fish-specific syntax (fish)
ok 52 read from installed
ok 53 read from known
ok 54 installed version not found
ok 55 known version not found
ok 56 complete name resolves to itself
ok 57 sort CPython
ok 58 ignores rolling releases, branch tips, alternative srcs, prereleases and virtualenvs
ok 59 no version
ok 60 local version
ok 61 discovers version file in parent directory
ok 62 ignores PYENV_DIR
ok 63 sets local version
ok 64 changes local version
ok 65 unsets local version
ok 66 prefix
ok 67 prefix for invalid version
ok 68 prefix for system
ok 69 prefix for system in sbin
ok 70 prefix for system in /
ok 71 prefix for invalid system
ok 72 blank invocation
ok 73 invalid command
ok 74 default PYENV_ROOT
ok 75 inherited PYENV_ROOT
ok 76 default PYENV_DIR
ok 77 inherited PYENV_DIR
ok 78 invalid PYENV_DIR
ok 79 adds its own libexec to PATH
ok 80 adds plugin bin dirs to PATH
ok 81 PYENV_HOOK_PATH preserves value from environment
ok 82 PYENV_HOOK_PATH includes pyenv built-in plugins
ok 83 prefixes
ok 84 empty rehash
not ok 85 non-writable shims directory
# (from function `flunk' in file /root/.pyenv/test/test_helper.bash, line 42,
#  from function `assert_failure' in file /root/.pyenv/test/test_helper.bash, line 56,
#  in test file /root/.pyenv/test/rehash.bats, line 24)
#   `assert_failure "pyenv: cannot rehash: ${PYENV_ROOT}/shims isn't writable"' failed
# expected failed exit status
#  output:
ok 86 rehash in progress
ok 87 wait until lock acquisition
ok 88 creates shims
ok 89 removes stale shims
ok 90 binary install locations containing spaces
ok 91 carries original IFS within hooks
ok 92 sh-rehash in bash
ok 93 sh-rehash in fish
ok 94 shell integration disabled
ok 95 shell integration enabled
ok 96 no shell version
ok 97 shell version
ok 98 shell version (fish)
ok 99 shell revert
ok 100 shell revert (fish)
ok 101 shell unset
ok 102 shell unset (fish)
ok 103 shell change invalid version
ok 104 shell change version
ok 105 shell change version (fish)
ok 106 no shims
ok 107 shims
ok 108 shims --short
ok 109 default version
ok 110 doesn't read version from non-pyenv repo
ok 111 reads version from git repo
ok 112 prints default version if no tags in git repo
ok 113 no version selected
ok 114 set by PYENV_VERSION
ok 115 set by local file
ok 116 set by global file
ok 117 set by PYENV_VERSION, one missing
ok 118 set by PYENV_VERSION, two missing
ok 119 set by PYENV_VERSION, one missing (stderr filtered)
ok 120 detects global 'version' file
ok 121 prints global file if no version files exist
ok 122 in current directory
ok 123 in parent directory
ok 124 topmost file has precedence
ok 125 PYENV_DIR has precedence over PWD
ok 126 PWD is searched if PYENV_DIR yields no results
ok 127 finds version file in target directory
ok 128 fails when no version file in target directory
ok 129 fails without arguments
ok 130 fails for invalid file
ok 131 fails for blank file
ok 132 reads simple version file
ok 133 ignores leading spaces
ok 134 reads only the first word from file
ok 135 loads *not* only the first line in file
ok 136 ignores leading blank lines
ok 137 handles the file with no trailing newline
ok 138 ignores carriage returns
ok 139 skips comment lines
ok 140 skips `..' relative path traversal
ok 141 skips glob path traversal
ok 142 allows relative paths that exist and stay within versions
ok 143 skips relative paths that lead outside of versions
ok 144 invocation without 2 arguments prints usage
ok 145 setting nonexistent version fails
ok 146 writes value to arbitrary file
ok 147 no version selected
ok 148 system version is not checked for existence
ok 149 PYENV_VERSION can be overridden by hook
ok 150 carries original IFS within hooks
ok 151 PYENV_VERSION has precedence over local
ok 152 local file has precedence over global
ok 153 missing version
ok 154 one missing version (second missing)
ok 155 one missing version (first missing)                                                                                         ok 156 one missing version (without stderr)
ok 157 version with prefix in name
ok 158 falls back to pyenv-latest
ok 159 reports global file even if it doesn't exist
ok 160 detects global file
ok 161 detects PYENV_VERSION
ok 162 detects local file
ok 163 reports from hook
ok 164 carries original IFS within hooks
ok 165 doesn't inherit PYENV_VERSION_ORIGIN from environment
ok 166 no versions installed
ok 167 not even system python available
ok 168 bare output no versions installed
ok 169 single version installed
ok 170 single version bare
ok 171 multiple versions and envs
ok 172 skips envs with --skip-envs
ok 173 indicates current version
ok 174 bare doesn't indicate current version
ok 175 globally selected version
ok 176 per-project version
ok 177 ignores non-directories under versions
ok 178 lists symlinks under versions
ok 179 doesn't list symlink aliases when --skip-aliases
ok 180 lists dot directories under versions
ok 181 sort supports version sorting
ok 182 sort doesn't support version sorting
ok 183 non-bare output shows symlink contents
ok 184 finds versions where present
ok 185 outputs path to executable
ok 186 searches PATH for system version
ok 187 searches PATH for system version (shims prepended)
ok 188 searches PATH for system version (shims appended)
ok 189 searches PATH for system version (shims spread)
ok 190 doesn't include current directory in PATH search
ok 191 version not installed
ok 192 versions not installed
ok 193 no executable found
ok 194 no executable found for system version
ok 195 executable found in other versions
ok 196 carries original IFS within hooks
ok 197 discovers version from pyenv-version-name
ok 198 resolves pyenv-latest prefixes
ok 199 hooks get resolved version name

Tenth, I repaired the following error output in the test:

...
not ok 85 non-writable shims directory
# (from function `flunk' in file /root/.pyenv/test/test_helper.bash, line 42,
#  from function `assert_failure' in file /root/.pyenv/test/test_helper.bash, line 56,
#  in test file /root/.pyenv/test/rehash.bats, line 24)
#   `assert_failure "pyenv: cannot rehash: ${PYENV_ROOT}/shims isn't writable"' failed
# expected failed exit status
#  output:
...

By temporarily exporting an environment variable in my current Zsh shell, where I was doing the installation process:

(base) ╭─root at localhost in ~/.pyenv/build on master✘✘✘ 24-04-24 - 19:56:31
╰─(base) ⠠⠵ export PYENV_ROOT="$HOME/.pyenv"

(base) ╭─root at localhost in ~/.pyenv/build on master✘✘✘ 24-04-24 - 19:56:43
╰─(base) ⠠⠵ echo $PYENV_ROOT

/root/.pyenv

This worked, as the 'make' was successful after much investigation, trial-and-error, tweaking, and endeavour, as advised above with the successful shell output.

Eleventh, all that remains is a make install, post-successful make. I ventured:

(base) ╭─root at localhost in ~/.pyenv/build on master✘✘✘ 24-04-24 - 21:45:09
╰─(base) ⠠⠵ make -f /root/.pyenv/src/Makefile PREFIX=/root/.pyenv install

make: *** No rule to make target 'install'.  Stop.

This is as far as I got. I looked everywhere I could think of to find the make install information, such as installation target, etc., without success, so as not to bother you.

Finally, I really need to know what is to be done to finalise the install. I also note, from the automated-installer script and repository from which I gathered much salient logic and information to progress the manual install, that there are plugins that need to be built and enabled, as well. Also, I noted the plugins in the locally git cloned repository, but have not yet progressed this, as I felt it best to finalise the 'pyenv' installation first, and ensure its executables are added to PATH, and then proceed with the shell initialisation process. Then, attend to the plugins. So, I humbly request to be schooled on the necessary information and processes to proceed.

Any assistance greatly appreciated.

Thanking you in anticipation
Beauford

@b9Joker108 b9Joker108 changed the title Custom manual installation within a dedicated 'build' directory, in a proot-distro alias of Debian chroot, in a Termux host environment: require make install instrictions, post successful BAT test Custom manual installation within a dedicated 'build' directory, in a proot-distro alias of Debian chroot, in a Termux host environment: require make install instrictions, post successful BAT test, and successful custom make Apr 24, 2024
@b9Joker108 b9Joker108 changed the title Custom manual installation within a dedicated 'build' directory, in a proot-distro alias of Debian chroot, in a Termux host environment: require make install instrictions, post successful BAT test, and successful custom make Custom manual installation within a dedicated 'build' directory, in a proot-distro alias of Debian chroot, in a Termux host environment: require make install instructions, post-successful BAT test, and successful custom make Apr 24, 2024
@native-api
Copy link
Member

native-api commented May 9, 2024

as I could find no express instructions for a manual installation within the README.md or within the locally cloned repository, other than the rudimentary git clone instructions

https://github.com/pyenv/pyenv?tab=readme-ov-file#installation

Git clone instructions are not "rudimentary", it's one of the supported installations schemes.

not ok 85 non-writable shims directory
# (from function `flunk' in file /root/.pyenv/test/test_helper.bash, line 42,
#  from function `assert_failure' in file /root/.pyenv/test/test_helper.bash, line 56,
#  in test file /root/.pyenv/test/rehash.bats, line 24)
#   `assert_failure "pyenv: cannot rehash: ${PYENV_ROOT}/shims isn't writable"' failed
# expected failed exit status
#  output:

This should not be a big deal in your case. This test checks that non-writable shims directory is correctly handled by Pyenv logic. You can see the test's code at

pyenv/test/rehash.bats

Lines 20 to 25 in aabaa89

@test "non-writable shims directory" {
mkdir -p "${PYENV_ROOT}/shims"
chmod -w "${PYENV_ROOT}/shims"
run pyenv-rehash
assert_failure "pyenv: cannot rehash: ${PYENV_ROOT}/shims isn't writable"
}
.
Most likely, in your system, there are other security mechanisms that override UNIX permissions and chmod -w has no effect as a result.

Eleventh, all that remains is a make install, post-successful make.

Not needed. Pyenv is written in Bash so it doesn't require compilation. Makefile is only needed to run tests (which is mainly useful for development) and to build an optional shell extension that speeds up some internal operations. An instruction to build the extension is present in the Basic Git checkout README section as it's only needed when using this installation scheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants