juju / charm-tools

Tools for charm authors and maintainers
Other
42 stars 64 forks source link

snap: Replace bhttp part with stage-snap #621

Closed fnordahl closed 2 years ago

fnordahl commented 2 years ago

The approach used in the snapcraft godeps plugin is deprecated and no longer works.

Replace it with using the bhttp snap as a stage-snap.

Note that this part of charm tools is probably not useful anymore as the old charm store is shut down, but let's get the snap building again.

ajkavanagh commented 2 years ago

I tried building it, and got this error:

Building wheels for collected packages: vergit          
  Running setup.py bdist_wheel for vergit ... error    
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-5s3l96e4/vergit/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp
viqergzzpip-wheel- --python-tag cp36:                                                                                                          
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]                                                                              
     or: -c --help [cmd1 cmd2 ...]                                                                                                             
     or: -c --help-commands                          
     or: -c cmd --help                                                                                                                         

  error: invalid command 'bdist_wheel'                                                                                                         

  ----------------------------------------                                                                                                     
  Failed building wheel for vergit                                                                                                             
  Running setup.py clean for vergit                                                                                                            
Failed to build vergit                                                                                                                         
Installing collected packages: vergit                                                                                                          
  Running setup.py install for vergit ... done                                                                                                 
Successfully installed vergit-1.0.2   

Is it working for you, or something at my end?

fnordahl commented 2 years ago

@ajkavanagh I see the same here, but at the end of the output you pasted it also says Successfully installed vergit-1.0.2, so I wrote that off as how pip / setuptools approaches the many ways of installing deps.

I can see that the package is indeed installed in the installed snap too:

ubuntu@f:~$ snap list|grep charm
charm   2.8.4+git-3-7f6ed4f  x2     -              -            classic
ubuntu@f:~$ find /snap/charm/current/ |grep vergit
/snap/charm/current/bin/vergit
/snap/charm/current/lib/python3.6/site-packages/vergit
/snap/charm/current/lib/python3.6/site-packages/vergit/VERSION
/snap/charm/current/lib/python3.6/site-packages/vergit/__init__.py
/snap/charm/current/lib/python3.6/site-packages/vergit-1.0.2.dist-info
/snap/charm/current/lib/python3.6/site-packages/vergit-1.0.2.dist-info/INSTALLER
/snap/charm/current/lib/python3.6/site-packages/vergit-1.0.2.dist-info/METADATA
/snap/charm/current/lib/python3.6/site-packages/vergit-1.0.2.dist-info/WHEEL
/snap/charm/current/lib/python3.6/site-packages/vergit-1.0.2.dist-info/entry_points.txt
/snap/charm/current/lib/python3.6/site-packages/vergit-1.0.2.dist-info/top_level.txt
fnordahl commented 2 years ago

Running the vergit tool from the snap also works:

ubuntu@f:~$ git clone https://github.com/juju/charm-tools.git
Cloning into 'charm-tools'...
remote: Enumerating objects: 6950, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 6950 (delta 48), reused 65 (delta 30), pack-reused 6858
Receiving objects: 100% (6950/6950), 55.09 MiB | 13.69 MiB/s, done.
Resolving deltas: 100% (4332/4332), done.
ubuntu@f:~$ cd charm-tools/
ubuntu@f:~/charm-tools$ sudo snap run --shell charm
root@f:/home/ubuntu/charm-tools# PATH=/snap/charm/current/bin:/snap/charm/current/usr/bin vergit
2.8.4+git-3-7f6ed4f