You are not logged in.

#1 2016-07-30 13:05:33

Neg
Member
Registered: 2012-07-24
Posts: 17

PKGBUILD review request: notion fork

# $Id: PKGBUILD 165753 2016-03-09 13:52:47Z spupykin $
# Maintainer: Sergey Miroshnichenko <serg.zorg@gmail.com>

pkgname=notion-neg-git
pkgver=2016073000
pkgrel=2
#_commit=ca9c104bfb7acbcc5b76bf205463c7c1edc906f1
pkgdesc="NotionWM fork with compton, dzen2, rofi, xft fonts support different default cfg. Look for https://github.com/neg-serg/notion.git for more details"
url="https://github.com/neg-serg/notion"
arch=('i686' 'x86_64')
license=('custom:LGPL')
depends=('glib2' 'gettext' 'lua' 'libxext' 'libsm')
optdepends=('libxrandr: xrandr support'
            'compton: X11 compositing support')
makedepends=('git'
             'pkgconfig' 
             'libxrandr' 
             'rofi' 
             'dzen2-xft-xpm-xinerama-git'
	         )
provides=('libtu' 'libextl' 'notion')
conflicts=('notion')

source=("notion::git://github.com/neg-serg/notion") 
md5sums=('SKIP')
prepare() {
  true
}

build() {
  cd ${srcdir}/notion
  make ETCDIR=/etc/notion/
}

package() {
  cd ${srcdir}/notion
  make DESTDIR=${pkgdir} ETCDIR=/etc/notion/ install

  install -Dm0644 LICENSE ${pkgdir}/usr/share/licenses/notion/LICENSE

  mkdir -p ${pkgdir}/usr/share/xsessions
  cat >${pkgdir}/usr/share/xsessions/notion.desktop <<EOF
[Desktop Entry]
Name=Notion
Comment=This session logs you into Notion
Exec=/usr/bin/notion
TryExec=/usr/bin/notion
Icon=
Type=XSession
EOF
}

install(){
  read -p "Do you want to install appropriate config in ${HOME}/.notion and move .notion to .notion_bck now (y/n)?" choice
  case "${choice}" in 
    y*|Y* ) 
        if [[ -d ${HOME}/.notion ]]; then
            rm -vr ${HOME}/.notion_bck
            mv -v ${HOME}/.notion{,_bck}
        fi
        mkdir -vp ${pkgdir}/${HOME}/.notion
        for i in ${srcdir}/notion/example_cfg/*; do
            cp -rvi ${i} "${pkgdir}/${HOME}/.notion"
        done
        chown ${USER} -R "${pkgdir}/${HOME}/.notion"
    ;;
    n|N ) echo "OK, you can find it on the github";;
    * ) echo "OK, you can find it on the github";;
  esac

}

Offline

#2 2016-07-30 13:44:45

ooo
Member
Registered: 2013-04-10
Posts: 1,637

Re: PKGBUILD review request: notion fork

Is there a reason for the prepare() function? It seems totally unnecessary.

I'd provide the notion.desktop as a separate file for cosmetic reasons, but your method works just as well.

regarding the install() section: my understanding is that makepkg should always be non-interactive.
Also it's not good practice to touch /home in any way, and that would probably fail in some cases, if $HOME is not set, e.g. building in fake chroot.

Offline

#3 2016-07-30 13:52:42

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: PKGBUILD review request: notion fork

I'm going to hit the high points.

-git packages need a pkgver() function.
Your pkgdesc is way too long. The second sentence is totally unnecessary.
pkgconfig is in the base-devel group and shouldn't be in the makedepends.
Empty prepare function should be deleted.
You should quote all paths that contain variables that you don't control, such as $pkgdir and $srcdir. They may contain spaces.
The install function will never be run. Install scriptlets are run from a separate file.
You should never touch the home dir anyway. Ideally, the program should do that on first run.

Offline

#4 2016-07-30 15:03:15

Neg
Member
Registered: 2012-07-24
Posts: 17

Re: PKGBUILD review request: notion fork

Ok, I am completely agree that touching home dir is a bad idea.
May be it is better to add autoconfig by notion itself.

But then I don't understand how to make a message to user about this changed behaviour.

echo command in post_install and another post_* hooks do nothing.

Offline

#5 2016-07-30 15:56:42

Awebb
Member
Registered: 2010-05-06
Posts: 6,275

Re: PKGBUILD review request: notion fork

I think any interactivity in a PKGBUILD is not okay either.

Post your .install file.

Offline

#6 2016-07-31 07:49:58

Neg
Member
Registered: 2012-07-24
Posts: 17

Re: PKGBUILD review request: notion fork

# Maintainer: Sergey Miroshnichenko <serg.zorg@gmail.com>

pkgname=notion-neg-git
pkgver=3612
pkgrel=1
pkgdesc="NotionWM fork with compton, dzen2, rofi, xft fonts support different default cfg"
url="https://github.com/neg-serg/notion"
arch=('i686' 'x86_64')
license=('custom:LGPL')
depends=('glib2' 'gettext' 'lua' 'libxext' 'libsm')
optdepends=('libxrandr: xrandr support'
            'compton: X11 compositing support')
makedepends=('git'
             'libxrandr' 
             'rofi' 
             'dzen2-xft-xpm-xinerama-git'
	         )
provides=('libtu' 'libextl' 'notion')
conflicts=('notion')

source=("notion::git://github.com/neg-serg/notion") 
md5sums=('SKIP')

pkgver() {
    cd "${srcdir}/notion" || exit 1
    git rev-list --count HEAD
}

build() {
    cd "${srcdir}/notion" || exit 1
    make
}

package() {
    cd "${srcdir}/notion" || exit 1
    make DESTDIR="${pkgdir}" install

    install -Dm0644 LICENSE "${pkgdir}/usr/share/licenses/notion/LICENSE"
    mkdir -p "${pkgdir}/usr/share/xsessions"
    cat > "${pkgdir}/usr/share/xsessions/notion.desktop" <<EOF
[Desktop Entry]
Name=Notion
Comment=This session logs you into Notion
Exec=/usr/sbin/notion
TryExec=/usr/sbin/notion
Icon=
Type=XSession
EOF
    for i in "${srcdir}/notion/example_cfg/"*; do
        cp -rv "${i}" "${pkgdir}/usr/etc/notion"
    done
}

I've fixed some issues here, how to post it into aur now?

I've added this bunch of config into ~/.ssh/config:

Host aur.archlinux.org
  IdentityFile ~/.ssh/aur
  User aur

But when I am doing this

git clone git+ssh://aur@aur.archlinux.org/notion-neg.git
Cloning into 'notion-neg'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What I need to do? Maybe one of aur contributors can help me to post this?

Last edited by Neg (2016-07-31 07:50:51)

Offline

#7 2016-07-31 14:28:53

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review request: notion fork

No need for the "|| exit 1" statements, makepkg already knows how to report a failure when part of the build process returns an error.

Also, as stated above, for purely cosmetic reasons I would recommend providing the desktop file as a separate file rather than a heredoc.

And on that note, the makedepends line doesn't really need to be split out to one makedepends per line -- contrary to your own pattern by depends and  provides. wink
And the desktop entry does not need to specify the full path to executables in your $PATH (and /usr/sbin is a symlink to /usr/bin not that that is the type of executable that belongs in sbin anyway...)

...

Did you upload the right ~/.ssh/aur.pub to your aur.archlinux.org profile?

Last edited by eschwartz (2016-07-31 14:35:20)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB