You are not logged in.

#1 2003-10-04 08:46:22

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

makeworld script that only rebuilds YOUR packages - DONE

**************************************************************
Edit 3:

makelocal 0.2-1 is available and is the current release.  Please see the last post in this topic for more info
***************************************************************


************************************************************
EDIT 2
************************************************************




*******************************************************************
EDIT - I made a second version of the script that uses python's built in regular expression module, which eliminates the sed dependency, please see the SECOND post in this thread for the updated script
*******************************************************************

Hey everyone,

I saw that most of the people using makeworld were wishing that they could run makeworld and have it only build the packages that they actually have installed.

I don't use makeworld myself, but I thought it would be fun to see what I could come up with.  I started making it in bash, but I quickly gave that up and switched to python.  So, here are the requirements:

1.  python:  pacman -S python
2.  sed:  pacman -S sed (no longer necessary with new script in second post)
3.  abs installed in /var/abs

DIRECTIONS:

1.  copy the python script below to a directory of your choice.  You could also copy it to /usr/bin if you want to be able to call it from any directory.  You can call it whatever you want to.  Let's say mwc.py (for makeworldcustom).

2.  change directories to the directory containing the script.  This is also the directory in which another directory will be created that contains all your package directories and their PKGBUILDs.

3.  chmod 755 mwc.py

4.  ./mwc.py

The script with then create a directory called makeworldcustom within the directory that you are executing the script in.  It will determine all the packages you have installed, and find their corresponding PKGBUILD files and any other files that should go with them from /var/abs.

Here is sample output

[john@limbo makeworldcustom]$ ./mwc.py
Found a2ps... Copying directory contents
Found a52dec... Copying directory contents
Found acroread... Copying directory contents
Found alsa-driver... Copying directory contents
Found alsa-lib... Copying directory contents
Found alsa-utils... Copying directory contents
Found anjuta... Copying directory contents
Found apache... Copying directory contents
Found artwiz-fonts... Copying directory contents
Found aspell... Copying directory contents
Found aspell-en... Copying directory contents
Found aterm... Copying directory contents
Found atk... Copying directory contents

Found audiofile... Copying directory contents
Found autoconf... Copying directory contents
Found automake... Copying directory contents
Found avifile... Copying directory contents
Found bash... Copying directory contents
Found bc... Copying directory contents
Found bin86... Copying directory contents
Found binutils... Copying directory contents
Found bison... Copying directory contents
Found bittorrent... Copying directory contents

Then, you can invoke makeworld with the following:

makeworld /path/where/you/want/packages/to/end/up makeworldcustom/

If you experience any problems, please let me know, because it is now 0400 hrs (in the morning), and my brain may not realize that things aren't working properly.

Good luck, and enjoy!

#####  This code has been replaced by another script that uses python's reg exps
#!/usr/bin/env python

import sys,os

def getinstalled():
        installed = os.popen('pacman -Q | sed "s/ .*//"').readlines()
        installed = [file[:-1] for file in installed]
        return installed
        
def copyPKGBUILDs(installed):
        for package in installed:
                checklist = os.popen('find /var/abs -iname "*%s*"' %(package)).readlines()
                checklist = [checkfile[:-1] for checkfile in checklist]
                for possible in checklist:
                        if (os.path.basename(possible) == package) and (checkPKGBUILD(possible)):
                                try:
                                        print "Found %s" %(package) + "... Copying directory contents"
                                        os.popen('mkdir makeworldcustom/%s' %(package,))
                                        os.popen('cp %s/* makeworldcustom/%s -r' %(possible,package))
                                except:
                                        print "error copying contents"
                
def checkPKGBUILD(possible):
        test = os.path.isfile(possible + "/PKGBUILD")
        return test

os.popen('mkdir makeworldcustom')
installed = getinstalled()
copyPKGBUILDs(installed)

Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#2 2003-10-04 15:31:23

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

#!/usr/bin/env python

import sys,os,re

def getinstalled():
        installed = os.popen('pacman -Q').readlines()
        installed = [file[:-1] for file in installed]
        p = re.compile(' .*')
        j = 0
        for i in installed:
                installed[j]=p.sub('',i)
                j = j + 1       
        return installed
        
def copyPKGBUILDs(installed):
        for package in installed:
                checklist = os.popen('find /var/abs -iname "*%s*"' %(package)).readlines()
                checklist = [checkfile[:-1] for checkfile in checklist]
                for possible in checklist:
                        if (os.path.basename(possible) == package) and (checkPKGBUILD(possible)):
                                try:
                                        print "Found %s" %(package) + "... Copying directory contents"
                                        os.popen('mkdir makeworldcustom/%s' %(package,))
                                        os.popen('cp %s/* makeworldcustom/%s -r' %(possible,package))
                                except:
                                        print "error copying contents"
                
def checkPKGBUILD(possible):
        test = os.path.isfile(possible + "/PKGBUILD")
        return test

os.popen('mkdir makeworldcustom')
installed = getinstalled()
copyPKGBUILDs(installed)

Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#3 2003-10-05 16:22:52

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

Re: makeworld script that only rebuilds YOUR packages - DONE

red_over_blue,

While I have as yet to try it, this is a very interesting script. Here's one user that's interested anyway. smile

You say:

I started making it in bash, but I quickly gave that up and switched to python.

Help me understand why it was that you made that decision, will you please.

Regards.

jlowell

Offline

#4 2003-10-05 21:58:00

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

Why did I chose python?  To be honest, just a couple reasons:

1.  I want to learn more python.  I knew I would learn a few new things taking on this little problem.

2.  If I want to incorporate this script into some larger project, it will be very easy.

3.  I don't do much bash programming, so I would have had to spend some time just learning some things that I already knew how to do with python.

4.  Python is simply fun to program in.  If you haven't tried it, and are interested in learning a new language, give it a go.


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#5 2003-10-12 23:22:13

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

******************************************************
EDIT:

makelocal 0.2-1 is available and is the current release.  Please see the last post in this topic for more info
*******************************************************

Hello fellow Archers,


Well, I have done some more work on the script, now semi-officially called makelocal.  It now has a CLI menu that allows the user to remove packages from the list of installed packages.  It will also display the command necessary to build the packages that makelocal creates the directory structure for. 

Also, I packaged it up into an Arch package so that it is easy to install/remove when desired.  It creates the symbolic link /usr/bin/makelocal so there is no need to copy the script around.  Simply change directories to a directory with alot of room, and execute "makelocal".  It will create two directories, one for the PKGBUILDs and another for the finished packages. 


I hope anyone who regularly uses makeworld will find this script useful.

Also, if you find any bugs, and I'm sure there are some, please respond in this thread and I will attempt to fix them.

Thanks, and good luck



red_over_blue


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#6 2003-10-13 01:22:25

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

Re: makeworld script that only rebuilds YOUR packages - DONE

red_over_blue,

Now lets make sure I understand things. We download the makelocal script package to a directory of our choosing, say, /home, and, since this is an Arch package, we run

pacman -S makelocal

as root and it installs to /usr/bin. We then select a directory to which /usr/bin/makelocal will be linked and which will accept both the PKGBUILDs and the finished packages. From that directory we run

makelocal

and the script executes? Have I got this right?

jlowell

Offline

#7 2003-10-13 01:56:13

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

jlowell,

You can download the arch package to whichever directory you wish.  To use pacman on a local package, you use the following (as root):

pacman -A /path/to/package/packagename

This will install everything for you.  All you have to do now is go to some directory that has alot of room that you want to build all you packages in.  Then just type "makelocal" and the script will launch. 

Just to be clear, after you use pacman to install the package, you _do_not_ need to make any symbolic links yourself or copy the script anywhere, this is all done automagically by the package I made.  If you type "makelocal" in any directory, the script will run.

I look forward to hearing how it works for you.  Also, please let me know if the menu is intuitive enough. 

Thanks in advance,


red_over_blue


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#8 2003-10-13 19:47:46

jlvsimoes
Member
From: portugal
Registered: 2002-12-23
Posts: 392
Website

Re: makeworld script that only rebuilds YOUR packages - DONE

this is a most excelent tool


-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GU/ d- s: a- C L U P+ L+++ E--- W+
N 0+ K- W-- !O !M V-- PS+ PE- V++ PGP T 5 Z+ R* TV+ B+
DI-- D- G-- e-- h! r++ z+ z*
------END GEEK CODE BLOCK------

Offline

#9 2003-10-21 23:03:18

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

Re: makeworld script that only rebuilds YOUR packages - DONE

I was wondering if you could add an option to it to upgrade the packages you've just rebuilded


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 2003-10-21 23:42:08

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

kakabaratruskia,

You should just be able to do something like the following, after the packages are built.

cd finishedpackages
pacman -U `ls`

Note - those are back-quotes in `ls`(on my keyboard, the key just below esc).  I haven't tested this, but I don't see why it woudn't work.


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#11 2003-10-22 00:46:32

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

Re: makeworld script that only rebuilds YOUR packages - DONE

Wouldn't it be easier to

pacman -U *.pkg.tar.gz

?


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

#12 2003-10-22 01:28:15

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

Xentac wrote:

Wouldn't it be easier to

pacman -U *.pkg.tar.gz

?

Thanks Xentac, that would be easier.


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#13 2003-10-22 01:52:22

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

Re: makeworld script that only rebuilds YOUR packages - DONE

right, thanks.


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

#14 2003-10-23 03:21:04

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

Re: makeworld script that only rebuilds YOUR packages - DONE

red_over_blue,

I'm finally getting to this project. I've got the Arch package you made downloaded and installed. But I'm a little confused about the comments immediately above. Once the packages are built they are not installed a la makepkg -bci? You need to run pacman -U to install/upgrade? Help me with what's happening here kindly.

jlowell

Offline

#15 2003-10-23 03:53:37

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

jlowell wrote:

red_over_blue,

I'm finally getting to this project. I've got the Arch package you made downloaded and installed. But I'm a little confused about the comments immediately above. Once the packages are built they are not installed a la makepkg -bci? You need to run pacman -U to install/upgrade? Help me with what's happening here kindly.

jlowell

if you run makeworld -bci it will infact install the packages upon successful build.  However, if someone just runs makeworld without any args, then just the packages will be built.  If they then want to install them, the have to "pacman -U *.pkg.tar.gz" as in the previous post.

That's part of the reason I didn't have makelocal run makeworld, since everyone is going to want to use it differently.


Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#16 2003-11-08 04:24:21

red_over_blue
Member
Registered: 2003-07-19
Posts: 152

Re: makeworld script that only rebuilds YOUR packages - DONE

Ok, makelocal 0.2-1 is available, and has alot of enhancements:

1.  Much improved interface
2.  Ability to read a packagelist from a plain text file.  Simply create a plain text file with line delimited packages (a package for each line) and you have the option to read from this file to create your packagelist.  Example file:

aterm
rxvt
ncftp

3.  Ability to change ABS directory, to use your local PKGBUILDs for example.  Note, only one abs source is available per makelocal session.

Here is a sample of the interface:

MakeLocal v0.2
                                                                                                                                               
Note:  The following directories will be created:
                                                                                                                                               
/usr/src/abs/PKGBUILDdir
/usr/src/abs/finishedpackages
                                                                                                                                               
                                                                                                                                               
Options
-------
                                                                                                                                               
(f) Import package list from file
(i) Create package list using currently installed packages
(v) View package list to be built
(e) Edit package list to be built
(c) Create directory structure for building
(b) Build command to start makeworld (makelocal will exit)
(n) New ABS directory root: /var/abs
(q) Quit
                                                                                                                                               
Usage: (General Guide)
                                                                                                                                               
1. Create/Import package list
2. Edit if necessary
3. Create directory structure for building
4. View build command for makeworld (makelocal exits automatically)
                                                                                                                                               
Selection: _

Don't forget to post your PKGBUILD in your thread when you announce a new package in incoming.
see HERE for details

Offline

#17 2009-08-11 04:28:45

wankel
Member
From: Iowa, USA
Registered: 2008-05-30
Posts: 218
Website

Re: makeworld script that only rebuilds YOUR packages - DONE

I know this is from a million years ago, but does anyone have this script or something similar? Ive already tried pacbuilder and Im looking to explore other options trying to recompile my entire system. Thanks!

Offline

Board footer

Powered by FluxBB