I’ve noticed that in the alsa
remote part wildcard notation is used in the organize
keyword to allow build in different snaps:
organize:
snap/*/current/usr/lib/*: usr/lib/
snap/*/current/usr/share/*: usr/share/
This syntax isn’t documented in snapcraft help plugins
and do not conform to the following expected syntax from the current documentation:
organize:
snap/*/current/: /
So I play with it a bit, here’s the result:
Without organizing:
parts/alsa-lib/install/
├── snap
│ └── alsa
│ └── current
│ └── usr
│ └── share
│ └── alsa
│ ├── alsa.conf
│ ├── alsa.conf.d
│ │ └── README
│ ├── cards
With organize: { snap/alsa/current/: / }
:
parts/alsa-lib/install/
├── snap
│ └── alsa
└── usr
<stripped>
└── share
├── aclocal
│ └── alsa.m4
└── alsa
├── alsa.conf
├── alsa.conf.d
│ └── README
<stripped>
16 directories, 120 files
With organize: { snap/*/current/: / }
:
parts/alsa-lib/install/
├── current
│ └── usr
│ └── share
│ └── alsa
│ ├── alsa.conf
│ ├── alsa.conf.d
│ │ └── README
│ ├── cards
│ │ ├── AACI.conf
<stripped>
With organize: { snap/*/current/*: / }
the build failed with:
shutil.Error: Destination path '/home/ubuntu/snapcraft-alsa/parts/alsa-lib/install/usr' already exists
With organize: { snap/*/current/usr/*: usr/ }
the build failed with:
shutil.Error: Destination path '/home/ubuntu/snapcraft-alsa/parts/alsa-lib/install/usr/share' already exists
With organize: {snap/*/current/usr/share/*: usr/share/}
, finally, the expected result:
parts/alsa-lib/install/
├── snap
│ └── alsa
│ └── current
│ └── usr
│ └── share
└── usr
<stripped>
└── share
├── aclocal
│ └── alsa.m4
└── alsa
├── alsa.conf
├── alsa.conf.d
│ └── README
<stripped>
Is there any proper documentation on how this works, and it is supported or not in the first place?
Also, this could be a lot easier if the organize keyword understands the $SNAPCRAFT_PROJECT_NAME expansion.