如何在Launchpad中设置PPA自动重定向至新包名?
bookworm to com.github.babluboy.bookworm The cleanest way to handle this package name transition on Launchpad is to leverage Debian's package dependency system—specifically the Provides, Conflicts, and Replaces fields. This will make APT automatically redirect users who run the old install command to the new package, eliminating the need for manual user intervention or in-app prompts. Here's how to implement it:
Step 1: Update the new package's control file
Edit the debian/control file of your new com.github.babluboy.bookworm package to include these lines in the package definition section:
Provides: bookworm Conflicts: bookworm Replaces: bookworm
Let's break down what each field does:
Provides: bookworm: Tells the package manager that this new package fulfills the functionality of the oldbookwormpackage.Conflicts: bookworm: Ensures the old and new packages can't be installed at the same time, preventing conflicts.Replaces: bookworm: Allows the new package to overwrite any files or configurations from the oldbookwormpackage, ensuring a smooth transition.
Step 2: Deprecate the old package
On Launchpad, you can mark the original bookworm package as obsolete:
- Navigate to your PPA's package page for
bookworm. - Under the "Status" dropdown, select "Obsolete" and save the change.
This signals to APT that the old package is no longer supported, and combined with the fields above, it will prioritize the new package when users try to install the old name.
Step 3: Verify the behavior
Once you've pushed the updated new package to your PPA, test the old install command:
sudo apt-get install bookworm
APT should now prompt you to install com.github.babluboy.bookworm instead, explaining that it provides the bookworm package and replaces the old version. Users won't accidentally install the outdated package anymore.
Why this is better than your temporary in-app prompt
- Root-level fix: Users don't need to open the app to see the prompt—this handles the transition at the package manager level, which is where they're initiating the install.
- No broken installs: Anyone following old tutorials will get the current supported package automatically, without confusion.
- Preserves dependencies: If any other tools or scripts depend on the
bookwormpackage name, theProvidesfield keeps those dependencies satisfied.
Just make sure your new package has a higher version number than the old bookworm package (which it should, since it's an updated release) to ensure APT picks it as the replacement.
内容的提问来源于stack exchange,提问作者Siddhartha Das

