Skip to content

Commit 4bd03f8

Browse files
authored
Merge pull request #78 from DrDaveD/v1
Make buildable on el9, update to 1.18
2 parents d85455b + 45003ef commit 4bd03f8

File tree

3 files changed

+40
-28
lines changed

3 files changed

+40
-28
lines changed

htgettoken

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from __future__ import print_function
1818

1919
prog = "htgettoken"
20-
version = "1.17"
20+
version = "1.18"
2121

2222
import os
2323
import sys

htgettoken.spec

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
%define downloads_version 1.7
1+
%define downloads_version 1.8
22

33
Summary: Get OIDC bearer tokens by interacting with Hashicorp vault
44
Name: htgettoken
5-
Version: 1.17
5+
Version: 1.18
66
Release: 1%{?dist}
77
License: BSD
88
Group: Applications/System
@@ -19,6 +19,7 @@ BuildRequires: python3-devel
1919
# OpenSSL 1.1
2020
BuildRequires: swig
2121
BuildRequires: openssl-devel
22+
BuildRequires: krb5-devel
2223

2324
# Needed by httokendecode
2425
Requires: jq
@@ -40,28 +41,28 @@ htgettoken gets OIDC bearer tokens by interacting with Hashicorp vault
4041
# starts out in htgettoken-downloads
4142

4243
set -e
43-
PYDIR=$PWD/.local
44+
PYVERS="python3$(python3 -V|cut -d. -f2)"
45+
PYDIR=$PWD/$PYVERS/.local
4446
PATH=$PYDIR/bin:$PATH
4547

4648
# install in reverse order of their download (because dependency downloads
4749
# come after requested packages)
48-
PKGS="$(tar tf %{SOURCE1} |sed 's,^%{name}-downloads-[^/]*/,,'| grep -v "^\.local"| tac)"
50+
PKGS="$(tar tf %{SOURCE1} | grep "/$PYVERS/." | sed 's,^%{name}-downloads-[^/]*/,,'| grep -v "^$PYVERS/\.local"| tac)"
4951
# installing wheel separately first eliminates warnings about falling back
5052
# to setup.py
51-
WHEELPKG="$(echo "$PKGS"|grep ^wheel)"
52-
PKGS="$(echo "$PKGS"|grep -v ^wheel|paste -sd ' ')"
53+
WHEELPKG="$(echo "$PKGS"|grep ^$PYVERS/wheel)"
54+
PKGS="$(echo "$PKGS"|grep -v ^$PYVERS/wheel|paste -sd ' ')"
5355
# --no-build-isolation is needed for offline build of pyinstaller as per
5456
# https://github.com/pyinstaller/pyinstaller/issues/4557
5557
# python3 is explicitly invoked here so it comes from $PATH to test
5658
# various versions
57-
HOME=$PWD python3 $(type -p pip3) install --no-cache-dir --no-build-isolation --user $WHEELPKG
59+
HOME=$PWD/$PYVERS python3 $(type -p pip3) install --no-cache-dir --no-build-isolation --user $WHEELPKG
5860
export PYTHONPATH="`echo $PYDIR/lib*/python*/site-packages|sed 's/ /:/g'`"
59-
HOME=$PWD python3 $(type -p pip3) install --no-cache-dir --no-build-isolation --user $PKGS
61+
HOME=$PWD/$PYVERS python3 $(type -p pip3) install --no-cache-dir --no-build-isolation --user $PKGS
6062

6163
cd ../%{name}-%{version}
6264

63-
PYIOPTS="--noconsole --log-level=WARN"
64-
python3 $PYDIR/bin/pyi-makespec $PYIOPTS --specpath=dist %{name}
65+
python3 $PYDIR/bin/pyi-makespec --noconsole --log-level=WARN --specpath=dist %{name}
6566

6667
# Exclude system libraries from the bundle as documented at
6768
# https://pyinstaller.readthedocs.io/en/stable/spec-files.html#posix-specific-options
@@ -83,7 +84,7 @@ awk '{
8384
print
8485
}' dist/%{name}-lesslibs.spec >dist/%{name}-lesslibsandwarn.spec
8586

86-
python3 $PYDIR/bin/pyinstaller $PYIOPTS --noconfirm --clean dist/%{name}-lesslibsandwarn.spec
87+
python3 $PYDIR/bin/pyinstaller --log-level=WARN --noconfirm --clean dist/%{name}-lesslibsandwarn.spec
8788

8889
find dist/%{name} -name '*.*' ! -type d|xargs chmod -x
8990

@@ -124,8 +125,10 @@ rm -rf $RPM_BUILD_ROOT
124125

125126

126127
%changelog
127-
# - Fix crash introduced in 1.17 when using --nobearertoken while the
128-
# credkey is not known.
128+
* Wed May 24 2023 Dave Dykstra <dwd@fnal.gov> 1.18-1
129+
- Fix crash introduced in 1.17 when using --nobearertoken while the
130+
credkey is not known.
131+
- Make source rpm buildable on el9.
129132

130133
* Wed Mar 15 2023 Dave Dykstra <dwd@fnal.gov> 1.17-1
131134
- Fix the usage of getaddrinfo, which caused a fatal error on python3.9

make-downloads

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,28 @@ set -ex
55
cd "`dirname $0`"
66
rm -rf $BASE-*
77
BASE="$BASE-`sed -n 's/^%define downloads_version //p' htgettoken.spec`"
8-
mkdir $BASE
9-
if [ "$(pip3 --version|sed 's/[^ ]* \([^.]*\).*/\1/')" -lt 19 ]; then
10-
# newer pip3 needed for cryptography
11-
pip3 install -U --no-cache-dir --prefix $PWD/$BASE/.local pip
12-
fi
13-
PATH=$PWD/$BASE/.local/bin:$PATH
14-
export PYTHONPATH=`echo $PWD/$BASE/.local/lib/*/site-packages`
15-
PIPOPTS="download --no-cache-dir -d $PWD/$BASE"
16-
pip3 $PIPOPTS pyinstaller
17-
pip3 $PIPOPTS m2crypto
18-
pip3 $PIPOPTS pyOpenSSL
19-
pip3 $PIPOPTS kerberos
20-
pip3 $PIPOPTS paramiko
21-
pip3 $PIPOPTS wheel
8+
export MYPYTHONVERSION=3$(python3 -V|cut -d. -f2)
9+
for pythonversion in 36 39; do
10+
(
11+
BASE=$BASE/python$pythonversion
12+
mkdir -p $BASE/.local
13+
if [ "$(pip3 --version|sed 's/[^ ]* \([^.]*\).*/\1/')" -lt 19 ]; then
14+
# newer pip3 needed for cryptography
15+
pip3 install -U --no-cache-dir --prefix $PWD/$BASE/.local pip
16+
fi
17+
PATH=$PWD/$BASE/.local/bin:$PATH
18+
export PYTHONPATH=`echo $PWD/$BASE/.local/lib/*/site-packages`
19+
PIPOPTS="download --no-cache-dir --python-version=$pythonversion --no-deps -d $PWD/$BASE"
20+
pip3 $PIPOPTS pyinstaller
21+
pip3 $PIPOPTS m2crypto
22+
pip3 $PIPOPTS pyOpenSSL
23+
pip3 $PIPOPTS kerberos
24+
pip3 $PIPOPTS paramiko
25+
pip3 $PIPOPTS wheel
26+
if [ $MYPTHONVERSION != $pythonversion ]; then
27+
rm -rf $BASE/.local
28+
fi
29+
)
30+
done
2231
tar czvf $BASE.tar.gz $BASE
2332
rm -rf $BASE

0 commit comments

Comments
 (0)