Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUR packaging #19837

Merged
merged 5 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions util/packaging/aur/chapel-git/.SRCINFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pkgbase = chapel-git
pkgdesc = Programming language designed for productive parallel computing at scale
pkgver = 1.27.0.7648.gbcc4ac3109
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what the stuff after the 1.27.0 here means? I copied it from something else but I have no idea what it's purpose is. I guess I'm just checking that you know more than I do about it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure exactly what you mean by "copied" it from something else?
The output of the pkgver() function automatically overwrites the pkgver line in PKGBUILD (I think the makepkg command probably feeds it to sed or something behind the scenes?).
As for what it means, I'm unsure on the central 4-digit part, but the very last part is g<beginning of most recent commit hash.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I made a hacky chapel-git for my own testing I just copied the version number from the other AUR project I was basing it on. Anyway since it will be overwritten in the PKGBUILD file by running pkgver(), it might be nice to have a comment to that effect next to the pkgver= line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. Just added that comment.

pkgrel = 1
url = https://chapel-lang.org/
arch = x86_64
arch = arm
license = Apache
makedepends = git
makedepends = cmake
depends = python
depends = perl
depends = llvm
depends = clang
source = git+https://github.com/chapel-lang/chapel.git
sha256sums = SKIP

pkgname = chapel-git
53 changes: 53 additions & 0 deletions util/packaging/aur/chapel-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

# Maintainer: Gabriel Brown <[email protected]>

_gituser="chapel-lang"
_gitname="chapel"

pkgname=${_gitname}-git
pkgver=1.27.0.7648.gbcc4ac3109
pkgrel=1
pkgdesc="Programming language designed for productive parallel computing at scale"
url="https://chapel-lang.org/"
arch=('x86_64' 'arm')
license=('Apache')
depends=('python' 'perl' 'llvm' 'clang')
makedepends=('git' 'cmake')
source=("git+https://github.com/${_gituser}/${_gitname}.git")
sha256sums=('SKIP') # source is not static

pkgver() {
cd "${srcdir}/${_gitname}"
# get correct numerical version from internal file
ver_file="compiler/main/version_num.h"
major_ver=$(grep MAJOR_VERSION ${ver_file} | cut -d ' ' -f 3)
minor_ver=$(grep MINOR_VERSION ${ver_file} | cut -d ' ' -f 3)
update_ver=$(grep UPDATE_VERSION ${ver_file} | cut -d ' ' -f 3)
ver_num="${major_ver}.${minor_ver}.${update_ver}"
# keep second (correct) half of git describe result
gitdescribe=$(git describe --long --tags --always)
tail=$(echo ${gitdescribe} | cut -d '-' -f 2,3) # no version number
# combine two pieces
ver_hyphen="${ver_num}-${tail}"
ver=$(echo ${ver_hyphen} | sed 's/\-/\./g')
echo ${ver}
# use below when git describe begins with correct version number
#git describe --long --tags --always | sed 's/\-/\./g'
}

build() {
cd "${srcdir}/${_gitname}"
./configure --prefix=/usr
make
}

check() {
cd "${srcdir}/${_gitname}"
export PATH="${srcdir}/${_gitname}/bin/linux64-x86_64:${PATH}"
make check
}

package() {
cd "${_gitname}"
make DESTDIR="${pkgdir}" install
}
20 changes: 20 additions & 0 deletions util/packaging/aur/chapel/.SRCINFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pkgbase = chapel
pkgdesc = Programming language designed for productive parallel computing at scale
pkgver = 1.26.0
pkgrel = 1
url = https://chapel-lang.org/
arch = x86_64
arch = arm
license = Apache
makedepends = git
makedepends = cmake
makedepends = libtool
depends = python
depends = perl
depends = llvm
depends = clang
depends = gmp
source = https://github.com/chapel-lang/chapel/releases/download/1.26.0/chapel-1.26.0.tar.gz
sha256sums = ba396b581f0a17f8da3f365a3f8b079b8d2e229a393fbd1756966b0019931ece

pkgname = chapel
35 changes: 35 additions & 0 deletions util/packaging/aur/chapel/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# Maintainer: J. Emiliano Deustua <[email protected]>
# Co-maintainer: Gabriel Brown <[email protected]>

pkgname=chapel
pkgver=1.26.0
pkgrel=1
pkgdesc="Programming language designed for productive parallel computing at scale"
url="https://chapel-lang.org/"
arch=('x86_64' 'arm')
license=('Apache')
depends=('python' 'perl' 'llvm' 'clang' 'gmp')
makedepends=('git' 'cmake' 'libtool')
source=("https://github.com/chapel-lang/chapel/releases/download/${pkgver}/chapel-${pkgver}.tar.gz")
sha256sums=('ba396b581f0a17f8da3f365a3f8b079b8d2e229a393fbd1756966b0019931ece')


build() {
cd "$srcdir/${pkgname}-${pkgver}"
export CHPL_LIB_PIC=pic # remove on next release a la
# https://github.com/chapel-lang/chapel/pull/19785
./configure --prefix=/usr
make
}

check() {
cd "$srcdir/${pkgname}-${pkgver}"
export PATH="$srcdir/${pkgname}-${pkgver}/bin/linux64-x86_64:$PATH"
make check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this checks that chpl runs before it is installed, right? I think the problem we are seeing is that something about the install process is not working right, so that's why this can pass even though the package is not working. Is there a post-install check available in some way (maybe just for people editing the AUR package and not necessarily something that runs when somebody installs the AUR package)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's my understanding as well, and I think that could be the case.

It is possible for me to include a post install script, but I'm not sure how integrated it is in the build and install process, since the package will already be installed. The one example I have hear is people using this script to bring up end user license agreement and so on, but I'm sure we can get it do more. What exactly were you thinking would go in here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just thinking it would be nice to have some scripting so that the maintainer of the Chapel AUR package can easily check that the installation is working. I.e. it could just be a script that you know how to run after installing. If we have that, we can (eventually) get some nightly testing config to check it as well.

I don't know whether or not it would be reasonable to do this with an AUR post install script but I suspect you wouldn't want people just installing the package to always run it. (So then not a post-install).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree post-install is probably not the right tool here, but something like you describe would be nice.

I think the typical approach for AUR packages is to do verification with make check before install, but that didn't work for us. I'm sure there are issues with this approach, but the way I was going to verify that the installation is working is just by building and running it myself (then addressing user issues as they appear in comments on AUR). This is less of a problem for chapel since it's frozen until the next release, but perhaps would be problematic for chapel-git which changes (and possibly breaks) with every PR.

}

package() {
cd "$srcdir/${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
}
19 changes: 19 additions & 0 deletions util/packaging/aur/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

This folder contains manual copies of Arch User Repository (AUR) packaging (one AUR package per directory).
The official remote sources for each of these are `https://aur.archlinux.org/packages/<AUR package name>`.
To clone the remote git repo hosted by AUR and containing the packaging and build files `git clone https://aur.archlinux.org/<AUR package name>.git`

To test these builds:
- install the `base-devel` package using (`sudo pacman -S base-devel`) since dependence on packages included in `base-devel` is not checked; this need only be done once
- change directories to AUR package you would like to build (e.g. `cd chapel-git`).
- build ready-to-install package from source using `makepkg --syncdeps`, which also installs any required dependencies
- install the local package with `makepkg --install`, you will be prompted for the root password

To bump to the next version number:
- ensure you have maintainer priveleges to the AUR git repo and clone it (address given above)
- (in `PKGBUILD`) update the version number and checksum (and dependencies if needed)
- generate the `.SRCINFO` from `PKGBUILD` using `makepkg --printsrcinfo > .SRCINFO`
- `add`, `commit`, and `push` your changes

For more detailed info about the purpose of the variables and functions in `PKGBUILD` see the articles on [`PKGBUILD`](https://wiki.archlinux.org/title/PKGBUILD) and [`makepkg`](https://wiki.archlinux.org/title/Makepkg) from the Arch Wiki.
[This article](https://wiki.archlinux.org/title/Creating_packages) contains a more general overview of packaging for Arch.