You are not logged in.

#1 2021-03-24 18:40:49

fideli
Member
From: Edmonton
Registered: 2004-06-20
Posts: 48

[SOLVED] PKGBUILD Review - onedriver

Hello all,

I've written a basic PKGBUILD for onedriver and I'm looking for some feedback. I've successfully installed it on my system. However, the main thing I'm unsure of is whether or not I've captured the all the makedepends. The repo states the following:

In addition to the traditional Go tooling, you will need a C compiler and development headers for webkit2gtk-4.0. On Fedora, these can be obtained with dnf install golang gcc pkg-config webkit2gtk3-devel. On Ubuntu, these dependencies can be installed with apt install golang gcc pkg-config libwebkit2gtk-4.0-dev.

Here's the PKGBUILD draft:

_pkgname=onedriver
pkgname=$_pkgname

pkgver=0.9.2
pkgrel=1
pkgdesc="onedriver is a native Linux filesystem for Microsoft OneDrive"
arch=('x86_64')
provides=('onedriver=$pkgver')
url='https://github.com/jstaf/onedriver'
license=('GPL3')
#depends=('')
makedepends=('go' 'webkit2gtk')
source=("https://github.com/jstaf/onedriver/archive/refs/tags/v$pkgver.tar.gz")
sha512sums=('5d64ab34d81c978408c7847f4b427d35694579024cc09a98336eef4b1b4880206be68ae78320d4ba674c0e1e4d16de1c2f063370a64df4748716e1ed9b457815')

build() {
  cd "$_pkgname-$pkgver"
  make
}

package() {
  cd "$_pkgname-$pkgver"
  install -d ~/pkgbuild/usr/share/icons/onedriver

  install -Dm 755 $_pkgname "$pkgdir"/usr/bin/$_pkgname
  install -Dm 755 resources/$_pkgname-launcher.sh "$pkgdir"/usr/bin/$_pkgname-launcher.sh

  install -Dm 644 "resources/onedriver@.service" "$pkgdir"/usr/lib/systemd/user/onedriver@.service
  install -Dm 644 resources/$_pkgname.desktop "$pkgdir"/usr/share/applications/$_pkgname.desktop
  install -Dm 644 resources/$_pkgname.png "$pkgdir"/usr/share/icons/onedriver/$_pkgname.png
  install -Dm 644 resources/$_pkgname.svg "$pkgdir"/usr/share/icons/onedriver/$_pkgname.svg
}

Thanks.

Last edited by fideli (2021-03-25 18:57:31)


-\ fideli /-

Offline

#2 2021-03-24 19:16:37

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 5,809
Website

Re: [SOLVED] PKGBUILD Review - onedriver

fideli wrote:

the main thing I'm unsure of is whether or not I've captured the all the makedepends

Build in a clean chroot to make sure they're all listed: https://wiki.archlinux.org/index.php/De … nience_way

If you're tight on disk space then you can upload the source tarball and PKGBUILD to the openSUSE Build Service instead, that spins up a fresh VM to build the packages.

fideli wrote:
_pkgname=onedriver
pkgname=$_pkgname

Why?

Offline

#3 2021-03-24 19:27:16

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 9,019

Re: [SOLVED] PKGBUILD Review - onedriver

You may find [1] helpful .

gcc, pkgconf [2] and  a lot of other useful stuff is in base-devel group[3] .
base-devel is required for building aur packages[4] .

provides=('onedriver=$pkgver')

packages always provide themselves, is there a reason why you want to provide a certain version ?

[1] https://wiki.archlinux.org/index.php/Go … guidelines
[2] we replaced pkg-config with pkgconf sometime ago
[3] https://archlinux.org/groups/x86_64/base-devel/
[4] https://wiki.archlinux.org/index.php/Ar … requisites


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
Did you use the guided installer ? If yes, I can't help you.

(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2021-03-24 19:33:37

loqs
Member
Registered: 2014-03-06
Posts: 13,177

Re: [SOLVED] PKGBUILD Review - onedriver

It does build in a clean chroot but you can see the failing calls to git.  You could switch to building from git or substitute the commit of the release for $(shell git rev-parse HEAD)

Starting build()...
make: git: No such file or directory
make: git: No such file or directory
go build -ldflags="-X main.commit=" ./cmd/onedriver
go: downloading github.com/hanwen/go-fuse v1.0.0
go: downloading github.com/spf13/pflag v1.0.3
go: downloading github.com/sirupsen/logrus v1.5.0
go: downloading github.com/rclone/rclone v1.50.0
go: downloading go.etcd.io/bbolt v1.3.4
go: downloading golang.org/x/sys v0.0.0-20200321134203-328b4cd54aae
go: downloading github.com/hanwen/go-fuse/v2 v2.0.3-0.20200103165319-0e3c45fc4899
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> WARNING: Package contains reference to $srcdir
usr/bin/onedriver
==> Creating package "onedriver"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: onedriver 0.9.2-1 (Wed 24 Mar 2021 07:25:18 PM GMT)
==> Installing package onedriver with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) onedriver-0.9.2-1

Total Installed Size:  5.81 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                                                                     [####################################################################] 100%
(1/1) checking package integrity                                                                                   [####################################################################] 100%
(1/1) loading package files                                                                                        [####################################################################] 100%
(1/1) checking for file conflicts                                                                                  [####################################################################] 100%
:: Processing package changes...
(1/1) installing onedriver                                                                                         [####################################################################] 100%
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating icon theme caches...
(3/3) Updating the desktop file MIME type cache...
resolving dependencies...
looking for conflicting packages...

Packages (4) licenses-20200427-1  pyalpm-0.9.2-1  python-pyelftools-0.27-1  namcap-3.2.10-2

Total Installed Size:  2.36 MiB

:: Proceed with installation? [Y/n] 
(4/4) checking keys in keyring                                                                                     [####################################################################] 100%
(4/4) checking package integrity                                                                                   [####################################################################] 100%
(4/4) loading package files                                                                                        [####################################################################] 100%
(4/4) checking for file conflicts                                                                                  [####################################################################] 100%
:: Processing package changes...
(1/4) installing pyalpm                                                                                            [####################################################################] 100%
(2/4) installing licenses                                                                                          [####################################################################] 100%
(3/4) installing python-pyelftools                                                                                 [####################################################################] 100%
(4/4) installing namcap                                                                                            [####################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
Checking PKGBUILD
PKGBUILD (onedriver) W: Missing Maintainer tag
PKGBUILD (onedriver) W: Non-unique source name (v0.9.2.tar.gz). Use a unique filename.
PKGBUILD (onedriver) W: Description should not contain the package name.
Checking onedriver-0.9.2-1-x86_64.pkg.tar.zst
onedriver W: ELF file ('usr/bin/onedriver') lacks FULL RELRO, check LDFLAGS.
onedriver W: ELF file ('usr/bin/onedriver') lacks PIE.
onedriver W: Unused shared library '/usr/lib/libgdk-3.so.0' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libz.so.1' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libpangocairo-1.0.so.0' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libpango-1.0.so.0' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libharfbuzz.so.0' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libatk-1.0.so.0' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libcairo-gobject.so.2' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libcairo.so.2' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libgdk_pixbuf-2.0.so.0' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libsoup-2.4.so.1' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libgio-2.0.so.0' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libjavascriptcoregtk-4.0.so.18' by file ('usr/bin/onedriver')
onedriver W: Unused shared library '/usr/lib/libglib-2.0.so.0' by file ('usr/bin/onedriver')
onedriver W: Description should not contain the package name.
onedriver E: Dependency webkit2gtk detected and not included (libraries ['usr/lib/libwebkit2gtk-4.0.so.37', 'usr/lib/libjavascriptcoregtk-4.0.so.18'] needed in files ['usr/bin/onedriver'])
==> Running checkpkg
error: target not found: onedriver
==> WARNING: Skipped checkpkg due to missing repo packages

Have you looked at the go package guidelines?
Edit:
Without specifying the commit a trailing space is added to the version which is not noticeable.
Edit2:

pkgdesc="onedriver is a native Linux filesystem for Microsoft OneDrive"

$pkgname in $pkgdesc.

#depends=('')
makedepends=('go' 'webkit2gtk')

webkit2gtk should be moved to depends as the binary links to libjavascriptcoregtk-4.0.so.18.

source=("https://github.com/jstaf/onedriver/archive/refs/tags/v$pkgver.tar.gz")

None unique source name.

Last edited by loqs (2021-03-24 20:48:16)

Offline

#5 2021-03-25 04:20:18

fideli
Member
From: Edmonton
Registered: 2004-06-20
Posts: 48

Re: [SOLVED] PKGBUILD Review - onedriver

Thanks everyone for the prompt responses and helpful comments.

Head_on_a_Stick wrote:
fideli wrote:
_pkgname=onedriver
pkgname=$_pkgname

Why?

The _pkgname has been removed.

Lone_Wolf wrote:

You may find [1] helpful .

Thank you for this. I have modified the build() to include the export line items and the go build flags. I no longer use the Makefile at all.

Lone_Wolf wrote:
fideli wrote:
provides=('onedriver=$pkgver')

packages always provide themselves, is there a reason why you want to provide a certain version ?

This was a mistake. I was using the onedrive-abraunegg example. While it makes sense in that example since it's a fork of the onedrive package, in this case it is not required. This line item is now removed.

loqs wrote:

It does build in a clean chroot but you can see the failing calls to git.  You could switch to building from git or substitute the commit of the release for $(shell git rev-parse HEAD)

I'd like to build release versions. It turns out in the source code downloads for tagged releases, there is no .git dir or HEAD. So I've instead hardcoded the commit into the go build line. Strictly speaking, this is probably not necessary to include at all.

loqs wrote:

Without specifying the commit a trailing space is added to the version which is not noticeable.

Should be fixed now by hardcoding the commit.

loqs wrote:
pkgdesc="onedriver is a native Linux filesystem for Microsoft OneDrive"

$pkgname in $pkgdesc.

Fixed.

loqs wrote:
#depends=('')
makedepends=('go' 'webkit2gtk')

webkit2gtk should be moved to depends as the binary links to libjavascriptcoregtk-4.0.so.18.

Fixed.

loqs wrote:
source=("https://github.com/jstaf/onedriver/archive/refs/tags/v$pkgver.tar.gz")

None unique source name.

I've changed it to source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz") now.

Updated PKGBUILD:

pkgname=onedriver
pkgver=0.9.2
pkgrel=1
pkgdesc="Native Linux filesystem for Microsoft OneDrive"
arch=('x86_64')
url='https://github.com/jstaf/onedriver'
license=('GPL3')
depends=('webkit2gtk')
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha512sums=('5d64ab34d81c978408c7847f4b427d35694579024cc09a98336eef4b1b4880206be68ae78320d4ba674c0e1e4d16de1c2f063370a64df4748716e1ed9b457815')

build() {
  cd "$pkgname-$pkgver"

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"

  go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-X main.commit=f560cbe48072bd8f88a44de038c1928e30608d14 -linkmode external -extldflags \"${LDFLAGS}\"" \
    ./cmd/onedriver
}

package() {
  cd "$pkgname-$pkgver"
  install -d ~/pkgbuild/usr/share/icons/onedriver

  install -Dm 755 $pkgname "$pkgdir"/usr/bin/$pkgname
  install -Dm 755 resources/$pkgname-launcher.sh "$pkgdir"/usr/bin/$pkgname-launcher.sh

  install -Dm 644 "resources/onedriver@.service" "$pkgdir"/usr/lib/systemd/user/onedriver@.service
  install -Dm 644 resources/$pkgname.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop
  install -Dm 644 resources/$pkgname.png "$pkgdir"/usr/share/icons/onedriver/$pkgname.png
  install -Dm 644 resources/$pkgname.svg "$pkgdir"/usr/share/icons/onedriver/$pkgname.svg
}

-\ fideli /-

Offline

#6 2021-03-25 10:56:01

loqs
Member
Registered: 2014-03-06
Posts: 13,177

Re: [SOLVED] PKGBUILD Review - onedriver

  install -d ~/pkgbuild/usr/share/icons/onedriver

I would change that to:

  install -d "$pkgdir"/usr/share/icons/onedriver

Or you could drop the line as

  install -Dm 644 resources/$pkgname.png "$pkgdir"/usr/share/icons/onedriver/$pkgname.png
  install -Dm 644 resources/$pkgname.svg "$pkgdir"/usr/share/icons/onedriver/$pkgname.svg

Will create the path.

Everything else looks good.

Offline

#7 2021-03-25 12:34:23

fideli
Member
From: Edmonton
Registered: 2004-06-20
Posts: 48

Re: [SOLVED] PKGBUILD Review - onedriver

loqs wrote:
  install -d ~/pkgbuild/usr/share/icons/onedriver

I would change that to:

  install -d "$pkgdir"/usr/share/icons/onedriver

Or you could drop the line as

  install -Dm 644 resources/$pkgname.png "$pkgdir"/usr/share/icons/onedriver/$pkgname.png
  install -Dm 644 resources/$pkgname.svg "$pkgdir"/usr/share/icons/onedriver/$pkgname.svg

Will create the path.

Great catch. That first install line was a gremlin from initial testing. I've removed it now.

Thanks for all the input! I'll submit this to the AUR today.


-\ fideli /-

Offline

#8 2021-03-25 18:58:06

fideli
Member
From: Edmonton
Registered: 2004-06-20
Posts: 48

Re: [SOLVED] PKGBUILD Review - onedriver

AUR Link: onedriver


-\ fideli /-

Offline

Board footer

Powered by FluxBB