Skip to content

Commit

Permalink
2022.2 release code drop.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjain-perforce committed Apr 11, 2023
1 parent f202ae3 commit 5fe4d00
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 132 deletions.
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022, Perforce Software, Inc. All rights reserved.
Copyright (c) 2023, Perforce Software, Inc. All rights reserved.

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

P4/P4API License
-----------------------
Copyright (c) 1995-2022, Perforce Software, Inc.
Copyright (c) 1995-2023, Perforce Software, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
260 changes: 147 additions & 113 deletions RELNOTES.txt

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions SpecMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$Id: //depot/main/p4-python/SpecMgr.cpp#53 $
$Id: //depot/main/p4-python/SpecMgr.cpp#54 $
*******************************************************************************/

/*******************************************************************************
Expand Down Expand Up @@ -60,7 +60,7 @@ struct specdata {
const char *type;
const char *spec;
} speclist[] = {

{
"branch",
"Branch;code:301;rq;ro;fmt:L;len:32;;"
Expand Down Expand Up @@ -137,6 +137,7 @@ struct specdata {
"MaxScanRows;code:403;type:word;len:12;;"
"MaxLockTime;code:407;type:word;len:12;;"
"MaxOpenFiles;code:413;type:word;len:12;;"
"MaxMemory;code:NNN;type:word;len:12;;"
"Timeout;code:406;type:word;len:12;;"
"PasswordTimeout;code:409;type:word;len:12;;"
"LdapConfig;code:410;type:line;len:128;;"
Expand Down Expand Up @@ -294,9 +295,9 @@ struct specdata {
"Type;code:708;rq;len:32;open:isolate;;"
"Description;code:709;type:text;len:128;open:isolate;;"
"Options;code:707;type:line;len:64;val:"
"allsubmit/ownersubmit,unlocked/locked,"
"toparent/notoparent,fromparent/nofromparent,"
"mergedown/mergeany;open:isolate;;"
"allsubmit/ownersubmit,unlocked/locked,"
"toparent/notoparent,fromparent/nofromparent,"
"mergedown/mergeany;open:isolate;;"
"ParentView;code:NNN;rq;open:isolate;"
"pre:inherit;val:noinherit/inherit;;"
"Components;code:NNN;type:wlist;words:3;maxwords:4;len:64;open:propagate;fmt:C;;"
Expand Down Expand Up @@ -332,7 +333,6 @@ struct specdata {
};



SpecMgr::SpecMgr(PythonDebug * dbg)
: debug(dbg)
{
Expand Down
6 changes: 3 additions & 3 deletions Version
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
# SUPPDATE = 2010 06 17 ;
# Of the build. The copyright date is derived from SUPPDATE.

RELEASE = 2020 1 GITHUB-PREP-TEST_ONLY ;
PATCHLEVEL = 0 ;
SUPPDATE = 0000 00 00 ;
RELEASE = 2022 2 ;
PATCHLEVEL = 2425690 ;
SUPPDATE = 2023 04 04 ;
5 changes: 4 additions & 1 deletion linux_build/build-wheels.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ for VERSION in $1; do
## Build the installer
"${PYBIN}/python" setup.py build_ext --apidir $P4API --ssl /openssl/lib bdist_wheel

## Upgrade pip
"${PYBIN}/python" -m pip install --upgrade pip

# Install the wheel
"${PYBIN}/python" -m pip install /work/p4-python/dist/$(ls /work/p4-python/dist/ | grep $VERSION)
"${PYBIN}/python" -m pip install /work/p4-python/dist/$(ls /work/p4-python/dist/ | grep $VERSION | grep \.whl)

## Test the build
"${PYBIN}/python" p4test.py
Expand Down
19 changes: 13 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from tools.P4APIFtp import P4APIFtp
from tools.PlatformInfo import PlatformInfo
from tools.VersionInfo import VersionInfo
from tools.P4APIHttps import P4APIHttps

if sys.version_info < (3, 0):
from ConfigParser import ConfigParser
Expand Down Expand Up @@ -162,13 +163,16 @@ def is_super(self):
def download_p4api(self, api_ver, ssl_ver):
global loaded_lib_from_ftp

print("Looking for P4 API {0} for SSL {1} on ftp.perforce.com".format(api_ver, ssl_ver))
p4ftp = P4APIFtp("perforce")
api_dir, api_tarball = p4ftp.load_api(api_ver, ssl_ver)
print("Looking for P4 API {0} for SSL {1} on https://ftp.perforce.com".format(api_ver, ssl_ver))

g_major, g_minor = P4APIFtp.get_glib_ver(self)
p4https = P4APIHttps()
url = p4https.get_url(g_minor, ssl_ver, api_ver)
api_dir, api_tarball= p4https.get_file(url)
print("Extracted {0} into {1}".format(api_tarball, api_dir))

loaded_lib_from_ftp = True
return api_dir, api_tarball
return api_dir

# run strings on p4api librpc.a to get the version of OpenSSL needed
def get_ssl_version_from_p4api(self):
Expand Down Expand Up @@ -229,7 +233,10 @@ def check_installed_ssl():
match = pattern.match(version_string)
if match:
version = int(match.group(1)) * 100 + int(match.group(2)) * 10 + int(match.group(3)) * 1
ver_only = str(match.group(1)) + "." + str(match.group(2)) + "." + str(match.group(3)) + str(match.group(4))
if str(match.group(4) is None):
ver_only = str(match.group(1)) + "." + str(match.group(2)) + "." + str(match.group(3))
else:
ver_only = str(match.group(1)) + "." + str(match.group(2)) + "." + str(match.group(3)) + str(match.group(4))
if version >= MIN_SSL_VERSION:
release = match.group(4)
for p in os.environ["PATH"].split(os.pathsep):
Expand Down Expand Up @@ -295,7 +302,7 @@ def run(self, *args, **kwargs):
if not p4_api_dir:
if (not self.apidir) and (sys.platform == "linux" or sys.platform == "linux2"):
# Attempt to download P4 API which matches our versions
(self.apidir, api_tarball) = self.download_p4api(VersionInfo(".").getVersion(), ssl_ver)
self.apidir = self.download_p4api(VersionInfo(".").getVersion(), ssl_ver)
p4_api_dir = self.apidir

if not self.apidir:
Expand Down
72 changes: 72 additions & 0 deletions tools/P4APIHttps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import os
import shutil
import urllib.request
import urllib.error
import re
import tarfile
import tempfile


class P4APIHttps:

def get_ssl_ver(self, ssl_ver_string):
pattern = re.compile("(\d+)\.(\d+).(\d+).*")
match = pattern.match(str(ssl_ver_string))
if match:
return match.group(1), match.group(2), match.group(3)
return "1", "1", "1"

def get_url(self, g_minor, ssl_ver, api_ver):

if int(g_minor) <= 3:
glib_ver = "2.3"
else:
glib_ver = "2.12"

s_major, s_minor, s_mini = self.get_ssl_ver(ssl_ver)

# When server releases ssl 3.x.x version of p4api, this will need to accommodate it
if (int(s_major) == 1) and (int(s_minor) == 0):
ssl_ver = "1.0.2"
else:
ssl_ver = "1.1.1"

f = "p4api-glibc{0}-openssl{1}.tgz".format(glib_ver, ssl_ver)
url = "https://ftp.perforce.com/perforce/{0}/bin.linux26x86_64/{1}".format(api_ver, f)
return url

def get_file(self, url):

p4api = 'p4api.tgz'

tempdir = tempfile.gettempdir()
tar = None
apidir = None

try:
# Don't download again if p4api exists
if not os.path.exists(p4api):
print("Downloading P4 API, this may take a while.")
urllib.request.urlretrieve(url, p4api)

tar = tarfile.open(p4api, 'r')
apidir = os.path.join(tempdir, tar.getnames()[0])

# If apidir exists, don't unpack again, otherwise read-only errors will occur
if not (os.path.exists(apidir) and os.path.isdir(apidir)):
tar.extractall(tempdir)

# Clean up downloaded archive
if os.path.exists(p4api):
os.remove(p4api)

return apidir, url
except (urllib.error.HTTPError, tarfile.TarError):
# If we are here errors occurred so lets clean up everything.
print("Download of P4 API failed. Cleaning up.")
if tar:
tar.close()
if os.path.exists(p4api):
os.remove(p4api)
if os.path.exists(apidir) and os.path.isdir(apidir):
shutil.rmtree(apidir, ignore_errors=True)
5 changes: 4 additions & 1 deletion tools/PlatformInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def __init__(self, api_version, release_version, ssl, ssl_ver):
release = "109"
self.extra_link_args += ["-framework", "Carbon"]

os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.12"
if unameOut.machine == 'arm64':
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "12.6"
else:
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.12"

arch = self.architecture(unameOut[4])

Expand Down

0 comments on commit 5fe4d00

Please sign in to comment.