You are not logged in.

#1 2009-05-07 11:50:50

cpc
Member
Registered: 2009-04-30
Posts: 42

convert .pkg folder to .pkg.tar.gz?

I just build a package gmchess-0.20-1-i686.pkg.tar.gz from PKGBUILD,  I unpack the gmchess-0.20-1-i686.pkg.tar.gz and create a folder gmchess-0.20-1-i686.pkg, after changing some .png files in this folder, I compress the gmchess-0.20-1-i686.pkg folder back to gmchess-0.20-1-i686.pkg.tar.gz, however it can not be installed with command pacman -U, I try to search wiki, but get no clues, thanks for help.


$ sudo pacman -U gmchess-0.20-1-i686.pkg.tar.gz
Password:
loading package data...
error: missing package metadata in gmchess-0.20-1-i686.pkg.tar.gz
error: 'gmchess-0.20-1-i686.pkg.tar.gz': invalid or corrupted package

Offline

#2 2009-05-07 12:07:01

EVRAMP
Member
From: Czech Republic
Registered: 2008-10-03
Posts: 173
Website

Re: convert .pkg folder to .pkg.tar.gz?

Use tar -zxvf gmchess-0.20-1-i686.pkg.tar.gz to unpack, change images and use tar -zcvf to compress.

Package metadata are stored in .INSTALL, .CHANGELOG and .PKGINFO files. You should see them in a list while using tar.
I would bet you haven't put them into your gmchess-0.20-1-i686.pkg.tar.gz.

Offline

#3 2009-05-07 12:12:53

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,385
Website

Re: convert .pkg folder to .pkg.tar.gz?

The command makepkg uses is:

bsdtar -czf .PKGINFO .INSTALL .CHANGELOG *

of course, you need to drop .INSTALL and .CHANGELOG if they are not in your package.  Also, check out "makepkg -R"...  then it is all automated for you.  And finally, you probably want to do the changes directly in the PKGBUILD.

Offline

#4 2009-05-07 12:13:54

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

Thanks for reply,

There is only .PKGINFO file in the folder gmchess-0.20-1-i686.pkg

Offline

#5 2009-05-07 12:21:01

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

Allan wrote:

The command makepkg uses is:

bsdtar -czf .PKGINFO .INSTALL .CHANGELOG *

of course, you need to drop .INSTALL and .CHANGELOG if they are not in your package.  Also, check out "makepkg -R"...  then it is all automated for you.  And finally, you probably want to do the changes directly in the PKGBUILD.

Thanks for reply, but I don't really know what and how to do, is there any document for .INSTALL ?

Offline

#6 2009-05-07 12:35:27

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

Allan wrote:

... check out "makepkg -R"...  then it is all automated for you...

Thanks a lot, the problem is solved.

Offline

#7 2009-05-07 13:55:45

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

Re: convert .pkg folder to .pkg.tar.gz?

Allan wrote:

you ... want to do the changes directly in the PKGBUILD.

I'm quoting this because you didn't respond to it, and it is the only correct way to do what you want.

Offline

#8 2009-05-07 15:34:48

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

tomk wrote:
Allan wrote:

you ... want to do the changes directly in the PKGBUILD.

I'm quoting this because you didn't respond to it, and it is the only correct way to do what you want.

I didn't modify the PKGBUILD, I just replaced some .png files in folder pkg, and then run makepkg -R, that is it.

Offline

#9 2009-05-07 15:53:53

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

Re: convert .pkg folder to .pkg.tar.gz?

I know you didn't, but you should have. Put your pngs in the source array and use them as required in the build function of the PKGBUILD.

The only thing you should do with an Arch package after building it is install it.

Offline

#10 2009-05-08 02:08:22

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

tomk wrote:

... Put your pngs in the source array and use them as required in the build function of the PKGBUILD...

I am still new to Arch, would you please show me how to put the pngs in the source array for replacement in PKGBUILD?

Thanks a lot.

Offline

#11 2009-05-08 06:01:59

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

Re: convert .pkg folder to .pkg.tar.gz?

All the details are in the wiki - start here.

Offline

#12 2009-05-09 15:52:47

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

tomk wrote:

All the details are in the wiki - start here.

I read it, but I still don't know how to put the local pngs in the source array for replacement in PKGBUILD? would you please show me an example?

Thanks a lot.

Offline

#13 2009-05-09 16:55:01

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: convert .pkg folder to .pkg.tar.gz?

Open up the PKGBUILD and replace the names of the old png files with the names of the new ones in the "source" array, e.g.:

source=(old_img_1.png old_img_2.png old_img_3.png)
source=(new_img_1.png new_img_2.png new_img_3.png)

Then run "makepkg -g" to generate the new md5sum array. Open the PKGBUILD again and replace the old md5sum array with the new one.

Last edited by Xyne (2009-05-09 16:56:23)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#14 2009-05-10 00:52:55

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

Xyne wrote:

Open up the PKGBUILD and replace the names of the old png files with the names of the new ones in the "source" array, e.g.:

source=(old_img_1.png old_img_2.png old_img_3.png)
source=(new_img_1.png new_img_2.png new_img_3.png)

Then run "makepkg -g" to generate the new md5sum array. Open the PKGBUILD again and replace the old md5sum array with the new one.

Thanks for your detailed reply, here is PKGBUILD, there is no source array about png, can I just put in the source array for new pngs?

=================================================================================================
# Contributor: yetist <yetist@gmail.com>

pkgname=gmchess
pkgver=0.20
pkgrel=1
pkgdesc="Chinese chess game"
arch=("i686" "x86_64")
url="http://code.google.com/p/gmchess/"
license=('GPL2')
depends=("gtkmm" "libglademm")
source=("http://gmchess.googlecode.com/files/$pkgname-$pkgver.tar.bz2")
md5sums=('14ac37609c2fd6f0611001ed4508d688')

build() {
        cd "$startdir/src/$pkgname-$pkgver"
    ./configure --prefix=/usr || return 1
        make || return 1
        make DESTDIR="$startdir/pkg" install || return 1
}

Offline

#15 2009-05-10 05:26:36

mcmillan
Member
Registered: 2006-04-06
Posts: 737

Re: convert .pkg folder to .pkg.tar.gz?

You'll want to just add the .png files to the array yourself after the source that's already there.  Everything between the { } just after build() is just the commands makepkg will run when it's building, so after the last line you'll want to add the commands to replace the files. So something like

build() {
        cd "$startdir/src/$pkgname-$pkgver"
    ./configure --prefix=/usr || return 1
        make || return 1
        make DESTDIR="$startdir/pkg" install || return 1
cp new_pic.png $startdir/pkg/old_pic.png
}

Last edited by mcmillan (2009-05-10 05:27:25)

Offline

#16 2009-05-11 01:55:28

cpc
Member
Registered: 2009-04-30
Posts: 42

Re: convert .pkg folder to .pkg.tar.gz?

If I want to spread this amended version with new pngs, I have to include new pngs with new PKGBUILD, otherwise this new PKGBUILD will be unuseable because of missing pngs, am I right? if so, I think to rebuild a .pkg.tar.gz with new pngs will be a better choice.

Offline

#17 2009-05-11 06:18:06

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

Re: convert .pkg folder to .pkg.tar.gz?

Depends what you mean by "spread". You could build it and distribute the compiled version, complete with new graphics, so other users just have to install it with pacman. If you want to "spread" the PKGBUILD, then yes, you need to provide the new pngs as well. You are, or course, free to do whatever you like, but as I said before, pkg,tar,gz tarballs are intended for installation only. The content of the tarball should be decided during the build process. Doing it your way works, but it is not the way the system was designed.

If you think your pngs should be part of the package, the best thing to do is to submit them as a feature request to the gmchess developer.

Offline

#18 2009-05-11 09:20:52

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: convert .pkg folder to .pkg.tar.gz?

It's actually better to distribute the PKGBUILD and local source files so people can build the package for their system but if you want to spread a pre-built package, edit the PKGBUILD as mentioned then run "makepkg" to automatically build the package. This is less effort than manually editing the package and will likely lead to fewer errors. It's the way it should be done.

Manually editing a package instead of the PKGBUILD is analogous to writing a paper on the computer then using correction fluid to correct the mistakes on the printed version instead of correcting them on the computer before printing.

*edit*
The best way would actually be to create an archive of the PKGBUILD and png images and distribute that.

Last edited by Xyne (2009-05-11 09:22:20)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#19 2009-05-11 09:47:33

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

Re: convert .pkg folder to .pkg.tar.gz?

Xyne wrote:

Manually editing a package instead of the PKGBUILD is analogous to writing a paper on the computer then using correction fluid to correct the mistakes on the printed version instead of correcting them on the computer before printing.

Excellent Xyne! smile

Offline

Board footer

Powered by FluxBB