fix arch subscription (#424)

* #423 fix arch subscription

* skip subscription in brewkit_mnt

---------

Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
Neil 2023-04-10 08:14:32 +08:00 committed by GitHub
parent b49b6572ce
commit b2126bc82e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -42,8 +42,13 @@ export async function subscribeToPackageTopic(pkgFullname: string) {
try {
if (Pushy.isRegistered()) {
const slug = nameToSlug(pkgFullname);
// override rules for brewkit_mnt
if (slug.includes("brewkit_mnt")) return;
const platformArch = getTopicArch();
const topic = `packages-${slug}_${platformArch}`;
await Pushy.subscribe(topic);
log.info("push: registered to pkg-topic: ", topic);
} else {
@ -108,7 +113,7 @@ enum PlatformArch {
}
export function getTopicArch() {
const arch = (process.arch as string) === "aarch64" ? "aarch64" : "x86-64";
const arch = (process.arch as string) === "arm64" ? "aarch64" : "x86-64";
const platform = process.platform === "darwin" ? "darwin" : "linux";
return `${platform}_${arch}` as PlatformArch;
}

View file

@ -164,7 +164,7 @@ export async function updatePackageInstalledList(list: InstalledPackage[]) {
export async function deletePackageFolder(fullName, version) {
try {
const foldPath = path.join(getTeaPath(), fullName, `v${version}`);
console.log(foldPath);
log.info("rm:", foldPath);
await fs.rmdirSync(foldPath, { recursive: true });
} catch (error) {
log.error(error);