diff --git a/src/build/build.v b/src/build/build.v index cf70894..942ce8a 100644 --- a/src/build/build.v +++ b/src/build/build.v @@ -93,7 +93,7 @@ fn build(conf Config) ? { 'source PKGBUILD', // The build container checks whether the package is already // present on the server - 'curl --head --fail $conf.address/$repo.repo/$build_arch/\$pkgname-\$pkgver-\$pkgrel-${build_arch}.pkg.tar.zst && exit 0', + 'curl --head --fail $conf.address/$repo.repo/$build_arch/\$pkgname-\$pkgver-\$pkgrel && exit 0', 'MAKEFLAGS="-j\$(nproc)" makepkg -s --noconfirm --needed && for pkg in \$(ls -1 *.pkg*); do curl -XPOST -T "\$pkg" -H "X-API-KEY: \$API_KEY" $conf.address/$repo.repo/publish; done', ] diff --git a/src/server/routes.v b/src/server/routes.v index a926425..f259af4 100644 --- a/src/server/routes.v +++ b/src/server/routes.v @@ -22,7 +22,9 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re db_exts := ['.db', '.files', '.db.tar.gz', '.files.tar.gz'] - if db_exts.any(filename.ends_with(it)) { + // There's no point in having the ability to serve db archives with wrong + // filenames + if db_exts.any(filename == '$repo$it') { full_path = os.join_path(app.repo.repos_dir, repo, arch, filename) // repo-add does this using symlinks, but we just change the requested @@ -30,8 +32,14 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re if !full_path.ends_with('.tar.gz') { full_path += '.tar.gz' } - } else { + } else if filename.contains('.pkg') { full_path = os.join_path_single(app.repo.pkg_dir, filename) + + // Default behavior is to return the desc file for the package, if present. + // This can then also be used by the build system to properly check whether + // a package is present in an arch-repo. + } else { + full_path = os.join_path(app.repo.repos_dir, repo, arch, filename, 'desc') } // Scuffed way to respond to HEAD requests