diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4c99a26..cc4b059 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -211,6 +211,9 @@ parts: - --with-drivers=cups,pwgraster,ps2write - --enable-freetype - --without-tesseract + - --without-gpdl + - --without-xps + - --without-pcl - --datarootdir=/snap/gutenprint-printer-app/current/usr/share/ stage-packages: - libpaper1 @@ -465,25 +468,68 @@ parts: - --disable-test - --disable-testpattern - --enable-nls + - --without-doc override-pull: | set -eux # Do the actual pull task craftctl default # Settings: - # Grade: stable/devel - GRADE=stable - # Package release number (integer) - PACKAGERELEASE=1 - # Current upstream version of Gutenprint - major=`cat configure.ac | grep pushdef | grep '\[GUTENPRINT_MAJOR_VERSION\]' | perl -p -e 's/^.*?\[(\d+)\].*$/\1/'` - minor=`cat configure.ac | grep pushdef | grep '\[GUTENPRINT_MINOR_VERSION\]' | perl -p -e 's/^.*?\[(\d+)\].*$/\1/'` - patch=`cat configure.ac | grep pushdef | grep '\[GUTENPRINT_MICRO_VERSION\]' | perl -p -e 's/^.*?\[(\d+)\].*$/\1/'` - upstreamversion="$major.$minor.$patch" + # Force channel: auto/devel/edge/stable + CHANNEL=stable + # Force package release number (integer) or "auto" + PACKAGERELEASE=auto + # Time stamp of Snap build in Snap Store + snapbuilddatehuman=`curl -s -H 'Snap-Device-Series: 16' https://api.snapcraft.io/v2/snaps/info/gutenprint-printer-app | jq -r '."channel-map" | .[] | select(.channel.name == "edge") | select(.channel.architecture == "amd64") | ."created-at"'` + snapbuilddate=`date +%s --date=$snapbuilddatehuman` + if [ -z "$snapbuilddate" ]; then + snapbuilddate=0 + fi + # Time stamp of the last GIT commit of the snapping repository + pushd $CRAFT_PROJECT_DIR + gitcommitdate=`git log -1 --date=unix | grep Date: | perl -p -e 's/Date:\s*//'` + popd + if [ -z "$gitcommitdate" ]; then + gitcommitdate=0 + fi + # Previous stable and development version + prevstable="$(curl -s -H 'Snap-Device-Series: 16' https://api.snapcraft.io/v2/snaps/info/gutenprint-printer-app | jq -r '."channel-map" | .[] | select(.channel.name == "stable") | select(.channel.architecture == "'$CRAFT_TARGET_ARCH'") | .version')" + if [ -z "$prevstable" ]; then + prevstable=0 + fi + prevdevel="$(curl -s -H 'Snap-Device-Series: 16' https://api.snapcraft.io/v2/snaps/info/gutenprint-printer-app | jq -r '."channel-map" | .[] | select(.channel.name == "edge") | select(.channel.architecture == "'$CRAFT_TARGET_ARCH'") | .version')" + if [ -z "$prevdevel" ]; then + prevdevel=0 + fi + # Previous version in general + dpkg --compare-versions "$prevdevel" lt "$prevstable" && prevversion=$prevstable || prevversion=$prevdevel + # Current upstream version of gutenprint + upstreamversion="$(git describe --tags --always | sed -E 's/^gutenprint-([0-9]+_[0-9]+_[0-9]+).*$/\1/; s/_/\./g')" + # Determine package release number + if test "x$PACKAGERELEASE" = "xauto"; then + packagerelease=`echo "$prevversion" | perl -p -e 's/^('"$upstreamversion"'\-(\d+)|.*)$/\2/'` + if [ -z "$packagerelease" ]; then + packagerelease=1 + else + if test "$gitcommitdate" -gt "$snapbuilddate"; then + packagerelease=$(( $packagerelease + 1 )) + fi + fi + else + packagerelease=$PACKAGERELEASE + fi # Compose version string - version="$upstreamversion-$PACKAGERELEASE" + version="$upstreamversion-$packagerelease" + # Select channel + if test "x$CHANNEL" = "xedge" -o "x$CHANNEL" = "xdevel"; then + grade=devel + elif test "x$CHANNEL" = "xstable"; then + grade=stable + else + [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable + fi # Set version and grade craftctl set version="$version" - craftctl set grade="$GRADE" + craftctl set grade="$grade" build-packages: - byacc - libreadline-dev @@ -492,6 +538,8 @@ parts: - flex - gettext - chrpath + - libtool-bin + - jq organize: snap/gutenprint-printer-app/current/usr/share: usr/share usr/lib/cups/filter/rastertogutenprint.5.3: usr/lib/gutenprint-printer-app/filter/rastertogutenprint.5.3