Commit Graph

2641 Commits

Author SHA1 Message Date
Dan McGee 8bbaf045b9 repo-add: use bsdtar optimization for better performance
When unzipping packages and the database archives, we don't need to look
through the entire archive to do what we need to do. For packages, .PKGINFO
should only be found once and should be the first file in the package. For
the database check, we only really need to look for one desc file.

The bsdtar -q option is very similar to the GNU tar --occurrence=1 option.

Example of speedup:

$ time repo-add junkdb.db.tar.gz *.pkg.tar.gz >/dev/null
real	0m16.159s
user	0m14.836s
sys	0m2.277s

$ time ./scripts/repo-add junkdb.db.tar.gz *.pkg.tar.gz >/dev/null
real	0m4.949s
user	0m3.730s
sys	0m2.093s

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-23 21:51:42 -05:00
Loui Chang 01f9ae63e7 makepkg: Move .PKGINFO creation into a function.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-22 17:09:16 +10:00
Loui Chang 02acf65ef3 makepkg: Download sources and check checksums for any source package.
It wouldn't be very nice to ship a PKGBUILD with the wrong checksums.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-21 20:32:17 +10:00
Allan McRae b3a5535360 Fix typos in PKGBUILD man page
Original-patch-by: Jason Ribeiro
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-21 20:00:00 +10:00
Nagy Gabor f250b034b4 Enable remove progressbar with -S (conflict resolving)
$ sudo pacman -S mc

Old output:
***********
:: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y
...
(1/1) checking for file conflicts                   [################] 100%
(1/1) installing mc                                 [################] 100%

New output:
***********
:: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y
...
(1/1) checking for file conflicts                   [################] 100%
(1/1) removing mc-mp                                [################] 100%
(1/1) installing mc                                 [################] 100%

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:57:59 -05:00
Allan McRae ef500b44ce makepkg: fix variable backup/restore for splitpkg
The backup and restore of variables that can be overridden while
making split packages only dealt with the first element, not the
whole array (FS#15010).  Adjust the bash voodoo to fix it...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:51:18 -05:00
Allan McRae 04d5c4294a makepkg: fix PKGBUILD sanity check
If PKGBUILD was good, the "insane" variable was not defined and so
the if statement failed.  Simplify and fix this check.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:50:53 -05:00
Dan McGee aa579b8438 Give sensible feedback when a repo has no configured servers
This fixes FS#14899. When running an -Sp operation without servers
configured for a repository, we would segfault, so add an assert to the
backend method returning the first server preventing a null pointer
dereference.

In addition, add a new error code to libalpm that indicates we have no
servers configured for a repository. This makes -Sy and -S <package>
operations fail gracefully and helpfully when a repo is set up with no
servers, as the default mirrorlist in Arch is provided this way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-08 20:02:17 -05:00
Nagy Gabor 19b8b63885 Introduce _alpm_pkg_free_trans()
The main purpose of this function to make our code more readable.
It frees transaction specific fields of pmpkg_t. (It is used when a package
is removed from the target list.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-07 15:11:16 -05:00
Dan McGee e61ab1536f makepkg: refactor sanity checking into a function
No new checks, just move it into a function and return 1 rather than exit
directly. This also allows the use of local variables.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-07 15:07:37 -05:00
Xavier Chantry 13b281d743 xdelta : only handle gz compression specifically
There is apparently no need to handle the re-compression manually when
applying a xdelta patch in case of bzip2 or xz.

Only gzip needs to be handled specifically for disabling timestamp with the
-n option.

After this patch, if xdelta is enhanced with xz support (1-line patch), it
will be transparent from pacman side.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-06 11:16:45 -05:00
Nagy Gabor 9af9c0f328 Document -T in the manual
See FS#14833.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: slight wording rework]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-06 10:46:56 -05:00
Nagy Gabor f4ecc908ec We don't need root with -Sp
FS#8905 is fixed. The front-end passes PM_TRANS_FLAG_NOLOCK to the back-end,
so it doesn't lock the database. That's why we don't need root anymore.

I reworked (and renamed) needs_transaction() accordingly. I also added
missing -Sc check there (for example, -Sci didn't print non-root error, but
pacman wanted to lock the database).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 22:01:04 -05:00
Nagy Gabor c520d38451 Introduce PM_TRANS_FLAG_NOLOCK
This flag indicates that the front-end will not call alpm_trans_commit(),
so the database needn't be locked. This is the first step toward fixing
FS#8905.

If this flag is set, alpm_trans_commit() does nothing and returns with
an error (that has new code: PM_ERR_TRANS_NOT_LOCKED).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 22:00:57 -05:00
Nagy Gabor 1b4135ca5d Change package to package(s) and file to file(s) in documentation
The pacman --help pages and the manual suggested that only one package can
be upgraded/removed per transaction.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 21:59:03 -05:00
Gerardo Exequiel Pozzi 6360fe0100 Remove unused string.h from src/pacman/remove.c
This header was used in the code for the function strdup()
that is not used anymore.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 21:57:58 -05:00
Xavier Chantry 30e2496775 repo-add: fail early if repo can not be created
Before this commit, the repo creation could fail after all packages have
been added to the database. Now this will be detected before adding
anything.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-23 12:27:32 -05:00
Gerardo Exequiel Pozzi 35b9dfc380 Remove unused included headers from testdb.c and testpkg.c
libgen.h was used for basename() in function main() from src/util/testdb.c
string.h was used for strlen() in function output_cb() from src/util/testpkg.c

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:22:38 -05:00
Pierre Schmitz c301d6aa25 Add support for the xz archive format
This simple patch adds support for the xz archive format to makepkg and repo-
add.
Xz can be used as source, package and package db file type.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
[Dan: fixed a few alignment issues]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:16:59 -05:00
Nagy Gabor 0bf340f73c Remove unused error codes and handle PM_ERR_RETRIEVE by alpm_strerror()
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:11:43 -05:00
Nagy Gabor 882bff36ac Remove find_replacements()
"Foo replaces bar" simply means that "foo is a new version of bar".
So this patch refactors the code to use this "rule".

_alpm_sync_sysupgrade now does the following for each local package [bar]
(pseudo-code):
for db in syncdbs {
   if(db contains bar) {check if db/bar is an upgrade; break;}
   replacers = find(bar replacers in db);
   if(replacers!=NULL) {ask_user; break;}
}

Note:
1. Replacers are grouped per repo. If more than one package replace bar in
a repo, all of them are considered ("package set of bar replacers").
2. If repo1/foo1 and repo2/foo2 both replaces bar, only repo1/foo1 is
considered (if repo1 stands before repo2 in pacman.conf). FS#11737 is fixed.
3. It can happen that pacman doesn't consider any replacer, if it found a
literal "earlier", so sync132.py modified accordingly (btw, that situation
should not appear irl).

The new sysupgrade code doesn't use sync_newversion(), so I removed the
"local is newer than repo" message, which was annoying with -Qu and
SyncFirst.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:11:05 -05:00
Nagy Gabor f89f7e136b Query documentation updates
The old documentation didn't emphasize our filtering options at all, and it
was a bit misleading. ("List ALL...")

I also clarified the description of -Qu.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:09:24 -05:00
Cedric Staniewski 212ea8a9ed repo-add: fix -n tests which are applicable only to strings
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:04:28 -05:00
Cedric Staniewski a812ad4ea4 libarchive development has moved to Google Code
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:02:56 -05:00
Dan McGee 1bbb34365c Add pyc files to autoclean
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:02:56 -05:00
Dan McGee 1d8d932fa6 Remove recursive remove in autoclean.sh
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:02:46 -05:00
Gerardo Exequiel Pozzi 783e710839 Add more files to cleanup in autoclean.sh
Add files pactest/tests/Makefile.in , pactest/tests/Makefile
and contrib/Makefile.in , contrib/Makefile to list of cleanup script.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 22:57:16 -05:00
Gerardo Exequiel Pozzi c5d9b999c7 Add repo-remove.8 to list of cleanup in doc/Makefile.am
repo-remove.8 is generated with Makefile but is not removed on clean.
This patch add it to list of untracked autoconf files.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 22:54:03 -05:00
Dan McGee 4a582fac2a Merge commit 'allan/working' 2009-05-18 22:51:25 -05:00
Gerardo Exequiel Pozzi 86cd72573b Add an initial pactest/test/.gitignore
Add an initial pactest/test/.gitignore to exclude sync200.py
that is generated from sync200.py.in

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 22:25:53 -05:00
Allan McRae 80caeabce0 NEWS file updates for makepkg and contrib
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-16 14:39:18 +10:00
Allan McRae 250e66e57b makepkg: fix sourcing BUILDSCRIPT and PATH issues
The bash source command looks in the users PATH for the file to source
before the local directory. This causes issues when someone has a
PKGBUILD somewhere in their path (for unknown some reason...).
Fixes FS#14727.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-16 13:48:10 +10:00
Allan McRae 5e32928a42 makepkg: Document package splitting
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:02 +10:00
Allan McRae de44a0f474 makepkg: do not update pkgver when building source package
When making a source package for a SCM PKGBUILD, makepkg should not
update the pkgver/pkgrel.  Noted in FS#14456.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:01 +10:00
Dan McGee 20017354f7 Remove version information from -Qqo output
This was the only --quiet operation that showed version information; make it
consistent with the rest.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 21:43:36 -05:00
Nagy Gabor a783f3fbf1 Introduce -Qlq
With --quiet flag, -Ql doesn't print the package name, just lists the files.
I made --quiet documentation up-to-date (I also added -Sgq/-Qgq).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 21:36:43 -05:00
Allan McRae f569c4a042 makepkg: several small fixes
1) Do not attempt to strip compressed binaries
Original-work-by: Marc - A. Dahlhaus <mad@wol.de>

2) Add "\" in "GPL\'ed" so quote mark does not break source code highlighting

3) Add local to docdir paths in makepkg.conf for consistency

4) Use full path to sed in MacOSX in case users have GNU sed earlier in
path

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 21:23:46 -05:00
Gerardo Exequiel Pozzi ed848b1c54 Fix non-C style comments in libalpm
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 20:26:49 -05:00
Allan McRae c27904661e makepkg: make in-place sed portable
Do a sed replacement in-place is not very portable.  On Mac OSX and
BSDs, the syntax is "sed -i ''" where as with GNU sed the command is
"sed -i''" or just "sed -i".  This patch detects which command should
be used during configure.

Credit to Kevin Barry who researched this issue and provided a patch
to work around this using temporary backup files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-26 09:22:23 -05:00
Loui Chang 10584ec8ea Mention required libraries in INSTALL.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-15 22:44:10 -05:00
Bryan Ischo db3e166503 Look in target-list first to resolve dependencies
This fixes a bug introduced by my previous changes which changes the
behavior of IgnorePkg/IgnoreGroup to allow the user to remove unresolvable
packages from the transaction.  The bug is that the target-list was no
longer being consulted first to resolve dependencies, which means that if
two packages in the sync database satisfied a dependency, and the user
explicitly requested one of those two packages in the sync, the other
package was still being pulled in.

A new test was added, sync993.py, to verify the desired behavior.

Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:39:24 -05:00
Bryan Ischo d70465decc Remove duplicates from the unresolvable list before prompting user
Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:24:52 -05:00
Dan McGee 4b78852f7e const-ify endswith()
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:13:03 -05:00
Nagy Gabor aefb4e0fa5 Remove pmsyncpkg_t
pmsyncpkg_t data sructure was removed:
1. pmpkg_t.reason is used instead of pmsyncpkg_t.newreason. (The target
packages come from sync repos, so we can use this field without any
problems. Upgrade transaction also uses this field to store this info.)
2. pmsyncpkg_t.removes was moved to pmpkg_t.removes.
This step requires careful programming, because we don't duplicate packages
when we add them to trans->packages. So we modify sync pkgcache when we
add this transaction-only info to our package. Hence it is important to
free this list when we remove any package from the target list
(remove_unresolvable, remove_conflicts, trans_free), otherwise this could
confuse the new sync transactions (with non-pacman GUI).

Overall, our code became ~100 line shorter, and we can call our helper
functions directly on trans->packages in sync.c, we don't need to maintain
parallel package lists.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:05:13 -05:00
Nagy Gabor 391952600d Fix for trans001.py (FS#9088)
From now on _alpm_db_find_fileconflicts() works with upgrade and remove
target lists (like checkdeps), which makes it transaction independent
(we still need a trans param because of the progressbar). This is a small
step towards the universal transaction. So we call this function directly
from sync.c before commiting the remove transaction. This is much safer,
but we can get false fileconflict error alarms in some tricky cases
("symlinks puzzle" etc).

The patch on find_fileconflict looks complex, but it is mainly an
"indent-patch", the new code-part can be found after the
/* check remove list ... */ comment, and I modified something around the
"file has changed hand" case (see comment modifications in the code).

Unfortunately sync.c became more ugly, because we have to create 2 parallel
internal transactions: to avoid duplicated work, upgrade transaction is
used to load package data (filelists). This problem will disappear, when
we finally get rid of internal transactions.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:59:55 -05:00
Nagy Gabor 634304feae Free *data list when user removes unresolvable packages
Resolvedeps reports error when it cannot resolve some dependencies, puts
them into the *data list, and set pm_errno. If user removes the
unresolvable packages from the target list, we have no error anymore,
so from now on we free *data list (we eliminate a memleak) and unset
pm_errno.

(Additionally I removed two needless lines from the code, unresolvable list
is always freed in cleanup.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:55:46 -05:00
Nagy Gabor 56fd24ecf8 Print warning in _alpm_resolvedep() if a satisfier package is ignored without QUESTION
After commit f57f8d3386 pacman *silently*
ignores packages from IgnorePkg/IgnoreGroup during dependency resolving,
if prompt == 0. This behavior is changed to "give warning + ignore".
(Otherwise the user is not informed about the fact that the package
resolving was blocked by ignorepkg.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:54:50 -05:00
Nagy Gabor 77efd51216 New error type: PM_ERR_PKG_IGNORED
This patch fixes FS#12059.
Now sync_addtarget can return with PM_ERR_PKG_IGNORED, which indicates that
although the requested package was found it is in ignorepkg, so alpm could
not add it to the transaction. So the front-end can decide what to do.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:54:25 -05:00
Dan McGee 93ca155b48 Merge branch 'xav/repo-add' 2009-04-11 13:50:56 -05:00
Dan McGee 101c16b3eb makepkg: fix double check on same path
Commit 142225fd typo-ed this one, as it should look like the rest of the
checks similar to it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:30:38 -05:00