summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2010-03-14Reduce duplicate code in DB extractionDan McGee1-37/+26
Follow-up to the previous "Only extract new DB entries" patch; move the partial extraction code inside one side of the loop so we can use the same code for actually doing file extraction. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14Only extract new DB entriesXavier Chantry2-13/+156
This implements FS#15198. The idea apparently came from Csaba Henk <csaba-ml <at> creo.hu> which submitted a patch to Frugalware, so thanks to him, even though I did not look at the code :) The idea is to only extract folders for new packages into the package database and clean up the old directories. This is essentially implementing Xyne's "rebase" script within pacman. If using -Syy, just remove and extract everything. If using -Sy : 1. Generate list of directories in DB 2. Generate list of directories in archive 3. Compare both 4. Clean up old directories 5. Extract new directories Original-work-by: Allan McRae <allan@archlinux.org> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> [Dan: fix compile error, s/int/size_t/] Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14Mark two functions staticDan McGee1-2/+2
These were just introduced in the `--print` patch, and don't need to be exposed outside of util.c. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14Add new --print operation for all operationsXavier Chantry11-47/+170
And a new --print-format option to configure the output. This implements FS#14208 Example usage : pacman -Sp --print-format "%r/%n-%v : %l [%s]" kdelibs extra/kdelibs-4.3.2-4 : ftp://mir2.archlinuxfr.org/archlinux/extra/os/i686/kdelibs-4.3.2-4-i686.pkg.tar.gz [0,00] Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14print installed packagesXavier Chantry1-2/+22
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14callback: use variable length for progressbar textXavier Chantry1-4/+15
This fixes FS#17523 We always used a fixed value of 50 for textlen, which is often not enough for download progress bar. At least we can use a bigger width on large terminal (e.g. 60% of width) and keep 50 as minimum. before: nautilus-2.28.4-1-x... 5.7M 789.2K/s 00:00:07 [####################################] 100% after: nautilus-2.28.4-1-x86_64 5.7M 770.7K/s 00:00:08 [##############################] 100% Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14callback.c : less magic progress barsXavier Chantry1-10/+13
1 - Explain magic numbers 2 - There was a weird off by 1 mess in the progress bar. The code supposedly shared the width between 50 chars for text (textlen) and the rest for the progress bar (proglen = getcols() - textlen). But the code actually used textlen + 1 for the text and proglen - 1 for the progress bar (with haslen=1, the progress bar was actually empty), which was a bit confusing so I changed it. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14delta : add external cleanup scriptXavier Chantry5-4/+186
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14makepkg: always update symlinks to compressed man pagesAllan McRae1-11/+12
When a man page has both symbolic and hard links, any symlink pointing to other than the alphabetically first hardlink was not "compressed" and left dangling towards the uncompressed man page. Fixes FS#18569. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14makepkg: make strip options configurableCedric Staniewski6-6/+45
The newly added variables STRIP_BINARIES, STRIP_SHARED and STRIP_STATIC, that are set in makepkg.conf, specify the strip options used on binaries and shared and static libraries. In addition, files are now stripped more aggressively by default. Implements FS#13592 the way it was suggested by Allan in the comments. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14makepkg: Remove setgid bit on srcdir/pkgdir creationDan McGee1-0/+6
It was noted in FS#17533 that setgid bits are carried down into any created subdirectories, and thus could end up being in a built package if the original package directory was marked g+s. When we create src/ and pkg/, explicitly chmod them to remove any sticky bits. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2010-03-14makepkg: abort on missing or non-writable PKGDESTAllan McRae1-6/+12
When PKGDEST pointed to a non-writable location, makepkg would fail after completing the build process. This patch makes it abort as soon as PKGDEST is parsed. Also, move the SRCDEST check to the same point rather than right before downloading sources (which was after dependency checks). Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14makepkg: only strip files that are writableAllan McRae1-1/+1
TODO: http://mailman.archlinux.org/pipermail/pacman-dev/2010-January/010390.html Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28makepkg: Add documentation for the new SRCPKGDEST variableNezmer1-0/+5
Add SRCPKGDEST documentation to the makepkg.conf man page Signed-off-by: Nezmer <git@nezmer.info> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28makepkg: document environment variables PKGDEST and SRCDESTCedric Staniewski1-0/+8
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28makepkg: update required programsAllan McRae1-1/+1
Remove getopt, add xz. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28bash_completion: remove absolute utility paths againCedric Staniewski1-14/+14
The location of the used utilities may and does differ between various distributions and therefore absolute paths do not work well. Since the main purpose of its introduction was to avoid side-effects caused by aliases, it is sufficient to disable possible aliases temporarily by preceding the commands with a backslash. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28contrib/*_completion: match *.pkg.tar.*Pierre Schmitz2-6/+6
Signed-off-by: Pierre Schmitz <pierre@archlinux.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19Do not print installed size when only downloadingAllan McRae1-1/+3
When using --downloadonly the "Total Installed Size" message is not needed and perhaps misleading. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19Print "there is nothing to do" with NOOP transactionsNagy Gabor3-1/+3
The "local database is up to date" message has been replaced with "there is nothing to do" message. This used with "empty" -S, -R, -U operations too. (Examples: pacman -S ignored_pkg, pacman -Ru needed_pkg.) See FS#17859. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19Merge branch 'maint'Dan McGee1-0/+1
Just a slight touchup in makepkg due to the [ -> [[ conversion, so nothing to see here. Conflicts: scripts/makepkg.sh.in
2010-01-19bash_completion: use absolute paths to utilitiesDan McGee1-14/+14
Fixes issues noted in FS#16630. Signed-off-by: Dan McGee <dan@archlinux.org> (cherry picked from commit 03f35b1432675f5b10ec53945e48c2bbd7c628e9) Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19makepkg: fix abortion after sourcing /etc/profileCedric Staniewski1-3/+4
The source command triggers / might trigger the ERR trap which makes makepkg abort right after a successful installation of missing dependencies. Thanks to Xavier Chantry <shiningxc@gmail.com> for finding this solution. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org> (cherry picked from commit 77e84bea71e3dfe87a8009e7e7a913d1a12b7585) Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19contrib/bacman: fix checking if file has been addedAllan McRae1-2/+2
Fixes FS#17140. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org> (cherry picked from commit 0199a7ee717f0848e336fda8dc1f5b9364ce3478) Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19NULL out handle after releaseDan McGee1-0/+1
We free'd the handle but didn't NULL out the global variable, leading to problems if you try to reinitialize the library. Make sure we clean up after ourselves. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19makepkg: Introduce $SRCPKGDESTNezmer2-2/+7
Introduce $SRCPKGDEST to define a destination dir for source packages instead of saving them in $PKGDEST with binary packages. The simple patch doesn't break old behavior. Signed-off-by: Nezmer <git@nezmer.info> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-14makepkg: check for non-empty pkgbase instead of pkgnameCedric Staniewski1-1/+1
pkgbase is used in the following rm calls, and since pkgname can be present when pkgbase is not, it is safer to check for pkgbase. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13makepkg: remove srclinks directory on error exitCedric Staniewski1-0/+1
When makepkg exits in create_srcpackage(), the (temporary) srclinks directory is left behind. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13makepkg: skip devel_check() when repackagingNezmer1-3/+3
Currently, "makepkg -R" creates a package with a wrong updated $pkgver. Signed-off-by: Nezmer <Nezmer@allurelinux.org> [Allan: adjusted comment] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13makepkg: limit sudo usage to allowed pacman commandsCedric Staniewski1-1/+1
This is particularly useful when using pacman wrappers which call sudo by themselves and therefore should not be run as root. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13makepkg: allow to specify an alternative pacman commandCedric Staniewski2-8/+20
If PACMAN environment variable is set, makepkg will try to use this command to check for installed dependencies and to install or remove packages. Otherwise, makepkg will fall back to pacman. Implements FS#13028. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> [Dan: move envvar section in manpage] Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13makepkg: check for references to build root in packageAllan McRae1-0/+5
Add a check that the package does not contain references to the folder it was built in. Fixes FS#14751 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13improve download_internal error messagesXavier Chantry1-2/+8
download_internal is supposed to always set pm_errno but did not in many cases. The most important (and tested) change is the one concerning fetchStat. This is typically where the code will fail when the network is down for example. Before commit d2dbb04a9af7a18da, this fetchStat call did not exist and the same kind of errors would be encountered in the fetchXGet call that follows. I just copied the error printing to restore the old behavior. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13add some more sanity check for optargXavier Chantry1-1/+15
getopt should already ensure that optarg is not NULL when an argument is required, but just be extra safe and double check it before using optarg. To be honest, I only did that to make clang shut up and eliminate the last warnings it reported. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13refactor _parseoptionsXavier Chantry1-138/+170
This function was quite huge (~230 lines) and difficult to parse, now it is slightly better. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13Print error on duplicated database entriesNagy Gabor1-0/+7
Some users reported duplicated database entries in /var/lib/pacman/local/, for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus 3rd-party scripts, backup?) In this case pacman reported no error and its behaviour was mysterious. From now on, pacman detects this situation and prints an error message. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13Remove trailing whitespace on all lines in list_displayDan McGee1-4/+6
This ensures we never have trailing whitespace. Take the following text, with line numbers added for clarity: 1. Title : item1 item2 item3 item4 2. item5 item6 item7 item8 3. item9 itemA itemB itemC Laszlo Papp helpfully pointed out we would have two trailing spaces on line three after the last item. However, we also had these trailing spaces on lines one and two, which the initial patch didn't take care of. This can be seen on something like `pacman -Qi glibc`. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-07Fix requiredby outputDan McGee1-1/+1
This is a bit embarrassing. For example: $ pacman -Qi mesa ... Required By : mesa mesa mesa mesa mesa mesa Something is clearly not right, and the problem was introduced in commit 0bc961. Fix the issue by getting the package name off the correct variable. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30bash_completion: use absolute paths to utilitiesDan McGee1-14/+14
Fixes issues noted in FS#16630. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30makepkg: allow specifying subsets of packages to buildAllan McRae2-1/+22
This allows makepkg to only build a specified subset of packages from a split PKGBUILD. This is very useful in combination with the -R flag or when bumping the pkgrel of a single package. Fixes FS#15956. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30makepkg: move pacman calls to a functionCedric Staniewski1-25/+16
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30makepkg: Place packages symlinks in build dir when PKGDEST is usedEric Bélanger1-5/+24
When PKGDEST is used, symlinks to the packages will be put in the build directory. This combines the convenience of a global package cache with the ease of having a package (i.e. a symlink) in the build directory for testing and installation purpose. Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> [Allan: add comment documenting clean-up addition] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30Replace an ugly while [ with a for (( loopIsaac Good1-3/+2
Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15Fix syntax error in new translationDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15HACKING: add some notes about valgrind/gdb usageDan McGee1-0/+13
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15download: major refactor to address lingering issuesDan McGee5-155/+141
Sorry for this being such a huge patch, but I believe it is necessary for quite a few reasons which I will attempt to explain herein. I've been mulling this over for a while, but wasn't super happy with making the download interface more complex. Instead, if we carefully order things in the internal download code, we can actually make the interface simpler. 1. FS#15657 - This involves `name.db.tar.gz.part` files being left around the filesystem, and then causing all sorts of issues when someone attempts to rerun the operation they canceled. We need to ensure that if we resume a download, we are resuming it on exactly the same file; if we cannot be almost postive of that then we need to start over. 2. http://www.mail-archive.com/pacman-dev@archlinux.org/msg03536.html - Here we have a lighttpd bug to ruin the day. If we send both a Range: header and If-Modified-Since: header across the wire in a GET request, lighttpd doesn't do what we want in several cases. If the file hadn't been modified, it returns a '304 Not Modified' instead of a '206 Partial Content'. We need to do a stat (e.g. HEAD in HTTP terms) operation here, and the proceed accordingly based off the values we get back from it. 3. The mtime stuff was rather ugly, and relied on the called function to write back to a passed in reference, which isn't the greatest. Instead, use the power of the filesystem to contain this info. Every file downloaded internally is now carefully timestamped with the remote file time. This should allow the resume logic to work. In order to guarantee this, we need to implement a signal handler that catches interrupts, notifies the running code, and causes it to set the mtimes on the file. It then rethrows the signal so the pacman signal handler (or any frontend) works as expected. 4. We did a lot of funky stuff in trying to track the DB last modified time. It is a lot easier to just keep the downloaded DB file around and track the time on that rather than in a funky dot file. It also kills a lot of code. 5. For GPG verification of the databases down the road, we are going to need the DB file around for at least a short bit of time anyway, so this gets us closer to that. Signed-off-by: Dan McGee <dan@archlinux.org> [Xav: fixed printf with off_t] Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-11-15Refactor do/while cycle and multiple while cyclesLaszlo Papp3-6/+14
* It makes the code clearer to read/understand * Cppcheck tool doesn't show this anymore: [./util.c:215]: (error) Resource leak: fd [Dan: don't change the coding style] Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15makepkg: Fixed logging for split packagesEric Bélanger1-2/+2
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15makepkg: allow the use of only a package() functionCedric Staniewski2-10/+19
For some packages, generally the 'any' arch ones, a build step is not required and therefore can be skipped. In these cases, a package() function without a build() one is sufficient. As a side effect, this commit makes meta packages without any function at all in the PKGBUILD possible. Fixes FS#15147. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15makepkg: extend test for hyphen prefixes to pkgbase and all pkgnamesCedric Staniewski1-2/+11
Since commit fb97d32, which brought in this test, support for split PKGBUILDs was added, and therefore, all values of pkgname and also pkgbase have to be checked now. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>