· 7 years ago · Feb 18, 2019, 09:28 PM
1
2local JD=load([===[
3local rA5U=20160728.17
4local Uc06="-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20160728.17 ]-"local lcBL={VERSION=rA5U,AUTHOR_NOTE=Uc06}local DHPxI=" "
5local dx={pretty=true,align_keys=false,indent=DHPxI}
6local RRuSHnxf={__tostring=function()return"JSON array"end}RRuSHnxf.__index=RRuSHnxf
7local mcYOuT={__tostring=function()return"JSON object"end}mcYOuT.__index=mcYOuT;function lcBL:newArray(iXxD6s)
8return setmetatable(iXxD6s or{},RRuSHnxf)end;function lcBL:newObject(oiY)return
9setmetatable(oiY or{},mcYOuT)end;local function Rr(FsYIVlkf)
10return
11type(FsYIVlkf)=='number'and FsYIVlkf or FsYIVlkf.N end
12local scRP0={__index=isNumber,__tostring=function(HLXS0Q_)return HLXS0Q_.S end,__unm=function(Kw)return
13Rr(Kw)end,__concat=function(nvaIsNv7,vDnoL55)
14return tostring(nvaIsNv7)..tostring(vDnoL55)end,__add=function(xlAK,zr1y)return Rr(xlAK)+Rr(zr1y)end,__sub=function(Hs,jk)return
15Rr(Hs)-Rr(jk)end,__mul=function(qzSFyIO,Z65)
16return Rr(qzSFyIO)*Rr(Z65)end,__div=function(umyCNfj,FT)return Rr(umyCNfj)/Rr(FT)end,__mod=function(YVLXYq,bJfct)return
17Rr(YVLXYq)%Rr(bJfct)end,__pow=function(OhuFpq_N,Dzg)return
18Rr(OhuFpq_N)^Rr(Dzg)end,__lt=function(_4O,C)return Rr(_4O)<Rr(C)end,__eq=function(fLI2zRe,_Fr2YU)return
19Rr(fLI2zRe)==Rr(_Fr2YU)end,__le=function(Xfn,U)return
20Rr(Xfn)<=Rr(U)end}
21function lcBL:asNumber(Ebsw)
22if getmetatable(Ebsw)==scRP0 then return Ebsw elseif
23type(Ebsw)=='table'and
24type(Ebsw.S)=='string'and type(Ebsw.N)=='number'then return setmetatable(Ebsw,scRP0)else
25local UlikV={S=tostring(Ebsw),N=tonumber(Ebsw)}return setmetatable(UlikV,scRP0)end end
26local function AI0R2TQ6(JtAjijkG)
27if JtAjijkG<=127 then return string.char(JtAjijkG)elseif JtAjijkG<=2047 then
28local s=math.floor(JtAjijkG/0x40)local YAtG_LV3=JtAjijkG- (0x40*s)return
29string.char(0xC0+s,0x80+YAtG_LV3)elseif JtAjijkG<=65535 then
30local LfEJbh_=math.floor(JtAjijkG/0x1000)local JD=JtAjijkG-0x1000*LfEJbh_
31local u=math.floor(JD/0x40)local pzDMZwG=JD-0x40*u;LfEJbh_=0xE0+LfEJbh_;u=0x80+u
32pzDMZwG=0x80+pzDMZwG
33if
34
35(LfEJbh_==0xE0 and u<0xA0)or
36(LfEJbh_==0xED and u>0x9F)or(LfEJbh_==0xF0 and u<0x90)or(LfEJbh_==0xF4 and u>0x8F)then return"?"else return string.char(LfEJbh_,u,pzDMZwG)end else local XPoQB=math.floor(JtAjijkG/0x40000)
37local XxJ=JtAjijkG-0x40000*XPoQB;local o5sms=math.floor(XxJ/0x1000)
38XxJ=XxJ-0x1000*o5sms;local JQi1jg=math.floor(XxJ/0x40)local wVzn=XxJ-0x40*JQi1jg
39return string.char(
400xF0+XPoQB,0x80+o5sms,0x80+JQi1jg,0x80+wVzn)end end
41function lcBL:onDecodeError(pE,RSjapQ,QJf,zC)if RSjapQ then
42if QJf then
43pE=string.format("%s at char %d of: %s",pE,QJf,RSjapQ)else pE=string.format("%s: %s",pE,RSjapQ)end end
44if zC~=nil then pE=pE.." ("..
45lcBL:encode(zC)..")"end
46if self.assert then self.assert(false,pE)else assert(false,pE)end end;lcBL.onDecodeOfNilError=lcBL.onDecodeError
47lcBL.onDecodeOfHTMLError=lcBL.onDecodeError
48function lcBL:onEncodeError(pfZ3SPy_,pDNa2ox6)
49if pDNa2ox6 ~=nil then pfZ3SPy_=pfZ3SPy_..
50" ("..lcBL:encode(pDNa2ox6)..")"end;if self.assert then self.assert(false,pfZ3SPy_)else
51assert(false,pfZ3SPy_)end end
52local function yA(Do6yo7nm,y06X3k,ivnJjrA,d3fMjkg)
53local el=y06X3k:match('^-?[1-9]%d*',ivnJjrA)or y06X3k:match("^-?0",ivnJjrA)if not el then
54Do6yo7nm:onDecodeError("expected number",y06X3k,ivnJjrA,d3fMjkg.etc)end
55local Wu_uIt=ivnJjrA+el:len()local w=y06X3k:match('^%.%d+',Wu_uIt)or""Wu_uIt=Wu_uIt+
56w:len()
57local sgeP=y06X3k:match('^[eE][-+]?%d+',Wu_uIt)or""Wu_uIt=Wu_uIt+sgeP:len()local CM=el..w..sgeP;if
58d3fMjkg.decodeNumbersAsObjects then return lcBL:asNumber(CM),Wu_uIt end
59if
60
61(
62d3fMjkg.decodeIntegerStringificationLength and(el:len()>=d3fMjkg.decodeIntegerStringificationLength or
63sgeP:len()>0))or
64(d3fMjkg.decodeDecimalStringificationLength and
65(
66w:len()>=d3fMjkg.decodeDecimalStringificationLength or sgeP:len()>0))then return CM,Wu_uIt end;local Qlmlet=tonumber(CM)if not Qlmlet then
67Do6yo7nm:onDecodeError("bad number",y06X3k,ivnJjrA,d3fMjkg.etc)end;return Qlmlet,Wu_uIt end
68local function XmVolesU(_,RkGFh6,hw18,nvCiFt7r)if RkGFh6:sub(hw18,hw18)~='"'then
69_:onDecodeError("expected string's opening quote",RkGFh6,hw18,nvCiFt7r.etc)end;local xSebv5Jc=hw18+1
70local mMp=RkGFh6:len()local rDtVf=""
71while xSebv5Jc<=mMp do local vj=RkGFh6:sub(xSebv5Jc,xSebv5Jc)if
72vj=='"'then return rDtVf,xSebv5Jc+1 end
73if vj~='\\'then rDtVf=rDtVf..vj;xSebv5Jc=
74xSebv5Jc+1 elseif RkGFh6:match('^\\b',xSebv5Jc)then rDtVf=rDtVf.."\b"xSebv5Jc=
75xSebv5Jc+2 elseif RkGFh6:match('^\\f',xSebv5Jc)then rDtVf=rDtVf.."\f"xSebv5Jc=
76xSebv5Jc+2 elseif RkGFh6:match('^\\n',xSebv5Jc)then rDtVf=rDtVf.."\n"xSebv5Jc=
77xSebv5Jc+2 elseif RkGFh6:match('^\\r',xSebv5Jc)then rDtVf=rDtVf.."\r"xSebv5Jc=
78xSebv5Jc+2 elseif RkGFh6:match('^\\t',xSebv5Jc)then rDtVf=rDtVf.."\t"xSebv5Jc=
79xSebv5Jc+2 else
80local z=RkGFh6:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])',xSebv5Jc)
81if z then xSebv5Jc=xSebv5Jc+6;local Zg=tonumber(z,16)
82if
83Zg>=0xD800 and Zg<=0xDBFF then
84local ykRppH=RkGFh6:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])',xSebv5Jc)
85if ykRppH then xSebv5Jc=xSebv5Jc+6;Zg=0x2400+ (Zg-0xD800)*0x400+
86tonumber(ykRppH,16)else end end;rDtVf=rDtVf..AI0R2TQ6(Zg)else rDtVf=rDtVf..
87RkGFh6:match('^\\(.)',xSebv5Jc)xSebv5Jc=xSebv5Jc+2 end end end
88_:onDecodeError("unclosed string",RkGFh6,hw18,nvCiFt7r.etc)end
89local function eZ0l3ch(WQ6,y36Aetn)local iPL3B4cr,GI2hz6SK=WQ6:find("^[ \n\r\t]+",y36Aetn)if GI2hz6SK then
90return GI2hz6SK+1 else return y36Aetn end end;local W_63_9
91local function h9dyA_4T(Oh,PG,n,O)if PG:sub(n,n)~='{'then
92Oh:onDecodeError("expected '{'",PG,n,O.etc)end;local N5UjTN=eZ0l3ch(PG,n+1)local qLH5=Oh.strictTypes and
93Oh:newObject{}or{}if
94PG:sub(N5UjTN,N5UjTN)=='}'then return qLH5,N5UjTN+1 end
95local tE=PG:len()
96while N5UjTN<=tE do local VcV0EuD,pX4gCR=XmVolesU(Oh,PG,N5UjTN,O)
97N5UjTN=eZ0l3ch(PG,pX4gCR)if PG:sub(N5UjTN,N5UjTN)~=':'then
98Oh:onDecodeError("expected colon",PG,N5UjTN,O.etc)end
99N5UjTN=eZ0l3ch(PG,N5UjTN+1)local gad4ZcL,pX4gCR=W_63_9(Oh,PG,N5UjTN,O)qLH5[VcV0EuD]=gad4ZcL
100N5UjTN=eZ0l3ch(PG,pX4gCR)local dk=PG:sub(N5UjTN,N5UjTN)
101if dk=='}'then return qLH5,N5UjTN+1 end;if PG:sub(N5UjTN,N5UjTN)~=','then
102Oh:onDecodeError("expected comma or '}'",PG,N5UjTN,O.etc)end
103N5UjTN=eZ0l3ch(PG,N5UjTN+1)end;Oh:onDecodeError("unclosed '{'",PG,n,O.etc)end
104local function oh(E,OO,y,cR6rJlAl)if OO:sub(y,y)~='['then
105E:onDecodeError("expected '['",OO,y,cR6rJlAl.etc)end;local M6ilzGJ=eZ0l3ch(OO,y+1)local iW6CD=E.strictTypes and
106E:newArray{}or{}if
107OO:sub(M6ilzGJ,M6ilzGJ)==']'then return iW6CD,M6ilzGJ+1 end
108local wZdg=1;local BaX=OO:len()
109while M6ilzGJ<=BaX do
110local SJsW11k,Ki1HJT=W_63_9(E,OO,M6ilzGJ,cR6rJlAl)iW6CD[wZdg]=SJsW11k;wZdg=wZdg+1;M6ilzGJ=eZ0l3ch(OO,Ki1HJT)
111local wjim8xCV=OO:sub(M6ilzGJ,M6ilzGJ)if wjim8xCV==']'then return iW6CD,M6ilzGJ+1 end;if
112OO:sub(M6ilzGJ,M6ilzGJ)~=','then
113E:onDecodeError("expected comma or '['",OO,M6ilzGJ,cR6rJlAl.etc)end
114M6ilzGJ=eZ0l3ch(OO,M6ilzGJ+1)end
115E:onDecodeError("unclosed '['",OO,y,cR6rJlAl.etc)end
116W_63_9=function(E,QLam,qTDt,v)qTDt=eZ0l3ch(QLam,qTDt)
117if qTDt>QLam:len()then E:onDecodeError("unexpected end of string",QLam,
118nil,v.etc)end
119if QLam:find('^"',qTDt)then return XmVolesU(E,QLam,qTDt,v.etc)elseif
120QLam:find('^[-0123456789 ]',qTDt)then return yA(E,QLam,qTDt,v)elseif QLam:find('^%{',qTDt)then
121return h9dyA_4T(E,QLam,qTDt,v)elseif QLam:find('^%[',qTDt)then return oh(E,QLam,qTDt,v)elseif QLam:find('^true',qTDt)then return true,
122qTDt+4 elseif QLam:find('^false',qTDt)then return false,qTDt+5 elseif
123QLam:find('^null',qTDt)then return nil,qTDt+4 else
124E:onDecodeError("can't parse JSON",QLam,qTDt,v.etc)end end
125function lcBL:decode(Ta,u,nArcvQl)if type(nArcvQl)~='table'then nArcvQl={}end;if u~=nil then
126nArcvQl.etc=u end;if
127type(self)~='table'or self.__index~=lcBL then
128lcBL:onDecodeError("JSON:decode must be called in method format",nil,nil,nArcvQl.etc)end
129if Ta==nil then
130self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"),
131nil,nil,nArcvQl.etc)elseif type(Ta)~='string'then
132self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s",type(Ta)),
133nil,nil,nArcvQl.etc)end;if Ta:match('^%s*$')then return nil end;if Ta:match('^%s*<')then
134self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"),Ta,
135nil,nArcvQl.etc)end
136if
137Ta:sub(1,1):byte()==0 or
138(Ta:len()>=2 and Ta:sub(2,2):byte()==0)then
139self:onDecodeError("JSON package groks only UTF-8, sorry",Ta,nil,nArcvQl.etc)end;if nArcvQl.decodeNumbersAsObjects==nil then
140nArcvQl.decodeNumbersAsObjects=self.decodeNumbersAsObjects end;if
141nArcvQl.decodeIntegerStringificationLength==nil then
142nArcvQl.decodeIntegerStringificationLength=self.decodeIntegerStringificationLength end;if
143nArcvQl.decodeDecimalStringificationLength==nil then
144nArcvQl.decodeDecimalStringificationLength=self.decodeDecimalStringificationLength end
145local h6Ub7U,Gm=pcall(W_63_9,self,Ta,1,nArcvQl)if h6Ub7U then return Gm else
146if self.assert then self.assert(false,Gm)else assert(false,Gm)end;return nil,Gm end end
147local function DZXGTh(YKA7cU)
148if YKA7cU=="\n"then return"\\n"elseif YKA7cU=="\r"then return"\\r"elseif YKA7cU=="\t"then return"\\t"elseif YKA7cU=="\b"then
149return"\\b"elseif YKA7cU=="\f"then return"\\f"elseif YKA7cU=='"'then return'\\"'elseif YKA7cU=='\\'then return'\\\\'else return
150string.format("\\u%04x",YKA7cU:byte())end end
151local Su9Koz='['..'"'..
152'%\\'..'%z'..'\001'..'-'..'\031'..']'local Uk7e=AI0R2TQ6(0x2028)local KwQCk_G=AI0R2TQ6(0x2029)
153local function ptZa(mCsewfX,yY)
154local Xf=mCsewfX:gsub(Su9Koz,DZXGTh)if yY.stringsAreUtf8 then
155Xf=Xf:gsub(Uk7e,'\\u2028'):gsub(KwQCk_G,'\\u2029')end;return'"'..Xf..'"'end
156local function PEqsd(UlFdiZ7v,U,wFeA)local JQgI={}local N={}local fs52REi=false;local PUNkgaiM
157for X in pairs(U)do
158if type(X)=='string'then
159table.insert(JQgI,X)elseif type(X)=='number'then table.insert(N,X)
160if X<=0 or X>=math.huge then
161fs52REi=true elseif not PUNkgaiM or X>PUNkgaiM then PUNkgaiM=X end else
162UlFdiZ7v:onEncodeError("can't encode table with a key of type "..type(X),wFeA)end end
163if#JQgI==0 and not fs52REi then
164if#N>0 then return nil,PUNkgaiM elseif
165tostring(U)=="JSON array"then return nil elseif tostring(U)=="JSON object"then return{}else return nil end end;table.sort(JQgI)local s6FbB
166if#N>0 then if UlFdiZ7v.noKeyConversion then
167UlFdiZ7v:onEncodeError("a table with both numeric and string keys could be an object or array; aborting",wFeA)end
168s6FbB={}for dc61,aguhyl in pairs(U)do s6FbB[dc61]=aguhyl end
169table.sort(N)
170for p,gOPDv in ipairs(N)do local aSdZU3=tostring(gOPDv)
171if s6FbB[aSdZU3]==nil then
172table.insert(JQgI,aSdZU3)s6FbB[aSdZU3]=U[gOPDv]else
173UlFdiZ7v:onEncodeError(
174"conflict converting table with mixed-type keys into a JSON object: key "..gOPDv.." exists both as a string and a number.",wFeA)end end end;return JQgI,nil,s6FbB end;local iSj
175function iSj(YKDL,oFyb6OLp,oGdh_mv,WjvvK,TASVwBgU,KjUncMB,XkT)
176if oFyb6OLp==nil or
177(not XkT and TASVwBgU and TASVwBgU.null and oFyb6OLp==
178TASVwBgU.null)then return'null'elseif
179type(oFyb6OLp)=='string'then return ptZa(oFyb6OLp,TASVwBgU)elseif type(oFyb6OLp)=='number'then
180if
181oFyb6OLp~=oFyb6OLp then return"null"elseif oFyb6OLp>=math.huge then return"1e+9999"elseif oFyb6OLp<=-math.huge then
182return"-1e+9999"else return tostring(oFyb6OLp)end elseif type(oFyb6OLp)=='boolean'then return tostring(oFyb6OLp)elseif type(oFyb6OLp)~=
183'table'then
184YKDL:onEncodeError("can't convert "..type(oFyb6OLp).." to JSON",WjvvK)elseif getmetatable(oFyb6OLp)==scRP0 then return tostring(oFyb6OLp)else
185local c3dr=oFyb6OLp;if type(TASVwBgU)~='table'then TASVwBgU={}end;if type(KjUncMB)~=
186'string'then KjUncMB=""end
187if oGdh_mv[c3dr]then
188YKDL:onEncodeError("table "..
189tostring(c3dr).." is a child of itself",WjvvK)else oGdh_mv[c3dr]=true end;local NGH;local tIc,MD2O,HQ=PEqsd(YKDL,c3dr,WjvvK)
190if MD2O then local cng={}for lE=1,MD2O do
191table.insert(cng,iSj(YKDL,c3dr[lE],oGdh_mv,WjvvK,TASVwBgU,KjUncMB))end
192if TASVwBgU.pretty then NGH="[ "..
193table.concat(cng,", ").." ]"else NGH="["..
194table.concat(cng,",").."]"end elseif tIc then local nI2F0id=HQ or c3dr
195if TASVwBgU.pretty then local N4aMD_P={}local pCi=0
196for lNOqUk8,YAnZNei in ipairs(tIc)do
197local h8YWR44E=iSj(YKDL,tostring(YAnZNei),oGdh_mv,WjvvK,TASVwBgU,KjUncMB,true)
198if TASVwBgU.align_keys then pCi=math.max(pCi,#h8YWR44E)end;table.insert(N4aMD_P,h8YWR44E)end
199local NzeoQJ=KjUncMB..tostring(TASVwBgU.indent or"")
200local AwGfFV=NzeoQJ..string.rep(" ",pCi)..
201(TASVwBgU.align_keys and" "or"")
202local wCRY="%s%"..string.format("%d",pCi).."s: %s"local d0uKSVw1={}
203for VF,fTrMe in ipairs(tIc)do
204local ypDndT8=iSj(YKDL,nI2F0id[fTrMe],oGdh_mv,WjvvK,TASVwBgU,AwGfFV)
205table.insert(d0uKSVw1,string.format(wCRY,NzeoQJ,N4aMD_P[VF],ypDndT8))end;NGH="{\n"..
206table.concat(d0uKSVw1,",\n").."\n"..KjUncMB.."}"else local MV65={}
207for Y3D66Ym9,q in
208ipairs(tIc)do
209local PhJ=iSj(YKDL,nI2F0id[q],oGdh_mv,WjvvK,TASVwBgU,KjUncMB)
210local h=iSj(YKDL,tostring(q),oGdh_mv,WjvvK,TASVwBgU,KjUncMB,true)
211table.insert(MV65,string.format("%s:%s",h,PhJ))end;NGH="{"..table.concat(MV65,",").."}"end else NGH="[]"end;oGdh_mv[c3dr]=false;return NGH end end
212function lcBL:encode(j2K,r8hgwQ,_6U)if type(self)~='table'or self.__index~=lcBL then
213lcBL:onEncodeError("JSON:encode must be called in method format",r8hgwQ)end;if
214type(_6U)~='table'then _6U={}end;return iSj(self,j2K,{},r8hgwQ,_6U)end
215function lcBL:encode_pretty(GLSzBQs,c,xg)if type(self)~='table'or self.__index~=lcBL then
216lcBL:onEncodeError("JSON:encode_pretty must be called in method format",c)end;if
217type(xg)~='table'then xg=dx end;return iSj(self,GLSzBQs,{},c,xg)end;function lcBL.__tostring()return"JSON encode/decode package"end
218lcBL.__index=lcBL
219function lcBL:new(Id2KoP_G)local Y2or={}if Id2KoP_G then
220for zN8ASHV5,iju in pairs(Id2KoP_G)do Y2or[zN8ASHV5]=iju end end
221return setmetatable(Y2or,lcBL)end;return lcBL:new()
222]===])()
223local u=(function()
224local N=[[ Copyright (c) The python-semanticversion project
225 All rights reserved.
226
227 Redistribution and use in source and binary forms, with or without
228 modification, are permitted provided that the following conditions are met:
229
230 1. Redistributions of source code must retain the above copyright notice, this
231 list of conditions and the following disclaimer.
232 2. Redistributions in binary form must reproduce the above copyright notice,
233 this list of conditions and the following disclaimer in the documentation
234 and/or other materials provided with the distribution.
235
236 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
237 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
238 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
239 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
240 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
241 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
242 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
243 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
244 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
245 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
246 ]]
247N=[[ The use of the library is similar to the original one,
248 check the documentation here: https://python-semanticversion.readthedocs.io/en/latest/
249 ]]local fs52REi,PUNkgaiM,s6FbB;do local KjUncMB=table
250fs52REi,PUNkgaiM,s6FbB=KjUncMB.concat,KjUncMB.insert,KjUncMB.unpack end;local X
251X=function(XkT)
252do local c3dr=tonumber(XkT)if
253c3dr then return c3dr,true else return XkT,false end end end;local dc61
254dc61=function(NGH)return
255NGH and NGH[1]=='0'and tonumber(NGH and NGH~='0')end;local aguhyl
256aguhyl=function(tIc,MD2O)if tIc==MD2O then return 0 end;if tIc>MD2O then return 1 end;if tIc<MD2O then
257return-1 end end;local p
258p=function(HQ,cng)local lE,nI2F0id=X(HQ)local N4aMD_P,pCi=X(cng)
259if nI2F0id and pCi then
260return aguhyl(lE,N4aMD_P)elseif nI2F0id then return-1 elseif pCi then return 1 else return aguhyl(lE,N4aMD_P)end end;local gOPDv
261gOPDv=function(NzeoQJ,AwGfFV)local wCRY
262do local d0uKSVw1={}
263for lNOqUk8=1,#NzeoQJ do if AwGfFV[lNOqUk8]then
264d0uKSVw1[NzeoQJ[lNOqUk8]]=AwGfFV[lNOqUk8]end end;wCRY=d0uKSVw1 end
265for YAnZNei,h8YWR44E in pairs(wCRY)do local VF=p(YAnZNei,h8YWR44E)if VF~=0 then return VF end end;return aguhyl(#NzeoQJ,#AwGfFV)end;local aSdZU3
266do local fTrMe
267local ypDndT8={_coerce=function(Y3D66Ym9,q,PhJ)if PhJ==nil then PhJ=false end
268if q==nil and PhJ then return q end;return tonumber(q)end,next_major=function(h)
269if
270h.prerelease and h.minor==0 and h.patch==0 then
271return
272aSdZU3(fs52REi((function()local j2K={}
273local r8hgwQ=1;local _6U={h.major,h.minor,h.patch}for GLSzBQs=1,#_6U do local c=_6U[GLSzBQs]
274j2K[r8hgwQ]=tostring(c)r8hgwQ=r8hgwQ+1 end;return j2K end)(),'.'))else
275return
276aSdZU3(fs52REi((function()local xg={}local Id2KoP_G=1;local Y2or={h.major+1,0,0}
277for zN8ASHV5=1,#Y2or do
278local iju=Y2or[zN8ASHV5]xg[Id2KoP_G]=tostring(iju)Id2KoP_G=Id2KoP_G+1 end;return xg end)(),'.'))end end,next_minor=function(XsWgh)if
279not(XsWgh.minor)then
280error("Partial version doesn't contain the minor component!")end
281if
282XsWgh.prerelease and XsWgh.patch==0 then
283return
284aSdZU3(fs52REi((function()local l4Hdz={}local NSXCgSH=1
285local Wq={XsWgh.major,XsWgh.minor,XsWgh.patch}for SbOQ=1,#Wq do local IiuHGo=Wq[SbOQ]l4Hdz[NSXCgSH]=tostring(IiuHGo)
286NSXCgSH=NSXCgSH+1 end;return l4Hdz end)(),'.'))else
287return
288aSdZU3(fs52REi((function()local cGqxtYr={}local bgJFKeeZ=1
289local yu9fg0nN={XsWgh.major,XsWgh.minor+1,0}
290for wgx=1,#yu9fg0nN do local zlU7X=yu9fg0nN[wgx]
291cGqxtYr[bgJFKeeZ]=tostring(zlU7X)bgJFKeeZ=bgJFKeeZ+1 end;return cGqxtYr end)(),'.'))end end,next_patch=function(t)if
292not(t.patch)then
293error("Partial version doesn't contain the patch component!")end
294if t.prerelease then
295return
296aSdZU3(fs52REi((function()local f6qbO={}local kk=1
297local QrubIAv={t.major,t.minor,t.patch}for bLHDW=1,#QrubIAv do local YjFd7b=QrubIAv[bLHDW]f6qbO[kk]=tostring(YjFd7b)
298kk=kk+1 end;return f6qbO end)(),'.'))else
299return
300aSdZU3(fs52REi((function()local jZgPYb={}local zN2=1;local IN69pa5={t.major,t.minor,t.patch+1}for UOWJ=1,#
301IN69pa5 do local WtalJw=IN69pa5[UOWJ]jZgPYb[zN2]=tostring(WtalJw)
302zN2=zN2+1 end;return jZgPYb end)(),'.'))end end,coerce=function(JYrf2,KHDOUlRY,I0JvPpn)if
303I0JvPpn==nil then I0JvPpn=false end;local Ce4ZE
304Ce4ZE=function(kxeBp)
305local a,kQ=kxeBp:match('^(%d+)(.*)$')if not(a)then return nil end;local EE9LAE=a
306local iVx,eg=kQ:match('^%.(%d+)(.*)$')if iVx then kQ=eg;EE9LAE=EE9LAE.. ('.'..iVx)end
307local AQviNt;AQviNt,eg=kQ:match('^%.(%d+)(.*)$')if AQviNt then kQ=eg;EE9LAE=EE9LAE..
308('.'..AQviNt)end;return kxeBp,EE9LAE end;local OVx_mN,lB=Ce4ZE(KHDOUlRY)if not(OVx_mN)then
309error("Version string lacks a numerical component: "..
310tostring(KHDOUlRY))end
311local byE=KHDOUlRY:sub(1,#lB)if not I0JvPpn then while({byE:gsub('.','')})[2]<2 do
312byE=byE..'.0'end end;if
313#lB==#KHDOUlRY then return aSdZU3(byE,I0JvPpn)end
314local bITCI=KHDOUlRY:sub(#lB+1)bITCI=bITCI:gsub('[^a-zA-Z0-9+.-]','-')local K,F5dtVpnN=nil,nil
315if
316bITCI:sub(1,1)=='+'then K=''F5dtVpnN=bITCI:sub(2)elseif bITCI:sub(1,1)=='.'then K=''
317F5dtVpnN=bITCI:sub(2)elseif bITCI:sub(1,1)=='-'then bITCI=bITCI:sub(2)
318do
319local T6=bITCI:find('+')if T6 then K,F5dtVpnN=bITCI:sub(1,T6-1),bITCI:sub(T6+1,-1)else
320K,F5dtVpnN=bITCI,''end end else do local NviN0i=bITCI:find('+')
321if NviN0i then K,F5dtVpnN=bITCI:sub(1,NviN0i-1),bITCI:sub(NviN0i+1,
322-1)else K,F5dtVpnN=bITCI,''end end end;F5dtVpnN=F5dtVpnN:gsub('+','.')if K and K~=''then
323byE=byE.. ('-'..K)end;if F5dtVpnN and F5dtVpnN~=''then
324byE=byE.. ('+'..F5dtVpnN)end;return JYrf2.__class(byE,I0JvPpn)end,parse=function(BlMQce,o,dpRE,fEiXwWq)if
325dpRE==nil then dpRE=false end;if fEiXwWq==nil then fEiXwWq=false end;if
326not o or type(o)~='string'or o==''then
327error("Invalid empty version string: "..
328tostring(tostring(o)))end;local r3JzMga6
329if dpRE then
330r3JzMga6=BlMQce.__class.partialVersionRe else r3JzMga6=BlMQce.__class.versionRe end;local Tuyw,FYLcr2nu,ioS69,AiP,S2jwpoi=r3JzMga6(BlMQce.__class,o)if not Tuyw then
331error(
332"Invalid version string: "..tostring(o))end;if dc61(Tuyw)then
333error("Invalid leading zero in major: "..tostring(o))end;if dc61(FYLcr2nu)then
334error("Invalid leading zero in minor: "..
335tostring(o))end;if dc61(ioS69)then
336error("Invalid leading zero in patch: "..
337tostring(o))end;Tuyw=tonumber(Tuyw)
338FYLcr2nu=BlMQce:_coerce(FYLcr2nu,dpRE)ioS69=BlMQce:_coerce(ioS69,dpRE)
339if AiP==nil then
340if
341dpRE and S2jwpoi==nil then return{Tuyw,FYLcr2nu,ioS69,nil,nil}else AiP={}end elseif AiP==''then AiP={}else
342do local _WX9u={}local u0riyU=1;for UH in AiP:gmatch('[^.]+')do _WX9u[u0riyU]=UH
343u0riyU=u0riyU+1 end;AiP=_WX9u end;BlMQce:_validateIdentifiers(AiP,false)end
344if S2jwpoi==nil then if dpRE then S2jwpoi=nil else S2jwpoi={}end elseif S2jwpoi==''then S2jwpoi={}else do
345local WNph={}local ytF=1
346for d in S2jwpoi:gmatch('[^.]+')do WNph[ytF]=d;ytF=ytF+1 end;S2jwpoi=WNph end
347BlMQce:_validateIdentifiers(S2jwpoi,true)end;return{Tuyw,FYLcr2nu,ioS69,AiP,S2jwpoi}end,_validateIdentifiers=function(gRm,LPX0,g)if
348g==nil then g=false end
349for _l=1,#LPX0 do local qao=LPX0[_l]if not qao then
350error("Invalid empty identifier "..
351
352tostring(qao).." in "..tostring(fs52REi(LPX0,'.')))end;if
353
354qao:sub(1,1)=='0'and tonumber(qao)and qao~='0'and not g then
355error("Invalid leading zero in identifier "..tostring(qao))end end end,__pairs=function(ipUPIzc)return
356pairs({ipUPIzc.major,ipUPIzc.minor,ipUPIzc.patch,ipUPIzc.prerelease,ipUPIzc.build})end,__ipairs=function(N8)return
357ipairs({N8.major,N8.minor,N8.patch,N8.prerelease,N8.build})end,__tostring=function(Gzk)
358local J7nsK=tostring(Gzk.major)
359if Gzk.minor~=nil then J7nsK=J7nsK.. ('.'..Gzk.minor)end
360if Gzk.patch~=nil then J7nsK=J7nsK.. ('.'..Gzk.patch)end
361if Gzk.prerelease and#Gzk.prerelease>0 or
362
363Gzk.partial and Gzk.prerelease and#Gzk.prerelease==0 and Gzk.build==nil then
364J7nsK=J7nsK.. ('-'..
365fs52REi(Gzk.prerelease,'.'))end
366if Gzk.build and#Gzk.build>0 or Gzk.partial and Gzk.build and
367#Gzk.build==0 then J7nsK=J7nsK.. ('+'..
368fs52REi(Gzk.build,'.'))end;return J7nsK end,_comparsionFunctions=function(dXbd,vQj)if
369vQj==nil then vQj=false end;local sVBxyy
370sVBxyy=function(bJtvRSR,aBhZK5)
371if bJtvRSR and aBhZK5 then
372return gOPDv(bJtvRSR,aBhZK5)elseif bJtvRSR then return-1 elseif aBhZK5 then return 1 else return 0 end end;local N9d
373N9d=function(Jz8JUscj,OtGmbAgE)
374if Jz8JUscj==OtGmbAgE then return 0 else return'not implemented'end end;local S7
375S7=function(oU_r)local n_lv
376n_lv=function(UYQF,WXx)
377if UYQF==nil or WXx==nil then return 0 else return oU_r(UYQF,WXx)end end;return n_lv end
378if vQj then
379return{aguhyl,S7(aguhyl),S7(aguhyl),S7(sVBxyy),S7(N9d)}else return{aguhyl,aguhyl,aguhyl,sVBxyy,N9d}end end,__compare=function(W4EuxJXi,BlYNd61h)
380local XDPndG=W4EuxJXi:_comparsionFunctions(
381W4EuxJXi.partial or BlYNd61h.partial)
382local sJYFQIP4={{XDPndG[1],W4EuxJXi.major,BlYNd61h.major},{XDPndG[2],W4EuxJXi.minor,BlYNd61h.minor},{XDPndG[3],W4EuxJXi.patch,BlYNd61h.patch},{XDPndG[4],W4EuxJXi.prerelease,BlYNd61h.prerelease},{XDPndG[5],W4EuxJXi.build,BlYNd61h.build}}
383for Ogq0S2=1,#sJYFQIP4 do local n8Cw3SR=sJYFQIP4[Ogq0S2]local GJqd7gt,slE5aDm2,aL_g=s6FbB(n8Cw3SR)
384local IMUI10L=GJqd7gt(slE5aDm2,aL_g)if IMUI10L~=0 then return IMUI10L end end;return 0 end,__compareHelper=function(vPA,pUXZ6G4,mk,OeQex1U4)
385local i0cV9=vPA:__compare(pUXZ6G4)if i0cV9 =='not implemented'then return OeQex1U4 end
386return mk(i0cV9)end,__eq=function(EGD,VWiGCreH)
387local B_kkL;B_kkL=function(uEO6Y)return uEO6Y==0 end;return
388EGD:__compareHelper(VWiGCreH,B_kkL,false)end,__lt=function(i_053JPY,l)
389local UK;UK=function(NzaICo)return NzaICo<0 end;return
390i_053JPY:__compareHelper(l,UK,false)end,__le=function(k1X83nYm,xxzxfj)
391local _ad1m4I;_ad1m4I=function(H1QsS)return H1QsS<=0 end;return
392k1X83nYm:__compareHelper(xxzxfj,_ad1m4I,false)end}ypDndT8.__index=ypDndT8
393fTrMe=setmetatable({__init=function(rIMx,TiA,Y51P)if Y51P==nil then Y51P=false end
394local ichL,NOK,Alv,YeLO2,CkrmO=s6FbB(rIMx:parse(TiA,Y51P))
395rIMx.major,rIMx.minor,rIMx.patch,rIMx.prerelease,rIMx.build,rIMx.partial=ichL,NOK,Alv,YeLO2,CkrmO,Y51P end,__base=ypDndT8,__name="Version"},{__index=ypDndT8,__call=function(ooovsSJe,...)
396local s5IsD=setmetatable({},ypDndT8)ooovsSJe.__init(s5IsD,...)return s5IsD end})ypDndT8.__class=fTrMe;local MV65=fTrMe
397MV65.versionRe=function(MV65,KvYEVoXt)
398local VWWD_P,zsMuNkv,aXxi,Q18a7QTy=KvYEVoXt:match('^(%d+)%.(%d+)%.(%d+)(.*)$')if not(VWWD_P)then return nil end
399local K5Rp6,GTIA=Q18a7QTy:match('^%-([0-9a-zA-z.-]+)(.*)$')if K5Rp6 then Q18a7QTy=GTIA end;local gdPUe
400gdPUe,GTIA=Q18a7QTy:match('^%+([0-9a-zA-Z.-]+)(.*)$')if gdPUe then Q18a7QTy=GTIA end;if#Q18a7QTy>0 then return nil end;return VWWD_P,zsMuNkv,
401aXxi,K5Rp6,gdPUe end
402MV65.partialVersionRe=function(MV65,_bxEn)local pcN_ceXY,_P=_bxEn:match('^(%d+)(.*)$')if
403not(pcN_ceXY)then return nil end;local rq,mo=_P:match('^%.(%d+)(.*)$')
404if rq then _P=mo end;local I;I,mo=_P:match('^%.(%d+)(.*)$')if I then _P=mo end;local RAAJAsR
405RAAJAsR,mo=_P:match('^%-([0-9a-zA-Z.-]*)(.*)$')if RAAJAsR then _P=mo end;local c1pjj7
406c1pjj7,mo=_P:match('^%+([0-9a-zA-Z.-]*)(.*)$')if c1pjj7 then _P=mo end;if#_P>0 then return nil end;return pcN_ceXY,rq,I,RAAJAsR,c1pjj7 end;aSdZU3=fTrMe end;local YKDL
407do local BMv
408local NQh8={parse=function(bkTe,ohmPbyDd)if not ohmPbyDd or type(ohmPbyDd)~='string'or
409ohmPbyDd==''then
410error("Invalid empty requirement specification: "..
411tostring(tostring(ohmPbyDd)))end
412if
413ohmPbyDd=='*'then return{bkTe.__class.KIND_ANY,''}end;local D,DfDLWkT=bkTe.__class:reSpec(ohmPbyDd)if not D then
414error(
415"Invalid requirement specification: "..tostring(ohmPbyDd))end;D=
416bkTe.__class.KIND_ALIASES[D]or D;local MTU8HP4d=aSdZU3(DfDLWkT,true)
417if
418MTU8HP4d.build~=nil and D~=bkTe.__class.KIND_EQUAL and D~=
419bkTe.__class.KIND_NEQ then
420error("Invalid requirement specification "..
421tostring(ohmPbyDd)..": build numbers have no ordering")end;return{D,MTU8HP4d}end,match=function(hIM_cG0i,jD)
422local me=hIM_cG0i.kind
423if hIM_cG0i.__class.KIND_ANY==me then return true elseif
424hIM_cG0i.__class.KIND_LT==me then return jD<hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_LTE==me then return jD<=
425hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_EQUAL==me then return
426jD==hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_GTE==me then
427return jD>=hIM_cG0i.spec elseif hIM_cG0i.__class.KIND_GT==me then return jD>hIM_cG0i.spec elseif
428hIM_cG0i.__class.KIND_NEQ==me then return jD~=hIM_cG0i.spec elseif
429hIM_cG0i.__class.KIND_CARET==me then return
430hIM_cG0i.spec<=jD and jD<hIM_cG0i.spec:next_major()elseif hIM_cG0i.__class.KIND_TILDE==me then return
431
432hIM_cG0i.spec<=jD and jD<hIM_cG0i.spec:next_minor()else return
433error("Unexpected match kind: "..tostring(hIM_cG0i.kind))end end,__tostring=function(sgU5HAMG)
434return
435tostring(sgU5HAMG.kind)..tostring(sgU5HAMG.spec)end,__eq=function(FDydY,PEZ_)return FDydY.kind==PEZ_.kind and FDydY.spec==
436PEZ_.spec end}NQh8.__index=NQh8
437BMv=setmetatable({__init=function(c,ElbTbcZG)
438c.kind,c.spec=s6FbB(c:parse(ElbTbcZG))end,__base=NQh8,__name="SpecItem"},{__index=NQh8,__call=function(r3,...)
439local pUiVYRok=setmetatable({},NQh8)r3.__init(pUiVYRok,...)return pUiVYRok end})NQh8.__class=BMv;local P=BMv;P.KIND_ANY='*'P.KIND_LT='<'P.KIND_LTE='<='
440P.KIND_EQUAL='=='P.KIND_SHORTEQ='='P.KIND_EMPTY=''P.KIND_GTE='>='P.KIND_GT='>'
441P.KIND_NEQ='!='P.KIND_CARET='^'P.KIND_TILDE='~'
442P.KIND_ALIASES={[P.__class.KIND_SHORTEQ]=P.__class.KIND_EQUAL,[P.__class.KIND_EMPTY]=P.__class.KIND_EQUAL}
443P.reSpec=function(P,jvPsY9)local tEBmuypm,hW=jvPsY9:match('^(.-)(%d.*)$')
444if
445not
446(
447
448tEBmuypm=='<'or tEBmuypm==
449'<='or tEBmuypm==''or tEBmuypm=='='or tEBmuypm=='=='or tEBmuypm=='>='or tEBmuypm=='>'or
450tEBmuypm=='!='or
451tEBmuypm=='^'or
452tEBmuypm=='~')then return nil else return tEBmuypm,hW end end;YKDL=BMv end;local oFyb6OLp
453do local iOcgdUx
454local kCwLIk={parse=function(_l,rjQ)local Euo0={}local LIV=1;for vydlAbZ3 in rjQ:gmatch('[^,]+')do
455Euo0[LIV]=YKDL(vydlAbZ3)LIV=LIV+1 end;return Euo0 end,match=function(BXxv5z,mKLU)
456local Him=BXxv5z.specs;for cPDhu=1,#Him do local UQnOS=Him[cPDhu]
457if not UQnOS:match(mKLU)then return false end end;return true end,filter=function(tRWU,X2Zy_nb)
458local ITtw3N7E=0
459return
460function()
461while true do ITtw3N7E=ITtw3N7E+1;local yozOp=X2Zy_nb[ITtw3N7E]
462if not(yozOp)then return nil end;if tRWU:match(yozOp)then return yozOp end end end end,select=function(wxU,kOmS5sy)
463local CLSdD;do local Fh={}local IlAPA=1
464for jLKMpQuK in wxU:filter(kOmS5sy)do Fh[IlAPA]=jLKMpQuK;IlAPA=IlAPA+1 end;CLSdD=Fh end
465if#CLSdD>0 then
466local sUQpby=CLSdD[1]for mbA=1,#CLSdD do local _qPhpaFx=CLSdD[mbA]
467if sUQpby<_qPhpaFx then sUQpby=_qPhpaFx end end;return sUQpby else return nil end end,__index=function(zex,pPGcdu)if
468zex:match(pPGcdu)then return true else return nil end end,__pairs=function(rjp)return
469pairs(rjp.specs)end,__ipairs=function(cT2z)return ipairs(cT2z.specs)end,__tostring=function(zke1tWps)
470return
471fs52REi((function()
472local gRFA={}local jX9a0tJX=1;local YFy4TGc=zke1tWps.specs
473for YjpbYkCb=1,#YFy4TGc do local L1p7luJ=YFy4TGc[YjpbYkCb]
474gRFA[jX9a0tJX]=tostring(L1p7luJ)jX9a0tJX=jX9a0tJX+1 end;return gRFA end)(),',')end,__eq=function(eH,WpOZ)
475local fD2289=eH.specs
476for folfO=1,#fD2289 do local vtsK=fD2289[folfO]local E1p4Mv=false;local IHap=WpOZ.specs
477for rDvV=1,#IHap do
478local RX1L2q=IHap[rDvV]if vtsK==RX1L2q then E1p4Mv=true;break end end;if not E1p4Mv then return false end end;return true end}kCwLIk.__index=kCwLIk
479iOcgdUx=setmetatable({__init=function(bCBtWguf,q)if type(q)=='string'then q={q}end
480local e1sXUN4f
481do local x={}local VP=1;for IQwqq=1,#q do local Xcc4=q[IQwqq]x[VP]=bCBtWguf:parse(Xcc4)
482VP=VP+1 end;e1sXUN4f=x end;bCBtWguf.specs={}for fqw5=1,#e1sXUN4f do local qnVfOeRE=e1sXUN4f[fqw5]
483for YIiSKsxK=1,#qnVfOeRE do
484local Ua=qnVfOeRE[YIiSKsxK]PUNkgaiM(bCBtWguf.specs,Ua)end end end,__base=kCwLIk,__name="Spec"},{__index=kCwLIk,__call=function(qeJtG,...)
485local pdpNgBcZ=setmetatable({},kCwLIk)qeJtG.__init(pdpNgBcZ,...)return pdpNgBcZ end})kCwLIk.__class=iOcgdUx;oFyb6OLp=iOcgdUx end;local oGdh_mv
486oGdh_mv=function(wV,rLd)return aguhyl(aSdZU3(wV,aSdZU3(rLd)))end;local WjvvK;WjvvK=function(z8oF,DB6A7N)
487return oFyb6OLp(z8oF):match(aSdZU3(DB6A7N))end
488local TASVwBgU
489TASVwBgU=function(VhYX)return({aSdZU3:parse(VhYX)})[1]end
490return{Spec=oFyb6OLp,SpecItem=YKDL,Version=aSdZU3,compare=oGdh_mv,match=WjvvK,validate=TASVwBgU}end)()local pzDMZwG;pzDMZwG=require("component").isAvailable;local XPoQB,XxJ
491do
492local Ha7ErH=require("shell")XPoQB,XxJ=Ha7ErH.parse,Ha7ErH.getWorkingDirectory end;local o5sms=require("shell")local JQi1jg,wVzn,pE,RSjapQ,QJf,zC
493do
494local rjU95v=require("filesystem")
495JQi1jg,wVzn,pE,RSjapQ,QJf,zC=rjU95v.isDirectory,rjU95v.exists,rjU95v.makeDirectory,rjU95v.concat,rjU95v.copy,rjU95v.lastModified end;local pfZ3SPy_=require("filesystem")local pDNa2ox6,Do6yo7nm
496do
497local sxBl=require("serialization")pDNa2ox6,Do6yo7nm=sxBl.serialize,sxBl.unserialize end;local y06X3k;y06X3k=require("event").pull;local ivnJjrA,d3fMjkg,el
498do
499local m=require("term")ivnJjrA,d3fMjkg,el=m.clearLine,m.getCursor,m.clear end;local Wu_uIt;Wu_uIt=os.exit;local w,sgeP;do local nD4LhX6z=io
500w,sgeP=nD4LhX6z.write,nD4LhX6z.stderr end;local CM,Qlmlet;do local iN=table
501CM,Qlmlet=iN.insert,iN.unpack end;local _=pfZ3SPy_.list;local RkGFh6,hw18={},{}local nvCiFt7r=nil
502local xSebv5Jc={}local mMp={}local rDtVf={}local vj="/etc/hpm/module/"local z="/var/lib/hpm/dist/"local Zg=0
503local ykRppH="/etc/hpm/hpm.cfg"local WQ6=[[Usage: hpm OPTIONS COMMAND
504See `man hpm` for more info.]]
505local y36Aetn=[[-- << Global settings >> -------------------------------------------------------
506-- A directory where package manifests will be placed.
507-- It will be created if it doesn't exist.
508dist = "/var/lib/hpm/dist"
509
510-- A place where to search for custom hpm modules.
511-- It will be created if it doesn't exist.
512modules = "/etc/hpm/module"
513
514-- << Settings related to the hel module >> ------------------------------------
515hel = {}
516
517-- If set to `false`, hpm will *only* remove a package that hpm is told to
518-- remove. Otherwise, all of its dependants will be also removed.
519hel.remove_dependants = true
520
521-- << Settings related to the oppm module >> -----------------------------------
522oppm = {}
523
524-- A cache file where package manifests will be stored for faster access.
525oppm.cache_file = "/var/cache/hpm/oppm"
526
527-- See hel.remove_dependants above.
528oppm.remove_dependants = true
529
530-- Connect additional GitHub repositories not present in OpenPrograms' list.
531-- The format is the same as in the oppm.cfg file at OpenPrograms:
532-- https://github.com/OpenPrograms/openprograms.github.io/blob/master/repos.cfg
533oppm.custom_repos = {
534 -- ["My-Super-Repository"] = {
535 -- repo="My-GitHub-Username/my-programs"
536 -- }
537}
538]]
539local iPL3B4cr={info=function(...)
540if RkGFh6.v then
541return
542print(table.concat((function(...)local Lq={}local s9tW=1;local R61K={...}for Jf4os=1,#R61K do local a4xc=R61K[Jf4os]
543Lq[s9tW]=tostring(a4xc)s9tW=s9tW+1 end;return Lq end)(...),"\t"))end end,print=function(...)
544if
545not(RkGFh6.q)then
546return
547print(table.concat((function(...)local e={}local la5=1;local i={...}for R=1,#i do local xWVu=i[R]
548e[la5]=tostring(xWVu)la5=la5+1 end;return e end)(...),"\t"))end end,error=function(...)
549if
550not(RkGFh6.q)then
551return
552sgeP:write(
553table.concat((function(...)local Yw8Yxix={}local i=1;local VoXG={...}
554for JL0I04c=1,#VoXG do
555local En6r_K97=VoXG[JL0I04c]Yw8Yxix[i]=tostring(En6r_K97)i=i+1 end;return Yw8Yxix end)(...),"\t")..'\n')end end,fatal=function(...)
556if
557not(RkGFh6.q)then
558sgeP:write(
559table.concat((function(...)local T4AA={}local VnuCKTdu=1;local XnNgn={...}
560for H1JD=1,#XnNgn do
561local gEEa9I=XnNgn[H1JD]T4AA[VnuCKTdu]=tostring(gEEa9I)VnuCKTdu=VnuCKTdu+1 end;return T4AA end)(...),"\t")..'\n')end;return Wu_uIt(1)end}local GI2hz6SK
562GI2hz6SK=function(ULLLDUm,e4F3)
563if not(ULLLDUm)then return iPL3B4cr.fatal(e4F3)end end;local Oh
564Oh=function(GsfNt7)return
565iPL3B4cr.fatal((tostring(GsfNt7))..": Not implemented yet!")end;local PG;PG=function()w(WQ6)return Wu_uIt(0)end;local n
566n=function(fF0,YWPfQKb2)if
567not(fF0)then iPL3B4cr.fatal(YWPfQKb2)end;return fF0 end;local O
568O=function(r,OS0Zp3i,BK)
569if not(type(r==OS0Zp3i))then
570iPL3B4cr.fatal("Value '"..
571tostring(r).."' is "..
572
573tostring(type(BK))..", however, a "..tostring(OS0Zp3i).." is expected.")end;return BK end;local N5UjTN
574N5UjTN=function(Idjbe70)return O(Idjbe70,"number",tonumber(Idjbe70))end;local qLH5
575qLH5=function(B)return O(B,"string",tostring(B))end;local tE
576tE=function(nDjt,NVWt)
577for efuUGMh,p4nNp in pairs(NVWt)do if p4nNp==nDjt then return true,efuUGMh end end;return false end;local VcV0EuD
578VcV0EuD=function(VW)local Zt=0;for V,mzeTI in pairs(VW)do Zt=Zt+1 end;return Zt end;local pX4gCR
579pX4gCR=function(s)
580if type(s)=="nil"then return true elseif type(s)=="string"then return not s or#s<1 elseif
581type(s)=="table"then return not s or VcV0EuD(s)<1 else return true end end;local gad4ZcL
582gad4ZcL=function(y4J)
583for ztJhP_u8=1,#y4J do local D=y4J[ztJhP_u8]if not D then return false end end;return true end;local dk
584dk=function(XIcl)return wVzn(XIcl)and JQi1jg(XIcl)end;local E
585E=function(ys)return wVzn(ys)and not JQi1jg(ys)end;local OO
586OO=function(rMQ1um8)return rMQ1um8 ==1 and""or"s"end;local y
587y=function(U2)return U2 ~=1 and""or"s"end;local cR6rJlAl
588cR6rJlAl=function(X)return X==1 and"is"or"are"end;local M6ilzGJ
589M6ilzGJ=function(zLtWO09,Z)
590for ZDICnKE,L in pairs(Z)do if type(L)~="table"or
591type(zLtWO09[ZDICnKE])~="table"then zLtWO09[ZDICnKE]=L else
592M6ilzGJ(zLtWO09[ZDICnKE],L)end end end;local iW6CD
593iW6CD=function(B58)if type(B58)~="table"then return B58 end;local PYVzrNl={}for KTVmRC,Pa in pairs(B58)do
594PYVzrNl[KTVmRC]=iW6CD(Pa)end;return PYVzrNl end;local wZdg
595wZdg=function()do local OJPc3R=io.open("/tmp/hpm-time","w")
596OJPc3R:write("")OJPc3R:close()end
597local bmK=zC("/tmp/hpm-time")pfZ3SPy_.remove("/tmp/hpm-time")return bmK end;local BaX
598BaX=function(j)
599if
600pfZ3SPy_.get(o5sms.resolve(j)).isReadOnly()then return false,"the path is readonly!"elseif not wVzn(j)then
601return false,"the filesystem node doesn't exist."else
602if
603not(JQi1jg(j)or pfZ3SPy_.isLink(j))then return pfZ3SPy_.remove(j)else for vMgKnGj in n(_(j))do
604BaX(RSjapQ(j,vMgKnGj))end;return pfZ3SPy_.remove(j)end end end;local SJsW11k
605SJsW11k=function()
606local M9K=RkGFh6.c or RkGFh6.config or ykRppH
607if not E(M9K)then local W0iTcMIt=pfZ3SPy_.path(M9K)
608if not dk(W0iTcMIt)then
609local Dq,y3Ur=pE(W0iTcMIt)
610if not Dq then return false,
611"Failed to create '"..tostring(W0iTcMIt)..
612"' directory for the config file: "..tostring(y3Ur)end end;local N,Hald6SO=io.open(M9K,"w")if N then N:write(y36Aetn)N:close()else
613return false,
614"Failed to open config file for writing: "..tostring(Hald6SO)end end;local Zeu,Q2_d=io.open(M9K,"r")
615if Zeu then local GL70F7uL=Zeu:read("*all")
616Zeu:close()local lqANrrJA={}
617(load(GL70F7uL,"config","t",lqANrrJA))()local WUFTXBy6
618WUFTXBy6=function(aEZf)if aEZf==nil then aEZf={}end
619return
620setmetatable(aEZf,{__index={get=function(QjQ_o,wDiq_,QYA5WJOY)
621if
622type(aEZf[QjQ_o])~="nil"then if type(aEZf[QjQ_o])=="table"then
623return WUFTXBy6(aEZf[QjQ_o])end;return aEZf[QjQ_o]end
624iPL3B4cr.error("Attempt to access undeclared config field '"..tostring(QjQ_o).."'!")
625if not QYA5WJOY then return wDiq_ else return WUFTXBy6(wDiq_)end end}})end;mMp=WUFTXBy6(lqANrrJA)vj=mMp.get("modules",vj)
626z=mMp.get("dist",z)return mMp else
627return false,"Failed to open config file for reading: "..tostring(Q2_d)end end;local Ki1HJT
628Ki1HJT=function()if not(pzDMZwG("internet"))then
629iPL3B4cr.fatal("This command requires an internet card to run!")end;nvCiFt7r=nvCiFt7r or
630require("internet").request end;local wjim8xCV
631wjim8xCV=function(yliV8)Ki1HJT()return pcall(nvCiFt7r,yliV8)end;local EQLam
632EQLam=function()
633if not dk(vj)then local YUGQovw,XZt7GyF=pE(vj)if not YUGQovw then
634return false,"Failed to create '"..
635tostring(vj)..
636"' directory for custom modules: "..tostring(XZt7GyF)end end;local rjpKFl=n(_(vj))
637for Zn3SC in rjpKFl do rDtVf.name=Zn3SC:match("^(.+)%..+$")
638local D4=n(loadfile(RSjapQ(vj,Zn3SC),"t",rDtVf))D4()rDtVf.name=nil end;return true end;local qTDt
639qTDt=function(crA9EKx)local IcsJ=crA9EKx;local A
640do local Wp9xT=crA9EKx:find(':')if Wp9xT then
641IcsJ=crA9EKx:sub(Wp9xT+1)A=crA9EKx:sub(1,Wp9xT-1)end end
642if not A then local P={}
643for o0_XG8FI,A in pairs(xSebv5Jc)do
644if A[IcsJ]then if type(A[IcsJ])=="table"and
645A[IcsJ].__public==true then
646CM(P,{class=A,module=o0_XG8FI,method=A[IcsJ]})end end end
647if#P>1 then local jLsxpw=nil
648for x,A in pairs(P)do if A.module=="hel"then jLsxpw=x;break end end;if jLsxpw then P={P[jLsxpw]}end end
649if#P>1 then
650iPL3B4cr.print("Ambiguous choice: method "..
651tostring(IcsJ).." is implemented in the following modules:")for AXNfV=1,#P do local A=P[AXNfV]
652iPL3B4cr.print(" * "..tostring(A.module))end
653iPL3B4cr.print(
654"Choose a specific module by prepending its name with a colon, e.g., "..
655tostring(P[1].module)..":"..tostring(IcsJ)..".")return false elseif#P==0 then
656iPL3B4cr.error("Unknown command: "..tostring(IcsJ))return false else A=P[1].module
657iPL3B4cr.info("Note, using "..tostring(A)..":"..
658tostring(IcsJ)..".")
659return function(...)return P[1].method(P[1].class,...)end end else
660if xSebv5Jc[A]and pX4gCR(IcsJ)then local cX={}
661for iyx,bxvn in pairs(xSebv5Jc[A])do if
662type(bxvn)=="table"and bxvn.__public==true then
663CM(cX,tostring(iyx))end end
664iPL3B4cr.print("Available module-specific commands: "..tostring(table.concat(cX,", ")))return false end
665if
666not xSebv5Jc[A]or not xSebv5Jc[A][IcsJ]or
667xSebv5Jc[A][IcsJ]and
668(type(xSebv5Jc[A][IcsJ])~="table"or
669xSebv5Jc[A][IcsJ].__public~=true)then
670iPL3B4cr.error("Unknown command: "..tostring(A)..":"..tostring(IcsJ))return false else return function(...)
671return xSebv5Jc[A][IcsJ](xSebv5Jc[A],...)end end end end;local v
672v=function(mWYrzB)
673if not mWYrzB or mWYrzB==""then mWYrzB="hel"else mWYrzB=mWYrzB end;return xSebv5Jc[mWYrzB]or xSebv5Jc.default end;local Ta
674Ta=function(O7kX,Q4XSpdY,...)if O7kX==nil then O7kX=xSebv5Jc.default end
675if O7kX[Q4XSpdY]then return
676O7kX[Q4XSpdY](O7kX,...)else return
677xSebv5Jc.default[Q4XSpdY](xSebv5Jc.default,...)end end;local unArcvQl
678unArcvQl=function(fzTyrQ9F,fAumJ0i,i0,tZliF4)if fAumJ0i==nil then fAumJ0i="hel"end;if i0 ==nil then
679i0=RSjapQ(z,fAumJ0i)end
680if tZliF4 ==nil then tZliF4=fzTyrQ9F.name end;if not fzTyrQ9F then return false,"'nil' given"end
681if not dk(i0)then
682local uS_N6,o5SLRA=pE(i0)
683if not uS_N6 then return false,
684"Failed to create '"..tostring(RSjapQ(i0,fAumJ0i)).."' directory for manifest files: "..
685tostring(o5SLRA)end end;local jlmopoj,R=io.open(RSjapQ(i0,tZliF4),"w")
686if jlmopoj then
687jlmopoj:write(pDNa2ox6(fzTyrQ9F))jlmopoj:close()return true else return false,
688"Failed to open file for writing: "..tostring(R)end end;local h6Ub7U
689h6Ub7U=function(ztwXaCR,M2WtMgiq,FgfME)if FgfME==nil then FgfME="hel"end
690M2WtMgiq=M2WtMgiq or RSjapQ(z,FgfME,ztwXaCR)
691if E(M2WtMgiq)then local ylH9o,CC4Kfjh=io.open(M2WtMgiq,"rb")
692if ylH9o then
693local k=n(Do6yo7nm(ylH9o:read("*all")))ylH9o:close()return k else return false,
694"Failed to open manifest for '"..tostring(ztwXaCR).."' package: "..
695tostring(CC4Kfjh)end else return false,
696"No manifest found for '"..tostring(ztwXaCR).."' package"end end;local Gm
697Gm=function(eUQ0x,r0OR)if r0OR==nil then r0OR="hel"end;local pYHkv=RSjapQ(z,r0OR,eUQ0x)
698if
699E(pYHkv)then return BaX(pYHkv)else return false,
700"No manifest found for '"..tostring(eUQ0x).."' package"end end;local YKA7cU
701YKA7cU=function(hxZHlgP)return
702setmetatable({__public=true},{__call=function(zct,...)return hxZHlgP(...)end})end;local mCsewfX
703mCsewfX=function(WQk6Wkd,t)return
704function()local pRCHPl,sCffg4HK=pcall(WQk6Wkd)if not(pRCHPl)then
705return false,tostring(sCffg4HK)else return sCffg4HK end end end;local yY
706yY=function(EyljhkFp,uGDn542,DQ)
707if uGDn542 ==nil then uGDn542="Could not download '%s': %s"end;if DQ==nil then DQ="Could not download '%s': %s"end
708local s6Ahlni_,T6dNu,H=wjim8xCV(EyljhkFp)if not(s6Ahlni_ and T6dNu)then
709return false,uGDn542:format(EyljhkFp,H)end;local YlzZm=""for vj9879b5,H in mCsewfX(T6dNu)do
710if vj9879b5 then
711YlzZm=YlzZm..vj9879b5 else return false,DQ:format(EyljhkFp,H)end end;return YlzZm end;local Xf
712Xf=function()
713if not(RkGFh6.y)then
714io.write("Press [ENTER] to continue...")local cotcYZ1f=select(3,y06X3k("key_down"))
715if cotcYZ1f==13 then
716ivnJjrA()return true else io.write("\n")return false end else return true end end;local UlFdiZ7v
717UlFdiZ7v=function(FRcmT)local zfl=0;local itxD={}
718if not(pX4gCR(FRcmT.install))then
719local JPHs7A={"Packages to INSTALL:",table.concat(FRcmT.install," ")}CM(itxD,JPHs7A)zfl=zfl+#FRcmT.install else
720FRcmT.install={}end
721if not(pX4gCR(FRcmT.reinstall))then
722local yzYgnMtr={"Packages to REINSTALL:",table.concat(FRcmT.reinstall," ")}CM(itxD,yzYgnMtr)zfl=zfl+#FRcmT.reinstall else
723FRcmT.reinstall={}end
724if not(pX4gCR(FRcmT.upgrade))then
725local o={"Packages to UPGRADE:",table.concat(FRcmT.upgrade," ")}CM(itxD,o)zfl=zfl+#FRcmT.upgrade else FRcmT.upgrade={}end
726if not(pX4gCR(FRcmT.remove))then
727local wmkJ={"Packages to REMOVE:",table.concat(FRcmT.remove," ")}CM(itxD,wmkJ)zfl=zfl+#FRcmT.remove else FRcmT.remove={}end
728do
729local I1={tostring(#FRcmT.install).." to INSTALL, "..
730tostring(#FRcmT.reinstall)..
731" to REINSTALL, "..
732tostring(#FRcmT.upgrade).." to UPGRADE, "..tostring(#FRcmT.remove)..
733" to REMOVE."}CM(itxD,I1)end
734for gXu5hG,R60Ru4bj in pairs(itxD)do for gXu5hG,eQWRf in pairs(R60Ru4bj)do
735if gXu5hG==1 then iPL3B4cr.print(eQWRf)else iPL3B4cr.print(
736" "..tostring(eQWRf))end end;if
737gXu5hG~=#itxD then iPL3B4cr.print("")end end
738if zfl>0 then if not(Xf())then return Wu_uIt(7)end end end
739do local WT2AX;local _AvO={}_AvO.__index=_AvO
740WT2AX=setmetatable({__init=function()end,__base=_AvO,__name="default"},{__index=_AvO,__call=function(q,...)
741local WUY7=setmetatable({},_AvO)q.__init(WUY7,...)return WUY7 end})_AvO.__class=WT2AX;local qEO=WT2AX
742qEO.install=function()return
743iPL3B4cr.fatal("Incorrect source is provided! No default 'install' implementation.")end
744qEO.remove=function(qEO,_puepou,DYLeJ)if DYLeJ==nil then DYLeJ="hel"end
745if _puepou then
746if _puepou.files then
747for udbF,dt1 in
748pairs(_puepou.files)do
749if dt1.path then local V7eMEiVW,Co1tUVas=BaX(dt1.path)if not(V7eMEiVW)then
750iPL3B4cr:error("Failed to remove '"..
751tostring(dt1.path).."': "..tostring(Co1tUVas))end else
752local B,UjlBMb=BaX(RSjapQ(dt1.dir,dt1.name))if not(B)then
753iPL3B4cr:error("Failed to remove '"..tostring(RSjapQ(dt1.dir,dt1.name)).."': "..
754tostring(UjlBMb))end end end end;return Gm(_puepou.name,DYLeJ)else
755return false,"Package can't be removed: the manifest is empty."end end;xSebv5Jc.default=WT2AX end
756do local PKWIJ9;local rQYWEt=xSebv5Jc.default;local nCwsa={}nCwsa.__index=nCwsa
757setmetatable(nCwsa,rQYWEt.__base)
758PKWIJ9=setmetatable({__init=function(zYGA2q2,...)return PKWIJ9.__parent.__init(zYGA2q2,...)end,__base=nCwsa,__name="hel",__parent=rQYWEt},{__index=function(I9Mw,e)
759local BUtIET=rawget(nCwsa,e)if BUtIET==nil then local NvAj=rawget(I9Mw,"__parent")
760if NvAj then return NvAj[e]end else return BUtIET end end,__call=function(Icg,...)
761local PzMsk=setmetatable({},nCwsa)Icg.__init(PzMsk,...)return PzMsk end})nCwsa.__class=PKWIJ9;local IPPy=PKWIJ9;IPPy.URL="https://api.fomalhaut.me/"
762IPPy.parsePackageJSON=function(IPPy,axLuO,j)if
763j==nil then j=u.Spec("*")end;local As=nil;local JmCzKm={}
764for PXrrrSid,L9 in
765pairs(axLuO.versions)do local _KZPScl=u.Version(PXrrrSid)if not(_KZPScl)then
766iPL3B4cr.fatal(
767"Could not parse the version in package: "..tostring(_KZPScl))end;JmCzKm[_KZPScl]=L9 end
768local Mwhc,A6z=pcall(function()
769return
770j:select((function()local dbTwy={}local R4f819q=1;for Kj1I,nTUMgqomA in pairs(JmCzKm)do dbTwy[R4f819q]=Kj1I
771R4f819q=R4f819q+1 end;return dbTwy end)())end)if not(Mwhc)then
772iPL3B4cr.fatal("Could not select the best version: "..tostring(A6z))end;As=tostring(A6z)if not(A6z)then
773iPL3B4cr.fatal(
774"No candidate for version specification '"..tostring(j).."' found!")end
775local _Mk={name=axLuO.name,version=As,files={},dependencies={}}for Id5sIM,gZM2ANLt in pairs(JmCzKm[A6z].files)do local aC72qEnu=gZM2ANLt.path
776CM(_Mk.files,{url=Id5sIM,path=aC72qEnu})end;for B60J,Y4 in
777pairs(JmCzKm[A6z].depends)do local f=Y4.version;local yeCnvcd6=Y4.type
778CM(_Mk.dependencies,{name=B60J,version=f,type=yeCnvcd6})end
779return _Mk end
780IPPy.getPackageSpec=function(IPPy,Iq93c6cA)
781iPL3B4cr.info("Downloading package data for "..tostring(Iq93c6cA).." ...")
782local nsM0h,Czi=wjim8xCV(IPPy.URL.."packages/"..Iq93c6cA)if not(nsM0h)then
783iPL3B4cr.fatal("HTTP request error: "..Czi)end;local IlxN=""
784local EA_3x01A,m54tY2=xpcall(function()
785for AhbP in Czi do IlxN=IlxN..AhbP end end,debug.traceback)
786if not(EA_3x01A)then
787local QHFgYUN={"HTTP request error.","Perhaps the package "..tostring(Iq93c6cA)..
788" doesn't exist, or the Hel Repository went down.","Rerun with -v to see traceback.",
789"\nError details:\n"..tostring(m54tY2)}if RkGFh6.v then table.remove(QHFgYUN,3)else
790table.remove(QHFgYUN,4)end
791iPL3B4cr.fatal(table.concat(QHFgYUN,"\n"))end;local WJWMdKI=JD:decode(IlxN)if not(WJWMdKI)then
792iPL3B4cr.fatal("Incorrect JSON format!\n"..
793tostring(IlxN))end;return WJWMdKI.data end
794IPPy.rawInstall=function(IPPy,RoEsr7So,dX,Rz)if dX==nil then dX=false end;if Rz==nil then Rz=false end;local j177r;if Rz then
795j177r=RSjapQ(XxJ(),RoEsr7So.name)else j177r="/"end
796if Rz and not dk(j177r)then
797local j,qCaFw=pE(j177r)
798if not(j)then
799iPL3B4cr.fatal("Failed creating '"..tostring(j177r)..
800"' directory for package '"..
801tostring(RoEsr7So.name).."'! \n"..tostring(qCaFw))end elseif not Rz then local syvPi=h6Ub7U(RoEsr7So.name,nil,"hel")
802if syvPi then
803if syvPi.version==
804tostring(RoEsr7So.version)then
805iPL3B4cr.print("'"..tostring(RoEsr7So.name)..
806"@"..
807tostring(syvPi.version).."' is already installed, skipping...")return syvPi else
808iPL3B4cr.fatal("'"..
809tostring(RoEsr7So.name)..
810"@"..
811
812tostring(RoEsr7So.version)..
813"' was attempted to install, however, another version of the same package is already installed: '"..
814tostring(RoEsr7So.name)..
815"@"..tostring(syvPi.version).."'")end end end
816for NrgSK2,wIH in pairs(RoEsr7So.files)do
817iPL3B4cr.info("Fetching '"..
818tostring(pfZ3SPy_.name(wIH.path)).."' ...")local TYWkpc=n(yY(wIH.url))
819local k=RSjapQ(j177r,pfZ3SPy_.path(wIH.path))
820if not dk(k)then local J,gtlO9=pE(k)if not(J)then
821iPL3B4cr.fatal("Failed to create '"..tostring(k)..
822"' directory for '"..
823tostring(pfZ3SPy_.name(wIH.path)).."'! \n"..tostring(gtlO9))end end
824do local Lun
825wIH,Lun=io.open(RSjapQ(k,pfZ3SPy_.name(wIH.path)),"w")if not(wIH)then
826iPL3B4cr.fatal("Could not open '"..
827
828tostring(RSjapQ(k,pfZ3SPy_.name(wIH.path))).."' for writing: "..tostring(Lun))end
829wIH:write(TYWkpc)wIH:close()end end;return
830{name=RoEsr7So.name,version=tostring(RoEsr7So.version),files=RoEsr7So.files,dependencies=RoEsr7So.dependencies,manual=dX}end
831IPPy.resolveDependencies=function(IPPy,beUJXhjw,zY7adu,Nlvw,K55,BJcMTdMi)if Nlvw==nil then Nlvw={}end;if K55 ==nil then K55={}end;if
832BJcMTdMi==nil then BJcMTdMi={}end
833for f1MKKJ=1,#beUJXhjw do local nFf=beUJXhjw[f1MKKJ]local EIqL41,iv
834EIqL41,iv=nFf.name,nFf.version;local rfmMR4=false;for Tq2I=1,#Nlvw do local GNo=Nlvw[Tq2I]
835if GNo.pkg.name==EIqL41 then rfmMR4=true;break end end
836if not(rfmMR4)then
837CM(K55,{name=EIqL41,version=""})local e5x=h6Ub7U(EIqL41,nil,"hel")
838if not e5x or not
839iv:match(u.Version(e5x.version))then
840local QrONvWGq=IPPy:getPackageSpec(EIqL41)local D94fnZaa=IPPy:parsePackageJSON(QrONvWGq,iv)
841K55[#K55].version=D94fnZaa.version;local XI=D94fnZaa.dependencies
842for FNi=1,#XI do local pRW2nEmK=XI[FNi]rfmMR4=false;for OR=1,#Nlvw do
843local Arww=Nlvw[OR]
844if Arww.pkg.name==pRW2nEmK.name then rfmMR4=true;break end end
845if not rfmMR4 then local BYH=nil
846for o7E8TLH,N5N27Jd in pairs(K55)do if
847N5N27Jd.name==pRW2nEmK.name then BYH=o7E8TLH;break end end
848if BYH then
849if K55[BYH].version==pRW2nEmK.version then
850iPL3B4cr.fatal("Circular dependencies detected: '"..
851
852tostring(EIqL41)..
853"@"..
854tostring(D94fnZaa.version)..
855"' depends on '"..
856tostring(pRW2nEmK.name)..
857"@"..
858
859tostring(pRW2nEmK.version).."', and '"..
860tostring(K55[BYH].name).."@"..
861tostring(K55[BYH].version)..
862"' depends on '"..tostring(EIqL41)..
863"@"..tostring(D94fnZaa.version).."'.")else
864iPL3B4cr.fatal("Attempted to install two versions of the same package: '"..
865tostring(pRW2nEmK.name)..
866"@"..
867
868tostring(pRW2nEmK.version)..
869"' and '"..
870tostring(K55[BYH].name)..
871"@"..tostring(K55[BYH].version)..
872
873"' when resolving dependencies for '"..tostring(EIqL41)..
874"@"..tostring(D94fnZaa.version).."'.")end end
875IPPy:resolveDependencies({{name=pRW2nEmK.name,version=u.Spec(pRW2nEmK.version)}},false,Nlvw,K55,BJcMTdMi)end end;CM(Nlvw,{pkg=D94fnZaa})
876CM(BJcMTdMi,{pkg=D94fnZaa})else CM(Nlvw,{pkg=e5x})
877if zY7adu then CM(BJcMTdMi,{pkg=e5x})end end;K55[#K55]=nil end end;return BJcMTdMi end
878IPPy.getPackageDependants=function(IPPy,m,nK,_zr)if nK==nil then nK={}end;if _zr==nil then _zr={}end
879for f5=1,#m do
880local UAc=m[f5]local Ef=false
881for P=1,#nK do local F4AWvI=nK[P]if F4AWvI.name==UAc then Ef=true;break end end
882if not(Ef)then CM(_zr,{name=UAc})local GYVN=h6Ub7U(UAc,nil,"hel")
883if GYVN then
884CM(nK,{name=UAc,manifest=GYVN})local DNlB1V=n(_(RSjapQ(z,"hel")))
885for erb6G_E in DNlB1V do
886GYVN=n(h6Ub7U(erb6G_E,nil,"hel"))local QFUU10K=GYVN.dependencies
887for xNPDtul=1,#QFUU10K do local k8=QFUU10K[xNPDtul]
888if k8.name==UAc then
889Ef=false;for HmgRk=1,#nK do local UuCdpVi=nK[HmgRk]
890if UuCdpVi.name==erb6G_E then Ef=true;break end end
891if not Ef then
892for fghe=1,#_zr do local vFXf=_zr[fghe]if
893vFXf.name==erb6G_E then
894iPL3B4cr.fatal("Circular dependencies detected: "..tostring(erb6G_E))end end;IPPy:getPackageDependants({erb6G_E},nK,_zr)end end end end else
895iPL3B4cr.fatal("Package "..
896tostring(UAc).." is referenced as a dependant of another package, however, this package isn't installed.")end;_zr[#_zr]=nil end end;return nK end
897IPPy.fileConflicts=function(IPPy,CA0uX7n)if RkGFh6.f or RkGFh6.force then
898iPL3B4cr.info("File conflict checking skipped: --force option given.")return true end
899iPL3B4cr.info("Checking for file conflicts...")local ze5Vpc3=false
900for vwK8=1,#CA0uX7n do local Sk_SiC=CA0uX7n[vwK8]local X0bgPvA=Sk_SiC.files
901for M9CyqH=1,#X0bgPvA do
902local z0x4qSAN=X0bgPvA[M9CyqH]
903if wVzn(z0x4qSAN.path)then
904iPL3B4cr.error("'"..
905tostring(Sk_SiC.name).."' wants to override node at '"..
906tostring(z0x4qSAN.path).."'")ze5Vpc3=true end end end;if ze5Vpc3 then
907iPL3B4cr.fatal("File conflicts detected; terminating.")end;return true end
908IPPy.install=YKA7cU(function(IPPy,...)
909if RkGFh6.l or RkGFh6["local"]then
910local S=o5sms.resolve(...)
911local NKetZhs=n(h6Ub7U(S,RSjapQ(S,"manifest")))
912local EFLZ0N1=IPPy:resolveDependencies((function()local rNOL8G={}local q=1;local lKO=NKetZhs.dependencies
913for hcwgu=1,#lKO do
914local omgCdqp8=lKO[hcwgu]local X17eHTx,SGF;X17eHTx,SGF=omgCdqp8.name,omgCdqp8.version
915rNOL8G[q]={name=X17eHTx,version=u.Spec(SGF)}q=q+1 end;return rNOL8G end)())local gL=RkGFh6.d or RkGFh6.onlyDeps;local m4={}for myIHU=1,#EFLZ0N1 do
916local xxNCdF=EFLZ0N1[myIHU]
917CM(m4,tostring(xxNCdF.pkg.name)..
918"@"..tostring(xxNCdF.pkg.version))end;if not(gL)then
919CM(m4,
920tostring(NKetZhs.name).."@"..tostring(NKetZhs.version))end;UlFdiZ7v({install=m4})
921IPPy:fileConflicts((function()
922local _cl1b={}local Xz18nk=1;for P=1,#EFLZ0N1 do local sTX4=EFLZ0N1[P]_cl1b[Xz18nk]=sTX4.pkg
923Xz18nk=Xz18nk+1 end;return _cl1b end)())
924for A0TJx=1,#EFLZ0N1,1 do local Nqdkw=EFLZ0N1[A0TJx]
925iPL3B4cr.print("Installing '"..
926
927tostring(Nqdkw.pkg.name).."@"..tostring(Nqdkw.pkg.version).."'...")local t=IPPy:rawInstall(Nqdkw.pkg,false,false)
928local QbMO,wYZ=unArcvQl(t,"hel")
929if QbMO then
930iPL3B4cr.info("Saved the manifest of '"..tostring(t.name).."'.")else
931iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(t.name)..
932"': "..tostring(wYZ)..".")end end
933if not gL then
934iPL3B4cr.print("Installing '"..tostring(NKetZhs.name).."@"..
935tostring(NKetZhs.version).."'...")
936for tx1LD,N3ROeR in pairs(NKetZhs.files)do
937local I1oQVnUd=N3ROeR.path or RSjapQ(N3ROeR.dir,N3ROeR.name)if not dk(pfZ3SPy_.path(I1oQVnUd))then
938pE(pfZ3SPy_.path(I1oQVnUd))end
939local oTX,WZlF4=QJf(RSjapQ(S,N3ROeR.url),I1oQVnUd)if not(oTX)then
940iPL3B4cr.fatal("Cannot copy file '"..tostring(N3ROeR.name)..
941"': "..tostring(WZlF4))end end;NKetZhs["local"]=true;local aMd,o0pf=unArcvQl(NKetZhs,"hel")
942if aMd then
943iPL3B4cr.info(
944"Saved the manifest of '"..tostring(NKetZhs.name).."'.")else
945iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(NKetZhs.name).."': "..
946tostring(o0pf)..".")end end;iPL3B4cr.print("Done.")return true end;local X0GTupeV={}local rQ={...}
947for IxqPDOWH=1,#rQ do local GZqV=rQ[IxqPDOWH]
948local OVubrDw_,G2_TeR8=GZqV:match("^(.+)@(.+)$")or GZqV;if pX4gCR(G2_TeR8)then G2_TeR8="*"end
949iPL3B4cr.info("Creating version specification for "..
950tostring(G2_TeR8).." ...")
951local yk,OPSPMfr_=pcall(function()return u.Spec(G2_TeR8)end)if not(yk)then
952iPL3B4cr.fatal("Could not parse the version specification: "..tostring(OPSPMfr_).."!")end
953CM(X0GTupeV,{name=OVubrDw_,version=OPSPMfr_})end;local k=RkGFh6.r or RkGFh6.reinstall
954local Oc=RkGFh6.s or RkGFh6.save;local IHovU=IPPy:resolveDependencies(X0GTupeV,k)local e_wDQjk={}
955local ClglY={}
956for QnNOl=1,#IHovU do local aQs=false
957repeat local uow_0tb=IHovU[QnNOl]
958if k then local tykg=false;for C_pPyW=1,#X0GTupeV do
959local mgb4b=X0GTupeV[C_pPyW]
960if mgb4b.name==uow_0tb.pkg.name then tykg=true;break end end;if tykg then
961CM(e_wDQjk,
962tostring(uow_0tb.pkg.name).."@"..tostring(uow_0tb.pkg.version))aQs=true;break end end
963CM(ClglY,tostring(uow_0tb.pkg.name).."@"..
964tostring(uow_0tb.pkg.version))aQs=true until true;if not aQs then break end end;UlFdiZ7v({install=ClglY,reinstall=e_wDQjk})
965IPPy:fileConflicts((function()
966local LOBqxO={}local m8=1
967for mcoAHO=1,#IHovU do local d3gFWO=IHovU[mcoAHO]
968if not
969tE(tostring(d3gFWO.pkg.name).."@"..
970tostring(d3gFWO.pkg.version),e_wDQjk)then LOBqxO[m8]=d3gFWO.pkg;m8=m8+1 end end;return LOBqxO end)())
971if k then local D
972do local obodPKnu={}local kgdzk=1
973for oVSp=1,#X0GTupeV do local uBJ=X0GTupeV[oVSp]obodPKnu[kgdzk]=n(h6Ub7U(uBJ.name,
974nil,"hel"))kgdzk=kgdzk+1 end;D=obodPKnu end;IPPy:_remove(D,true,false)end
975for A=1,#IHovU do local MP=IHovU[A]
976iPL3B4cr.print("Installing '"..tostring(MP.pkg.name).."@"..
977tostring(MP.pkg.version).."'...")local jb=false
978for PPNahh=1,#X0GTupeV do local z2g=X0GTupeV[PPNahh]if z2g.name==MP.pkg.name then
979jb=true;break end end;local uKSj=IPPy:rawInstall(MP.pkg,jb,Oc)
980local YXgXQB,bvL1X4=unArcvQl(uKSj,"hel")
981if YXgXQB then
982iPL3B4cr.info("Saved the manifest of '"..tostring(uKSj.name).."'.")else
983iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(uKSj.name).."': "..
984tostring(bvL1X4)..".")end end;return iPL3B4cr.print("Done.")end)
985IPPy.remove=YKA7cU(function(IPPy,...)local m9JTkVv6={...}local Q={}for bWkP=1,#m9JTkVv6 do local JtFj=m9JTkVv6[bWkP]
986local PQ3=n(h6Ub7U(JtFj,nil,"hel"))CM(Q,PQ3)end
987IPPy:_remove(Q,false)return iPL3B4cr.print("Done.")end)
988IPPy._remove=function(IPPy,_xCtN,JVpe,nG36XmZC)if JVpe==nil then JVpe=false end
989if nG36XmZC==nil then nG36XmZC=true end;local Vf26
990if not
991mMp.get("hel",{},true).get("remove_dependants",true)or not nG36XmZC then
992do
993local xUGt={}local _U=1;for hkI39=1,#_xCtN do local MwwN=_xCtN[hkI39]
994xUGt[_U]={name=MwwN.name,manifest=MwwN}_U=_U+1 end;Vf26=xUGt end else
995Vf26=IPPy:getPackageDependants((function()local oZ9={}local OXlT0=1;for V=1,#_xCtN do local zIYNIXy1=_xCtN[V]
996oZ9[OXlT0]=zIYNIXy1.name;OXlT0=OXlT0+1 end;return oZ9 end)())end
997if not(JVpe)then
998UlFdiZ7v({remove=(function()local c={}local mReHt4h=1
999for I7=1,#Vf26 do local Upw=Vf26[I7]
1000c[mReHt4h]="hel:"..
1001
1002tostring(Upw.manifest.name).."@"..tostring(Upw.manifest.version)mReHt4h=mReHt4h+1 end;return c end)()})end
1003for nqBfKL=1,#Vf26 do local gs3a=Vf26[nqBfKL]
1004iPL3B4cr.print("Removing '"..
1005tostring(gs3a.manifest.name)..
1006"@"..tostring(gs3a.manifest.version).."' ...")
1007n(PKWIJ9.__parent.remove(IPPy,gs3a.manifest,"hel"))end;return true end
1008IPPy.upgrade=YKA7cU(function(IPPy)local AkKaBC={}
1009for mZPe4w in n(_(RSjapQ(z,"hel")))do
1010if not
1011(JQi1jg(RSjapQ(z,"hel",mZPe4w)))then local OvZ=n(h6Ub7U(mZPe4w,nil,"hel"))if not
1012(OvZ["local"])then CM(AkKaBC,OvZ)end end end;local OmRH8={}
1013for cBOpf=1,#AkKaBC do local KZYA5y=AkKaBC[cBOpf]
1014local YoCAN7OU,FoP=pcall(IPPy.getPackageSpec,IPPy,KZYA5y.name)
1015if YoCAN7OU then local jqtWXY=IPPy:parsePackageJSON(FoP)
1016KZYA5y.latest={spec=FoP,data=jqtWXY}
1017if u.Version(KZYA5y.latest.data.version)>
1018u.Version(KZYA5y.version)then CM(OmRH8,KZYA5y)end end end
1019local GY=IPPy:resolveDependencies((function()local XgRb={}local G3e=1;for GoP6=1,#OmRH8 do local cZ_=OmRH8[GoP6]
1020XgRb[G3e]={name=cZ_.name,version=u.Spec(cZ_.latest.data.version)}G3e=G3e+1 end
1021return XgRb end)())local oukM79R
1022do local NYc8={}local Dff8=1
1023for lEYwsOG9=1,#OmRH8 do local M=OmRH8[lEYwsOG9]
1024NYc8[Dff8]=
1025tostring(M.name)..
1026"@{"..tostring(M.version).." => "..
1027tostring(M.latest.data.version).."}"Dff8=Dff8+1 end;oukM79R=NYc8 end;local D_j={}
1028for Vt95q2G=1,#GY do local jsPbwU=GY[Vt95q2G]local Wvs3rd6o=true
1029for UdVlP=1,#OmRH8 do local N=OmRH8[UdVlP]if N.name==
1030jsPbwU.pkg.name then Wvs3rd6o=false;break end end;if Wvs3rd6o then
1031CM(D_j,tostring(jsPbwU.pkg.name)..
1032"@"..tostring(jsPbwU.pkg.version))end end;UlFdiZ7v({upgrade=oukM79R,install=D_j})
1033for v9mB_RUi=1,#GY do
1034local hX=GY[v9mB_RUi]local AVU=false;local I=false
1035for l6xUetCb=1,#OmRH8 do local lOb_Sv=OmRH8[l6xUetCb]if
1036lOb_Sv.name==hX.pkg.name then AVU=lOb_Sv;I=lOb_Sv.manual;break end end;if AVU then IPPy:_remove({AVU},true,false)end
1037iPL3B4cr.print(
1038"Installing '"..tostring(hX.pkg.name)..
1039"@"..tostring(hX.pkg.version).."'...")local _x5O1=IPPy:rawInstall(hX.pkg,I,false)
1040local eFI8dI3,i=unArcvQl(_x5O1,"hel")
1041if eFI8dI3 then
1042iPL3B4cr.info("Saved the manifest of '"..tostring(_x5O1.name).."'.")else
1043iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(_x5O1.name)..
1044"': "..tostring(i)..".")end end;return iPL3B4cr.print("Done.")end)
1045IPPy.info=YKA7cU(function(IPPy,VspvGB9V,LrFLp5)if LrFLp5 ==nil then LrFLp5="*"end;if pX4gCR(VspvGB9V)then
1046iPL3B4cr.fatal("Usage: hpm hel:info <package name> [<version specification>]")end
1047if pX4gCR(LrFLp5)then LrFLp5="*"end
1048iPL3B4cr.print("Creating version specification for "..tostring(LrFLp5).." ...")
1049local GfB7,Iz_w1j=pcall(function()return u.Spec(LrFLp5)end)if not(GfB7)then
1050iPL3B4cr.fatal("Could not parse the version specification: "..tostring(Iz_w1j).."!")end
1051local G=IPPy:getPackageSpec(VspvGB9V)local X7YKzX=IPPy:parsePackageJSON(G,Iz_w1j)local od0VOF={}
1052CM(od0VOF,
1053"- Package name: "..tostring(G.name))
1054CM(od0VOF,"- Description:\n"..tostring(G.description))
1055CM(od0VOF,"- Package owners: "..tostring(table.concat(G.owners,", ")))
1056CM(od0VOF,"- Authors:\n"..
1057tostring(table.concat((function()local oO6SbZ={}local UE_vrsNx=1;local kef2zBS=G.authors;for Z=1,#kef2zBS do
1058local ze0=kef2zBS[Z]oO6SbZ[UE_vrsNx]=" - "..tostring(ze0)
1059UE_vrsNx=UE_vrsNx+1 end;return oO6SbZ end)(),"\n")))
1060CM(od0VOF,"- License: "..tostring(G.license))
1061CM(od0VOF,"- Versions: "..tostring(VcV0EuD(G.versions))..", latest: "..
1062tostring(X7YKzX.version))
1063CM(od0VOF," - Files: "..tostring(#X7YKzX.files))
1064CM(od0VOF," - Depends: "..
1065tostring(table.concat((function()local ylW3uC0={}local N_G1=1;local wkGNE=X7YKzX.dependencies
1066for ccK=1,#wkGNE
1067do local BV=wkGNE[ccK]ylW3uC0[N_G1]=tostring(BV.name)..
1068"@"..tostring(BV.version)N_G1=N_G1+1 end;return ylW3uC0 end)()," ")))
1069CM(od0VOF," - Changes:\n"..
1070tostring(G.versions[X7YKzX.version].changes))CM(od0VOF,"- Stats:")
1071CM(od0VOF," - Views: "..tostring(G.stats.views))
1072CM(od0VOF,"- Creation date: "..tostring(G.stats.date.created).." UTC")
1073CM(od0VOF,"- Last updated: "..
1074tostring(G.stats.date["last-updated"]).." UTC")
1075return iPL3B4cr.print(table.concat(od0VOF,"\n"))end)
1076IPPy.search=YKA7cU(function(IPPy,...)local HnLY=0
1077while true do local cm51CH1n={}local iWrSgT=IPPy.URL.."packages"iWrSgT=iWrSgT..
1078"?offset="..tostring(HnLY)
1079if...then
1080iWrSgT=iWrSgT..
1081("&q="..
1082table.concat((function(...)
1083local Ub9iqg={}local r_S8HFRo=1;local qIF4RFBv={...}
1084for wNbC65Ta=1,#qIF4RFBv do local xOiPW=qIF4RFBv[wNbC65Ta]Ub9iqg[r_S8HFRo]=
1085'"'..xOiPW:gsub("\"","")..'"'r_S8HFRo=
1086r_S8HFRo+1 end;return Ub9iqg end)(...)," "):gsub("&",""))end;local C,YK1=wjim8xCV(iWrSgT)if not(C)then
1087iPL3B4cr.fatal("HTTP request error: "..YK1)end;local t96Qtz=""
1088for Z9j in YK1 do t96Qtz=t96Qtz..Z9j end;local HjKNi=JD:decode(t96Qtz)if not(HjKNi)then
1089iPL3B4cr.fatal("Incorrect JSON format!\n"..
1090tostring(t96Qtz))end;cm51CH1n=HjKNi.data.list;for r=1,#
1091cm51CH1n do local OnJ1=cm51CH1n[r]
1092iPL3B4cr.print(tostring(OnJ1.name)..": "..
1093tostring(OnJ1.short_description))end;if
1094#cm51CH1n==0 and HnLY==0 then
1095iPL3B4cr.print("No packages found.")break end
1096if
1097HjKNi.data.truncated and HjKNi.data.sent+
1098HjKNi.data.offset<HjKNi.data.total then HnLY=HjKNi.data.offset+HjKNi.data.sent else break end end end)
1099if rQYWEt.__inherited then rQYWEt.__inherited(rQYWEt,PKWIJ9)end;xSebv5Jc.hel=PKWIJ9 end
1100do local KFU0;local Pvuq=xSebv5Jc.default;local lOpDJ={}lOpDJ.__index=lOpDJ
1101setmetatable(lOpDJ,Pvuq.__base)
1102KFU0=setmetatable({__init=function(lTH,...)return KFU0.__parent.__init(lTH,...)end,__base=lOpDJ,__name="oppm",__parent=Pvuq},{__index=function(JL,FpU_E)
1103local JWtwnQ2t=rawget(lOpDJ,FpU_E)
1104if JWtwnQ2t==nil then local uEKPPpj_=rawget(JL,"__parent")if uEKPPpj_ then
1105return uEKPPpj_[FpU_E]end else return JWtwnQ2t end end,__call=function(aYO4NN,...)
1106local CtG9nSQL=setmetatable({},lOpDJ)aYO4NN.__init(CtG9nSQL,...)return CtG9nSQL end})lOpDJ.__class=KFU0;local YLe=KFU0
1107YLe.REPOS="https://raw.githubusercontent.com/OpenPrograms/openprograms.github.io/master/repos.cfg"YLe.PACKAGES="https://raw.githubusercontent.com/%s/master/programs.cfg"
1108YLe.FILES="https://raw.githubusercontent.com/%s/%s"YLe.DIRECTORY="https://api.github.com/repos/%s/contents/%s?ref=%s"
1109YLe.DEFAULT_CACHE_FILE="/var/cache/hpm/oppm"
1110YLe.cacheFile=function(YLe)
1111local uZtK5yX=mMp.get("oppm",{},true).get("cache_file",YLe.DEFAULT_CACHE_FILE)
1112if not(dk(pfZ3SPy_.path(uZtK5yX)))then
1113local kr2CYaS,hXgSzEI=pE(pfZ3SPy_.path(uZtK5yX))if not(kr2CYaS)then
1114iPL3B4cr.fatal("Could not create the cache directory at "..
1115tostring(pfZ3SPy_.path(uZtK5yX))..": "..tostring(hXgSzEI))end end
1116if not(E(uZtK5yX))then local AUQ,B=io.open(uZtK5yX,"w")if not(AUQ)then
1117iPL3B4cr.fatal(
1118"Could not open '"..tostring(uZtK5yX).."' for writing: "..tostring(B))end
1119AUQ:write("{}")AUQ:close()end;return uZtK5yX end
1120YLe.notifyCacheUpdate=function(YLe,J)local coSiE=wZdg()local wm=coSiE-J
1121if wm>24*60*60*1000 then
1122iPL3B4cr.print("Cache was last updated more than a day ago.")
1123return iPL3B4cr.print("Consider running hpm oppm:cache update to update it.")end end
1124YLe.listCache=function(YLe)local _O;local smj=YLe:cacheFile()
1125do local obBu,cbQlG=io.open(smj,"r")if not
1126(obBu)then
1127return false,"Could not open '"..
1128tostring(smj).."' for reading: "..tostring(cbQlG)end
1129gad4ZcL=obBu:read("*all")_O,cbQlG=Do6yo7nm(gad4ZcL)if not(_O)then return false,
1130"Cache is malformed: "..tostring(cbQlG)end
1131obBu:close()end
1132if not _O.updated or not _O.cache then _O={updated=0,cache=_O}end;return _O end
1133YLe.resolveDirectory=function(YLe,YZQu1DR4,kza,CvGDk_2)
1134local EGpun=n(yY(YLe.DIRECTORY:format(YZQu1DR4,CvGDk_2,kza)))EGpun=JD:decode(EGpun)
1135if EGpun.message then return false,
1136"Could not fetch "..tostring(YZQu1DR4)..
1137":"..
1138tostring(kza).."/"..
1139tostring(CvGDk_2)..": "..tostring(EGpun.message)end;local LNlhK={}local cnx_1g=1
1140for eV=1,#EGpun do local DGQnw=EGpun[eV]
1141if DGQnw.type=="file"then
1142LNlhK[cnx_1g]={name=DGQnw.name,url=DGQnw.download_url,path=DGQnw.path}cnx_1g=cnx_1g+1 end end;return LNlhK end
1143YLe.updateCache=function(YLe)local yLgHuF=YLe:cacheFile()local fpL,k6=YLe:listCache()if
1144not(fpL)then
1145iPL3B4cr.error("Old cache is malformed: "..tostring(fpL))fpL={}else fpL=fpL.cache end;local m
1146m,k6=yY(YLe.REPOS)
1147if not(m)then return false,"Could not fetch "..
1148tostring(YLe.REPOS)..": "..tostring(k6)end;m=Do6yo7nm(m)local rvNhq6v={}
1149for WV,yUho4MXRx in
1150pairs(iW6CD(mMp.get("oppm",{},true).get("custom_repos",{})))do rvNhq6v["local/"..tostring(WV)]=yUho4MXRx end;M6ilzGJ(m,rvNhq6v)local gC={}
1151for J2,hgrBfz0w in pairs(m)do local Gi=false
1152repeat
1153if hgrBfz0w.repo then
1154iPL3B4cr.info(
1155"Fetching '"..tostring(J2)..
1156"' at '"..tostring(hgrBfz0w.repo).."' ...")local wpv1,I9IMuWm
1157wpv1,I9IMuWm,k6=wjim8xCV(YLe.PACKAGES:format(hgrBfz0w.repo))
1158if not(wpv1 and I9IMuWm)then
1159iPL3B4cr.error("Could not fetch '"..
1160tostring(J2).."' at '"..
1161tostring(hgrBfz0w.repo).."': "..tostring(k6))Gi=true;break end;local a=""
1162for wpv1,VKTNfzUf in function()return pcall(I9IMuWm)end do
1163if not wpv1 then
1164iPL3B4cr.error("Could not fetch '"..
1165tostring(J2).."' at '"..
1166tostring(hgrBfz0w.repo).."': "..tostring(VKTNfzUf))a=false;break else if not VKTNfzUf then break end;a=a..VKTNfzUf end end;if a==false then Gi=true;break end;if pX4gCR(a)then
1167iPL3B4cr.error("Could not fetch '"..
1168tostring(J2)..
1169"' at '"..tostring(hgrBfz0w.repo).."'")Gi=true;break end
1170local rZ;rZ,k6=Do6yo7nm(a)
1171if not rZ then
1172iPL3B4cr.error("Manifest '"..tostring(J2)..
1173"' at '"..
1174tostring(hgrBfz0w.repo).."' is malformed: "..tostring(k6))Gi=true;break end
1175for Oms4,JfA in pairs(rZ)do local CPu1=false
1176repeat
1177if Oms4:match("[^A-Za-z0-9._-]")then
1178iPL3B4cr.error(
1179"Package name contains illegal characters: "..tostring(J2)..":"..tostring(Oms4).."!")CPu1=true;break end
1180CM(gC,{repo=hgrBfz0w.repo,name=Oms4,data=JfA})CPu1=true until true;if not CPu1 then break end end end;Gi=true until true;if not Gi then break end end;local QO={}local VvzMQHj={}
1181for pfyhF=1,#gC do local pglFz82w=gC[pfyhF]local RkeCL,LoW_7e,mLgQ
1182RkeCL,LoW_7e,mLgQ=pglFz82w.name,pglFz82w.repo,pglFz82w.data;if tE(RSjapQ(LoW_7e,RkeCL),QO)then
1183iPL3B4cr.error("There're multiple packages under the same name: "..
1184tostring(RkeCL).."!")end
1185CM(VvzMQHj,{pkg=RkeCL,repo=LoW_7e,data={name=RkeCL,repo=LoW_7e,data=mLgQ}})local ng;do
1186for Pp_NboV,owAp3u2G in pairs(fpL)do if
1187owAp3u2G.repo==LoW_7e and owAp3u2G.pkg==RkeCL then ng=Pp_NboV;break end end end
1188if ng then
1189table.remove(fpL,ng)else CM(QO,RSjapQ(LoW_7e,RkeCL))end end;local fSYJX;fSYJX,k6=io.open(yLgHuF,"w")
1190if not(fSYJX)then return false,
1191"Could not open '"..
1192tostring(yLgHuF).."' for writing: "..tostring(k6)end;do
1193fSYJX:write(pDNa2ox6({updated=wZdg(),cache=VvzMQHj}))fSYJX:close()end
1194iPL3B4cr.print("- "..
1195
1196tostring(#gC).." program"..tostring(OO(#gC)).." cached.")
1197iPL3B4cr.print("- "..tostring(#QO)..
1198" package"..tostring(OO(#QO)).." "..
1199tostring(cR6rJlAl(#QO)).." new.")
1200iPL3B4cr.print("- "..tostring(#fpL)..
1201" package"..tostring(OO(#fpL)).." no longer exist"..
1202tostring(y(#fpL))..".")return true end
1203YLe.parseLocalPath=function(YLe,OH0C,kmQkm9cr)
1204if kmQkm9cr:sub(1,2)=="//"then return
1205RSjapQ(OH0C,kmQkm9cr:sub(3))else return RSjapQ(OH0C,"usr",kmQkm9cr)end end
1206YLe.rawInstall=function(YLe,IE97m,wey,hThO6,zXU)if wey==nil then wey="/"end;if hThO6 ==nil then hThO6=false end;if zXU==
1207nil then zXU=false end;local HmJym2=n(YLe:listCache())
1208HmJym2=HmJym2.cache;local Jjb7Am5={filesInstalled=0,packagesInstalled=0}
1209if zXU and not dk(wey)then
1210local gA,r=pE(wey)if not(gA)then
1211iPL3B4cr.fatal("Failed to create '"..
1212tostring(wey).."' directory for package '"..tostring(IE97m).."'! \n"..
1213tostring(r))end elseif not zXU then local LWe=h6Ub7U(IE97m,
1214nil,"oppm")if LWe then
1215iPL3B4cr.print("'"..tostring(IE97m)..
1216"' is already installed, skipping...")return LWe,Jjb7Am5 end end;local UwqY7A
1217for _3Tq=1,#HmJym2 do local Rq1hByv=HmJym2[_3Tq]local iFk,sEFtmNgB,qxiez0Cn
1218iFk,sEFtmNgB,qxiez0Cn=Rq1hByv.pkg,Rq1hByv.repo,Rq1hByv.data;if iFk==IE97m then UwqY7A=Rq1hByv;break end end;if not(UwqY7A)then
1219iPL3B4cr.fatal("No such package: "..tostring(IE97m))end;local k={}local d7gPKcw=UwqY7A.repo
1220for Ck_H,Sc in
1221pairs(UwqY7A.data.data.files)do local _QFw_It={}
1222if Ck_H:sub(1,1)==":"then
1223_QFw_It=YLe:resolveDirectory(d7gPKcw,Ck_H:sub(2,Ck_H:find("/")-1,
1224nil),Ck_H:sub(Ck_H:find("/")+1))elseif Ck_H:sub(1,1)=="?"then
1225if
1226wVzn(RSjapQ(YLe:parseLocalPath(wey,Sc),pfZ3SPy_.name(Ck_H)))then _QFw_It={}else local WLqHf=Ck_H:sub(2,-1)
1227_QFw_It={{name=pfZ3SPy_.name(WLqHf),path=WLqHf,url=YLe.FILES:format(d7gPKcw,WLqHf)}}end else
1228_QFw_It={{name=pfZ3SPy_.name(Ck_H),path=Ck_H,url=YLe.FILES:format(d7gPKcw,Ck_H)}}end;local IE97m
1229for vN=1,#_QFw_It do local BIwW6_=_QFw_It[vN]local Vdfc3,CzM7PG
1230IE97m,Vdfc3,CzM7PG=BIwW6_.name,BIwW6_.path,BIwW6_.url;local RKf6s5=n(yY(CzM7PG))local tP9E_=YLe:parseLocalPath(wey,Sc)if not
1231(dk(tP9E_))then pE(tP9E_)end
1232do
1233local Y1WX,G06Z2=io.open(RSjapQ(tP9E_,IE97m),"w")if not Y1WX then
1234iPL3B4cr.fatal("Could not open file for writing: "..tostring(G06Z2))end;Y1WX:write(RKf6s5)
1235Y1WX:close()end;Jjb7Am5.filesInstalled=Jjb7Am5.filesInstalled+1
1236CM(k,{name=IE97m,url=CzM7PG,dir=tP9E_})end end;local naeNp={}
1237if UwqY7A.data.data.dependencies then for K in
1238pairs(UwqY7A.data.data.dependencies)do CM(naeNp,{name=K})end end;Jjb7Am5.packagesInstalled=Jjb7Am5.packagesInstalled+1;return
1239{name=IE97m,files=k,dependencies=naeNp,manual=hThO6},Jjb7Am5 end
1240YLe.resolveDependencies=function(YLe,tQx9TV,FL7g2o,dkh7Tt9,XiNd_H,Q_c4px86)if dkh7Tt9 ==nil then dkh7Tt9={}end
1241if XiNd_H==nil then XiNd_H={}end;if Q_c4px86 ==nil then Q_c4px86={}end
1242local _F6VYt=n(YLe:listCache())_F6VYt=_F6VYt.cache
1243for ITv3PH1i=1,#tQx9TV do local _5fF=tQx9TV[ITv3PH1i]local OUQqQp=false
1244for OyOfzTWn=1,#dkh7Tt9
1245do local rx=dkh7Tt9[OyOfzTWn]if rx==_5fF then OUQqQp=true;break end end
1246if not(OUQqQp)then XiNd_H[_5fF]=true;local ijvSrZA1=h6Ub7U(_5fF,nil,"oppm")
1247if not
1248ijvSrZA1 then local STNuSN6
1249for PYOeGnAZ=1,#_F6VYt do local s10ar5XH=_F6VYt[PYOeGnAZ]local YoKhvIs
1250YoKhvIs=s10ar5XH.pkg;if YoKhvIs==_5fF then STNuSN6=s10ar5XH;break end end;if not(STNuSN6)then
1251return false,"Unknown package: "..tostring(_5fF)end
1252if STNuSN6.data.data.dependencies then
1253for I2ipE in
1254pairs(STNuSN6.data.data.dependencies)do OUQqQp=false;for qS730I=1,#dkh7Tt9 do local PYEbnua=dkh7Tt9[qS730I]
1255if PYEbnua==I2ipE then OUQqQp=true;break end end
1256if not(OUQqQp)then
1257if
1258XiNd_H[I2ipE]then
1259iPL3B4cr.fatal("Circular dependencies detected: '"..
1260tostring(_5fF).."' depends on '"..
1261tostring(I2ipE).."', and '"..
1262
1263tostring(I2ipE).."' depends on '"..tostring(_5fF).."'.")end
1264YLe:resolveDependencies({I2ipE},false,dkh7Tt9,XiNd_H,Q_c4px86)end end end;CM(Q_c4px86,_5fF)else if FL7g2o then CM(Q_c4px86,_5fF)end end;CM(dkh7Tt9,_5fF)XiNd_H[_5fF]=nil end end;return Q_c4px86 end
1265YLe.getPackageDependants=function(YLe,Um4ZYiT,AF,s)if AF==nil then AF={}end;if s==nil then s={}end
1266for hIHW=1,#Um4ZYiT do
1267local H5=Um4ZYiT[hIHW]local HYY=false;for C3=1,#AF do local SkCMMH=AF[C3]
1268if SkCMMH.name==H5 then HYY=true;break end end
1269if not(HYY)then CM(s,{name=H5})
1270local kvvs=h6Ub7U(H5,nil,"oppm")
1271if kvvs then CM(AF,{name=H5,manifest=kvvs})
1272local _yTx3S94=n(_(RSjapQ(z,"oppm")))
1273for Mm in _yTx3S94 do kvvs=n(h6Ub7U(Mm,nil,"oppm"))
1274local g524=kvvs.dependencies
1275for WUdVeYc=1,#g524 do local lHep6wo=g524[WUdVeYc]
1276if lHep6wo.name==H5 then HYY=false
1277for BKZsJ=1,#AF do
1278local Sw=AF[BKZsJ]if Sw.name==Mm then HYY=true;break end end
1279if not HYY then
1280for W67mm9p6=1,#s do local oBxdTi6u=s[W67mm9p6]if oBxdTi6u.name==Mm then
1281iPL3B4cr.fatal(
1282"Circular dependencies detected: "..tostring(Mm))end end;YLe:getPackageDependants({Mm},AF,s)end end end end else
1283iPL3B4cr.fatal("Package "..
1284tostring(H5).." is referenced as a dependant of another package, however, this package isn't installed.")end;s[#s]=nil end end;return AF end
1285YLe.whatDependsOn=function(YLe,T7hLe5j)local I_=n(h6Ub7U(T7hLe5j,nil,"oppm"))
1286local J2Jin={}local Rvg=n(_(RSjapQ(z,"oppm")))
1287for HpdA in Rvg do
1288I_=n(h6Ub7U(HpdA,nil,"oppm"))local DsAJbW=I_.dependencies
1289for AXfX=1,#DsAJbW do local btcUUhB=DsAJbW[AXfX]if
1290btcUUhB.name==T7hLe5j then CM(J2Jin,HpdA)end end end;return J2Jin end
1291YLe.install=YKA7cU(function(YLe,...)local iw0S=n(YLe:listCache())
1292YLe:notifyCacheUpdate(iw0S.updated)local Tjg={...}local n2srE7H=RkGFh6.r or RkGFh6.reinstall;local Rf=RkGFh6.s or
1293RkGFh6.save
1294local X9ZjrTz=n(YLe:resolveDependencies(Tjg,n2srE7H))
1295UlFdiZ7v({install=(function()local Ht5Ge={}local l=1
1296for IO=1,#X9ZjrTz do local YDJY=X9ZjrTz[IO]if
1297not n2srE7H or not tE(YDJY,Tjg)then Ht5Ge[l]=YDJY;l=l+1 end end;return Ht5Ge end)(),reinstall=
1298
1299n2srE7H and
1300(function()local t={}local Rdi8NIft=1
1301for J0uTkQ9=1,#X9ZjrTz do local sd6k=X9ZjrTz[J0uTkQ9]if tE(sd6k,Tjg)then
1302t[Rdi8NIft]=sd6k;Rdi8NIft=Rdi8NIft+1 end end;return t end)()or nil})local tYFIuD={filesInstalled=0,packagesInstalled=0}
1303if n2srE7H then local a
1304do local lK7={}local KWMxs7a=1;for T=1,#Tjg do
1305local LBIp4=Tjg[T]lK7[KWMxs7a]=n(h6Ub7U(LBIp4,nil,"oppm"))
1306KWMxs7a=KWMxs7a+1 end;a=lK7 end;YLe:_remove(a,true,false)end
1307for A5=1,#X9ZjrTz do local PV168s0f=X9ZjrTz[A5]
1308iPL3B4cr.print("Installing '"..
1309tostring(PV168s0f).."'...")local bjK;if Rf then bjK="./"..tostring(PV168s0f).."/"else
1310bjK="/"end
1311local Us1Xh,rs59=YLe:rawInstall(PV168s0f,bjK,tE(PV168s0f,Tjg),Rf)
1312tYFIuD.filesInstalled=tYFIuD.filesInstalled+rs59.filesInstalled
1313tYFIuD.packagesInstalled=tYFIuD.packagesInstalled+rs59.packagesInstalled
1314if tYFIuD.packagesInstalled~=0 then local R,rGa2MaGH=unArcvQl(Us1Xh,"oppm")
1315if R then
1316iPL3B4cr.info(
1317"Saved the manifest of '"..tostring(Us1Xh.name).."'.")else
1318iPL3B4cr.fatal("Couldn't save the manifest of '"..tostring(Us1Xh.name).."': "..
1319tostring(rGa2MaGH)..".")end end end
1320iPL3B4cr.print("- "..
1321tostring(tYFIuD.packagesInstalled).." package"..
1322tostring(OO(tYFIuD.packagesInstalled)).." installed.")
1323iPL3B4cr.print("- "..
1324tostring(tYFIuD.filesInstalled).." file"..
1325tostring(OO(tYFIuD.filesInstalled)).." installed.")return iPL3B4cr.print("Done.")end)
1326YLe.remove=YKA7cU(function(YLe,...)local i6={...}local u33wPQT={}for aNrMnPZ=1,#i6 do local fC=i6[aNrMnPZ]
1327local Kl=n(h6Ub7U(fC,nil,"oppm"))CM(u33wPQT,Kl)end
1328YLe:_remove(u33wPQT,false)return iPL3B4cr.print("Done.")end)
1329YLe._remove=function(YLe,EmJGBwA,_E3,j3)if _E3 ==nil then _E3=false end;if j3 ==nil then j3=true end;local f
1330if not
1331mMp.get("oppm",{},true).get("remove_dependants",true)or not j3 then
1332do local jy={}
1333local Ifev2bUE=1
1334for ZY=1,#EmJGBwA do local KCpJbzHT=EmJGBwA[ZY]
1335jy[Ifev2bUE]={name=KCpJbzHT.name,manifest=KCpJbzHT}Ifev2bUE=Ifev2bUE+1 end;f=jy end else
1336f=YLe:getPackageDependants((function()local g={}local dQl0xvy2=1;for hX=1,#EmJGBwA do local wYTrvPn=EmJGBwA[hX]
1337g[dQl0xvy2]=wYTrvPn.name;dQl0xvy2=dQl0xvy2+1 end;return g end)())end
1338if not(_E3)then
1339UlFdiZ7v({remove=(function()local pB6K={}local YV=1;for zPm=1,#f do local JmEyZ5=f[zPm]
1340pB6K[YV]=tostring(JmEyZ5.name)YV=YV+1 end;return pB6K end)()})end
1341for FGvy=1,#f do local KpnA=f[FGvy]
1342iPL3B4cr.print("Removing '"..
1343tostring(KpnA.manifest.name).."' ...")
1344n(KFU0.__parent.remove(YLe,KpnA.manifest,"oppm"))end;return true end
1345YLe.cache=YKA7cU(function(YLe,j_F9c,...)local q=j_F9c
1346if"update"==q then
1347iPL3B4cr.print("Updating OpenPrograms program cache ...")n(YLe:updateCache())
1348return iPL3B4cr.print("Done.")else iPL3B4cr.error("Unknown command.")return
1349iPL3B4cr.print("Usage: hpm oppm:cache update")end end)
1350YLe.autoremove=YKA7cU(function(YLe)local b7G0ciz={}local rF2te={}
1351local KG_EjN=n(_(RSjapQ(z,"oppm")))
1352for aIrjXeB in KG_EjN do local sZdri=n(h6Ub7U(aIrjXeB,nil,"oppm"))
1353if not
1354(sZdri.manual)then local pT=YLe:getPackageDependants(aIrjXeB)if#pT==1 then
1355CM(b7G0ciz,aIrjXeB)CM(rF2te,aIrjXeB)end end end
1356while true do local XgkgIR9=false;KG_EjN=n(_(RSjapQ(z,"oppm")))
1357for sm2 in KG_EjN do
1358if not
1359(tE(sm2,b7G0ciz))then local cz=n(h6Ub7U(sm2,nil,"oppm"))
1360if
1361not(cz.manual)then local pSL=YLe:getPackageDependants(sm2)
1362table.remove(pSL,1)
1363if
1364gad4ZcL((function()local ifrP9={}local Iynmp=1;for PFvHX=1,#pSL do local sP=pSL[PFvHX]
1365ifrP9[Iynmp]=tE(sP.name,b7G0ciz)Iynmp=Iynmp+1 end;return ifrP9 end)())then
1366for Y=1,#pSL do local QHxdp58D=pSL[Y]local efdknL,YUdva=tE(QHxdp58D.name,rF2te)if YUdva then
1367table.remove(rF2te,YUdva)end end;CM(b7G0ciz,sm2)CM(rF2te,sm2)XgkgIR9=true end end end end;if not(XgkgIR9)then break end end
1368UlFdiZ7v({remove=(function()
1369if#b7G0ciz>0 then local x8FBS={}local LGBr=1
1370for M=1,#b7G0ciz do local I=b7G0ciz[M]x8FBS[LGBr]="oppm:"..
1371tostring(I)LGBr=LGBr+1 end;return x8FBS else return nil end end)()})for W=1,#rF2te do local Dx5GC=rF2te[W]
1372YLe:_remove({n(h6Ub7U(Dx5GC,nil,"oppm"))},false)end
1373iPL3B4cr.print("Done.")return true end)
1374YLe.search=YKA7cU(function(YLe,...)local kwZhI=n(YLe:listCache())
1375YLe:notifyCacheUpdate(kwZhI.updated)local T0h=n(kwZhI.cache)local H0={}
1376if...then
1377for Mrz66=1,#T0h do local A=T0h[Mrz66]local RR;RR=A.data
1378local Oj4B=RR.data;local aT={...}
1379for ZN0brC=#aT,1,-1 do local g=aT[ZN0brC]if RR.name:find(g)then
1380table.remove(aT,ZN0brC)break end;if Oj4B.name and Oj4B.name:find(g)then
1381table.remove(aT,ZN0brC)break end
1382if Oj4B.description and
1383Oj4B.description:find(g)then table.remove(aT,ZN0brC)break end;if Oj4B.note and Oj4B.note:find(g)then
1384table.remove(aT,ZN0brC)break end end;if#aT==0 then CM(H0,RR)end end else
1385do local iYIip_rt={}local WoJla=1;for jk=1,#T0h do local Y=T0h[jk]iYIip_rt[WoJla]=Y.data
1386WoJla=WoJla+1 end;H0=iYIip_rt end end
1387for sM=1,#H0 do local MMJEx=H0[sM]
1388iPL3B4cr.print(tostring(MMJEx.name)..
1389" - "..tostring(MMJEx.data.name or
1390MMJEx.name)..
1391": "..tostring(MMJEx.data.description))end end)
1392YLe.info=YKA7cU(function(YLe,EB)if pX4gCR(EB)then
1393iPL3B4cr.fatal("Usage: hpm oppm:info <package name>")end
1394local Qy=n(YLe:listCache())Qy=Qy.cache;local rCWKBim=nil;for i=1,#Qy do local wLI=Qy[i]
1395if wLI.pkg==EB then rCWKBim=wLI;break end end;if not(rCWKBim)then
1396iPL3B4cr.fatal("No such package.")end
1397iPL3B4cr.print("- Package name: "..tostring(rCWKBim.pkg))if rCWKBim.data.data.name then
1398iPL3B4cr.print(" "..
1399tostring(rCWKBim.data.data.name))end;if
1400rCWKBim.data.data.description then
1401iPL3B4cr.print("- Description:\n"..
1402tostring(rCWKBim.data.data.description))end;if
1403rCWKBim.data.data.authors then
1404iPL3B4cr.print("- Authors:\n"..tostring(rCWKBim.data.data.authors))end;if
1405rCWKBim.data.data.files then
1406iPL3B4cr.print("- Files: "..
1407tostring(VcV0EuD(rCWKBim.data.data.files)))end
1408if
1409rCWKBim.data.data.dependencies then
1410iPL3B4cr.print("- Depends: "..
1411tostring(table.concat((function()local N7h={}local jDOa=1
1412for DcVHvlcZ in
1413pairs(rCWKBim.data.data.dependencies)do N7h[jDOa]=DcVHvlcZ;jDOa=jDOa+1 end;return N7h end)()," ")))end;if rCWKBim.data.data.note then
1414iPL3B4cr.print("- Note:\n"..
1415tostring(rCWKBim.data.data.note))end;return
1416iPL3B4cr.print(
1417"- Repository: https://github.com/"..tostring(rCWKBim.repo))end)
1418if Pvuq.__inherited then Pvuq.__inherited(Pvuq,KFU0)end;xSebv5Jc.oppm=KFU0 end;local U
1419U=function()local Z=n(_(z))pX4gCR=true
1420for Ke2eY9 in Z do local mJU4=pfZ3SPy_.name(Ke2eY9)
1421if
1422JQi1jg(RSjapQ(z,mJU4))then local ywtz=n(_(RSjapQ(z,mJU4)))
1423for N7 in ywtz do
1424if not
1425(JQi1jg(RSjapQ(z,mJU4,N7)))then local LLka3VWH=n(h6Ub7U(N7,nil,mJU4))
1426iPL3B4cr.print(
1427mJU4 ..":"..N7 ..
1428(LLka3VWH.version and" @ "..LLka3VWH.version or""))pX4gCR=false end end end end
1429if pX4gCR then return iPL3B4cr.print("No packages installed.")end end;local wFeA
1430wFeA=function(...)hw18,RkGFh6=XPoQB(...)if#hw18 <1 then return PG()end end;local JQgI
1431JQgI=function()local B34=hw18[1]
1432if"list"==B34 then return U()elseif"help"==B34 then return PG()else
1433do
1434local S9D=qTDt(hw18[1])
1435if S9D then
1436return
1437S9D(Qlmlet((function()local JeqL={}local RmN8=1;for ePtDYbn=2,#hw18 do local dPm5lS=hw18[ePtDYbn]JeqL[RmN8]=dPm5lS
1438RmN8=RmN8+1 end;return JeqL end)()))end end end end
1439rDtVf.semver={Version=u.Version,Spec=u.Spec,SpecItem=u.SpecItem,compare=u.compare,match=u.match,validate=u.validate}rDtVf.json=JD;rDtVf.CONFIG_PATH=ykRppH;rDtVf.USAGE=WQ6
1440rDtVf.DEFAULT_CONFIG=y36Aetn;rDtVf.options=RkGFh6;rDtVf.args=hw18;rDtVf.request=nvCiFt7r
1441rDtVf.modules=xSebv5Jc;rDtVf.config=mMp;rDtVf.modulePath=vj;rDtVf.distPath=z
1442rDtVf.exitCode=Zg;rDtVf.log=iPL3B4cr;rDtVf.assert=GI2hz6SK;rDtVf.unimplemented=Oh
1443rDtVf.printUsage=PG;rDtVf.try=n;rDtVf.checkType=O;rDtVf.argNumber=N5UjTN
1444rDtVf.argString=qLH5;rDtVf.isin=tE;rDtVf.tableLen=VcV0EuD;rDtVf.empty=pX4gCR
1445rDtVf.all=gad4ZcL;rDtVf.existsDir=dk;rDtVf.existsFile=E;rDtVf.plural=OO;rDtVf.singular=y
1446rDtVf.linkingVerb=cR6rJlAl;rDtVf.remove=BaX;rDtVf.loadConfig=SJsW11k;rDtVf.checkInternet=Ki1HJT
1447rDtVf.download=wjim8xCV;rDtVf.findCustomCommand=qTDt;rDtVf.getModuleBy=v
1448rDtVf.callModuleMethod=Ta;rDtVf.saveManifest=unArcvQl;rDtVf.loadManifest=h6Ub7U
1449rDtVf.removeManifest=Gm;rDtVf.public=YKA7cU;rDtVf.wrapResponse=mCsewfX;rDtVf.recv=yY
1450rDtVf.confirm=Xf;rDtVf.pkgPlan=UlFdiZ7v;rDtVf.printPackageList=U
1451rDtVf.parseArguments=wFeA;rDtVf.process=JQgI;for fNIe,y2R1 in pairs(_G)do rDtVf[fNIe]=y2R1 end
1452wFeA(...)n(SJsW11k())EQLam()JQgI()return Zg