You are not logged in.

#1 2012-09-11 03:37:13

OLSHoya
Member
Registered: 2012-09-10
Posts: 10

[SOLVED] How to patch package build (uzbl-git)

Hello,

I am experiencing a similar issue while building uzbl-git as reported here in the last few posts https://aur.archlinux.org/packages.php? … 2&detail=1

When running "makepkg -s", I receive the following error:

creating /usr/lib/python3.2/site-packages/uzbl
error: could not create '/usr/lib/python3.2/site-packages/uzbl': Permission denied
make: *** [install-event-manager] Error 1

A user on the page posted a patch for this issue:

PKGBUILD diff:
======
14,15c14,15
< source=()
< md5sums=()
---
> source=('Makefile.patch')
> md5sums=('1fb21dc7128e11d9a91351702c5fee53')
45a46,48
>
> # fix python site-packages installation
> patch -p0 < "$srcdir/Makefile.patch"
=====

Makefile.patch:
=====
--- Makefile 2012-06-26 15:00:00.017779376 +0000
+++ Makefile.fixed 2012-06-26 14:54:24.969594488 +0000
@@ -12,6 +12,7 @@
PYTHON=python3
PYTHONV=$(shell $(PYTHON) --version | sed -n /[0-9].[0-9]/p)
COVERAGE=$(shell which coverage)
+PYINSTALL_EXTRA=--prefix="${DESTDIR}${PREFIX}"

# --- configuration ends here ---
===== 

Could someone enlighten me on how this patch should be applied? I have looked over the patching page on the arch wiki, but am still not sure. Should those lines be added at lines 14,15 and 45,46,48 in the PKGBUILD, respectively, and should I then create the file makefile.patch in the same directory with the second part of the code? It is unclear to me as both source=() and md5sums=() are not anywhere in the PKGBUILD, so I can't remove these lines as the patch suggests if I am reading it correctly (I have no coding experience).

Someone posted an alternative patch, I am note sure if this is any easier to apply (https://github.com/keis/uzbl/commit/d4c … 6874dda0ea)

Thank you in advance.

Last edited by OLSHoya (2012-09-11 19:51:24)

Offline

#2 2012-09-11 05:31:55

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: [SOLVED] How to patch package build (uzbl-git)

Where in the file system are you trying to run this?  What you should do is copy the directory to $HOME and makepkg it there.  After the package is built, install it with sudo makepkg ....


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2012-09-11 05:36:55

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] How to patch package build (uzbl-git)

Save the above to a file where your PKGBUILD file is. We'll call it uzbl.patch. Then cd to that directory and run "patch -p1 < uzbl.patch"
Don't see why that wouldn't work (to patch the file I mean).

Last edited by dodo3773 (2012-09-11 05:38:06)

Offline

#4 2012-09-11 14:55:55

OLSHoya
Member
Registered: 2012-09-10
Posts: 10

Re: [SOLVED] How to patch package build (uzbl-git)

ewaller: I have downloaded the uzbl-git directory to /home/olshoya/Desktop/AUR/uzbl-git using cower. If I run, "makepkg -s" I receive the error above regarding file permissions. I have installed two other packages from AUR this way without any issues.

dodo3773:
If I save the file as uzbl.patch and run "patch -p1 < uzbl.patch" I get:

can't find file to patch at input line 19
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
------------------------------------------
PKGBUILD diff:
======
14,15c14,15
< source=()
< md5sums=()
---
> source=('Makefile.patch')
> md5sums=('1fb21dc7128e11d9a91351702c5fee53')
45a46,48
>
> # fix python site-packages installation
> patch -p0 < "$srcdir/Makefile.patch"
=====

Makefile.patch:
=====
--- Makefile 2012-06-26 15:00:00.017779376 +0000
+++ Makefile.fixed 2012-06-26 14:54:24.969594488 +0000
------------------------------------------

This part refers to patching the makefile, while the directory currently only contains a PKGBUILD. Is there a step that I am missing in applying this patch?

Offline

#5 2012-09-11 15:59:52

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] How to patch package build (uzbl-git)

There are two patches there - one for the PKGBUILD, and one for the Makefile (to be put in the build directory). Not sure why the contributor used different formats for them....

Offline

#6 2012-09-11 16:04:40

OLSHoya
Member
Registered: 2012-09-10
Posts: 10

Re: [SOLVED] How to patch package build (uzbl-git)

Does this mean I should make a separate file named makefile.patch with the second part of the pach.

And leave the first part in a file (e.g. uzbl.patch), and then run:

"patch -p1 < uzbl.patch"

At this point, I only have the PKGBUILD in the uzbl-git directory.

Someone else on the uzbl-git page recommended this patch, not sure which is more appropriate: https://github.com/keis/uzbl/commit/d4c … 6874dda0ea

Last edited by OLSHoya (2012-09-11 16:22:48)

Offline

#7 2012-09-11 18:19:01

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] How to patch package build (uzbl-git)

PKGBUILD

# Maintainer: Mark Foxwell <fastfret79@archlinux.org.uk>
# Contributor: Dieter Plaetinck <dieter@plaetinck.be>
# Contributer: Brendan Taylor <whateley@gmail.com>
# Contributer: L42y <423300@gmail.com>
pkgname=uzbl-git
pkgver=20120212
pkgrel=1
pkgdesc="All uzbl web interface tools: latest from the git master branch"
arch=('i686' 'x86_64')
url="http://github.com/Dieterbe/uzbl/"
license=('GPL3')
depends=('libwebkit3' 'socat' 'zenity' 'xclip' 'dmenu' 'python2' 'pygtk')
makedepends=('git' 'pkgconfig' 'libwebkit>=1.2.0')
source=('Makefile.patch')
md5sums=('1fb21dc7128e11d9a91351702c5fee53')
provides=('uzbl-core' 'uzbl-browser' 'uzbl-tabbed')
conflicts=('uzbl-core' 'uzbl-browser' 'uzbl-tabbed' 'uzbl-experimental-git')

_gitroot="git://github.com/Dieterbe/uzbl.git"
_gitname="uzbl"

build() {

  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [ -d $_gitname ] ; then
    cd $_gitname && git pull origin
    msg "The local files are updated."
  else
    git clone $_gitroot $_gitname
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."

  rm -rf "$srcdir/$_gitname-build"
  git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"

patch -p0 < "$srcdir/Makefile.patch"
  for file in bin/*; do
    sed -i 's_#!/usr/bin/env python$_#!/usr/bin/env python2_' $file
  done
  sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
    -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
    $(find ./ -name '*.py')

  make
}

package(){
   cd "$srcdir/$_gitname-build"
   make DESTDIR="$pkgdir" PREFIX=/usr  install
}

Makefile.patch

--- Makefile 2012-06-26 15:00:00.017779376 +0000
+++ Makefile.fixed 2012-06-26 14:54:24.969594488 +0000
@@ -12,6 +12,7 @@
PYTHON=python3
PYTHONV=$(shell $(PYTHON) --version | sed -n /[0-9].[0-9]/p)
COVERAGE=$(shell which coverage)
+PYINSTALL_EXTRA=--prefix="${DESTDIR}${PREFIX}"

Save them both in the same folder and run makepkg. After you save Makefile.patch run "md5sum Makefile.patch" and update the md5sums array in the PKGBUILD if you need to.

Offline

#8 2012-09-11 19:05:52

OLSHoya
Member
Registered: 2012-09-10
Posts: 10

Re: [SOLVED] How to patch package build (uzbl-git)

Thank you for the continued help dodo3773.

I incoporated those files, updated the md5sum array, but instead recieve an error when "patching file Makefile" which states "patch: **** malformed patch at line 4: PYTHON:python3"

I compared this patch with the second one that was proposed on the uzbl-git arch package page and I see some differences. I am not sure whether this is the cause:

https://github.com/keis/uzbl/commit/d4c … 6874dda0ea

Like I said, I have little coding experience so it is difficult for me to try to decipher these patches and see where it is going wrong. But why is it that I am having this issue? Is it a broader concern or something that I need to fix with my system, since I am sure most people are able to install uzbl-git without these issues.

Last edited by OLSHoya (2012-09-11 19:06:46)

Offline

#9 2012-09-11 19:42:25

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] How to patch package build (uzbl-git)

Your welcome. Happy to help. Here you go:

Makefile.patch

--- Makefile	2012-09-11 12:25:06.742825968 -0700
+++ uzbl/Makefile	2012-09-11 12:36:30.402865742 -0700
@@ -12,7 +12,6 @@
 PYTHON=python3
 PYTHONV=$(shell $(PYTHON) --version | sed -n /[0-9].[0-9]/p)
 COVERAGE=$(shell which coverage)
-PYINSTALL_EXTRA=--prefix="${DESTDIR}${PREFIX}"
 
 # --- configuration ends here ---

Answer "y" when it asks you "Reversed (or previously applied) patch detected!  Assume -R? [n] ".

Offline

#10 2012-09-11 19:50:48

OLSHoya
Member
Registered: 2012-09-10
Posts: 10

Re: [SOLVED] How to patch package build (uzbl-git)

Thank you, this solved the issue.

Do you know what the issue was and how I can avoid it in the future? What exactly did this patch do and it this something I would likely face during subsequent uzbl updates?

Offline

#11 2012-09-11 19:56:48

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] How to patch package build (uzbl-git)

OLSHoya wrote:

Thank you, this solved the issue.

Do you know what the issue was and how I can avoid it in the future? What exactly did this patch do and it this something I would likely face during subsequent uzbl updates?

The issue was in the Makefile. It is not something you can avoid because it is not your fault. What the patch did was add the line:

PYINSTALL_EXTRA=--prefix="${DESTDIR}${PREFIX}"

to the Makefile. Hard to say on the update question. Usually PKGBUILDs are fixed pretty quick though on popular aur packages. I doubt if you will have an issue on the next update (there may be an update coming soon if they fix it and change the version number).

Offline

#12 2012-09-11 20:02:33

OLSHoya
Member
Registered: 2012-09-10
Posts: 10

Re: [SOLVED] How to patch package build (uzbl-git)

Ok, is there somewhere I can read up on how to apply a patch correctly (I thought the arch page was not very extensive on the subject, although it is probably something that is pretty package-specific). For example, how did you know to switch the -12,7 +12,6 around?

Sorry for all the questions, hopefully I can fix it on my own next time something similar comes up.

Offline

#13 2012-09-11 20:09:51

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] How to patch package build (uzbl-git)

I'm not sure where to read up on it. I agree with you though on the lack of simple documentation on this subject. Here is what I did: I copied the Makefile from the src/uzbl directory, added the needed line, and then ran "diff -ur Makefile src/uzbl/Makefile > Makefile.patch". After that I changed src/uzbl/Makefile to uzbl/Makefile and deleted the src directory and rebuilt it. In other words I did not change the patch; I just created another one for you. I actually do not know that much yet about how patch works. Wish I could be of more help.

Offline

#14 2012-09-11 20:26:59

OLSHoya
Member
Registered: 2012-09-10
Posts: 10

Re: [SOLVED] How to patch package build (uzbl-git)

Ok, thank you for the help.

Offline

Board footer

Powered by FluxBB