FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-20-2012, 12:07 PM
Emil Renner Berthing
 
Default Create split package dirs first

Hi,

When creating split packages I always wished one could just do make
install in one of the package functions and then directly move the
files belonging to other packages off to their respective pkgdirs.
If you look at the PKGBUILD for systemd this is basically what it's
doing except for one thing: the pkgdirs aren't created before calling
the package functions. To work around this it creates it's own
temporary _$pkgdir directories, moves the files to there and then from
there to their proper destination in the later package functions.

The following small patch fixes this.

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 718b4e9..2a2901c 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1924,9 +1924,11 @@ restore_package_variables() {
run_split_packaging() {
local pkgname_backup=${pkgname[@]}
for pkgname in ${pkgname_backup[@]}; do
+ mkdir -p "$pkgdir/$pkgname"
+ chmod a-s "$pkgdir/$pkgname"
+ done
+ for pkgname in ${pkgname_backup[@]}; do
pkgdir="$pkgdir/$pkgname"
- mkdir -p "$pkgdir"
- chmod a-s "$pkgdir"
backup_package_variables
run_package $pkgname
tidy_install
 
Old 06-20-2012, 12:58 PM
Allan McRae
 
Default Create split package dirs first

On 20/06/12 22:07, Emil Renner Berthing wrote:
> Hi,
>
> When creating split packages I always wished one could just do make
> install in one of the package functions and then directly move the
> files belonging to other packages off to their respective pkgdirs.


To do this you make a big assumption.... The only guarantee makepkg has
about folder locations is that the sources will be found in $srcdir and
that $pkgdir will point at the directory containing the package files
during its package function. So how are you going to move the files
from one package directory to another one in an unknown location? The
directory layout has changed before and possibly will again
(particularly when splitting debug symbols to their own package happens...).


So instead, lets deal with this properly. I mentioned this recently on
the mailing list but did not go into details. So here goes an example
PKGBUILD snippet:


pkgname=('libfoo-headers' 'libfoo')

package() { make -C $srcdir/$pkgname-$pkgver install }

package_libfoo-headers() {
filelist=('usr/include/*')
}

package_libfoo() {
filelist=('*')
}

makepkg sees this PKGBUILD, notices it is a split package from the
pkgname array, but also sees it has a package function. When it comes
to packaging, it creates a temporary directory for filling when running
the package() function. Then the actual packaging functions are run.
makepkg sees the "filelist" variable is set and moves the files from the
temporary directory to the package directory. Note that in this example
package_libfoo() is called last and just mops up the remaining files.
This is not necessary, but if there are files left over after the last
package functions is run, makepkg should print a warning.


So the patch would look something like:

run_split_packaging() {
local pkgname_backup=${pkgname[@]}

+ if (( PKGFUNC )); do
+ pkgname=$pkgbase
+ tmpdir=$(mktemp -d ......)
+ pkgdir=$tmpdir
+ mkdir -p "$pkgdir"
+ chmod a-s "$pkgdir"
+ run_package
+ fi

for pkgname in ${pkgname_backup[@]}; do
pkgdir="$pkgdir/$pkgname"
mkdir -p "$pkgdir"
chmod a-s "$pkgdir"
backup_package_variables
run_package $pkgname

+ if [[ -n $filelist ]]; do
+ for f in ${filelist[@]}; do
+ // simplified... need to create dirs
+ mv $tmpdir/$f $pkgdir
+ done
+ fi
+ unset filelist

tidy_install
create_package $pkgname
restore_package_variables
pkgdir="${pkgdir%/*}"
done
pkgname=${pkgname_backup[@]}

+ leftover=$(find $tmpdir ! -type d)
+ if (( ${#leftover[*]} != 0 )) {
+ warning "$(gettext "Files leftover during split packaging")"
+ fi

}


The only hard bit that remains is creating the correct directory
structure for the files to be moved into. I leave that for someone to
finish...

Allan


Wed Jun 20 15:30:02 2012
Return-Path: <bounce-debian-kernel=tom=linux-archive.org@lists.debian.org>
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
eagle542.startdedicated.com
X-Spam-Level:
X-Spam-Status: No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,
T_RP_MATCHES_RCVD autolearn=ham version=3.3.1
X-Original-To: tom@linux-archive.org
Delivered-To: tom-linux-archive.org@eagle542.startdedicated.com
Received: from bendel.debian.org (bendel.debian.org [82.195.75.100])
by eagle542.startdedicated.com (Postfix) with ESMTP id 9513C20E0348
for <tom@linux-archive.org>; Wed, 20 Jun 2012 15:03:22 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
by bendel.debian.org (Postfix) with QMQP
id 2B449C3; Wed, 20 Jun 2012 13:03:19 +0000 (UTC)
Old-Return-Path: <debbugs@busoni.debian.org>
X-Original-To: lists-debian-kernel@bendel.debian.org
Delivered-To: lists-debian-kernel@bendel.debian.org
Received: from localhost (localhost [127.0.0.1])
by bendel.debian.org (Postfix) with ESMTP id 1C54350
for <lists-debian-kernel@bendel.debian.org>; Wed, 20 Jun 2012 13:03:19 +0000 (UTC)
X-Virus-Scanned: at lists.debian.org with policy bank en-ht
Received: from bendel.debian.org ([127.0.0.1])
by localhost (lists.debian.org [127.0.0.1]) (amavisd-new, port 2525)
with ESMTP id hQLVUZc0YCG0
for <lists-debian-kernel@bendel.debian.org>;
Wed, 20 Jun 2012 13:03:10 +0000 (UTC)
Received: from busoni.debian.org (busoni.debian.org [140.211.15.34])
(using TLSv1 with cipher AES256-SHA (256/256 bits))
(Client did not present a certificate)
by bendel.debian.org (Postfix) with ESMTPS id 5FBE66B;
Wed, 20 Jun 2012 13:03:10 +0000 (UTC)
Received: from debbugs by busoni.debian.org with local (Exim 4.72)
(envelope-from <debbugs@busoni.debian.org>)
id 1ShKYq-0005mW-BZ; Wed, 20 Jun 2012 13:03:05 +0000
X-Loop: owner@bugs.debian.org
Subject: Bug#642025: (r8169): transmit queue 0 timed out
Reply-To: a.vasilishin@kpi.ua, 642025@bugs.debian.org
Resent-From: =?UTF-8?Q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9_?= =?UTF-8?Q?=D0=92=D0=B0=D1=81=D0=B8=D0=BB=D0=B8=D1=88=D0= B8=D0=BD?= <a.vasilishin@kpi.ua>
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: Debian Kernel Team <debian-kernel@lists.debian.org>
X-Loop: owner@bugs.debian.org
Resent-Date: Wed, 20 Jun 2012 13:03:02 +0000
Resent-Message-ID: <handler.642025.B642025.134019730121859@bugs.debia n.org>
X-Debian-PR-Message: followup 642025
X-Debian-PR-Package: linux-2.6
X-Debian-PR-Keywords:
X-Debian-PR-Source: linux-2.6
Received: via spool by 642025-submit@bugs.debian.org id=B642025.134019730121859
(code B ref 642025); Wed, 20 Jun 2012 13:03:02 +0000
Received: (at 642025) by bugs.debian.org; 20 Jun 2012 13:01:41 +0000
Received: from mail0.kpi.ua ([77.47.128.135] helo=mail1.kpi.ua)
by busoni.debian.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
(Exim 4.72)
(envelope-from <a.vasilishin@kpi.ua>)
id 1ShKXE-0005ey-BN
for 642025@bugs.debian.org; Wed, 20 Jun 2012 13:01:35 +0000
Authentication-Results: mail1.kpi.ua; auth=pass (auth_dovecot_plain) smtp.mail=andron@kpi.ua
Received: from [91.218.74.202] (helo=[192.168.1.103])
by mail1.kpi.ua with esmtpsa (TLS1.0HE_RSA_AES_256_CBC_SHA1:32)
(Exim 4.72)
(envelope-from <a.vasilishin@kpi.ua>)
id 1ShJix-0000Or-4q; Wed, 20 Jun 2012 15:09:27 +0300
Message-ID: <4FE1BD74.2070109@kpi.ua>
Date: Wed, 20 Jun 2012 15:09:24 +0300
From: =?UTF-8?Q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9_?= =?UTF-8?Q?=D0=92=D0=B0=D1=81=D0=B8=D0=BB=D0=B8=D1=88=D0= B8=D0=BD?=
<a.vasilishin@kpi.ua>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
MIME-Version: 1.0
To: Jonathan Nieder <jrnieder@gmail.com>
CC: 642025@bugs.debian.org
References: <4E7626F7.6060608@kpi.ua> <20120619191035.GA19914@burratino>
In-Reply-To: <20120619191035.GA19914@burratino>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: ClamAV at mail1.kpi.ua
X-Greylist: delayed 1107 seconds by postgrey-1.32 at busoni; Wed, 20 Jun 2012 13:01:24 UTC
X-Rc-Virus: 2007-09-13_01
X-Mailing-List: <debian-kernel@lists.debian.org> archive/latest/84184
X-Loop: debian-kernel@lists.debian.org
List-Id: <debian-kernel.lists.debian.org>
List-URL: <http://lists.debian.org/debian-kernel/>
List-Post: <mailto:debian-kernel@lists.debian.org>
List-Help: <mailto:debian-kernel-request@lists.debian.org?subject=help>
List-Subscribe: <mailto:debian-kernel-request@lists.debian.org?subject=subscribe>
List-Unsubscribe: <mailto:debian-kernel-request@lists.debian.org?subject=unsubscribe>
Precedence: list
Resent-Sender: debian-kernel-request@lists.debian.org

19.06.2012 22:10, Jonathan Nieder ?¿?¸???µ??:
> Hi Andrei,
>
> ???½?´???µ?¹ ???°???¸?»?¸???¸?½ wrote:
>
>> NETDEV WATCHDOG: eth0 (r8169): transmit queue 0 timed out
>
> Sorry for the long silence.
>
> Did this happen only once, or was it reproducible? If the latter, is
> it still reproducible? What kernel are you using these days?
>
> Thanks for writing,
> Jonathan
>


Now I am using 3.2.0-2 kernel and not using Realtek NIC, thats why I
can't reproduce this bug.

--
WBR, Andrey Vasilishin CDIG1-UANIC, CDIG1-RIPE





--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/4FE1BD74.2070109@kpi.ua
 
Old 06-20-2012, 01:19 PM
Emil Renner Berthing
 
Default Create split package dirs first

On 20 June 2012 14:58, Allan McRae <allan@archlinux.org> wrote:
> On 20/06/12 22:07, Emil Renner Berthing wrote:
>> Hi,
>>
>> When creating split packages I always wished one could just do make
>> install in one of the package functions and then directly move the
>> files belonging to other packages off to their respective pkgdirs.
>
>
> To do this you make a big assumption.... *The only guarantee makepkg has
> about folder locations is that the sources will be found in $srcdir and
> that $pkgdir will point at the directory containing the package files
> during its package function. *So how are you going to move the files
> from one package directory to another one in an unknown location? *The
> directory layout has changed before and possibly will again
> (particularly when splitting debug symbols to their own package happens...).

Yes, this only works if you can trust all the pkgdirs are created as
subdirs of the same directory (as they are now).
I had another approach lined up if you didn't like this assumption,
but I thought I'd start with the least invasive version

> So instead, lets deal with this properly. *I mentioned this recently on
> the mailing list but did not go into details. *So here goes an example
> PKGBUILD snippet:

[...]

Cool, this is very much what I had imagined only it goes even further.
I like it. Thumbs up from here.

/Emil
 

Thread Tools




All times are GMT. The time now is 12:18 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org