Include architectures for dummy data

This commit is contained in:
Hugo Osvaldo Barrera 2022-07-19 18:51:51 +02:00
parent 65d8f18255
commit 3cf974da4d

View file

@ -96,6 +96,22 @@ def genFortune():
return fortunes[random.randrange(0, len(fortunes))].replace("'", "") return fortunes[random.randrange(0, len(fortunes))].replace("'", "")
def genArch() -> str:
arches: list[str] = []
if random.randrange(0, 10) < 8:
arches.append("x86_64")
if random.randrange(0, 10) < 6:
arches.append("aarch64")
if random.randrange(0, 10) < 2:
arches.append("riscv")
if arches:
return ",".join(arches)
else:
return "any"
# load the words, and make sure there are enough words for users/pkgs # load the words, and make sure there are enough words for users/pkgs
# #
log.debug("Grabbing words from seed file...") log.debug("Grabbing words from seed file...")
@ -235,9 +251,11 @@ for p in list(seen_pkgs.keys()):
s = s % (seen_pkgs[p], p, NOW, NOW, uuid, muid, puid) s = s % (seen_pkgs[p], p, NOW, NOW, uuid, muid, puid)
out.write(s) out.write(s)
s = ("INSERT INTO Packages (ID, PackageBaseID, Name, Version) VALUES " s = (
"(%d, %d, '%s', '%s');\n") "INSERT INTO Packages (ID, PackageBaseID, Name, Version, Arch) VALUES "
s = s % (seen_pkgs[p], seen_pkgs[p], p, genVersion()) "(%d, %d, '%s', '%s', '%s');\n"
)
s = s % (seen_pkgs[p], seen_pkgs[p], p, genVersion(), genArch())
out.write(s) out.write(s)
count += 1 count += 1