Skip to content

Commit

Permalink
update kernel version parser
Browse files Browse the repository at this point in the history
  • Loading branch information
nobara256 committed Jan 22, 2025
1 parent ea7dd57 commit df25324
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/kernel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
.kernelcfg=(.version | sub("(?<x>\\d+\\.\\d+)(.*)"; "kernel-\(.x)_arm64.cfg")) |
.release=(
if (.version | test("^\\d+\\.\\d+$")) then
(.version | sub("(?<x>\\d+\\.\\d+)"; "\(.x).0+nobara-1kernel\(0)"))
(.version | sub("(?<x>\\d+\\.\\d+)"; "\(.x).0+nobara-\(1000)"))
elif(.version | test("^\\d+\\.\\d+\\.\\d+$")) then
(.version | sub("(?<x>\\d+\\.\\d+)\\.(?<y>\\d+)"; "\(.x).\(.y)+nobara-1kernel\(.y | tonumber + 0)"))
(.version | sub("(?<x>\\d+\\.\\d+)\\.(?<y>\\d+)"; "\(.x).\(.y)+nobara-\(.y | tonumber + 1000)"))
else
(.version | sub("(?<x>\\d+\\.\\d+)-rc(?<y>\\d+)"; "\(.x).0+nobara-0kernel\(.y | tonumber + 0)"))
(.version | sub("(?<x>\\d+\\.\\d+)-rc(?<y>\\d+)"; "\(.x).0+nobara-\(.y | tonumber + 1000)"))
end
)
)
Expand Down
27 changes: 13 additions & 14 deletions ruler/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,13 @@ def parse_args():
parse_args()


exit()
# exit()

def encode_array(array, xlen=4, ylen=25):
array = [k for k in map(lambda x: (len(max(x, key=lambda y: len(y))), x), batched(array, ylen))]
def encode_array(array, xlen=4):

ylen = 1+(len(array) // xlen)

array = [k for k in map(lambda x: [ len(max(x, key=lambda y: len(y))), x ], batched(array, ylen))]
dump = ""
for y in range(ylen):
for x in range(xlen):
Expand All @@ -283,7 +286,7 @@ def encode_array(array, xlen=4, ylen=25):

def decode_array(dump, xlen=4):

array = findall(r"\S+", dump)
array = findall('"(.+)"', dump)

darray = []

Expand All @@ -295,24 +298,20 @@ def decode_array(dump, xlen=4):
for x in range(xlen):
for y in range(ylen):
try:
if y > rlen:
r = 1
else:
r = 0
darray.append( array[x+y*(xlen-r)] )

darray.append( array[x+y*xlen] )

except IndexError:
pass

return darray

print(encode_array(debootstrap_package_array, xlen=4, ylen=1+(len(debootstrap_package_array)//4)))
print(encode_array(pipewire_server_package_array, xlen=4, ylen=1+(len(pipewire_server_package_array)//4)))
print(encode_array(cross_compiler_packages, xlen=4, ylen=1+(len(cross_compiler_packages)//4)))
print(dump:=encode_array(server_package_array, xlen=4, ylen=1+(len(server_package_array)//4)))
print(encode_array(debootstrap_package_array, xlen=4))
print(encode_array(pipewire_server_package_array, xlen=4))
print(encode_array(cross_compiler_packages, xlen=4))
print(dump:=encode_array(server_package_array, xlen=4))


print(decode_array(dump, xlen=4))


# xz --decompress --stdout < ubuntu-image/ubuntu-24.10-preinstalled-server-arm64.img.xz | sudo dd of=/dev/nvme0n1 bs=8M iflag=fullblock oflag=direct status=progress
Expand Down

0 comments on commit df25324

Please sign in to comment.