Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/admin/actions/package_publisher_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final packagePublisherSet = AdminAction(
triggerPackagePostUpdates(
packageName,
skipReanalysis: true,
skipVersionsExport: true,
skipArchiveExport: true,
);
if (currentPublisherId != null) {
await purgePublisherCache(publisherId: currentPublisherId);
Expand Down
2 changes: 1 addition & 1 deletion app/lib/admin/actions/publisher_package_remove.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ If the publisher has no members, the package will end up without uploaders.
triggerPackagePostUpdates(
packageName,
skipReanalysis: true,
skipVersionsExport: true,
skipArchiveExport: true,
);
await purgePublisherCache(publisherId: currentPublisherId);
return {
Expand Down
34 changes: 21 additions & 13 deletions app/lib/package/api_export/api_exporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,14 @@ final class ApiExporter {
///
/// When [forceDelete] is set, the age threshold limit for stray files is
/// ignored, they will be deleted even if they were updated recently.
///
/// When [skipArchives] is set, skip the archive-related exports
/// (e.g. public or canonical buckets).
Future<void> synchronizePackage(
String package, {
bool forceWrite = false,
bool forceDelete = false,
bool skipArchives = false,
}) async {
_log.info('synchronizePackage("$package")');

Expand All @@ -229,21 +233,25 @@ final class ApiExporter {
skipCache: true, // Skipping the cache when fetching security advisories
);

final versions = await packageBackend.tarballStorage
.listVersionsInCanonicalBucket(package);
if (!skipArchives) {
final versions = await packageBackend.tarballStorage
.listVersionsInCanonicalBucket(package);

// Remove versions that are not exposed in the public API.
versions.removeWhere(
(version, _) => !versionListing.versions.any((v) => v.version == version),
);
// Remove versions that are not exposed in the public API.
versions.removeWhere(
(version, _) =>
!versionListing.versions.any((v) => v.version == version),
);

await _api
.package(package)
.synchronizeTarballs(
versions,
forceWrite: forceWrite,
forceDelete: forceDelete,
);
}

await _api
.package(package)
.synchronizeTarballs(
versions,
forceWrite: forceWrite,
forceDelete: forceDelete,
);
await _api
.package(package)
.advisories
Expand Down
12 changes: 5 additions & 7 deletions app/lib/package/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class PackageBackend {
),
);
});
triggerPackagePostUpdates(package, skipVersionsExport: true);
triggerPackagePostUpdates(package, skipArchiveExport: true);
}

/// Updates [options] on [package]/[version], assuming the current user
Expand Down Expand Up @@ -929,7 +929,7 @@ class PackageBackend {
triggerPackagePostUpdates(
packageName,
skipReanalysis: true,
skipVersionsExport: true,
skipArchiveExport: true,
);
return rs;
}
Expand Down Expand Up @@ -2446,10 +2446,8 @@ class _VersionTransactionDataAcccess {
/// Skip triggering a new export to the CDN bucket.
bool skipExport = false,

/// Skip only the version-related exports to the CDN bucket, keeps the
/// package-related operations.
/// TODO: implement this in API exporter.
bool skipVersionsExport = false,
/// Skip only the archive-related exports to the CDN bucket.
bool skipArchiveExport = false,

/// Pass the force-deletion flag to the package export operation.
bool exportForceDelete = false,
Expand All @@ -2476,7 +2474,7 @@ class _VersionTransactionDataAcccess {
() => apiExporter.synchronizePackage(
package,
forceDelete: exportForceDelete,
// TODO: implement and use [skipVersionsExport]
skipArchives: skipArchiveExport,
),
),
];
Expand Down