How to create an AUR from a package in Ubuntu?

Cheese has a bug that it does not support CSD headerbar in anywhere except GNOME.
This has been previously reported at Manjaro Forum

Ubuntu has patched Cheese to enable CSD headerbars. I want to create an AUR from Ubuntu’s Cheese package.

Can anyone guide me towards building an AUR package from Ubuntu’s Cheese package? I would like to copy the binary of Cheese from Ubuntu, and turn it into an AUR, instead of the AUR building Cheese from source.

There is no better place and explanations than this to create AUR packages
https://wiki.archlinux.org/index.php/Arch_User_Repository
For the PKGBUILD itself you will have to follow this PKGBUILD - ArchWiki
Include the patch and test it.

You could also use the existing PKGBUILD and just add the patch …

You can use the package debtap to convert a downloaded deb package to pacman format.

The conversion are not guaranteed to be perfect - but it works in most cases.

Many applications in AUR are repacked deb packages - maybe with some sed commands to change various locations inside configs or scripts.

You can get the PKGBUILD used by Arch by locating the package using the Arch web page - then click the source link - change the pkgbuild - bump the pkgrel and run makepkg -s (add -i if you want to launch pacman -U immediately after build)

https://www.archlinux.org/packages/extra/x86_64/cheese/

patch file
$ cat 0001-Allow-headerbar-to-appear-on-all-desktops.patch
From 81f9be8b6c6208b8d88badead94eb5d5da0bfb63 Mon Sep 17 00:00:00 2001
From: esoleyman <emil@soleyman.com>
Date: Wed, 12 Aug 2020 12:22:01 -0500
Subject: [PATCH] Allow headerbar to appear on all desktops

Removed gtk_dialogs_use_header() and accompanying code to allow the
headerbar to appear in GNOME as well as other desktops. Tested with
XFCE and it works as expected.

Fixes: #62, #85
---
 src/cheese-window.vala | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index ff069808..b3a13ddf 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -123,14 +123,8 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
         GLib.Object (application: application);
 
         header_bar = header_bar_ui.get_object ("header_bar") as Gtk.HeaderBar;
-
-        Gtk.Settings settings = Gtk.Settings.get_default ();
-
-        if (settings.gtk_dialogs_use_header)
-        {
-            header_bar.visible = true;
-            this.set_titlebar (header_bar);
-        }
+        header_bar.visible = true;
+        this.set_titlebar (header_bar);
     }
 
     private void set_window_title (string title)
-- 
2.29.2
3 Likes

This is one of the simplest AUR wrapper for a .deb. The first line of package() function is sufficient for most .deb, but not always.

I want to use this source branch, and the latest commit in it.

Therefore, I changed the following lines in the PKGBUILD

pkgrel=2
_commit=cea8e6fbc616062e1d690dfaa5f95c082dea68f5 
source=("git+https://git.launchpad.net/ubuntu/+source/cheese#commit=$_commit")
sha256sums=('SKIP')

When I run makepkg -s I get the following error after it is cloned

Switched to a new branch 'makepkg'
==> Starting prepare()...
==> Starting pkgver()...
warning: tag 'applied/3.38.0-2' is externally known as 'importer/applied/3.38.0-2'
==> ERROR: pkgver is not allowed to contain colons, forward slashes, hyphens or whitespace.
==> ERROR: pkgver() generated an invalid version: importer/applied/3.38.0+2+0+gcea8e6f

Do I need to change these lines in the PKGBUILD?

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

Don’t change version - bump pkgrel

pkgrel=

@linux-aarhus
I did not change package version, but the issue was there. I did bump pkgrel.

I managed to build after commenting out these lines.

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

This is the current PKGBUILD, which works!

pkgname=cheese
pkgver=3.38.0
pkgrel=2
pkgdesc="Take photos and videos with your webcam, with fun graphical effects"
url="https://wiki.gnome.org/Apps/Cheese"
arch=(x86_64)
license=(GPL)
depends=(gtk3 gstreamer gst-plugins-bad gst-plugins-base gst-plugins-good clutter-gst clutter-gtk
         libcanberra librsvg gnome-desktop libgudev dconf gnome-video-effects)
makedepends=(gobject-introspection vala git appstream-glib meson yelp-tools)
checkdepends=(xorg-server-xvfb)
groups=(gnome)
_commit=cea8e6fbc616062e1d690dfaa5f95c082dea68f5
source=("git+https://git.launchpad.net/ubuntu/+source/cheese#commit=$_commit")
sha256sums=('SKIP')

#pkgver() {
  #cd $pkgname
  #git describe --tags | sed 's/-/+/g'
#}

prepare() {
  cd $pkgname
}

build() {
  arch-meson $pkgname build -D tests=true
  meson compile -C build
}

check() (
  glib-compile-schemas "${GSETTINGS_SCHEMA_DIR:=$PWD/$pkgname/data}"
  export GSETTINGS_SCHEMA_DIR

  dbus-run-session xvfb-run \
    -s '-screen 0 1920x1080x24 -nolisten local' \
    meson test -C build --print-errorlogs
)

package() {
  DESTDIR="$pkgdir" meson install -C build
}

I will test it a bit more, and then upload to AUR.

By the way, is there a way to propose patches to Manjaro’s official packages?
Also, should I keep the pkgname=cheese? Or, should I make it something like cheese-csd-headerbar and add cheese as its conflicting package?

You should definately change the package name - conflict with existing package.

If you have not already done so check the AUR package and submission guidelines

Using launchpad.net as a source is a very bad idea.

For starters this sources has the patch not applied. Debian packageing does not work like this. The patch is in Debian/patches .

You should use the normal PKGBUILD with the original upstream source url.

The add a second source with a link the the plain patch. Applied it in prepare with patch.

The plain link to the patch. Lets hope it applies without any error. I did not test it.
https://git.launchpad.net/ubuntu/+source/cheese/plain/debian/patches/gitlab_always_headerbar.patch

That is a good idea. How do I configure the second source so that the patch will be applied?

The source of the patch is MR #34:

It can be added as a patch in the PKGBUILD:

   1   │ --- PKGBUILD_orig   2020-11-04 09:49:49.501573835 -0700
   2   │ +++ PKGBUILD    2020-11-04 09:49:33.824692678 -0700
   3   │ @@ -15,6 +15,8 @@
   4   │  groups=(gnome)
   5   │  _commit=2129dde7149bba5461590e575ce360e1dd6ef0ee  # tags/3.38.0^0
   6   │ -source=("git+https://gitlab.gnome.org/GNOME/cheese.git#commit=$_commit")
   7   │ -sha256sums=('SKIP')
   8   │ +source=("git+https://gitlab.gnome.org/GNOME/cheese.git#commit=$_commit"
   9   │ +        'https://gitlab.gnome.org/GNOME/cheese/-/merge_requests/34.patch')
  10   │ +sha256sums=('SKIP'
  11   │ +            '164893fb4ee6fb6c22dd7951cb493c4ecf0e54aea3f6569f95b470bcff3f536a')
  12   │  
  13   │  pkgver() {
  14   │ @@ -25,4 +27,5 @@
  15   │  prepare() {
  16   │    cd $pkgname
  17   │ +  git apply -3 ../34.patch
  18   │  }
  19   │  

4 Likes

This builds successfully.

Thank you all. I have created an AUR package and created a How to.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.