Skip to content

Commit

Permalink
2023.1 release code drop.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjain-perforce committed May 26, 2023
1 parent 71f2ec8 commit 6698485
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 123 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
126 changes: 66 additions & 60 deletions RELNOTES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Release Notes for
P4Ruby, Perforce's script API for Ruby

Version 2022.1
Version 2023.1

Introduction

Expand All @@ -16,8 +16,8 @@ Introduction
release up to the bug fix change level.

Precompiled versions of P4Ruby are built against a corresponding version
of the Perforce C++ API, e.g., P4Ruby 2022.1 will be compiled using a
2022.1 version of the P4API. You can always install P4Ruby using a
of the Perforce C++ API, e.g., P4Ruby 2023.1 will be compiled using a
2023.1 version of the P4API. You can always install P4Ruby using a
source-only variation, selecting a specific version of the P4API.

To determine the version of your P4Ruby, and which version of the
Expand All @@ -26,7 +26,14 @@ Introduction

--------------------------------------------------------------------------

Installing P4Ruby
Important End-of-Life Notice

This major release of P4Ruby would be the last to test against Ruby 2.7
which is in EOL status. This is part of our commitment to focus on supported
technology platforms

--------------------------------------------------------------------------
Installation

The recommended method of installing P4Ruby is via gems.

Expand All @@ -52,69 +59,30 @@ Installing P4Ruby

Building P4Ruby from Source

1. Download the Perforce C++ API from the Perforce FTP site at
"ftp://ftp.perforce.com/perforce". The API archive is located
in release and platform-specific subdirectories and is named
"p4api-glibc2.3-openssl1.1.1.tgz" .

Note: 32-bit builds of P4Ruby require a 32-bit version of the
C++ API and a 32-bit version of Ruby. 64-bit builds of
P4Ruby require a 64-bit version of the C++ API and a
64-bit version of Ruby.

Unzip the archive into an empty directory.

2. Extract the P4Ruby API archive into a new, empty directory.

3. Execute the build commands:

bundle install
bundle exec rake compile -- --with-p4api_dir=<absolute path to Perforce C++ API> \
--with-ssl-dir=<absolute path to OpenSSL libraries matching Perforce C++ API>

OR pass through environment variables
bundle exec rake compile p4api_dir=<absolute path to Perforce C++ API>

Note: If the --p4api_dir flag is not provided, P4Ruby will attempt
to download and extract correct version of Perforce C++ API
The official version of P4Ruby exists as source on:
https://github.com/perforce/p4ruby

4. Test your distribution.

bundle exec rake test

Tests require the perforce server binary (p4d) present in the path.

5. Install P4Ruby into your local gem cache:

bundle exec rake install

SSL support
-----------

Perforce Server 2012.1 and later supports SSL connections and the
C++ API has been compiled with this support.

If the P4Ruby build detects that OpenSSL is available, it will be
included by default. If you want to use libraries deployed to nonstandard
paths, use the --ssl_dir=<path to Openssl include and lib folders>
Instructions for building are in the BUILD.md file which can be found
here - https://github.com/perforce/p4ruby/blob/master/build.md

--------------------------------------------------------------------------

Compatibility Statements

Server Compatibility

The 2022.1 release of P4Ruby supports the 2022.1 Perforce Server.
This release of P4Ruby supports the 2023.1 Perforce Server.
Older releases might work but are not supported.

API Compatibility

The 2022.1 release of P4Ruby supports the 2022.1 Perforce API.
Older releases might work but are not supported.
This release of P4Ruby supports the 2023.1 Perforce API
(2023.1/2442900). Older releases might work but are not supported.

Ruby Compatibility

The 2022.1 release of P4Ruby is supported on Ruby versions 2.7 3.0 and 3.1
This release of P4Ruby is supported on Ruby versions 2.7 3.0, 3.1
and 3.2

For detailed compatibility, please check the following table:

Expand All @@ -123,24 +91,28 @@ Compatibility Statements
2.7 | 2020.1 or later
3.0 | 2021.1 or later
3.1 | 2022.1 or later
3.2 | 2023.1 or later

OpenSSL Compatibility

P4Ruby requires OpenSSL 1.0.2+ or 1.1.1+

Running P4Ruby linked to an older library will
fail with the error:
To build P4Ruby with encrypted communication support, you must use the
version of OpenSSL that Perforce C/C++ API has been built against.

"SSL library must be at least version 1.0.2."
Beginning with the 2017.1 release of the Helix C/C++ API, the dependency
on OpenSSL is now enforced and the SSL stub library has been removed.
Executables linked against the P4API libraries must also be linked against
real OpenSSL libraries: The latest 3.0.x or 1.1.1 patch is recommended

Platform Compatibility

While P4Ruby is generally portable, this release is certified
only on the following platforms:

- RVM based installs for Ruby 2.7, 3.0 and 3.1 on Ubuntu and CentOS.
- rubyinstaller.org for Ruby 2.7, 3.0 and 3.1
on Windows Server 2016/2019, and Windows 10
Windows (x64)
Server 2016
Linux
Ubuntu 20.04, 22.04
CentOS 8

Compiler Compatibility

Expand Down Expand Up @@ -170,6 +142,40 @@ Key to symbols used in change notes below.
*** -- requires new p4d server program

--------------------------------------------------------------------------
--------------------------------------------------------------------------

New functionality in 2023.1 (2023.1/2446234) (2023/05/25)

#2443839 (Job #115709) * ** ***
This release of P4Ruby supports P4API 2023.1 (2023.1/2442900).

#2443217, #2438303 (Job #115281) *
Added support for Ruby 3.2.

#2439606 (Job #2439606) * **
Windows gems for P4Ruby are now shipped with OpenSSL 3.0.8

--------------------------------------------------------------------------
--------------------------------------------------------------------------

New functionality in 2022.1 Patch 2 (2022.1/2405581) (2023/02/10)

Important security note
This version addresses vulnerabilities in OpenSSL (CVE-2023-0286,
CVE-2023-0215, CVE-2022-4450, CVE-2022-4304) by linking in version
1.1.1t of the library.

--------------------------------------------------------------------------
--------------------------------------------------------------------------

Bugs fixed in 2022.1 Patch 1 (2022.1/2368511) (2022/11/10)

(Job #113209) * **
Correct the handling of untranslated text left in the
compression buffer on Close(). Build only change.

--------------------------------------------------------------------------
--------------------------------------------------------------------------

New functionality in 2022.1 (2022.1/2359956) (2022/10/26)

Expand Down
81 changes: 22 additions & 59 deletions ext/P4/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
$:.push File.expand_path("../../../lib", __FILE__)

require 'mkmf'
require 'net/ftp'
require 'P4/version'
require 'rbconfig'
require 'openssl'
require 'net/http'

# Set this to the main version directory we look up in ftp.perforce.com for the P4API
# This is ignored if you specify the version on the command line.
Expand Down Expand Up @@ -266,9 +266,9 @@ def P4ApiVersion.load(dir)
# subdirectory. Look there if we can't find it in the API root
#
ver_file = dir + "/Version"
unless File.exists?(ver_file)
unless File.exist?(ver_file)
ver_file = dir + "/sample/Version"
return nil unless File.exists?(ver_file)
return nil unless File.exist?(ver_file)
end

re = Regexp.new('^RELEASE = (\d+)\s+(\d+)\s+(\w*\S*)\s*;')
Expand Down Expand Up @@ -390,7 +390,7 @@ def resolve_p4api_dir
end

if !p4api_dir && !with_config('p4api-dir') && enable_config('p4api-download', true)
download_api_via_ftp
download_api_via_https
unzip_file
p4api_dir = downloaded_p4api_dir
dir_config('p4api', "#{p4api_dir}/include", "#{p4api_dir}/lib")
Expand Down Expand Up @@ -468,7 +468,7 @@ def platform_dir_name
"bin.#{p4_platform_label}"
end

def ftp_download_dir(version)
def download_dir(version)
"perforce/#{version}/#{platform_dir_name}"
end

Expand All @@ -484,7 +484,9 @@ def filename
filename = 'p4api-openssl1.1.1.zip'
when /1.0/
filename = 'p4api-openssl1.0.2.zip'
end
when /3.0/
filename = 'p4api-openssl3.zip'
end
end
elsif RbConfig::CONFIG['target_os'].downcase =~ /darwin19|darwin[2-9][0-9]/
filename = 'p4api-openssl1.1.1.tgz'
Expand All @@ -496,69 +498,30 @@ def filename
filename = 'p4api-glibc2.3-openssl1.1.1.tgz'
when /1.0/
filename = 'p4api-glibc2.3-openssl1.0.2.tgz'
when /3.0/
filename = 'p4api-glibc2.3-openssl3.tgz'
end
end
end
return filename
end


def remote_files_matching(ftp, dir, regex)
ftp.ls(dir.to_s).map { |entry|
if match = entry.match(regex)
yield match
else
nil
end
}.reject { |entry|
entry.nil?
}
end

def find_latest_with_p4api(ftp, versions)
versions.reverse_each { |v|
begin
remote_files_matching(ftp, "r#{v}/#{platform_dir_name}/", /p4api/) do
return v
end
rescue
next
end
}
end

def find_latest_version_dir(ftp)
ftp.chdir('perforce')

# Capture all versions
versions = remote_files_matching(ftp, '.', /r(1\d\.\d)/) { |m| m.captures.first }.sort

version = find_latest_with_p4api(ftp, versions)

ftp.chdir('..')

"r#{version}"
end

# Downloads the C++ P4API via FTP to the local directory, then 'initializes' it
#############################################
# Downloads the C++ P4API via HTTPS to the local directory, then 'initializes' it
# by unpacking it.
def download_api_via_ftp
ftp = Net::FTP.new('ftp.perforce.com')
ftp.passive=true
ftp.login

# At one point, we allowed the gem build to just find the most recent p4api build.
# P4Ruby probably shouldn't do that by default.
#version_dir = find_latest_version_dir(ftp)
def download_api_via_https

dir = ftp_download_dir(p4api_version_dir)
ftp.chdir(dir)
uri=URI('https://ftp.perforce.com:443')
dir = download_dir(p4api_version_dir)

puts "downloading #{filename} from #{dir} on ftp.perforce.com"
ftp.getbinaryfile(filename)
puts "Downloading #{filename} from #{dir} on https://ftp.perforce.com"

ensure
ftp.close if ftp and !ftp.closed?
Net::HTTP.start(uri.host, uri.port, :use_ssl =>true) do |http|
resp = http.get("/" + dir + "/" + filename)
open(filename, "wb") do |file|
file.write(resp.body)
end
end
end

def unzip_file
Expand Down
5 changes: 5 additions & 0 deletions ext/P4/p4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,11 @@ void Init_P4()

// P4::Progress class.
cP4Prog = rb_define_class_under( cP4, "Progress", rb_cObject );

rb_undef_alloc_func(cP4);
rb_undef_alloc_func(cP4MD);
rb_undef_alloc_func(cP4Map);
rb_undef_alloc_func(cP4Msg);

};

Expand Down
4 changes: 3 additions & 1 deletion ext/P4/specmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ struct defaultspec {
"AltRoots;code:308;type:llist;len:64;;"
"Options;code:309;type:line;len:64;val:"
"noallwrite/allwrite,noclobber/clobber,nocompress/compress,"
"unlocked/locked,nomodtime/modtime,normdir/rmdir;;"
"unlocked/locked,nomodtime/modtime,normdir/rmdir,"
"noaltsync/altsync;;"
"SubmitOptions;code:313;type:select;fmt:L;len:25;val:"
"submitunchanged/submitunchanged+reopen/revertunchanged/"
"revertunchanged+reopen/leaveunchanged/leaveunchanged+reopen;;"
Expand Down Expand Up @@ -128,6 +129,7 @@ struct defaultspec {
"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
2 changes: 1 addition & 1 deletion lib/P4/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class P4
Version = VERSION = '2020.1.1970474'
Version = VERSION = '2023.1.2443531'
end

0 comments on commit 6698485

Please sign in to comment.