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

snap on classic branch can't be built #103

Open
dilyn-corner opened this issue Aug 29, 2023 · 1 comment
Open

snap on classic branch can't be built #103

dilyn-corner opened this issue Aug 29, 2023 · 1 comment

Comments

@dilyn-corner
Copy link

https://github.com/snapcore/pc-gadget/blob/f604792d13d7e0cbb0f42d18c333ff654247a311/snapcraft.yaml#L17C63-L17C63

This line should reference ${SNAPCRAFT_PROJECT_DIR}/gadget-${SNAPCRAFT_TARGET_ARCH}.yaml -- ${SNAPCRAFT_PROJECT_DIR} is actually a different location depending on if you're building with --destructive-mode so the file path needs to be explicit.

Build log:

dilyn@Ares:~/work/canonical/pc-gadget -> snapcraft               
Starting Snapcraft 7.5.2.post73+git48bd0632                                                                                                            
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20230829-132113.589633.log'                                                     
Running on amd64 for amd64                                                                                                                             
Launching instance...                                                                                                                                  
Starting instance                                                                                                                                      
Starting Snapcraft 7.5.2.post73+git48bd0632                                                                                                            
Logging execution to '/tmp/snapcraft.log'                                                                                                              
Running on amd64 for amd64                                                                                                                             
Initializing parts lifecycle                                                                                                                           
Executing parts lifecycle...                                                                                                                           
Installing build-packages                                                                                                                              
Installing build-snaps                                                                                                                                 
Executing parts lifecycle: skip pull gadget-yaml (already ran)                                                                                         
Executing action                                                                                                                                       
Executed: skip pull gadget-yaml (already ran)                                                                                                          
Executing parts lifecycle: skip pull grub-prepare (already ran)                                                                                        
Executing action                                                                                                                                       
Executed: skip pull grub-prepare (already ran)                                                                                                         
Executing parts lifecycle: update sources for grub (source changed)                                                                                    
Executing action                                                                                                                                       
Executed: update sources for grub (source changed)                                                                                                     
Executing parts lifecycle: build gadget-yaml                                                                                                           
Executing action                                                                                                                                       
:: + install -m 644 gadget-amd64.yaml /root/project/gadget.yaml                                                                                        
:: install: cannot stat 'gadget-amd64.yaml': No such file or directory                                                                                 
'override-build' in part 'gadget-yaml' failed with code 1.
Review the scriptlet and make sure it's correct.                                            
Failed to execute pack in instance.                                                                                                                    
Full execution log: '/home/dilyn/.local/state/snapcraft/log/snapcraft-20230829-132113.589633.log'    
@dilyn-corner
Copy link
Author

dilyn-corner commented Aug 29, 2023

Additionally, the ln and cp in the Makefile's install: target should use -f to avoid file collision problems:

{snip}
:: mkdir -p /root/parts/grub/install/meta                                                                                                              
:: ln gadget-amd64.yaml gadget.yaml                                                                                                                    
:: ln: failed to create hard link 'gadget.yaml': File exists                                                                                           
:: make: *** [Makefile:170: install] Error 1                                                                                                           
Failed to run the build script for part 'grub'.                                                                                                        
Failed to execute pack in instance.                                                                                                                    
Full execution log: '/home/dilyn/.local/state/snapcraft/log/snapcraft-20230829-151724.771742.log'    

It probably also wouldn't hurt to run make clean after everything is finished to make sure we don't dirty the current working directory once we've finished building the snap.

@dilyn-corner dilyn-corner changed the title snap can't be built snap on classic branch can't be built Aug 29, 2023
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

1 participant