Skip to content

Commit

Permalink
feat(backend): parse db's file list for soNames / refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dr460nf1r3 committed Nov 7, 2024
1 parent 7a47b9c commit c0b919d
Show file tree
Hide file tree
Showing 14 changed files with 13,849 additions and 146 deletions.
3 changes: 1 addition & 2 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { RepoManagerModule } from "./repo-manager/repo-manager.module";
import { RouterModule } from "./router/router.module";
import { UsersModule } from "./users/users.module";
import { ThrottlerModule } from "@nestjs/throttler";
import { TelegramModule } from "./telegram/telegram.module";

@Module({
imports: [
Expand All @@ -31,7 +30,7 @@ import { TelegramModule } from "./telegram/telegram.module";
MiscModule,
RepoManagerModule,
RouterModule,
TelegramModule,
// TelegramModule,
TerminusModule,
ThrottlerModule.forRoot([
{
Expand Down
4 changes: 2 additions & 2 deletions backend/src/builder/builder.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type Repository,
} from "typeorm";
import { BuildStatus } from "../types";
import { NamcapAnalysis, RepoStatus } from "../interfaces/repo-manager";
import { NamcapAnalysis, ParsedPackageMetadata, RepoStatus } from "../interfaces/repo-manager";

@Entity()
export class Builder {
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Package {
bumpTriggers: { pkgname: string; archVersion: string }[];

@Column({ type: "jsonb", nullable: true })
metadata: string;
metadata: ParsedPackageMetadata;

@Column({ type: "int", nullable: true })
pkgrel: number;
Expand Down
3 changes: 2 additions & 1 deletion backend/src/interfaces/repo-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ export interface ParsedPackageMetadata {
checkDepends?: string[];
conflicts?: string[];
deps?: string[];
desc?: string;
filename: string;
license?: string;
makeDeps?: string[];
optDeps?: string[];
packager?: string;
desc?: string;
provides?: string[];
replaces?: string[];
soNameList?: string[];
url?: string;
}

Expand Down
22 changes: 20 additions & 2 deletions backend/src/repo-manager/repo-manager.controller.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
import { Controller, Get } from "@nestjs/common";
import { Controller, Get, Param, ParseIntPipe, Query } from "@nestjs/common";
import { RepoManagerService } from "./repo-manager.service";
import { AllowAnonymous } from "../auth/anonymous.decorator";
import { BumpLogEntry } from "../interfaces/repo-manager";

@Controller("repo")
export class RepoManagerController {
constructor(private repoManager: RepoManagerService) {}

@AllowAnonymous()
@Get("run")
run(): void {
void this.repoManager.run();
}

@AllowAnonymous()
@Get("update-db")
updateChaoticVersions(): void {
void this.repoManager.updateChaoticVersions();
}


@AllowAnonymous()
@Get("bump-logs/:amount")
getBumpLogs(
@Param("amount", ParseIntPipe) amount: number,
@Query("skip", new ParseIntPipe({ optional: true })) skip: number,
): Promise<BumpLogEntry[]> {
return this.repoManager.getBumpLogs({ amount, skip });
}

@AllowAnonymous()
@Get("test")
test(): void {
void this.repoManager.updateChaoticVersions();
}

@Get("read-namcap")
readNamcap(): void {
void this.repoManager.readNamcap();
Expand Down
5 changes: 5 additions & 0 deletions backend/src/repo-manager/repo-manager.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { ArchlinuxPackage, PackageBump, RepoManagerSettings } from "./repo-manag
import { ConfigModule } from "@nestjs/config";
import repoManagerConfig from "../config/repo-manager.config";
import { BuilderModule } from "../builder/builder.module";
import { ServeStaticModule } from "@nestjs/serve-static";
import { join } from "path";

@Module({
controllers: [RepoManagerController],
Expand All @@ -15,6 +17,9 @@ import { BuilderModule } from "../builder/builder.module";
forwardRef(() => BuilderModule),
ConfigModule.forFeature(repoManagerConfig),
HttpModule,
ServeStaticModule.forRoot({
rootPath: join(__dirname, "backend/src/repo-manager/public"),
}),
TypeOrmModule.forFeature([ArchlinuxPackage, RepoManagerSettings, PackageBump]),
],
providers: [RepoManagerService],
Expand Down
Loading

0 comments on commit c0b919d

Please sign in to comment.