You are not logged in.

#1 2004-03-02 22:16:05

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

I am lost with understanding the Arch Build System

Hey I have read the below but it just doesn´t sink in sad  I don´t understand... is there a longer... perhaps more simple explaination.

Do I have to make a package to install a program from src??

What is a proto suffix?

Maby I will just try to do it and maby it will all come to me later!

5 Arch Build System (ABS)
Binarys. Source
Where pacman is responsible for the binary side of the package world, ABS is responsible for the source side: It helps you to build your own custom packages from source code, also letting you rebuild Arch Linux packages with your own customizations. The procedure usually goes as follows:

Synchronize your ABS tree with the server (run abs as root)
Create a new directory in /var/abs/local named after the package you are going to create.
Copy the PKGBUILD.proto prototype from /var/abs/ into your newly created directory, remove the proto suffix, and edit it for the new package.
Run makepkg in the working directory with the PKGBUILD file.
Install the newly built package with pacman.
Send the package to your friends for bragging rights (or give it to an Archer so s/he can stick it in the master ABS tree).
5.2 Synchronizing Your ABS Tree

Adam


¿Pero, Por que?

Offline

#2 2004-03-02 22:35:16

jlowell
Member
Registered: 2003-08-10
Posts: 270

Re: I am lost with understanding the Arch Build System

Hi Adam,

With Arch, there are two alternatives, you can install precompiled binary packages using the command pacman -S packagename or you can compile and upgrade/install a package via the Arch PKGBUILD system. To initiate the PKGBUILD system, you need to have cvsup and wget installed. Once that step is completed you run abs to download the PKGBUILD scripts from the repositories. Simply change directory for the package you want to build, say cd /var/abs/base/glibc, and run makepkg -bci. The package will be built and upgraded/installed. That's pretty much it, actually.

jlowell

Offline

#3 2004-03-03 09:00:02

mico
Member
From: Slovenia
Registered: 2004-02-08
Posts: 247

Re: I am lost with understanding the Arch Build System

What is a proto suffix?

PKGBUILD.proto is a sample PKGBUILD - when you want to create your own package and there is no PKGBUILD for it yet, copy PKGBUILD.proto to /var/abs/local/your_package_name and remove the suffix, then edit that PKGBUILD before running makepkg.

I prefer running makepkg as normal user (without any flags, at least without -i) and then su to root and install the package. You need also the fakeroot package to use makepkg as a normal user.

The main advantage is that you won't be able to install to /usr instead to /var/abs/local with makepkg in case your PKGBUILD is not set up correctly - this will not likely happen with an official PKGBUILD but it may happen with your PKBUILD if you make a mistake in it. Besides, it is always a bad idea to do something as root if you can do the same as user.

After makepkg is finished, su to root and install with:
pacman -A your_package

If you built a program that is not already in the repositories (check also the incoming and TURs) you could post the PKGBUILD in this forum so others could make use of it, too.

If it all sounds too complicated and new, you can just take the usual path with:
./configure
make
make install

Offline

#4 2004-03-03 09:39:03

calexico
Member
Registered: 2004-02-11
Posts: 32

Re: I am lost with understanding the Arch Build System

Abs can also be very usefull to customize existing packages : imagine that you want mplayer with arts and alsa support, it's very easy.
- synchro your abs tree
- go to /var/abs/local
- cp ../multimedia/mplayer/PKGBUILD .
- customize :

./configure --prefix=/usr --enable-gui --enable-linux-devfs --enable-alsa 
    --enable-arts --disable-external-faad --enable-runtime-cpudetection 
    --enable-sdl --enable-x11 --enable-real --with-win32libdir=/usr/lib/win32

instead of :

./configure --prefix=/usr --enable-gui --enable-linux-devfs --disable-alsa 
    --disable-arts --disable-external-faad --enable-runtime-cpudetection 
    --enable-sdl --enable-x11 --enable-real --with-win32libdir=/usr/lib/win32

- save
- makepkg

And that's all ! You've got your new package. However it's just an example but abs is really usefull, no matter the way you use it wink

Offline

#5 2004-03-03 11:16:55

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Sorry guys I must look pretty stupid but I have never really used a packet manager  in the short time I have had linux and am pretty much a kenisthetic (sorry for the spelling) learner :oops:

Firstly I am having real problems setting up my system up so that pacman uses local packages (and finds dependencies)  I have read the pacman manual.

I coppied all the packages from the cd to /pkgs/

Commented out everything in pacman.conf except:

[Options] (not touched)

[Custom] (changed to where I coppied cd packages)
Server = file:///pkgs/

I then ran:
pacman --refresh
pacman -- sync xxxx and it always says xxxxx not found in db
pacman --list (and it returns nothing)

What am I doing wrong??

Next question
So you put all the src files in the  /var/abs/xxxx directory (or where ever) and then download PKGBUILD scripts from the repositories and then you use the above steps to make packages that you can install with pacman??

Thanks and I hope I don´t drive you guys crazy! :shock:
Adam


¿Pero, Por que?

Offline

#6 2004-03-03 12:24:02

calexico
Member
Registered: 2004-02-11
Posts: 32

Re: I am lost with understanding the Arch Build System

Well, first : abs.

You must run as root :

abs

. But for it to works you must have installed wget and cvsup.

This will download the abs tree to /var/abs . You now have two kinds of folders :
- local, where you can build your own packages
- the others (like multimedia, base, etc) which contains all the PKGBUILD files for all softs actually available in binary form (I'm not pretty sure but at least most of them) : http://www.archlinux.org/packages.php.

You also have the file /var/abs/PKGBUILD.proto which looks like this :

pkgname=NAME
pkgver=VERSION
pkgrel=1
pkgdesc=""
url=""
depends=()
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=($pkgname-$pkgver.tar.gz)
md5sums=()

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

To better understand, we'll take an example : let say that we want to build a package for showimg.

First you copy /var/abs/PKGBUILD.proto to /var/abs/local/PKGBUILD

You have two choices : download the source in /var/abs/local or copy the url where the source is located, that's what I'll do. So the first thing you have to do is :

source=(http://www.jalix.org/projects/showimg/download/$pkgver/$pkgname-$pkgver.tar.gz

Which will in fact be equivalent to :

http://www.jalix.org/projects/showimg/d … 9.0.tar.gz

So next :

pkgname=showimg
pkgver=0.9.0
pkgdesc="Image viewer for kde"
depends=(qt)

There might be other dependencies that you should check but let say that it only needs qt.

As it is a kde app, we'll also change the install path from /usr to /opt/kde :

./configure --prefix=/opt/kde

and :

make prefix=$startdir/pkg/opt/kde install

Well it's almost complete. This package is far from following the guidelines but at least it will work. All you have to do now is to launch makepkg :

/var/abs/local - user $ makepkg

And this will generate the file showimg-0.9.0-1.pkg.tar.gz which is our package. You can install it typing pacman -A showimg...

Well this is the quick and dirty way, you'll learn to make good packages later  (I'm still using this way tongue).

It applies if you want to create a package which is not already available. If you want to modify a package already existing, say mplayer (see above) :
- cp /var/abs/multimedia/mplayer/PKGBUILD /var/abs/local/PKGBUILD
- modify the PKGBUILD file to feet your needs
- launch makepkg
- install

Now about using local packages. Once more, you have two ways :
- pacman -A package_location/package but it doesn't resolve dependencies
- copy the packages files to /var/cache/pacman/pkg and then pacman -S package.

Well in fact when you type pacman -S package what pacman does is :
- look in the database for needed packages (dependencies etc)
- look if these packages are present in /var/cache/pacman/pkg
- download missing packages to /var/cache/pacman/pkg
- install packages

So one way is to put your packages there. But it requires that your packages are in the same version in the db.

Well do you have an internet connection ? Why not just downloading them ?

Offline

#7 2004-03-03 16:15:39

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: I am lost with understanding the Arch Build System

jimdaworm wrote:

I then ran:
pacman --refresh
pacman -- sync xxxx and it always says xxxxx not found in db
pacman --list (and it returns nothing)

The best way to explain this is to look at big commands and small commands (major and minor).

-A (add), -F (freshen), -Q (query), -R (remove), -S (sync), -U (upgrade), and -V (version) are all major commands.  These are the ones that make pacman do stuff.

--refresh (-y) is a minor command.  You need to combine it with a major command (in this case -S).

pacman -Sy will get your package list.  Then pacman -S <package name> will install them.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#8 2004-03-03 17:54:59

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Hey calexico that is a WICKED explaination I think what I was missing is that I need to copy the packages from the cd to the /var/cache/pacman/pkg directory.

Hey and your package building explaination was great too ... well anyway from my point of view it should be framed!

I still don´t understand 100percent but I am getting there... oh yeah and the internet thing I pay for the time I use on my 56.6k modem at home but I work in an ´Internet Cafe´ where we have fibre access...

I think the intelligent move for me if I can figure it out is to use my work connection to download the packages!

Hey Xentac thanks for pointing that out ... I am getting there... I will be printing this whole thread out and taking it home with me for many hours of fun wink

Adam

Edit: its funny to think that sometimes compiling from source ./configure, make and make install ... seems soo much simplier!


¿Pero, Por que?

Offline

#9 2004-03-03 20:18:51

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: I am lost with understanding the Arch Build System

jimdaworm wrote:

Edit: its funny to think that sometimes compiling from source ./configure, make and make install ... seems soo much simplier!

but this makes tracking of installed materail very difficult as many source packages do not have uninstall scripts and it basically renders a package manager useless.  the more self compiled packages you introduce to the system the more you can create problems for your package manager..

the reason your local repository was not working was not because of  your commands necessarily but in your description you did not mention if you accually created a database of what was in your repo with gensync. 

basically you put your packages in  your local repo make sure the build directories for them are in /var/abs/local  then gensync (to for example of how to use gensync see the pacman manpage) . if you don't have any sort of reference of what is in your repo then pacman will not "see" anything in that repo nor will any dependency solving be present because the data is not there.

you can use you cache as a local db but it can get messy.


AKA uknowme

I am not your friend

Offline

#10 2004-03-03 20:36:54

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

but this makes tracking of installed materail very difficult as many source packages do not have uninstall scripts and it basically renders a package manager useless. the more self compiled packages you introduce to the system the more you can create problems for your package manager..

Exactly! Easy to install... more complicated to uninstall!

the reason your local repository was not working was not because of your commands necessarily but in your description you did not mention if you accually created a database of what was in your repo with gensync.

Hey I did try to do a gensync... but is said some error about there not being a file in the /var/abs/local (I think that was the error from memory)

make sure the build directories for them are in /var/abs/local then gensync


I don´t understand the above...what are the build directories, and how do I get them from my cd/cd pacakges???

Oh  :cry:  After reading the above posts I though thatI could just put the package files off the cd in the cache directory and be done with it!

Thanks for your help and patience!
Adam


¿Pero, Por que?

Offline

#11 2004-03-03 22:18:30

calexico
Member
Registered: 2004-02-11
Posts: 32

Re: I am lost with understanding the Arch Build System

Well, I'm not quite sur of what you want to do :
- install packages from the install cd of the 0.6 version
- you've got an installed version and a slow connection and want a way to download packages at work to install them later at home (I imagine that you might burn them on a cdrw or something like that)

Well in fact the second case take into account the first one. What you must understand is how pacman works with dependencies and package repositories in general.

When you run pacman -Sy, pacman download little files from each repository. These files are databases of what the repository contains, that is all the PKGBUILD files for each package present. You can imagine it as your abs tree gzipped (actually the reality is probably different, but I think that it's a good way to see it). Go to /var/abs and you'll see folders with subfolders and inside PKGBUILD files. first level folders are the category (multimedia, etc) and second level folders are the packages.

What sarah31 wanted to say was that when you put :

 Server = file:///pkgs/ 

You add a repository, and this repository needs an associated database which would contain all the informations needed by pacman to know what's there and how it can be handled (dependencies).

You understand that PKGBUILD file contains everything needed to build a dependency tree : you read the dependencies of the soft you want to install, and for each dependency you do the same etc..

So when you want to install something, pacman reads into his databases the dependencies of the soft and build the dependencies tree. To install the soft you need to download all these packages.

My personal advice (hope that some may have other ideas) is :
- think about what are the packages you need, let say it's kde, openoffice and mplayer.
- connect to the internet
- run pacman -Sy to sync
- run pacman -S kde openoffice mplayer
- pacman will tell you I must install a b c d e f g ...
- write this
- go to work
- download a b c d e f g ... (some packages might be in extra)
- go back home
- put everything in /tmp/whatever
- go to /tmp/whatever
- do pacman -A *
- good luck (but it should works)

Offline

#12 2004-03-04 05:03:33

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: I am lost with understanding the Arch Build System

if you look on the web interface of the ftp site and venture into the repository directories one of the files you will see listed is "current.db.tar.gz" . within this zipped directory is all the metadata of all the packages in the repository.

when you run abs it creates a directory /var/abs within this directory are all of the diretories that contain the files used to build a package. the main file used for building is the PKGBUILD. in the PKGBUILD is all the data such as the version of the application, release version, and dependencies. all of that data is the data that gets read when you run gensync and create your .db.tar.gz file.

now when you run a pacman -Syu pacman reads this file and compares it to the versions you have installed and if there are differences it will tell you what needs upgrading


AKA uknowme

I am not your friend

Offline

#13 2004-03-04 20:28:42

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Thanks sarah31 ... I am just going to browse though this forum.... and read everything I can that way in a week or so I should understand how it all works!

Just a quick question....

so these files for example hwd-1.6-2.pkg.tar actually has the details of how it needs to be installed inside it, dependencies etc.

I copy this file to my local directory /pkg/
(which is set up as specified in the manual in the /etc/pacman.conf file)

I run gensync (pacman --gensync??) and this creates a  .db.tar.gz database in my /pkg/ directory off all the files in this directory.

Then when I type pacman -Sy this looks in the /pkg/ directory at this .db.tar.gz file and  updates my /var/abs (which has all the details on how to build all the files in /pkg/ directory)

Somthing like that?

Anyway I am off to read stuff in this forum.
Thanks Again
Adam


¿Pero, Por que?

Offline

#14 2004-03-04 21:27:40

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: I am lost with understanding the Arch Build System

jimdaworm wrote:

so these files for example hwd-1.6-2.pkg.tar actually has the details of how it needs to be installed inside it, dependencies etc.

yes they have meta data but all *.pkg.tar.gz also contain the files necessary for the application to.

I copy this file to my local directory /pkg/
(which is set up as specified in the manual in the /etc/pacman.conf file)

yes.

I run gensync (pacman --gensync??) and this creates a  .db.tar.gz database in my /pkg/ directory off all the files in this directory.

no not really. what you would do is that for every package you place in your local repository you would go into abs and find its build directory (for example if you had glibc in your local repository you would find glibc's build directory in /var/abs/base) and copy it to /var/abs/local/ . when you have copied all of the build directories over to /var/abs/local/ you would then run :

gensync /var/abs/local /path/to/your/packages/custom.db.tar.gz

you may have to change the "custom" to local or whatever you named your repository in pacman.conf. 

Then when I type pacman -Sy this looks in the /pkg/ directory at this .db.tar.gz file and  updates my /var/abs (which has all the details on how to build all the files in /pkg/ directory)

whan you type pacman -Sy it reads your cusom/local.db.tar.gz and the metadata in your packages and makes sure they match. you only need abs in the gensync step.  BUT you do have to make sure your abs matches the the versions of your packages. for example if you see that glibc is upograded and you download it and then put it in your custom repo you will have to first run abs then transfer the glibc build directory to your var/abs/local/ again then run gensync then pacman -Syu and glibc will upgrade and so forth.


AKA uknowme

I am not your friend

Offline

#15 2004-03-05 14:12:58

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Hey again Sarah31.

I have had a look in my /var/abs/ directory and there is only one directory /var/abs/local and it doesn´t have anything in it I also note the absence of a /var/abs/base directory.

I guessed that I needed to do a abs but I typed abs and got the below message:
Name lookup failure for "cvs.archlinux.org": Host name lookup failed
Name lookup failure for "cvs.archlinux.org": Host name lookup failed

Do you have to be connected to internet to do abs?? Or is there some way I can change the abs.conf so I don´t need to be connected??

Thanks a lot for you help

BTW quoting the Arch Linux Documentation 6.5 How can I install packages from the install CD with pacman -sync (so it resolves dependencies for me)?

Edit /etc/pacman.conf add Server = file:///mnt/cd (where mnt/cd is your package directory) then use pacman --sync as you normally would is this missing a step??  Like that you have to do abs first??  Connected to Internet??

Adam


¿Pero, Por que?

Offline

#16 2004-03-05 14:29:48

calexico
Member
Registered: 2004-02-11
Posts: 32

Re: I am lost with understanding the Arch Build System

Yes you need to be connected to do abs because running abs synchro you abs tree with the abs server smile

Offline

#17 2004-03-05 16:03:27

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: I am lost with understanding the Arch Build System

well ideally you should conect to download you abs data but i suppose if you wanted to download on another machine and save it to disc then copy it over to your home machine that would work too. all you have do is make sure that what ever you are syncing matches.


AKA uknowme

I am not your friend

Offline

#18 2004-03-05 19:35:04

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Thanks very much sarah31 and calexico that was the missing link for me smile

What do you guys think about the manual?? Shouldn´t it give some reference to this... as after all I guess lots of people (if there are lots without internet ) who want to install the packages locally (like me) will need to do this.

Maby they could even include it in the cd??

Maby you shouldn´t listen to me ... maby I am rambling  :shock:

Adam


¿Pero, Por que?

Offline

#19 2004-03-05 21:44:27

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: I am lost with understanding the Arch Build System

well i don't know about being in th install manual but it could definitely be one of the howto's in the wiki.


AKA uknowme

I am not your friend

Offline

#20 2004-03-05 21:57:41

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Sorry my last message was a little unclear I ment maby they should include the abs tree in the cd.


Hey I didn´t know about the  wiki ... just reading stuff there now!

Adam


¿Pero, Por que?

Offline

#21 2004-03-05 22:45:14

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: I am lost with understanding the Arch Build System

well the abs tree on cd would only be good for what is on the cd not for any upgrades you may do. you could feature request it through the bugtracker the worst they can do is say no.


AKA uknowme

I am not your friend

Offline

#22 2004-03-05 22:48:57

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Might just do... that would have been handy for me, but then again majority rules!

Thanks again for all the help... I am downloading PKGBUILD files from this site and their respective .tar.gz files which I am going to burn on my cdrw and take home with me tonight... figures crossed I am starting to understand!  wink

Adam


¿Pero, Por que?

Offline

#23 2004-03-05 22:53:14

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: I am lost with understanding the Arch Build System

good luck


AKA uknowme

I am not your friend

Offline

#24 2004-03-05 23:39:41

calexico
Member
Registered: 2004-02-11
Posts: 32

Re: I am lost with understanding the Arch Build System

Well I started a page on the wiki : http://wiki.archlinux.org/index.php/Pac … %20Makepkg where I'll try to put everything there. Might be completed in two or three days.

Offline

#25 2004-03-05 23:42:17

jimdaworm
Member
Registered: 2004-02-29
Posts: 17

Re: I am lost with understanding the Arch Build System

Hey I read that.  Its great!  I am waiting for you to finish it off  wink

Adam


¿Pero, Por que?

Offline

Board footer

Powered by FluxBB