- icon_path=$app/Contents/Resources/
- background_path=background
- # retrieve sfa/sfa and sface/sface in the image
- git_retrieve $sfa_GITPATH sfa $img_mnt/$resource_path/
- git_retrieve $sface_GITPATH sface $img_mnt/$resource_path/
+
+ # retrieve sfa and sface full repos in a temp dir
+ temp=$(mktemp -d -t sface-dmg)
+
+ git_retrieve $sfa_GITPATH $temp/sfa
+ git_retrieve $sface_GITPATH $temp/sface
+
+ # retrieve version number, and run make version
+ sfa_spec=$temp/sfa/sfa.spec
+ # use newlines and keep only the first line, for multiple packages
+ sfa_version=$(rpm -q --specfile $sfa_spec --qf '%{version}\n' | head -1)
+ # cannot extract taglevel, issues lots of 'error: incorrect format: unknown tag'
+ # turns out release is the same in our case as we haven't computed header.spec
+ sfa_release=$(rpm -q --specfile $sfa_spec --qf '%{release}\n' | head -1 | cut -d. -f1)
+ sfa_tag=${sfa_version}-${sfa_release}
+ make -C $temp/sfa VERSIONTAG="${sfa_tag}" SCMURL="${sfa_GITPATH}" version
+
+ sface_spec=$temp/sface/sface.spec
+ sface_version=$(rpm -q --specfile $sface_spec --qf '%{version}\n' | head -1)
+ sface_release=$(rpm -q --specfile $sface_spec --qf '%{release}\n' | head -1 | cut -d. -f1)
+ sface_tag=${sface_version}-${sface_release}
+ make -C $temp/sface VERSIONTAG="${sface_tag}" SCMURL="${sface_GITPATH}" version
+
+ # copy sfa/ and sface/ subdirs in image
+ rm -rf "$img_mnt"/$resource_path/{sfa,sface}
+ tar -C $temp/sfa -cf - sfa | tar -C "$img_mnt"/$resource_path/ -xf -
+ tar -C $temp/sface -cf - sface | tar -C "$img_mnt"/$resource_path/ -xf -
+