Skip to content

Commit

Permalink
Merge branch 'v1' into more-v1-ci-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-tleavitt committed Apr 15, 2024
2 parents 458f285 + 08b3846 commit fa14af7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 52 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- HSIEO-9484: Add additional argument to buildDepsGraph to allow putting in an additional list element of dependency's DisplayName
- HSIEO-9484: Add additional property DisplayName to %IPM.Storage.ModuleReference
- HSIEO-10274: Separate DependencyAnalyzer out from IPM
- #261: IPM now truly supports using multiple registries for installation / discovery of packages (without needing to prefix the package with the registry name on "install", although it is still possible and now effective to use the prefix).

### Fixed
- HSIEO-9269, HSIEO-9402: % percent perforce directories are no longer necessary
Expand All @@ -38,6 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #451: (CI) Run on fewer versions to minimize overhead and Community Edition expiration issues
- #451, #428: Fixes "Verify" phase to work properly after %IPM rename
- #451: Avoid compliation errors due to storage location conflict on IRIS for Health prior to 2024.1
- #455: Upgrade from %ZPM classes updates language extensions correctly to use %IPM
- #373: Cleaner cross-version approach used in language extension routine generation

### Security
-
Expand Down
64 changes: 14 additions & 50 deletions src/cls/IPM/Main.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1881,12 +1881,6 @@ ClassMethod Install(ByRef pCommandInfo) [ Internal ]
If (tModuleName = "") {
Quit $$$OK
}
If tRegistry = "" {
Set tServer = ##class(%IPM.Repo.Remote.Definition).DeploymentServerOpen(1,,.tSC)
If $IsObject(tServer) {
Set tRegistry = tServer.Name
}
}

Set tVersion = $Get(pCommandInfo("parameters","version"))
Set tKeywords = $$$GetModifier(pCommandInfo,"keywords")
Expand Down Expand Up @@ -2518,39 +2512,20 @@ ClassMethod Import(ByRef pCommandInfo)

ClassMethod UpdateLanguageExtensionsOne(RoutineName As %String, pTestOnly As %Boolean = 0, Output pFound As %Boolean = 0, ByRef tGenLines) As %Status
{
#def1arg STARTTAGQ " ;Generated by %IPM.Main: Start"
#def1arg ENDTAGQ " ;Generated by %IPM.Main: End"
#def1arg STARTTAG ##Expression($$$STARTTAGQ)
#def1arg ENDTAG ##Expression($$$ENDTAGQ)
Set tRtn = ##class(%Routine).%New(RoutineName)
If ##class(%Routine).Exists(RoutineName) {
Set tEnded = 1
While 'tRtn.AtEnd {
Set tLine = tRtn.ReadLine()
If (tLine = $$$STARTTAGQ) {
If $Match(tLine,$$$STARTTAGREGEX) {
// Read through the ending tag.
While ('tRtn.AtEnd) && (tRtn.ReadLine() '= $$$ENDTAGQ) {}
While ('tRtn.AtEnd) && ('$Match(tRtn.ReadLine(),$$$ENDTAGREGEX)) {}

// Generate the lines.
Set pFound = 1
For i=1:1:tGenLines {
Set tRtnLines($Increment(tRtnLines)) = tGenLines(i)
}
} Else {
// Before %ZLANGC00 was generated: there's an old version with ZPM defined.
Set tIsZPM = ($ZConvert($Extract(tLine,1,4),"U") = "ZPM(")
If tIsZPM {
Set pFound = 1
Set tEnded = 0
Set tRtnLines($Increment(tRtnLines)) = $$$STARTTAGQ
}
If '(tIsZPM || tEnded) {
If ($ZStrip($Extract(tLine),"*W") '= "") {
Set tRtnLines($Increment(tRtnLines)) = $$$ENDTAGQ
Set tEnded = 1
}
}
Set tRtnLines($Increment(tRtnLines)) = tLine
}
}
If 'tEnded {
Expand All @@ -2577,11 +2552,6 @@ ClassMethod UpdateLanguageExtensionsOne(RoutineName As %String, pTestOnly As %Bo

ClassMethod UpdateLanguageExtensions(pVerbose As %Boolean = 0, pTestOnly As %Boolean = 0, Output pFound As %Boolean = 0) As %Status
{
#def1arg STARTTAGQ " ;Generated by %IPM.Main: Start"
#def1arg ENDTAGQ " ;Generated by %IPM.Main: End"
#def1arg STARTTAG ##Expression($$$STARTTAGQ)
#def1arg ENDTAG ##Expression($$$ENDTAGQ)

Set tSC = $$$OK
Set tInitTLevel = $TLevel
Try {
Expand All @@ -2590,18 +2560,13 @@ ClassMethod UpdateLanguageExtensions(pVerbose As %Boolean = 0, pTestOnly As %Boo
Set tOffset = 0
Set tStarted = 0
Set labelPrefix = $Select($System.Version.GetMajor() >= 2023: "",1: "z")
For {
Set tLineName = labelPrefix_"UpdateLanguageExtensions"_"+"_$i(tOffset)_"^"_$ZName
Set tExtLine = $Text(@(tLineName))
If (tExtLine=$$$STARTTAGQ) {
Set tStarted = 1
}
If (tStarted) {
Set tGenLines($Increment(tGenLines)) = tExtLine
}
Quit:(tExtLine=$$$ENDTAGQ)
Quit:(tExtLine="")
Set method = ##class(%Dictionary.MethodDefinition).IDKEYOpen($classname(),"LanguageExtensions",,.sc)
$$$ThrowOnError(sc)
Set tGenLines($i(tGenLines)) = $$$STARTTAGQ
While 'method.Implementation.AtEnd {
Set tGenLines($i(tGenLines)) = method.Implementation.ReadLine()
}
Set tGenLines($i(tGenLines)) = $$$ENDTAGQ

If '$Data(tGenLines) {
$$$ThrowStatus($$$ERROR($$$GeneralError,"Could not find %ZLANGC00 routine contents in "_$Classname()))
Expand All @@ -2610,7 +2575,7 @@ ClassMethod UpdateLanguageExtensions(pVerbose As %Boolean = 0, pTestOnly As %Boo
Quit:pTestOnly
Set i=""
For { Set i=$Order(tGenLines(i),1,tStr) Quit:i=""
If tStr[" Do ##class" Set tGenLines(i)=$Replace($Replace(tStr," Quit","")," Do "," Quit ") Quit
If tStr["Do ##class" Set tGenLines(i)=$Replace($Replace(tStr,"Quit",""),"Do ","Quit ") Quit
}
Do ..UpdateLanguageExtensionsOne("%ZLANGF00.MAC", pTestOnly,.pFound,.tGenLines)
TCOMMIT
Expand All @@ -2621,18 +2586,18 @@ ClassMethod UpdateLanguageExtensions(pVerbose As %Boolean = 0, pTestOnly As %Boo
TROLLBACK 1
}
Quit tSC
#; These are the actual contents of %ZLANGC00 (to be added/updated)
$$$STARTTAG
}

ClassMethod LanguageExtensions() [ Private ]
{
ZPM(pArgs...)
If $System.CLS.IsMthd("%IPM.Main", "Shell") {
Do ##class(%IPM.Main).Shell(pArgs...) Quit
} Else {
// TODO: Decide what to do here; definitely needs to support enabling IPM from here as well,
// but need to decide what level of customization to provide
Quit
Quit ""
}
$$$ENDTAG
#; Need an extra line down here to avoid the end bracket being on the same line as $$$ENDTAG - a comment is just fine.
}

ClassMethod EnableIPM(ByRef pCommandInfo)
Expand Down Expand Up @@ -2980,4 +2945,3 @@ ClassMethod DisplayModules(ByRef pList, pNumbered As %Boolean = 0, pWithNamespac
}

}

6 changes: 5 additions & 1 deletion src/cls/IPM/Repo/Manager.cls
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ Method SearchRepositoriesForModule(pSearchCriteria As %IPM.Repo.SearchCriteria,
Try {
Set registry = pSearchCriteria.Registry
Set pSearchCriteria.Name = $$$lcase(pSearchCriteria.Name)
Set tRes = ##class(%SQL.Statement).%ExecDirect(,"select ID from %IPM_Repo.Definition where Enabled = 1 and (:registry is null or Name = :registry) order by %IPM_Repo.Definition_SortOrder(ID)")
Set tRes = ##class(%SQL.Statement).%ExecDirect(,
"select ID from %IPM_Repo.Definition "_
"where Enabled = 1 "_
"and (? is null or Name = ?) order by %IPM_Repo.Definition_SortOrder(ID)",
registry,registry)
If (tRes.%SQLCODE < 0) {
Set tSC = $$$ERROR($$$SQLCode,tRes.%SQLCODE,tRes.%Message)
Quit
Expand Down
10 changes: 9 additions & 1 deletion src/inc/IPM/Common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ ROUTINE %IPM.Common [Type=INC]
#define SLASH $Select($$$isWINDOWS: "\", 1: "/")

#define IPMModuleName "zpm"
#define IPMServerRegistryModuleName "zpm-registry"
#define IPMServerRegistryModuleName "zpm-registry"

#; Macros used in language extension generation
#def1arg STARTTAGQ " ;Generated by %IPM.Main: Start"
#def1arg ENDTAGQ " ;Generated by %IPM.Main: End"
#def1arg STARTTAGREGEX "^ ;Generated by (%IPM.Main|%ZPM.PackageManager): Start$"
#def1arg ENDTAGREGEX "^ ;Generated by (%IPM.Main|%ZPM.PackageManager): End$"
#def1arg STARTTAG ##Expression($$$STARTTAGQ)
#def1arg ENDTAG ##Expression($$$ENDTAGQ)

0 comments on commit fa14af7

Please sign in to comment.