You are not logged in.

#1 2003-11-13 20:00:42

ipqw
Member
From: Denmark
Registered: 2003-11-02
Posts: 24
Website

Pacman2 - a pacman wrapper which provides proxy support

Hi all!

Due to my private need for Pacman supporting proxy, I have made a small Ruby script called Pacman2, which do just that. The script is for made solely for my own benefit, but it is general usefull for users who are behind a proxy. Pacman2 can quite easily, thanks to the design of Arch packages, be expanded to provide the full functionality of Pacman as we know it today.

If you are interested, take a look at: http://www.cs.auc.dk/~ks/pacman2.shtml


Cheers, Kristian Sørensen.

Offline

#2 2003-11-14 03:29:43

sud_crow
Member
From: Argentina
Registered: 2003-06-30
Posts: 546
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

Hi, well, i think is a good idea, but i was thinking that the "pacman2" name, may confuse other people...

Also i came up with an easy name for it: Proxyman

wouldnt that be more suitable? or maybe, just ask nicely to apeiro giving that function to pacman, now that the only thing he would need to do, is check, copy and paste the code.


Leonardo Andrés Gallego
www.archlinux-es.org || Comunidad Hispana de Arch Linux

Offline

#3 2003-11-14 04:05:21

hughchen
Member
From: ShenZhen,GD,China
Registered: 2003-11-06
Posts: 10
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

1.when I su to root and run the script,it says i must be root to run this script.
2.surprisingly,i have to remove the --passive-ftp option to get wget download
    files correctly.
3.when i tried to install a package,i got:
              [root@chenjf pacman2]# ./pacman2 -S gtkmm
              searching for gtkmm
              adding gtkmm--2.2.8-1 for download
              resolving dependency, adding libsigc++2 for download
              ./pacman2:107:in `resolveDependencies': nested *?+ in regexp: /libsigc++2/ (RegexpError)
                   from ./pacman2:101:in `each'
                   from ./pacman2:101:in `resolveDependencies'
                   from ./pacman2:100:in `each'
                   from ./pacman2:100:in `resolveDependencies'
                   from ./pacman2:184

Offline

#4 2003-11-14 13:11:01

ipqw
Member
From: Denmark
Registered: 2003-11-02
Posts: 24
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

Hi Hughchen!

hughchen wrote:

1.when I su to root and run the script,it says i must be root to run this script.

I guess that is a shell problem. The script reads the USER variable in your shell in order to determine your username... if somehow this variable is not avilable the script will exit. Which shell are you using and what does the commend "env" produce?

hughchen wrote:

2.surprisingly,i have to remove the --passive-ftp option to get wget download files correctly.

This is most certainly a problem of your connection. Actually most times passive ftp will succeed when "normal" will not.

hughchen wrote:

3.when i tried to install a package,i got:
              [root@chenjf pacman2]# ./pacman2 -S gtkmm
              searching for gtkmm
              adding gtkmm--2.2.8-1 for download
              resolving dependency, adding libsigc++2 for download
              ./pacman2:107:in `resolveDependencies': nested *?+ in regexp: /libsigc++2/ (RegexpError)
                   from ./pacman2:101:in `each'
                   from ./pacman2:101:in `resolveDependencies'
                   from ./pacman2:100:in `each'
                   from ./pacman2:100:in `resolveDependencies'
                   from ./pacman2:184

This sound mysterious. Are you using the newest version of Ruby?
Try inserting: puts "DEBUG: " + search
into line 105 (right after the IF). What does this produce?

Anyone else got this problem?

Cheers, KS.

Offline

#5 2003-11-14 13:14:47

ipqw
Member
From: Denmark
Registered: 2003-11-02
Posts: 24
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

sud_crow wrote:

Hi, well, i think is a good idea, but i was thinking that the "pacman2" name, may confuse other people...

Also i came up with an easy name for it: Proxyman

That might be a good idea smile Thanks for your input!

sud_crow wrote:

wouldnt that be more suitable? or maybe, just ask nicely to apeiro giving that function to pacman, now that the only thing he would need to do, is check, copy and paste the code.

Well the original pacman program is written in pure C, so copy paste code is not an option sad

I could not get an overview of the pacman code, and I needed the proxy support. It is overkill to implement such simple behaveour in C, so there fore the Ruby script smile


Cheers, KS.

Offline

#6 2003-11-15 04:00:35

sud_crow
Member
From: Argentina
Registered: 2003-06-30
Posts: 546
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

That might be a good idea  Thanks for your input!

You'r welcome!

Well the original pacman program is written in pure C, so copy paste code is not an option

I could not get an overview of the pacman code, and I needed the proxy support. It is overkill to implement such simple behaveour in C, so there fore the Ruby script


Ooops! didnt knew that! well then, guess your ¿modification? will be very usefull for everyone using a proxy. Including me in some time from now wink


Leonardo Andrés Gallego
www.archlinux-es.org || Comunidad Hispana de Arch Linux

Offline

#7 2003-11-15 15:55:23

ipqw
Member
From: Denmark
Registered: 2003-11-02
Posts: 24
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

To those using pacman2, please download the new release, which includes a fix for downloading from unofficial mirrors. This failed before due to a type error yikes)

Offline

#8 2003-11-17 03:05:08

Guest
Guest

Re: Pacman2 - a pacman wrapper which provides proxy support

ipqw wrote:

Hi Hughchen!

hughchen wrote:

1.when I su to root and run the script,it says i must be root to run this script.

I guess that is a shell problem. The script reads the USER variable in your shell in order to determine your username... if somehow this variable is not avilable the script will exit. Which shell are you using and what does the commend "env" produce?

hughchen wrote:

2.surprisingly,i have to remove the --passive-ftp option to get wget download files correctly.

This is most certainly a problem of your connection. Actually most times passive ftp will succeed when "normal" will not.

hughchen wrote:

3.when i tried to install a package,i got:
              [root@chenjf pacman2]# ./pacman2 -S gtkmm
              searching for gtkmm
              adding gtkmm--2.2.8-1 for download
              resolving dependency, adding libsigc++2 for download
              ./pacman2:107:in `resolveDependencies': nested *?+ in regexp: /libsigc++2/ (RegexpError)
                   from ./pacman2:101:in `each'
                   from ./pacman2:101:in `resolveDependencies'
                   from ./pacman2:100:in `each'
                   from ./pacman2:100:in `resolveDependencies'
                   from ./pacman2:184

This sound mysterious. Are you using the newest version of Ruby?
Try inserting: puts "DEBUG: " + search
into line 105 (right after the IF). What does this produce?

Anyone else got this problem?

Cheers, KS.

I had some time to kill yesterday,so I went through the pacman2 script
and had the following findings:
1.I think "`whoami`" should be used to determine the username instead of
"`echo $USER`' since if a normal user switch to root by su,"`echo $USER`"
return the name of the original normal user instead of root.
2.The script currently can't handle some packages correctly whose names
contain special charaters like +,that is why I can't install gtkmm with
this script since the gtkmm pakcage depends on libsigc++2 package whose
name contains + and then I got a regular expression error message.I think
we should search the package name and add a "" prefix to the special
charaters if any.
3.Looking through the script,I found several line codes to remove the
leading hyphenation of a package version,but in fact,the leading "-"
of the package version still there and that lead to an annoysing "file
not found" problem when downloading the package.I think it must be the
problem of the following line:
      version = pkgPath.at(1).reverse.chomp.reverse
but there's nothing I can help there since I'm not a Ruby programmer.

#9 2003-11-17 20:17:10

ipqw
Member
From: Denmark
Registered: 2003-11-02
Posts: 24
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

Hi,

Anonymous wrote:

1.I think "`whoami`" should be used to determine the username instead of
"`echo $USER`' since if a normal user switch to root by su,"`echo $USER`"
return the name of the original normal user instead of root.

That is right, I've corrected is now.

Anonymous wrote:

2.The script currently can't handle some packages correctly whose names
contain special charaters like +,that is why I can't install gtkmm with
this script since the gtkmm pakcage depends on libsigc++2 package whose
name contains + and then I got a regular expression error message.I think
we should search the package name and add a "" prefix to the special
charaters if any.

You're right. I have forgot to escape package names when using them as search string in a regular expression. That is also fixed now.

Anonymous wrote:

3.Looking through the script,I found several line codes to remove the
leading hyphenation of a package version,but in fact,the leading "-"
of the package version still there and that lead to an annoysing "file
not found" problem when downloading the package.I think it must be the
problem of the following line:
      version = pkgPath.at(1).reverse.chomp.reverse
but there's nothing I can help there since I'm not a Ruby programmer.

That error was allready corrected in the version available for download smile The error was that I accidently used "chomp" in stead of "chop" in the above line. Chomp removes n, t and others from the end of the line. Chop just removes the last character, and this is needed to remove '-'.

Thanks a lot for your input!! An updated version is available on http://www.cs.auc.dk/~ks/pacman2.shtml


Cheers, ipqw.

Offline

#10 2003-11-18 03:02:26

hughchen
Member
From: ShenZhen,GD,China
Registered: 2003-11-06
Posts: 10
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

ipqw wrote:

Hi,


Thanks a lot for your input!! An updated version is available on http://www.cs.auc.dk/~ks/pacman2.shtml


Cheers, ipqw.

You're welcome,ipqw.You've really done a great job!And now I
am wondering  if I can update an installed package with this
script.But when I try to update an installed package xxx with
this script.I got a "package xxx already installed" message and
the script exits.Does this script can only install new package or did I do someting wrong?

P.S. I forgot to login when I posted my last message.

Offline

#11 2003-11-18 21:51:55

ipqw
Member
From: Denmark
Registered: 2003-11-02
Posts: 24
Website

Re: Pacman2 - a pacman wrapper which provides proxy support

Hi again yikes)

hughchen wrote:

You've really done a great job!And now I
am wondering  if I can update an installed package with this
script.But when I try to update an installed package xxx with
this script.I got a "package xxx already installed" message and
the script exits.Does this script can only install new package or did I do someting wrong?

Thanks a lot! wink

At present, I have not made the implementation for automatic updates of allready installed packages. However you might download the packages, using pacman2, and when the script fails, then manually use the original pacman to install the packages like:
(cd /var/cache/pacman/pkg; pacman -U pkg_1 pkg_2 .. pkg_n)

I will post to this thread, if/when this feature is implemented. It is a rellatively simple expanding of the script, so if you - or anyone else would like to implement the feature, just send me a patch, and I'll update the homepage smile

Cheers, ipqw.

Offline

Board footer

Powered by FluxBB