Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove one .whl file from a release? #448

Closed
wimglenn opened this issue Aug 9, 2017 · 6 comments
Closed

How to remove one .whl file from a release? #448

wimglenn opened this issue Aug 9, 2017 · 6 comments

Comments

@wimglenn
Copy link

wimglenn commented Aug 9, 2017

There's a package with multiple wheels built for different architecture. The 2.7 wheel has an issue and needs to be removed from the index.

The devpi remove sub-command just accepts a single positional argument:

positional arguments:
  spec             remove info/files for a project/version/release file from
                   the current index. Example specs: 'pytest' or
                   'pytest>=2.3.5'

Asking to remove a version number lists all the wheels:

$ devpi remove "somepackage==1.2.3"
About to remove the following releases and distributions
version: 1.2.3
  - https://devpi/x/y/+f/cafef00d/somepackage-1.2.3-268-cp27-cp27mu-linux_x86_64.whl
  - https://devpi/x/y/+f/cafef00d/somepackage-1.2.3-268-cp36-cp36m-linux_x86_64.whl
Are you sure (yes/no)?

It just prompts to remove all or none. How to specify the 'spec' to only remove the 2.7 wheel? It's not working to just ssh into devpi server and getting rid of the file itself; this leaves the devpi metadata all screwed up and the index views still think that the wheel exists.

The devpi client version is 3.0.0 and the server version is 4.0.0.

@fschulze
Copy link
Contributor

fschulze commented Aug 9, 2017

Unfortunately this isn't possible at the moment. There is no API endpoint in devpi-server that allows deletion of individual files. This is certainly something that should be possible though.

@wimglenn
Copy link
Author

Hi @fschulze , thank you for the prompt response. If this is not possible from devpi client, can you suggest a way to do it:

  • from devpi server CLI
  • through a Python interpreter directly, on the machine hosting server

Alternatively, a way to cleanup the metadata after simply removing the files directly from the host?

@fschulze
Copy link
Contributor

Make a backup of your data!

Create a python file like the following, adjusted to your data. You can comment out the remove_links line while adjusting the script to only get a dry run:

from devpi_server.main import get_pluginmanager, parseoptions, XOM
import sys


pm = get_pluginmanager()
config = parseoptions(pm, sys.argv)
xom = XOM(config)


with xom.keyfs.transaction(write=True):
    stage = xom.model.getstage('fschulze', 'dev')
    linkstore = stage.get_linkstore_perstage('devpi-server', '3.0.0b2', readonly=False)
    links = linkstore.get_links()
    info = [
        (x.rel, x.basename)
        for x in linkstore.get_links()
        if x.basename.endswith('.whl')]
    for rel, basename in info:
        print(rel, basename)
        linkstore.remove_links(rel=rel, basename=basename)

Stop the server to be save, but if there are no writes to the db, it may work while the server is running.

Run the above python file with the python interpreter of your devpi-server virtualenv using the same options like you run normally, most importantly --serverdir.

@wimglenn
Copy link
Author

Thanks for the answer. You may convert this issue into a feature request, or just close it if you like. Cheers.

@cjw296
Copy link

cjw296 commented Mar 6, 2018

Workaround would be to download the one you want to keep, delete them both, then re-upload the one you wanted to keep.

fschulze added a commit to fschulze/devpi that referenced this issue Jun 21, 2018
fschulze added a commit to fschulze/devpi that referenced this issue Jun 21, 2018
fschulze added a commit to fschulze/devpi that referenced this issue Jul 12, 2018
fschulze added a commit to fschulze/devpi that referenced this issue Jul 12, 2018
fschulze added a commit to fschulze/devpi that referenced this issue Jul 12, 2018
fschulze added a commit that referenced this issue Jul 12, 2018
Implement #448: allow deletion of single release files.
@fschulze
Copy link
Contributor

fschulze commented Jul 13, 2018

With devpi-server 4.6.0 a single release can be deleted using a DELETE request on it's URL. For now one has to use curl or similar tool, which is a bit cumbersome because of authentication etc. I plan to add support for it in devpi-client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants