You are not logged in.

#1 2008-05-23 01:10:31

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

pkgman - a bash script for local package and PKGBUILD management

hi all,

here is a script which manages a local repository and lets you edit
PKGBUILDs and other related files, automatically generates checksums,
build packages, add them to your local repo and so on.
it also has AUR support for submitting tarballs, leaving comments, etc.

get it from here:
http://sourceforge.net/projects/pkgman/
and AUR package:
http://aur.archlinux.org/packages.php?ID=17100
you need abs, curl and pacman and optionally namcap and desktop-file-utils.

RTFM online:
http://sourceforge.net/apps/mediawiki/p … n_man_page

first of all copy the pkgman.conf and AUR.conf files from /usr/share/pkgman to ~/.config/pkgman/  or ${XDG_CONFIG_HOME}/pkgman - if ${XDG_CONFIG_HOME} is set,
edit these two files and then run

pkgman --runmefirst

pkgman doesn´t install anything. if you want it just builds the package and moves it to your local repository. install it then with pacman.
it also has no dependency handling. there are many other tools which provide this.

the main intention was to keep track of package versions, different PKGBUILD versions and own AUR submitted tarballs; also to keep a clean local repository and clean build directories.

pkgman is stable now. i´m using it for months without any issues.
however, if there are problems or feedback please post them here.

vlad

changelog:

version 2.4:
       *pkgman now respects the PKGDEST and SRCDEST variables from makepkg.conf. (though it still moves the src.tar.gz and .pkg.tar.gz to package backup directory).

version 2.5:
       *pkgman uses PKGDEST if SRCDEST not set in makepkg.conf.

version 2.6 -> r26:
       *changed version system: version 2.6 is now r26!
       *minor changes: > pkgman uses now the $SHELL variable.
                                > new and more comprehensible manpage description (thanks to bender02)

version r27:
       *changed SRCDEST since it's only a cache dir. all files (pkg.tar.gz and src.tar.gz) go to PKGDEST.

version r28:
       *added new variable ShellCommand to pkgman.conf. Default is $SHELL.
       *One might use an external application (like screen or xterm) to switch to build directory and edit files simultaneously.

version r30:
       *minor changes. nothing crucial

r32: *OverwriteExistingPackage isn't used anymore. one can delete it from ~/.config/pkgman/pkgman.conf.
       *minor changes

version r33:
       *"-l|--list" also shows installed package version and available ABS/AUR PKGBUILD version for given package.
       *"-a|--abs" can now also be used with other options (like "-e")

r39: * when backing up src.tarballs it asks whether to backup the source file or not
       * more detailed "--list" option - also shows if package is installed or not and available ABS/AUR version
       * added prompt to clean up directory after makepkg
       * when checking pkg.tar.gz also possibility to check for conflicts with files of already installed packages
       * use $PAGER instead of less
       * --help directly shows the manpage
       * --shorthelp shows a brief usage overview
       * added a custom prompt, but only when using bash (is somehow experimental - works fine here for me)
       * minor internal changes
       * pkgman also reads ~/.aurvote file for getting aur name and password. if one already uses aurvote then there is no need for the
         ~/.config/pkgman/AUR.conf file.

r40: * new manual page & rewrite of usage function
       * both option "--flush" and "--flushall" were omitted in favor of the more versatile "--cleanup" option
       * pkgman <packagename> checks now if <packagename> is owned by user
       * backup option after each editing
       * added license
       * minor internal changes

r41: * just small bug fixes, nothing crucial.

r42: * more bugs fixed.

r45: * new options added:
          >   --listversions: list local and available versions of installed packages from LocalPackages directory
          >  --getownpackages: synchronize local own packages with AUR
       * added new variable in pkgman.conf:
          > ListOutputInPager: output of, for example, "--list" or "--own" is piped into $PAGER
       * added a new optional dependency "desktop-file-utils" for validating desktop entry files
       * also supports now auto-generation of sha sums not only md5
       * internal fixes due to AUR interface changes:
          > use of json interface
          > correct parsing of package category
       * added 2 proto files (located under /usr/share/pacman):
          >  proto.desktop: a template for *.desktop files
          > PKGBUILD-lib32.proto: a template for lib32 packages for x86_64
       * some code changes and fixes

r46: * added new option to pkgman.conf (AutoGenerateSums).
         > if AutoGenerateSums=no then pkgman asks whether to generate checksums or not.
         > if set to yes it behaves like in former versions.

r52: * "--getownpackages" with more than 100 packages works again
       * added new option "--cachecopy":
          For each package in CacheCopyList (new variable in pkgman.conf) get existing package from pacman's cache directory - if
          CopyPkgFromCache (new variable in pkgman.conf) is set to yes - and/or create a source tarball of PKGBUILD and related files from ABS -
          if CopySrcFromABS (new variable in pkgman.conf) is set to yes - and copy them to package backup directory.
       * added new variables to pkgman.conf:
           > "CacheCopyList=file" - batch backup file, one package per line - default location is "$HOME/.config/pkgman/package.list".
           > "CopySrcFromABS=[yes|no]"
           > "CopyPkgFromCache=[yes|no]"
       * some bugfixes
       * docs completed
       * CacheCopyList should look like
         

package1
package2
#this is a comment
!  this too
package3
!package4

r54: * renamed "--listversions" option to "--diffversions". makes more sense!
          from the man page:
              pkgman --diffversions
              Show differing ABS/AUR versions of installed packages from LocalPackages.

r55: * minor changes.

r57: * testing release
       * added a new option "--rollback":
           "pkgman <packagename> --rollback" - checks  http://arm.kh.nu for available package versions,
                                                      lets you choose one, fetches the package and
                                                      moves it to the <packagename> backup directory (if "--repoadd" is used).

r59: * stable release
       * new option "--rollback" (see r57):
               it checks http://arm.kh.nu (Arch Rollback Machine) for available package versions,
               downloads chosen file and moves it to local repository (if "-r|--repoadd"  is used).
        * posting files/comments/etc to AUR should work now again.

r65: *stable release
       * new option "-M,--meta" to create metapackages and add them and their dependencies to local repository.
          it searches for deps inside the backup directories, pacman's cache and if the packages are not available, it tries to fetch the missing
          dependencies from the Arch Rollback Machine site (http://arm.kh.nu).

r66: * minor fixes

r68: * some bugfixes
       * "--repoadd" and "--Reporemove" now accurately removes old packages from LocalRepository

r69: * small bugfixes when listing packages with similar names
       * curl retries now 5 times if connection is not established

r75: * "--cachecopy" does not try to dl sourcefiles when backing up ABS PKGBUILDs
       * some work on package splitting
       * further internal changes

r76: * minor mistakes with "ln" purged

r79: * mostly small changes
       * "--cleanup" now also removes uninstalled packages from LocalRepository

r81 & r80: * added AUR v1.6.0 support (use more json)
                * small ARM changes ("--rollback")

r85:
      * pkgman supports pkg.tar.xz packages
      * some code rewrite, bugs purged (hopefully)

r113:
      * pkgman now supports building split packages through makepkg.
         If you already use pkgman you need to rerun "pkgman --runmefirst" after updating.
      * new  "-t,--template" option ("pkgman <packagename> --template <alt. packagename> [--pkgbuildversion <version>] [options]").
         Useful to create a new PKGBUILD and use an existing one as a template.
      * new option: "--conf /path/to/alternate/conf/file" - Specify another configuration file.
      * pkgman now uses ${XDG_CONFIG_HOME}/pkgman or $HOME/.config/pkgman - if first not set - as the default location for its conf files.

r116:
      * check inet conection when submitting src tarballs to AUR
      * some bugs
      * updated manpage on sf

For further details please read the manual page.

Last edited by DonVla (2010-04-28 11:56:59)

Offline

#2 2008-05-23 01:25:29

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

I'm having some troubles with it (perhaps missing dependencies, and forgotten hardcoded dirs?):

jan@aconcagua  8:20PM ~ % pkgman --runmefirst
/usr/bin/pkgman: line 77: /home/jan/apps/skripte/archscripts/pkgman/share/pkgman/color.bash: No such file or directory
/usr/bin/pkgman: line 1293: initcolor: command not found
/usr/bin/pkgman: line 312: highlight: command not found
/usr/bin/pkgman: line 312: error: command not found
/usr/bin/pkgman: line 313: highlight: command not found
/usr/bin/pkgman: line 313: error: command not found
/usr/bin/pkgman: line 314: highlight: command not found
/usr/bin/pkgman: line 314: error: command not found
/usr/bin/pkgman: line 315: highlight: command not found
/usr/bin/pkgman: line 315: error: command not found
/usr/bin/pkgman: line 317: error: command not found
/usr/bin/pkgman: line 318: error: command not found
/usr/bin/pkgman: line 321: highlight: command not found
/usr/bin/pkgman: line 321: msg: command not found

/usr/bin/pkgman: line 329: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
touch: cannot touch `/bin/.pkgman.registered': Permission denied
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found

/usr/bin/pkgman: line 337: msg: command not found

curl: option --output: requires parameter
curl: try 'curl --help' or 'curl --manual' for more information
^C/usr/bin/pkgman: line 209: cleanoutput: command not found

/usr/bin/pkgman: line 209: cleanoutput: command not found

(I terminated with ctrl-c).

EDIT: errors resolved by correcting the path $HOME/apps/skripte/archscripts/pkgman/share/pkgman to /usr/share/pkgman in the pkgman itself.

Last edited by bender02 (2008-05-23 01:28:58)

Offline

#3 2008-05-23 01:48:25

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

Another problem is that I have
PKGDEST=/var/abs/local/packages
set in /etc/makepkg.conf, and so all the built packages and source tarballs are exported into that directory. Your prog assumes that they remain in the dir where makepkg is called, and so it doesn't do what you expect it to do (well, no harm done, it just doesn't do anything).

But except for this, I quite like your script!

EDIT: I guess a solution to this could be that you 'source /etc/makepkg.conf' and then use $PKGDEST whenever you want to move/copy stuff made by makepkg.

Last edited by bender02 (2008-05-23 01:53:46)

Offline

#4 2008-05-23 01:53:17

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

oh sorry! my fault.
corrected! should work now.

vlad

Offline

#5 2008-05-23 01:55:42

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

Just keep md5sums on AUR in sync with your updates, please smile

Offline

#6 2008-05-23 02:01:46

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

bender02 wrote:

Another problem is that I have
PKGDEST=/var/abs/local/packages
set in /etc/makepkg.conf, and so all the built packages and source tarballs are exported into that directory. Your prog assumes that they remain in the dir where makepkg is called, and so it doesn't do what you expect it to do (well, no harm done, it just doesn't do anything).

But except for this, I quite like your script!

EDIT: I guess a solution to this could be that you 'source /etc/makepkg.conf' and then use $PKGDEST whenever you want to move/copy stuff made by makepkg.

i see. i haven´t thought about that. i never used PKGDEST and the other variables in makepkg.conf.
this script is intended to be used as user not root, so you don´t have write permissions to /var/abs/local anyway. everything should be inside the $HOME dir...
i will check how to integrate makepkg.conf.

vlad

ps: md5sums are ok now.
sorry for the inconvenience.

Last edited by DonVla (2008-05-23 02:03:54)

Offline

#7 2008-05-23 02:05:36

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

DonVla wrote:

i see. i haven´t thought about that. i never used PKGDEST and the other variables in makepkg.conf.
this script is intended to be used as user not root, so you don´t have write permissions to /var/abs/local anyway. everything should be inside the $HOME dir...
i will check how to integrate makepkg.conf.

hm? I use your script as a user. I do all local package management as a user (makepkg, ...), and I have write permissions to /var/abs/local/* That's how I set things up: /var/abs/local/* contains the usual directory structure of a repo with my own dirs with PKGBUILDs. (/var/abs/local/packages is an exception smile

I don't know, I read somewhere that /var/abs/local is one of the possibilities for a local repo (abs leaves it alone, and it nicely exists alongside other repos), and so I set it up that way... No matter, it's like having it in $HOME.

EDIT: Having a second look at makepkg.conf, there's one more var that affect your script: SRCDEST.

Last edited by bender02 (2008-05-23 02:09:28)

Offline

#8 2008-05-23 02:11:30

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

i´m a little confused.
i have no write permissions to /var/abs/local. perhaps makepkg is allowed to copy files therein.
i think that´s an important point i missed.
need more input and testing.

vlad

Offline

#9 2008-05-23 02:17:41

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

I'm sorry. I didn't mean to confuse you. I myself decided that /var/abs/local would be a good place for a local repo with PKGBUILDs, and so I created that directory, chowned it to myself (not root!), pointed /etc/makepkg.conf to it, and went ahead and created some PKGBUILDs there.

I meant to say, it's the same thing as if you would keep PKGBUILDs in (e.g.) $HOME/localrepo... it just seemed to me as a good idea to use /var/abs/local instead (at that time).

It's just that you need to incorporate PKGDEST and SRCDEST variables from /etc/makepkg.conf into your script - since when you call 'makepkg --source', it creates .src.tar.gz in the SRCDEST dir, and when you call 'makepkg ...', it creates .pkg.tar.gz in the PKGDEST dir.

Offline

#10 2008-05-23 02:44:52

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

ok, i thought the /var/abs/local stuff is a "hidden" feature of abs and makepkg.
in next version i´ll integrate the PKGDEST and SRCDEST variables.
thanks! i totally missed this.

vlad

Offline

#11 2008-05-23 03:38:48

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

version 2.4: 
pkgman now respects the PKGDEST and SRCDEST variables from makepkg.conf.
(though it moves the src.tar.gz and .pkg.tar.gz to the backup directory).

vlad

Offline

#12 2008-05-23 03:43:49

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

Thanks!

I've been playing around with it a bit, and I must admit that I don't quite understand the workflow. The functions I miss are of sorts "[cleanup]: delete src/* pkg/* and all the downloaded source files, and leave only PKGBUILD + .install + some other files that came with the tarball"; "[make backup]: make another backup (after I edited the PKGBUILD manually)". For instance, it usually takes me a few tries to debug a new PKGBUILD, and after I'm done with it, I'd like to make a backup to the .backup dir using pkgman.

Last edited by bender02 (2008-05-23 03:44:41)

Offline

#13 2008-05-23 03:53:46

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

Ah! There's one more thing to be aware of: if you have PKGDEST *set* and SRCDEST *not set* in makepkg.conf, then makepkg uses PKGDEST as SRCDEST implicitly (ie .src.tar.gz's are put into PKGDEST).

One possible fix is to use  ${SRCDEST:-$PKGDEST} instead of $SRCDEST (or just make a test if SRCDEST is set after sourcing makepkg.conf, and if not, set it to PKGDEST). Now I don't know what happens if SRCDEST is set but PKGDEST is not....

Offline

#14 2008-05-23 04:04:04

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

bender02 wrote:

Thanks!

I've been playing around with it a bit, and I must admit that I don't quite understand the workflow. The functions I miss are of sorts "[cleanup]: delete src/* pkg/* and all the downloaded source files, and leave only PKGBUILD + .install + some other files that came with the tarball";

you can edit a PKGBUILD and then run makepkg ("pkgman -emb"). if this fails you can edit it again. afterwards you can tag the source tarball file (smth like <test 1>). then run "pkgman --flush" to clear the directory (it doesn´t remove the package source files - the actual code) and reedit a version by running "pkgman -e -v <version of source tarball and tag>"

"[make backup]: make another backup (after I edited the PKGBUILD manually)". For instance, it usually takes me a few tries to debug a new PKGBUILD, and after I'm done with it, I'd like to make a backup to the .backup dir using pkgman.

backed up source tarballs with same version and/or same tag are overwritten anyway.

vlad

Last edited by DonVla (2008-05-23 04:42:11)

Offline

#15 2008-05-23 04:14:37

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

Great! Thanks! I knew it's just that I don't understand the options properly. I guess I was fooled by the explanations of '-b' and '-m' that are printed when you run 'pkgman'. I thought that they just edit the pkgman.conf file.

Offline

#16 2008-05-23 04:26:59

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

bender02 wrote:

Great! Thanks! I knew it's just that I don't understand the options properly. I guess I was fooled by the explanations of '-b' and '-m' that are printed when you run 'pkgman'. I thought that they just edit the pkgman.conf file.

no, these options toggle the settings in pkgman.conf. i always back up everything, so i use BackupTarball=yes.
the help and manpage could be more explicit. it is only quick-and-dirty...
i also have to take a closer look at the makepkg.conf settings.

vlad

Offline

#17 2008-05-23 06:54:08

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

bender02 wrote:

Ah! There's one more thing to be aware of: if you have PKGDEST *set* and SRCDEST *not set* in makepkg.conf, then makepkg uses PKGDEST as SRCDEST implicitly (ie .src.tar.gz's are put into PKGDEST).

One possible fix is to use  ${SRCDEST:-$PKGDEST} instead of $SRCDEST (or just make a test if SRCDEST is set after sourcing makepkg.conf, and if not, set it to PKGDEST). Now I don't know what happens if SRCDEST is set but PKGDEST is not....

thank you again, bender02!
i've changed this in v2.5.
if PKGDEST not set, makepkg leaves source tarball in current directory.

vlad

Offline

#18 2008-05-23 14:58:31

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

DonVla wrote:

you can edit a PKGBUILD and then run makepkg ("pkgman -emb"). if this fails you can edit it again. afterwards you can tag the source tarball file (smth like <test 1>). then run "pkgman --flush" to clear the directory (it doesn´t remove the package source files - the actual code) and reedit a version by running "pkgman -e -v <version of source tarball and tag>"

I ran 'pkgman -emb' on a package, created a package... etc... but .src.tar.gz was not created at any point - so pkgman --flush deleted the PKGBUILD, which is now nowhere to be found.

I guess I don't like that --flush deletes also PKGBUILDs, .install files and such - since if they're not backed up (which is a thing which I still don't know when it happens), they're just lost.

Offline

#19 2008-05-23 17:17:31

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

hi bender02,

bender02 wrote:

I ran 'pkgman -emb' on a package, created a package... etc... but .src.tar.gz was not created at any point - so pkgman --flush deleted the PKGBUILD, which is now nowhere to be found.

the "-b" flag depends on your BackupTarball seeting in pkgman.conf. if "BackupTarball=no" then using "-b" creates the src.tar.gz file and moves it to your <packagename>/.backup/ directory, if "BackupTarball=yes", then using "-b" *does not* create the src.tar.gz.
as i said, i use "BackupTarball=yes" in my pkgman.conf, so the edited PKGBUILD+files are always backed up. no need then to use -b every time. perhaps i should change the default setting to "BackupTarball=yes".

to make it clear: --makepkg, --backup, --repoadd and --switch "react" on your settings of UseMakepkg, BackupTarball, UseRepoadd and SwitchToBuildDirectory.
for example --switch: if you want to change to build directory everytime you edit or build a package then you set "SwitchToBuildDirectory=yes" in your pkgman.conf. using --switch then, pkgman does not ask to change to that directory. this option is disabled (SwitchToBuildDirectory is temporarily set to no). the other three options behave the same way.
when setting these four options to no, the flags act like simple "do this, then do that" flags.
the first time it might be confusing, but i thnik it's quite convenient when you get used to.

vlad

Last edited by DonVla (2008-05-23 17:19:36)

Offline

#20 2008-05-23 22:49:37

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

Thanks again! Somehow, the idea that switches interact with the conf file setting did not make it to my (tiny inferior) brain. It (slowly) begins to make sense... (I set BackupTarball=Yes for instance, so I shouldn't have been surprised that 'pkgman -emb' didn't make the backup smile

Offline

#21 2008-05-25 07:09:22

Stythys
Member
From: SF Bay Area
Registered: 2008-05-18
Posts: 878
Website

Re: pkgman - a bash script for local package and PKGBUILD management

dude...pkgman is awesome.

nice job smile


[home page] -- [code / configs]

"Once you go Arch, you must remain there for life or else Allan will track you down and break you."
-- Bregol

Offline

#22 2008-05-25 12:45:51

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

Re: pkgman - a bash script for local package and PKGBUILD management

Seems pretty handy, actually.

Just make it shell agnostic, because I suddenly found myself in bash.

Last edited by scj (2008-05-25 12:46:17)

Offline

#23 2008-05-25 13:02:38

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: pkgman - a bash script for local package and PKGBUILD management

scj wrote:

Seems pretty handy, actually.

Just make it shell agnostic, because I suddenly found myself in bash.

which shell do you use?
i'll add a ShellCommand variable to pkgman.conf next version.

i'm still trying to complete the manpage. is someone interested to help?
if one's not familiar with the nroff syntax, no problem, just send, post or mail me the text.

vlad

Last edited by DonVla (2008-05-25 13:07:27)

Offline

#24 2008-05-25 13:13:20

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

Re: pkgman - a bash script for local package and PKGBUILD management

Eh, why not just use the $SHELL variable?

Offline

#25 2008-05-25 13:34:03

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: pkgman - a bash script for local package and PKGBUILD management

DonVla wrote:

i'm still trying to complete the manpage. is someone interested to help?
if one's not familiar with the nroff syntax, no problem, just send, post or mail me the text.

I'll take a look. Posting because I have a suggestion if you don't like *roff: Use asciidoc (warning: to use it, you need to have 'asciidoc' and 'docbook-xsl' installed, but it works nicely).

Offline

Board footer

Powered by FluxBB