You are not logged in.

#1 2004-07-23 15:12:49

tehdely
Member
Registered: 2004-02-20
Posts: 148
Website

[PATCH] Some changes I made to Pacman

I decided to hack on Pacman last night and make a few changes that I wanted.  Since I'm too lazy to retype my email to Judd, I'll just repost it here along with my patch.  I think it would be nice if a few people gave these changes a shot and sent me back some feedback; the decision is of course Judd's whether these changes actually end up being integrated into Pacman, but if lots of people like them it may improve my chances tongue

So, what have I changed?

Pacman now looks in /etc/pacman.conf for a line entitled Pacfiles.  It
might look like this:

Pacfiles = (current extra unstable !release)

I went for consistency with the rest of Arch's init and configuration
scripts, so I used bash-like syntax (even though it is clearly
arbitrary as far as Pacman is concerned).

Pacman looks in /etc/pacman.d for the files corresponding to those
labelled in the Pacfiles line.  These files can contain any number of
repositories, but nothing that belongs in the [Options] section
(likewise, pacman.conf can no longer contain repositories).

But what of all the custom repositories I use, asks the befuddled Arch
Linux user?  Well, do as I do.  Throw them in /etc/pacman.d/local
(that's the name I chose) and enable it in the pacfiles line.  Easy smile

I did this mainly to scratch an itch of mine, which is that I hate
having to redo pacman.conf every time something changes in the
official repositories (or on those occasions when pacman is upgraded
and installs a new pacman.conf).  This way, all my personalized stuff
can go in one file, and the mirror lists for official Arch
repositories can be upgraded transparently, with no disruption.
Likewise, this means that pacman.conf will now rarely have to be
upgraded at all, as most of the changes that might take place between
versions will take place in /etc/pacman.d.  Furthermore, this makes it
even simpler to add other peoples' repositories.  One can simply
distribute a pacfile, and then instruct the user to enable it in
pacman.conf.  I'm hoping in the future that repositories can be
distributed as packages which contain a pacfile and a supfile, for
easy installation and building.

Other peoples' itches were also scratched.  Xentac wanted to be able
to modify core repositories (to enable special ones that only he uses)
without having to edit more than one file.  Hence, I have made it
possible for a particular labelled section to appear more than once...
If you have a line in /etc/pacman.d/local that reads:

[extra]
Server = http://my.secret.ultra.fast.mirror

And also have the "extra" pacfile enabled, it will simply add the two
server lists together.

Contrasutra wanted to easily disable repositories.  Thus, I added an
IgnoreRepo directive, which should be self-explanatory.

I also scratched a little itch of mine and added a "--nobuild" option
to makepkg.  It vastly simplifies packaging when I can have makepkg
fetch and extract the sources and no more, thus allowing me to modify
them/generate patches/etc before I do a full build.  Apparently some
people have been asking for this but noone has gone so far as to make
this very trivial change in makepkg.

The included patch should apply cleanly against the pacman-2.8.2
source directory.  It includes a modified /etc that fits with Pacman's
new behavior (and a modified Makefile.in which installs it).

I hope you like what I've done.  I have some more ideas in the works
but they are more comprehensive, and would be better off in a Pacman
3.0 release.

Link to patch

PKGBUILD:

# $Id: PKGBUILD,v 1.88 2004/07/22 17:28:48 judd Exp $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=pacman
pkgver=2.8.2
pkgrel=2t2
pkgdesc="A .tar.gz based package manager with dependency support"
url="http://www.archlinux.org/pacman"
backup=('etc/pacman.conf' 'etc/makepkg.conf' 'etc/abs/abs.conf')
makedepends=('libtar')
install=pacman.install
source=(ftp://ftp.archlinux.org/other/pacman/$pkgname-$pkgver.tar.gz 
  http://www.archlinux.org/pacman/sortmirrors.pl 
  supfile.arch supfile.extra supfile.unstable abs abs.conf pacman-dely.patch)
md5sums=('a2c4ab480c5824bbc394ae63859f0fd7' 'ea1b2611e0c38be802861da0edba44f8'
         '2c564a8760ec0dac96082f1855d153d1' 'f83885f6c431e4e7f8b131fe444ac0d2'
         '9a44663da93a07c8df42741ea0e41930' '0025f9f786d50201951fc7444207a089'
         '5dfcce0aa5e121936c002e555d6fb55e' 'b4de1996d7180d9640fde9e8ffe7e880')

build() {
  cd $startdir/src/$pkgname-$pkgver
  patch -p1 < $startdir/src/pacman-dely.patch
  ./configure --prefix=/usr
  make || return 1
  make DESTDIR=$startdir/pkg install
  mkdir -p $startdir/pkg/var/abs/local
  install -D -m755 ../sortmirrors.pl $startdir/pkg/usr/bin/sortmirrors.pl
  install -D -m755 ../abs $startdir/pkg/usr/bin/abs
  install -D -m644 ../abs.conf $startdir/pkg/etc/abs/abs.conf
  install -D -m644 ../supfile.arch $startdir/pkg/etc/abs/supfile.arch
  install -D -m644 ../supfile.extra $startdir/pkg/etc/abs/supfile.extra
  install -D -m644 ../supfile.unstable $startdir/pkg/etc/abs/supfile.unstable
}

[Arch GNUstep Repository] [ PKGBUILDS ]
[code][gnustep]
Server = ftp://blkwidow.lerp.com/pub/mirror/arch/gnustep[/code]

Offline

#2 2004-07-23 15:46:19

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: [PATCH] Some changes I made to Pacman

i find your ideas good - but i'm not sure if i understood everything ...

new, you have:

/etc/pacman.d/somefiles
/etc/pacman.conf

pacman.conf consists of

 
#
# /etc/pacman.conf
#

# See the pacman manpage for option directives

[options]
LogFile   = /var/log/pacman.log

NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/fstab etc/raidtab
NoUpgrade = etc/rc.conf etc/rc.local
NoUpgrade = etc/lilo.conf boot/grub/menu.lst
NoUpgrade = etc/modules.conf 
NoUpgrade = etc/pacman.conf
NoUpgrade = etc/abcde.conf
NoUpgrade = etc/httpd/conf/httpd.conf
NoUpgrade = etc/tpbrc etc/fonts/local.conf

#IgnorePkg = lilo kernel

# XferCommand = /usr/bin/sirobot.pl %u

Pacfiles = (somefile1 myrepos) 

IgnoreRepo = (release testing)

and in /etc/pacman.d/somefile1 you have e.g.

[current]
bla bla bla repos-URL's

[extra]
bla bla bla repos-URL's

and in e.g. /etc/pacman.d/myrepos

[myrepo1]
URL to myrepo1

...

is this what you mean? did i understand you right?


The impossible missions are the only ones which succeed.

Offline

#3 2004-07-23 16:39:50

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: [PATCH] Some changes I made to Pacman

sounds really interesting ...

Offline

#4 2004-07-23 17:59:37

tehdely
Member
Registered: 2004-02-20
Posts: 148
Website

Re: [PATCH] Some changes I made to Pacman

dp: Close big_smile  For now I have chosen to use Pacman's regular syntax for the IgnoreRepo line.  Here is an example pacman.conf to clarify:

[Options]
LogFile     = /var/log/pacman.log
NoUpgrade   = /etc/passwd /etc/group
HoldPkg     = pacman glibc
Pacfiles    = (myrepos current extra unstable !release !nptl)
IgnoreRepo  = contrasutra bfinch
# I would rather use the libFoo from staging than from contrasutra
# and bfinch has a broken libBar

And /etc/pacman.d/myrepos might look something like this:

# enable my GNUstep repo
[GNUstep]
Server      = file:///var/abs/gnustep.repo

# enable some TURs
[staging]
Server      = ftp://ftp.archlinux.org/tur/staging

[bfinch]
Server      = ftp://ftp.archlinux.org/tur/bfinch

[contrasutra]
Server      = ftp://ftp.archlinux.org/tur/contrasutra

[deepfreeze]
Server      = ftp://ftp.archlinux.org/tur/deepfreeze

[dp]
Server      = ftp://ftp.archlinux.org/tur/dp

[tpowa]
Server      = ftp://ftp.archlinux.org/tur/tpowa

/etc/pacman.d/current would look like:

[current]
Server = ftp://ftp.archlinux.org/current/os/i686
Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/current/os/i686
Server = ftp://ftp.archlinux.de/pub/archlinux/current/os/i686
# etc...

[Arch GNUstep Repository] [ PKGBUILDS ]
[code][gnustep]
Server = ftp://blkwidow.lerp.com/pub/mirror/arch/gnustep[/code]

Offline

#5 2004-07-23 19:56:02

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: [PATCH] Some changes I made to Pacman

ohh ... ok, very nice - excellent idea to split them in different files!! and i hope the others will like it too

on the other hand, i think that

NoUpgrade
HoldPkg
IgnorePkg
PacFiles

it would be not bad to have a unified

VarIable = ( listitem1 listitem2 ... )

or

Variable = listitem1 listitem2 ...

but not mixing the styles

but this is really a small unimportant detail that can cleanup the confusion when to use what syntax


The impossible missions are the only ones which succeed.

Offline

#6 2004-07-23 20:18:29

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: [PATCH] Some changes I made to Pacman

Is it that people read my mind, or I have no mind of my own? Just yesterday I was finding myself irritated with the length and unnavigability of pacman.conf and here's a fix ready to be added...

Thanks so much. Judd better accept it now. :-D

One thing I don't like is the way /etc always has so many files, lsing it is a real pain. If you put pacman.conf and pacman.d inside another dir, /etc/pacman, that might be more pretty... then again. you have to press tab an extra time every time you want to edit pacman.conf, and that's a pain too...

Dusty

Offline

#7 2004-07-23 20:28:41

morphus
Member
From: Braunschweig
Registered: 2003-08-06
Posts: 145

Re: [PATCH] Some changes I made to Pacman

One thing I don't like is the way /etc always has so many files, lsing it is a real pain. If you put pacman.conf and pacman.d inside another dir, /etc/pacman, that might be more pretty... then again. you have to press tab an extra time every time you want to edit pacman.conf, and that's a pain too...

there should be either one big file pacman.conf, which was also good to handle, or a directory in which the files belonging to pacman exist.

But I think that for a new user it is much more complicated to make him clear that he has to edit 2 files. Look at some other config-files, like X11's. It is definetly huge, but it would be really complicated if they splited it up into a directory and a bunch full of config files. I like it to edit just XF86Config and that's all.

Pacman IS a great program, but it is also a small one who doesn't need to have two or more config files... mho smile

Offline

#8 2004-07-23 20:37:33

tehdely
Member
Registered: 2004-02-20
Posts: 148
Website

Re: [PATCH] Some changes I made to Pacman

morphus wrote:

One thing I don't like is the way /etc always has so many files, lsing it is a real pain. If you put pacman.conf and pacman.d inside another dir, /etc/pacman, that might be more pretty... then again. you have to press tab an extra time every time you want to edit pacman.conf, and that's a pain too...

there should be either one big file pacman.conf, which was also good to handle, or a directory in which the files belonging to pacman exist.

But I think that for a new user it is much more complicated to make him clear that he has to edit 2 files. Look at some other config-files, like X11's. It is definetly huge, but it would be really complicated if they splited it up into a directory and a bunch full of config files. I like it to edit just XF86Config and that's all.

Pacman IS a great program, but it is also a small one who doesn't need to have two or more config files... mho smile

This issue has been raised by several people on IRC.  Here is my response to it.

1) For a new user, I think it is less complicated to just enable/disable pacfiles in /etc/pacman.conf, then to do what is currently required (commenting/uncommenting/deleting).
2) I used as my model Arch's init script layout.  Though it serves a totally different purpose, I appreciate the separation between /etc/rc.d, which contains scripts automatically installed by various packages, and /etc/rc.conf, in which the user enables or disables them.  With my Pacman changes, the user rarely has to poke around in /etc/pacman.d except in the case where he is using custom repositories, in which case he only really needs to edit one file (or however many he wishes... there is no limit tongue).  Most of the changes will have to be done in pacman.conf, where you can now not only enable/disable files but also ignore particular repositories with just one command (instead of laboriously commenting them out).
3) Yes, Pacman's simplicity and small size is one of its greatest features.  I think simplifying pacman.conf adds to this, as opposed to making it more complex.

And one other thing, which is really the primary reason I decided to create this patch:
4) Arch's mirrors change from time.  Recently all of the URIs were changed to point to architecture-specific directories (right now just i686).  This necessitated the replacement of pacman.conf.  Also, mirrors are occasionally added or deleted.  These changes create a lot of work for the user, who has to rebuild his pacman.conf every few months (especially the user who uses several custom repositories, and must go ahead and add them to the new file).  By separating out the most frequently-changed stuff (the core repository mirror lists) into their own files, the user is thus freed of a lot of work and his pacman.conf needs to change with much less frequency (and he only needs to edit his personal pacfile when he wishes to change it).


[Arch GNUstep Repository] [ PKGBUILDS ]
[code][gnustep]
Server = ftp://blkwidow.lerp.com/pub/mirror/arch/gnustep[/code]

Offline

#9 2004-07-23 20:47:58

kakabaratruskia
Member
From: Santiago, Chile
Registered: 2003-08-24
Posts: 596

Re: [PATCH] Some changes I made to Pacman

I like a lot your idea, as I faced the problem of rebuilding my pacman.conf a few times before. One question: How do I apply the patch? I thought of using srcpac, but didn't know the command to patch things, nor how to use sed.


And where were all the sportsmen who always pulled you though?
They're all resting down in Cornwall
writing up their memoirs for a paper-back edition
of the Boy Scout Manual.

Offline

#10 2004-07-23 20:53:11

tehdely
Member
Registered: 2004-02-20
Posts: 148
Website

Re: [PATCH] Some changes I made to Pacman

kakabaratruskia wrote:

I like a lot your idea, as I faced the problem of rebuilding my pacman.conf a few times before. One question: How do I apply the patch? I thought of using srcpac, but didn't know the command to patch things, nor how to use sed.

You can use the PKGBUILD I pasted above (it is from NPTL but I believe it is no different than the regular one), or you can just untar the pacman sources and apply it like so:

tar zxvf pacman-2.8.2.tar.gz
cd pacman-2.8.2
patch -p1 < /path/to/pacman-dely.patch

[Arch GNUstep Repository] [ PKGBUILDS ]
[code][gnustep]
Server = ftp://blkwidow.lerp.com/pub/mirror/arch/gnustep[/code]

Offline

#11 2004-07-23 21:01:25

kakabaratruskia
Member
From: Santiago, Chile
Registered: 2003-08-24
Posts: 596

Re: [PATCH] Some changes I made to Pacman

Oh, thanks., I did not realize that the PKGBUILD patched it.


And where were all the sportsmen who always pulled you though?
They're all resting down in Cornwall
writing up their memoirs for a paper-back edition
of the Boy Scout Manual.

Offline

#12 2004-07-24 06:14:03

morphus
Member
From: Braunschweig
Registered: 2003-08-06
Posts: 145

Re: [PATCH] Some changes I made to Pacman

morning,

And one other thing, which is really the primary reason I decided to create this patch:
4) By separating out the most frequently-changed stuff (the core repository mirror lists) into their own files, the user is thus freed of a lot of work and his pacman.conf needs to change with much less frequency (and he only needs to edit his personal pacfile when he wishes to change it).

This is a point for you. But we have the problem to tell the starting users that there are 2 files they have to edit: 1st pacman.conf to control the standard behaviour, and 2nd the directorys cause he wants to change the mirrors he is using. (Correct me if I understand your idea wrong since I didn't use it yet).

I always change after an update my mirror to my favourite (fast smile ) one, and since the mirror-list is also changing regurlarly, everytime this list gets updated I have to edit it.
I don't see the point that I really have less work to do. You are right with the personal repositorys, but this is making the stuff much more complicated.

nontheless thank you for working so much for arch. smile

Offline

#13 2004-07-24 20:50:41

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: [PATCH] Some changes I made to Pacman

In general, newbies don't want to worry about which mirror they're downloading from, just which repository. Once that is working, they can find the better mirror... It's a nice layout, IMO. But if Judd uses the patch, somebody has to update the docs.... *sigh*

Dusty

Offline

#14 2004-07-24 22:03:16

Haakon
Member
From: Bergen, Norway
Registered: 2004-05-09
Posts: 109

Re: [PATCH] Some changes I made to Pacman

I have to say I side with morpheus. On the other hand, I'm wary of being "feature paranoid" in the name of simplicity. On the third hand (I knew that third hand would come in handy), tehdely did a great job in its own right, and it feels impolite to suggest it be thrown away wink

I can see this point, though: When a new pacman version arrives with a new pacman.conf, it backs up your old and replaces it with a default one. This is a nuicense, but you can quickly look at the new one, see what is new and incorporate that into your trusty old one. It takes a minute, and although that's not a lot, one can argue that users shouldn't have to do it.

Judd has the final say, and I trust his judgement.


Jabber: haakon@jabber.org

Offline

#15 2004-07-25 03:14:05

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: [PATCH] Some changes I made to Pacman

Haakon wrote:

I can see this point, though: When a new pacman version arrives with a new pacman.conf, it backs up your old and replaces it with a default one.

You could NoUpgrade pacman.conf so it doesn't auto overwrite your old...

Offline

#16 2004-07-25 15:46:00

Haakon
Member
From: Bergen, Norway
Registered: 2004-05-09
Posts: 109

Re: [PATCH] Some changes I made to Pacman

Ok, cool! But what happens with the new one in that case? I'd like to be able to quickly see what new fields are allowed etc...


Jabber: haakon@jabber.org

Offline

#17 2004-07-25 16:26:54

cjdj
Member
From: Perth, Western Australia
Registered: 2004-05-07
Posts: 121

Re: [PATCH] Some changes I made to Pacman

I like this idea a lot.
Thanks!  I just hope it gets incorporated into the legit pacman.

Offline

#18 2004-07-25 19:51:06

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: [PATCH] Some changes I made to Pacman

Haakon wrote:

Ok, cool! But what happens with the new one in that case? I'd like to be able to quickly see what new fields are allowed etc...

Then the new file get saved as "pacman.conf.pacnew", so you can now vimdiff or otherwise merge whatever differences between old and new, save asif it was overwritten and saved as "pacman.conf.pacsave". I just figure it makes more sense to edit new changes into a local config rather than vice versa, as the new changes are usually smaller.

Dusty

Offline

#19 2004-08-05 01:50:12

tehdely
Member
Registered: 2004-02-20
Posts: 148
Website

Re: [PATCH] Some changes I made to Pacman

cjdj wrote:

I like this idea a lot.
Thanks!  I just hope it gets incorporated into the legit pacman.

Looks like Judd went ahead and did one better.  I like his version even more tham mine  wink


Hooray  :twisted:


[Arch GNUstep Repository] [ PKGBUILDS ]
[code][gnustep]
Server = ftp://blkwidow.lerp.com/pub/mirror/arch/gnustep[/code]

Offline

#20 2004-08-05 14:06:41

cjdj
Member
From: Perth, Western Australia
Registered: 2004-05-07
Posts: 121

Re: [PATCH] Some changes I made to Pacman

tehdely wrote:

Looks like Judd went ahead and did one better.  I like his version even more tham mine  wink

Very cool.  Now I can happilly get rid of the pacmanex tool I wrote that updates the pacman.conf file automatically with the other repositories. 

This method is much more friendly, and the repository files themselves can be in a package.

I likey.

Offline

#21 2004-08-05 20:33:51

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: [PATCH] Some changes I made to Pacman

nice work guys,  big_smile , thanks for including comments,
I prefer my repos in one file though, no need to split them up.

does this feature work with [options] also?


arch + gentoo + initng + python = enlisy

Offline

#22 2004-08-05 22:23:15

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: [PATCH] Some changes I made to Pacman

pacman just incorporated this feature...i'm not sure if using includes beats having a list.  at least having the list it is consistent with rc.conf, where modules and daemons are loaded using the list and disabled with !

in pacman.conf, currently to enable or disable we have to uncomment or comment....

ah well, same thing, minor difference.

Offline

Board footer

Powered by FluxBB