Skip to content

Commit 5fe4d00

Browse files
2022.2 release code drop.
1 parent f202ae3 commit 5fe4d00

File tree

8 files changed

+251
-132
lines changed

8 files changed

+251
-132
lines changed

LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022, Perforce Software, Inc. All rights reserved.
1+
Copyright (c) 2023, Perforce Software, Inc. All rights reserved.
22

33
Redistribution and use in source and binary forms, with or without
44
modification, are permitted provided that the following conditions are met:
@@ -32,7 +32,7 @@ this program.
3232

3333
P4/P4API License
3434
-----------------------
35-
Copyright (c) 1995-2022, Perforce Software, Inc.
35+
Copyright (c) 1995-2023, Perforce Software, Inc.
3636
All rights reserved.
3737

3838
Redistribution and use in source and binary forms, with or without

RELNOTES.txt

Lines changed: 147 additions & 113 deletions
Large diffs are not rendered by default.

SpecMgr.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2424
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
26-
$Id: //depot/main/p4-python/SpecMgr.cpp#53 $
26+
$Id: //depot/main/p4-python/SpecMgr.cpp#54 $
2727
*******************************************************************************/
2828

2929
/*******************************************************************************
@@ -60,7 +60,7 @@ struct specdata {
6060
const char *type;
6161
const char *spec;
6262
} speclist[] = {
63-
63+
6464
{
6565
"branch",
6666
"Branch;code:301;rq;ro;fmt:L;len:32;;"
@@ -137,6 +137,7 @@ struct specdata {
137137
"MaxScanRows;code:403;type:word;len:12;;"
138138
"MaxLockTime;code:407;type:word;len:12;;"
139139
"MaxOpenFiles;code:413;type:word;len:12;;"
140+
"MaxMemory;code:NNN;type:word;len:12;;"
140141
"Timeout;code:406;type:word;len:12;;"
141142
"PasswordTimeout;code:409;type:word;len:12;;"
142143
"LdapConfig;code:410;type:line;len:128;;"
@@ -294,9 +295,9 @@ struct specdata {
294295
"Type;code:708;rq;len:32;open:isolate;;"
295296
"Description;code:709;type:text;len:128;open:isolate;;"
296297
"Options;code:707;type:line;len:64;val:"
297-
"allsubmit/ownersubmit,unlocked/locked,"
298-
"toparent/notoparent,fromparent/nofromparent,"
299-
"mergedown/mergeany;open:isolate;;"
298+
"allsubmit/ownersubmit,unlocked/locked,"
299+
"toparent/notoparent,fromparent/nofromparent,"
300+
"mergedown/mergeany;open:isolate;;"
300301
"ParentView;code:NNN;rq;open:isolate;"
301302
"pre:inherit;val:noinherit/inherit;;"
302303
"Components;code:NNN;type:wlist;words:3;maxwords:4;len:64;open:propagate;fmt:C;;"
@@ -332,7 +333,6 @@ struct specdata {
332333
};
333334

334335

335-
336336
SpecMgr::SpecMgr(PythonDebug * dbg)
337337
: debug(dbg)
338338
{

Version

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
# SUPPDATE = 2010 06 17 ;
1212
# Of the build. The copyright date is derived from SUPPDATE.
1313

14-
RELEASE = 2020 1 GITHUB-PREP-TEST_ONLY ;
15-
PATCHLEVEL = 0 ;
16-
SUPPDATE = 0000 00 00 ;
14+
RELEASE = 2022 2 ;
15+
PATCHLEVEL = 2425690 ;
16+
SUPPDATE = 2023 04 04 ;

linux_build/build-wheels.sh

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ for VERSION in $1; do
2828
## Build the installer
2929
"${PYBIN}/python" setup.py build_ext --apidir $P4API --ssl /openssl/lib bdist_wheel
3030

31+
## Upgrade pip
32+
"${PYBIN}/python" -m pip install --upgrade pip
33+
3134
# Install the wheel
32-
"${PYBIN}/python" -m pip install /work/p4-python/dist/$(ls /work/p4-python/dist/ | grep $VERSION)
35+
"${PYBIN}/python" -m pip install /work/p4-python/dist/$(ls /work/p4-python/dist/ | grep $VERSION | grep \.whl)
3336

3437
## Test the build
3538
"${PYBIN}/python" p4test.py

setup.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from tools.P4APIFtp import P4APIFtp
4747
from tools.PlatformInfo import PlatformInfo
4848
from tools.VersionInfo import VersionInfo
49+
from tools.P4APIHttps import P4APIHttps
4950

5051
if sys.version_info < (3, 0):
5152
from ConfigParser import ConfigParser
@@ -162,13 +163,16 @@ def is_super(self):
162163
def download_p4api(self, api_ver, ssl_ver):
163164
global loaded_lib_from_ftp
164165

165-
print("Looking for P4 API {0} for SSL {1} on ftp.perforce.com".format(api_ver, ssl_ver))
166-
p4ftp = P4APIFtp("perforce")
167-
api_dir, api_tarball = p4ftp.load_api(api_ver, ssl_ver)
166+
print("Looking for P4 API {0} for SSL {1} on https://ftp.perforce.com".format(api_ver, ssl_ver))
167+
168+
g_major, g_minor = P4APIFtp.get_glib_ver(self)
169+
p4https = P4APIHttps()
170+
url = p4https.get_url(g_minor, ssl_ver, api_ver)
171+
api_dir, api_tarball= p4https.get_file(url)
168172
print("Extracted {0} into {1}".format(api_tarball, api_dir))
169173

170174
loaded_lib_from_ftp = True
171-
return api_dir, api_tarball
175+
return api_dir
172176

173177
# run strings on p4api librpc.a to get the version of OpenSSL needed
174178
def get_ssl_version_from_p4api(self):
@@ -229,7 +233,10 @@ def check_installed_ssl():
229233
match = pattern.match(version_string)
230234
if match:
231235
version = int(match.group(1)) * 100 + int(match.group(2)) * 10 + int(match.group(3)) * 1
232-
ver_only = str(match.group(1)) + "." + str(match.group(2)) + "." + str(match.group(3)) + str(match.group(4))
236+
if str(match.group(4) is None):
237+
ver_only = str(match.group(1)) + "." + str(match.group(2)) + "." + str(match.group(3))
238+
else:
239+
ver_only = str(match.group(1)) + "." + str(match.group(2)) + "." + str(match.group(3)) + str(match.group(4))
233240
if version >= MIN_SSL_VERSION:
234241
release = match.group(4)
235242
for p in os.environ["PATH"].split(os.pathsep):
@@ -295,7 +302,7 @@ def run(self, *args, **kwargs):
295302
if not p4_api_dir:
296303
if (not self.apidir) and (sys.platform == "linux" or sys.platform == "linux2"):
297304
# Attempt to download P4 API which matches our versions
298-
(self.apidir, api_tarball) = self.download_p4api(VersionInfo(".").getVersion(), ssl_ver)
305+
self.apidir = self.download_p4api(VersionInfo(".").getVersion(), ssl_ver)
299306
p4_api_dir = self.apidir
300307

301308
if not self.apidir:

tools/P4APIHttps.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import os
2+
import shutil
3+
import urllib.request
4+
import urllib.error
5+
import re
6+
import tarfile
7+
import tempfile
8+
9+
10+
class P4APIHttps:
11+
12+
def get_ssl_ver(self, ssl_ver_string):
13+
pattern = re.compile("(\d+)\.(\d+).(\d+).*")
14+
match = pattern.match(str(ssl_ver_string))
15+
if match:
16+
return match.group(1), match.group(2), match.group(3)
17+
return "1", "1", "1"
18+
19+
def get_url(self, g_minor, ssl_ver, api_ver):
20+
21+
if int(g_minor) <= 3:
22+
glib_ver = "2.3"
23+
else:
24+
glib_ver = "2.12"
25+
26+
s_major, s_minor, s_mini = self.get_ssl_ver(ssl_ver)
27+
28+
# When server releases ssl 3.x.x version of p4api, this will need to accommodate it
29+
if (int(s_major) == 1) and (int(s_minor) == 0):
30+
ssl_ver = "1.0.2"
31+
else:
32+
ssl_ver = "1.1.1"
33+
34+
f = "p4api-glibc{0}-openssl{1}.tgz".format(glib_ver, ssl_ver)
35+
url = "https://ftp.perforce.com/perforce/{0}/bin.linux26x86_64/{1}".format(api_ver, f)
36+
return url
37+
38+
def get_file(self, url):
39+
40+
p4api = 'p4api.tgz'
41+
42+
tempdir = tempfile.gettempdir()
43+
tar = None
44+
apidir = None
45+
46+
try:
47+
# Don't download again if p4api exists
48+
if not os.path.exists(p4api):
49+
print("Downloading P4 API, this may take a while.")
50+
urllib.request.urlretrieve(url, p4api)
51+
52+
tar = tarfile.open(p4api, 'r')
53+
apidir = os.path.join(tempdir, tar.getnames()[0])
54+
55+
# If apidir exists, don't unpack again, otherwise read-only errors will occur
56+
if not (os.path.exists(apidir) and os.path.isdir(apidir)):
57+
tar.extractall(tempdir)
58+
59+
# Clean up downloaded archive
60+
if os.path.exists(p4api):
61+
os.remove(p4api)
62+
63+
return apidir, url
64+
except (urllib.error.HTTPError, tarfile.TarError):
65+
# If we are here errors occurred so lets clean up everything.
66+
print("Download of P4 API failed. Cleaning up.")
67+
if tar:
68+
tar.close()
69+
if os.path.exists(p4api):
70+
os.remove(p4api)
71+
if os.path.exists(apidir) and os.path.isdir(apidir):
72+
shutil.rmtree(apidir, ignore_errors=True)

tools/PlatformInfo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ def __init__(self, api_version, release_version, ssl, ssl_ver):
105105
release = "109"
106106
self.extra_link_args += ["-framework", "Carbon"]
107107

108-
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.12"
108+
if unameOut.machine == 'arm64':
109+
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "12.6"
110+
else:
111+
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.12"
109112

110113
arch = self.architecture(unameOut[4])
111114

0 commit comments

Comments
 (0)