You are not logged in.

#1 2016-02-02 16:31:25

fusion809
Member
Registered: 2015-06-19
Posts: 70

What is wrong with my modified atom-editor-git PKGBUILD?

Hi,

I have modified the atom-editor-git PKGBUILD in the AUR (here is the link to the original in the AUR), to get it to build the latest stable release of Atom (found on the stable branch of the Atom git repository, my pkgver() function is based on conversation here at Unix & Linux StackExchange), with a modified set of preinstalled Atom packages (which I have chosen to make the editor ideal for developers). Here is my present PKGBUILD:

# Maintainer: Brenton Horne <brentonhorne77 at gmail dot com>
# Contributor: Andya <ap_9@outlook.com>
# Contributor: oozyslug <oozyslug@gmail.com>
# Contributor: Timofey Titovets <nefelim4ag@gmail.com>
# Submitter: John Reese <john@noswap.com>
# Upstream URL: https://github.com/atom/atom

# Please do mind that pkgbuild will automagically update
# to latest tagged release (you could have problems if you use an aur helper),
# there's no need to manually change pkgver.
# Please don't flag out-of-date!
pkgname=atom-editor-git
_pkgname=atom
pkgver=1.4.2
pkgrel=1
pkgdesc="Chrome-based text editor from Github"
arch=('i686' 'x86_64')
url="https://github.com/atom/atom"
license=('MIT')
provides=('atom-editor')
conflicts=('atom-editor' 'atom-editor-bin')
depends=('gconf' 'nodejs' 'libgnome-keyring' 'python2')
makedepends=('git' 'npm')
source=("${_pkgname}::git+git://github.com/atom/atom")
md5sums=('SKIP')

pkgver() {
  cd atom
  git describe --tags stable | cut -d- -f1 | sed 's/v//g'
}

prepare() {
  cd "$srcdir/${_pkgname}"
  git checkout v${pkgver}

  sed -i -e "/exception-reporting/d" \
      -e "/metrics/d" package.json

  # Adding some Atom packages
  sed -e 's/"command-palette": /"build": "0.54.1",\n    "command-palette": /' \
      -e 's|"go-to-line": |"git-plus": "5.12.1",\n    "go-to-line": |' \
      -e 's|"settings-view": |"pigments": "0.22.1",\n    "settings-view": |' \
      -e 's|"settings-view": |"script": "3.3.0",\n    "settings-view": |' \
      -e 's|"timecop": |"terminal-plus: "0.14.5",\n    "timecop": |' \
      -e 's|"language-make": |"language-liquid": "0.4.0",\n    "language-make": |' \
      -e 's|"language-make": |"language-lua": "0.9.4",\n    "language-make": |' \
      -e 's|"language-xml": |"language-vala": "0.2.0",\n    "language-xml": |' package.json

  sed -e "s/<%= description %>/$pkgdesc/" \
      -e "s|<%= executable %>|/usr/bin/atom|"\
      -e "s|<%= iconName %>|atom|"\
      -e "s|GNOME;||"\
      -e "s|text/plain;|application/javascript;application/json;application/postscript;application/x-csh;application/x-desktop;application/x-httpd-eruby;application/x-httpd-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/x-latex;application/x-msdos-program;application/x-ruby;application/x-sh;application/x-shellscript;application/x-sql;application/x-tcl;application/x-tex;application/xhtml+xml;application/xml;application/xml-dtd;application/xslt+xml;text/css;text/csv;text/html;text/plain;text/xml;text/xml-dtd;text/x-asm;text/x-bibtex;text/x-boo;text/x-c++;text/x-c++hdr;text/x-c++src;text/x-c;text/x-chdr;text/x-csh;text/x-csrc;text/x-dsrc;text/x-diff;text/x-eiffel;text/x-fortran;text/x-go;text/x-haskell;text/x-java;text/x-java-source;text/x-lua;text/x-makefile;text/x-markdown;text/x-objc;text/x-pascal;text/x-perl;text/x-php;text/x-python;text/x-ruby;text/x-scala;text/x-scheme;text/x-sh;text/x-tcl;text/x-tex;text/x-vala;text/yaml;|"\
      resources/linux/atom.desktop.in > resources/linux/Atom.desktop
}

build() {
  cd "$srcdir/atom"

  export PYTHON=python2
  until ./script/build --build-dir "$srcdir/atom-build"; do :; done
}

package() {
  cd "$srcdir/atom"

  script/grunt install --build-dir "$srcdir/atom-build" --install-dir "$pkgdir/usr"

  install -Dm644 resources/linux/Atom.desktop "$pkgdir/usr/share/applications/atom.desktop"
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"
}

whenever I run

makepkg -s

I get this error:

==> Making package: atom-editor-git 1.4.2-1 (Wed Feb  3 02:29:13 AEST 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating atom git repo...
Fetching origin
==> Validating source files with md5sums...
    atom ... Skipped
==> Extracting sources...
  -> Creating working copy of atom git repo...
Reset branch 'makepkg'
==> Starting pkgver()...
fatal: Not a valid object name stable
==> ERROR: pkgver is not allowed to be empty.
==> ERROR: pkgver() generated an invalid version: 

I haven't the foggiest what the problem is as running

git describe --tags stable | cut -d- -f1 | sed 's/v//g'

from the atom subdirectory of the folder containing this PKGBUILD returns the desired result, 1.4.2.

Thanks for your time,
Brenton

Last edited by fusion809 (2016-02-02 16:32:17)

Offline

#2 2016-02-02 17:15:44

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

Re: What is wrong with my modified atom-editor-git PKGBUILD?

The pkgname is a lie.
This isn't a git package, and you should just download the tagged release tarball.

...

But if you are really determined to do it this way (rather than using atom-editor together with customizepkg or a git clone of the AUR package with rebasing), then you should try actually running that command from inside the "${srcdir}/${_pkgname}" directory.

It might make the "fatal: Not a valid object name stable" error more noticeable.

You will notice that there is no stable branch. This is because neither git nor makepkg checkout local branches for every remote branch.
You can try describing origin/stable, or better yet, append "#branch=stable" to the source url.



Is it necessarily the best idea to tie the version of an Atom package to the version of Atom?
Is there some way of installing global packages, which you could use make an Arch package which depends on atom-editor?

Last edited by eschwartz (2016-02-02 17:17:27)


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

Offline

#3 2016-02-02 17:26:55

fusion809
Member
Registered: 2015-06-19
Posts: 70

Re: What is wrong with my modified atom-editor-git PKGBUILD?

@eschwartz thanks, the PKGBUILD works when modified to:

# Maintainer: Brenton Horne <brentonhorne77 at gmail dot com>
# Contributor: Andya <ap_9@outlook.com>
# Contributor: oozyslug <oozyslug@gmail.com>
# Contributor: Timofey Titovets <nefelim4ag@gmail.com>
# Submitter: John Reese <john@noswap.com>
# Upstream URL: https://github.com/atom/atom

# Please do mind that pkgbuild will automagically update
# to latest tagged release (you could have problems if you use an aur helper),
# there's no need to manually change pkgver.
# Please don't flag out-of-date!
pkgname=atom-editor-git
_pkgname=atom
pkgver=1.4.2
pkgrel=1
pkgdesc="Chrome-based text editor from Github"
arch=('i686' 'x86_64')
url="https://github.com/atom/atom"
license=('MIT')
provides=('atom-editor')
conflicts=('atom-editor' 'atom-editor-bin')
depends=('gconf' 'nodejs' 'libgnome-keyring' 'python2')
makedepends=('git' 'npm')
source=("${_pkgname}::git+git://github.com/atom/atom#branch=stable")
md5sums=('SKIP')

pkgver() {
  cd ${srcdir}/${_pkgname}
  git describe --tags | cut -d- -f1 | sed 's/v//g'
}

prepare() {
  cd "$srcdir/${_pkgname}"
  git checkout v${pkgver}

  sed -i -e "/exception-reporting/d" \
      -e "/metrics/d" package.json

  # Adding some Atom packages
  sed -e 's/"command-palette": /"build": "0.54.1",\n    "command-palette": /' \
      -e 's|"go-to-line": |"git-plus": "5.12.1",\n    "go-to-line": |' \
      -e 's|"settings-view": |"pigments": "0.22.1",\n    "settings-view": |' \
      -e 's|"settings-view": |"script": "3.3.0",\n    "settings-view": |' \
      -e 's|"timecop": |"terminal-plus: "0.14.5",\n    "timecop": |' \
      -e 's|"language-make": |"language-liquid": "0.4.0",\n    "language-make": |' \
      -e 's|"language-make": |"language-lua": "0.9.4",\n    "language-make": |' \
      -e 's|"language-xml": |"language-vala": "0.2.0",\n    "language-xml": |' package.json

  sed -e "s/<%= description %>/$pkgdesc/" \
      -e "s|<%= executable %>|/usr/bin/atom|"\
      -e "s|<%= iconName %>|atom|"\
      -e "s|GNOME;||"\
      -e "s|text/plain;|application/javascript;application/json;application/postscript;application/x-csh;application/x-desktop;application/x-httpd-eruby;application/x-httpd-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/x-latex;application/x-msdos-program;application/x-ruby;application/x-sh;application/x-shellscript;application/x-sql;application/x-tcl;application/x-tex;application/xhtml+xml;application/xml;application/xml-dtd;application/xslt+xml;text/css;text/csv;text/html;text/plain;text/xml;text/xml-dtd;text/x-asm;text/x-bibtex;text/x-boo;text/x-c++;text/x-c++hdr;text/x-c++src;text/x-c;text/x-chdr;text/x-csh;text/x-csrc;text/x-dsrc;text/x-diff;text/x-eiffel;text/x-fortran;text/x-go;text/x-haskell;text/x-java;text/x-java-source;text/x-lua;text/x-makefile;text/x-markdown;text/x-objc;text/x-pascal;text/x-perl;text/x-php;text/x-python;text/x-ruby;text/x-scala;text/x-scheme;text/x-sh;text/x-tcl;text/x-tex;text/x-vala;text/yaml;|"\
      resources/linux/atom.desktop.in > resources/linux/Atom.desktop
}

build() {
  cd "$srcdir/atom"

  export PYTHON=python2
  until ./script/build --build-dir "$srcdir/atom-build"; do :; done
}

package() {
  cd "$srcdir/atom"

  script/grunt install --build-dir "$srcdir/atom-build" --install-dir "$pkgdir/usr"

  install -Dm644 resources/linux/Atom.desktop "$pkgdir/usr/share/applications/atom.desktop"
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"
}

the reason why I am writing this package, even though I know it does not fit the strict definition of a -git PKGBUILD, is because it means this PKGBUILD will never have to be manually bumped by myself, whereas getting the source code tarballs requires that I regularly bump the pkgver in the PKGBUILD myself. The extra packages are something I may drop later, as I realize they remove the value of an automatically updating PKGBUILD like this one, as these package versions have to be manually updated myself with each new release.

If there's a way to automatically update the version of each of these atom packages with each new release of Atom that you (or anyone else) is aware of, I am interested in hearing it.

Last edited by fusion809 (2016-02-02 17:29:19)

Offline

#4 2016-02-02 17:35:57

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

Re: What is wrong with my modified atom-editor-git PKGBUILD?

I would just use the existing atom-editor package in the AUR.

There are one or two packages that I modify before building, I keep them cloned in /var/aur/$pkgname and commit my personal changes. Then to update I do "git pull --rebase && makepkg"


One of the advantages is NOT having to download 300 MB worth of upstream history just to build a stable release.


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

Offline

Board footer

Powered by FluxBB