[aur-general] RFC: PKGBUILD for nixnote2-release-bin

Tom Hale tom at hale.ee
Mon Nov 5 12:07:09 UTC 2018


Could I please have comments on the below (and attached) PKGBUILD for 
nixnote2-release-bin.

To pre-empt some comments:

1) This will download the latest binary from GitHub. I'm open to a 
different package name to denote that it's not a '-git' or 
build-from-latest-source-code, but rather a 
build-from-latest-binary-release.

You may say that building from latest binary release against the 
packaging guidelines, but I can't see where. Please see prior art 
regarding this at:

https://bbs.archlinux.org/viewtopic.php?pid=1811590#p1811590

2) There is already a '-git' version of this package, but I want to 
provide another option which:
* Is more stable - based on versioned releases rather than the 
'continuous' branch.
* Has a quicker install - doesn't require waiting for compiling


Question:

I've found that even with pointing the .desktop file explicitly at the 
pathname of the icon, xfce4 still doesn't pick it up. Why not?

===============================================================

# Maintainer: Tom Hale <tom[noodle]hale[point]ee>
# Contributor: twa022 <twa022 at gmail dot com>

OPTIONS=(!strip)  # Stripping an AppImage renders it non-functional

_pkgname=nixnote2
pkgname=${_pkgname}-release-bin
pkgver=2.1.0.beta4
pkgrel=1
pkgdesc='Evernote clone (formerly Nevernote) - latest binary release'
url="https://github.com/robert7/$_pkgname"
arch=(x86_64)
license=(GPL3)
depends=(hicolor-icon-theme zlib)
makedepends=(git)
conflicts=(nixnote2-git)
provides=("nixnote=${pkgver%.r*}" "$_pkgname=${pkgver%.r*}")
replaces=(nevernote nixnote nixnote-beta)
source=("$pkgname:desktop.patch")
sha256sums=(4f12cddc49e0c694f41e344acebc0d8a3bce07a3496098eb2fae258ba9044967)
noextract=("${source[@]%%::*}")  # Don't extract anything

_version_file=$pkgname-PKGBUILD-version  # For version from the download URL

_appimage_path=$(curl -s 'https://github.com/robert7/nixnote2/releases' |
                   sed -En 
's:.*(/releases/download/v[^"/]+/[^"/]+[Aa]pp[Ii]mage)".*:\1:p' |
                   head -n1)

_appimage=${_appimage_path##*/}  # basename of AppImage

prepare() {
    wget -N "$url/$_appimage_path"  # Only download again if server 
version is newer

    # Make download executable
    chmod 755 "$_appimage"

    # Extract user resources from inside the AppImage
    # All files in the directories specified are extracted
    # Note that --appimage-extract currently doesn't support recursive 
extraction:
    # https://github.com/AppImage/AppImageKit/issues/370
    local extract_dirs=(usr/share/applications
                        usr/share/man/man1
                        usr/share/icons/hicolor/48x48/apps
                        usr/share/nixnote2
                        usr/share/nixnote2/help
                        usr/share/nixnote2/translations)

    # Due to this issue, all --appimage-extract target directories must 
already exist
    # https://github.com/AppImage/AppImageKit/issues/363
    local dir
    for dir in "${extract_dirs[@]}"; do
      mkdir -p squashfs-root/"$dir"
      "./$_appimage" --appimage-extract "$dir/*"
    done

    # Save version of extracted files for pkgver() in `makepkg -e`
    [[ $_appimage_path =~ /releases/download/v([^/]+).* ]]
    local version=${BASH_REMATCH[1]}
    echo ${version//-/.} >| "$_version_file"

    rm -r squashfs-root/usr/share/"$_pkgname"/{java,images}  # Remove 
non-human resources

    # Directories are extracted with no permissions for group and other. 
Fix:
    find squashfs-root -type d -exec chmod go+rx -- {} +

    # Have the .desktop point explicitly at the icon
    patch -d squashfs-root/usr/share/applications < "$pkgname:desktop.patch"
}


pkgver() {
      cat "$_version_file"
}


package() {
    cd "$pkgdir"

    # User resources
    cp -pr "$srcdir"/squashfs-root/usr .

    # AppImage as /usr/bin/nixnote2 for .desktop file
    install -Dm755 -T "$srcdir/$_appimage" usr/bin/"$_pkgname"
}

-- 
Tom Hale
-------------- next part --------------
# Maintainer: Tom Hale <tom[noodle]hale[point]ee>
# Contributor: twa022 <twa022 at gmail dot com>

OPTIONS=(!strip)  # Stripping an AppImage renders it non-functional

_pkgname=nixnote2
pkgname=${_pkgname}-release-bin
pkgver=2.1.0.beta4
pkgrel=1
pkgdesc='Evernote clone (formerly Nevernote) - latest binary release'
url="https://github.com/robert7/$_pkgname"
arch=(x86_64)
license=(GPL3)
depends=(hicolor-icon-theme zlib)
makedepends=(git)
conflicts=(nixnote2-git)
provides=("nixnote=${pkgver%.r*}" "$_pkgname=${pkgver%.r*}")
replaces=(nevernote nixnote nixnote-beta)
source=("$pkgname:desktop.patch")
sha256sums=(4f12cddc49e0c694f41e344acebc0d8a3bce07a3496098eb2fae258ba9044967)
noextract=("${source[@]%%::*}")  # Don't extract anything

_version_file=$pkgname-PKGBUILD-version  # For version from the download URL

_appimage_path=$(curl -s 'https://github.com/robert7/nixnote2/releases' |
                 sed -En 's:.*(/releases/download/v[^"/]+/[^"/]+[Aa]pp[Ii]mage)".*:\1:p' |
                 head -n1)

_appimage=${_appimage_path##*/}  # basename of AppImage

prepare() {
  wget -N "$url/$_appimage_path"  # Only download again if server version is newer

  # Make download executable
  chmod 755 "$_appimage"

  # Extract user resources from inside the AppImage
  # All files in the directories specified are extracted
  # Note that --appimage-extract currently doesn't support recursive extraction:
  # https://github.com/AppImage/AppImageKit/issues/370
  local extract_dirs=(usr/share/applications
                      usr/share/man/man1
                      usr/share/icons/hicolor/48x48/apps
                      usr/share/nixnote2
                      usr/share/nixnote2/help
                      usr/share/nixnote2/translations)

  # Due to this issue, all --appimage-extract target directories must already exist
  # https://github.com/AppImage/AppImageKit/issues/363
  local dir
  for dir in "${extract_dirs[@]}"; do
    mkdir -p squashfs-root/"$dir"
    "./$_appimage" --appimage-extract "$dir/*"
  done

  # Save version of extracted files for pkgver() in `makepkg -e`
  [[ $_appimage_path =~ /releases/download/v([^/]+).* ]]
  local version=${BASH_REMATCH[1]}
  echo ${version//-/.} >| "$_version_file"

  rm -r squashfs-root/usr/share/"$_pkgname"/{java,images}  # Remove non-human resources

  # Directories are extracted with no permissions for group and other. Fix:
  find squashfs-root -type d -exec chmod go+rx -- {} +

  # Have the .desktop point explicitly at the icon
  patch -d squashfs-root/usr/share/applications < "$pkgname:desktop.patch"
}


pkgver() {
    cat "$_version_file"
}


package() {
  cd "$pkgdir"

  # User resources
  cp -pr "$srcdir"/squashfs-root/usr .

  # AppImage as /usr/bin/nixnote2 for .desktop file
  install -Dm755 -T "$srcdir/$_appimage" usr/bin/"$_pkgname"
}


More information about the aur-general mailing list