summaryrefslogtreecommitdiff
path: root/scripts/repo-add.sh.in
AgeCommit message (Collapse)Author
2011-06-15scripts: refactor output formatting functionsAllan McRae
Move the common output formatting functions into a separate library file and import that into each script. makepkg is excluded due to its additional color formatting. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-02Merge branch 'maint'Dan McGee
Conflicts: src/pacman/callback.c
2011-06-02repo-add: anchor exclusion pattern when generating filelistDan McGee
Fixes FS#24534. Dotfiles, such as /etc/skel/.bash_profile, were not being included in generated files entries. bsdtar --exclude option supports anchors on the pattern, so using "^.*" instead of ".*" solves our problem and still excludes all root-level dotfiles (e.g. .PKGINFO). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24repo-add: update copyright messageAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24repo-add: check for gpg earlyAllan McRae
Check for the presence of gpg as soon as we know we need it. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24repo-add: check for valid key when signing is requestedAllan McRae
Follow the example of makepkg Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24repo-add: add option to specify a different key to sign withDenis A. Altoé Falqueto
Add -k/--key option to specify a non-default key for signing a package database. Original-patch-by: Denis A. Altoé Falqueto <denisfalqueto@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24repo-add: simplify usage messageAllan McRae
Listing every option on the usage line becomes unweildly as more options get added so simplify it. Also, provide a standard package name in the repo-add example. Dan: just use 'options' as we use elsewhere, not 'option(s)'. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27Clean up repo-add usage messageRay Kohler
This now includes -s and -v, tailors itself to the current command, and is formatted more like that of other pacman commands. Signed-off-by: Ray Kohler <ataraxia937@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27Sign database even if emptyRay Kohler
Move the create_signature() call outside the case of non-empty databases, so it will be called regardless. Signed-off-by: Ray Kohler <ataraxia937@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27Rely on the return value of type instead of its outputDave Reisner
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24Fix use of relative paths for packages in repo-addRay Kohler
Move checksum and pgpsig calcluation before changing into the tmpdir, otherwise we can't find the files if a relative path was used. Signed-off-by: Ray Kohler <ataraxia937@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23repo-add: add sha256sum values to repo databaseDan McGee
Implements FS#23103. Also modify libalpm so it ignores this value without any warning as we know it is likely to exist. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23repo-add: add symlink to signature fileAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23repo-add: Fix up usage with GPG optionsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23repo-add: add -v/--verify optionDan McGee
This is intended to verify an existing signature on a database before making further changes to it and performing updates. Rarely would you use this without immediately resigning it via the -s/--sign option. Instead, it is intended as a "chain of trust" operation where the previous signature is verified to give you some sense that what you sign off on is also safe. Still todo: don't make changes unless the signature is not only good, but also in the accepted list of keys. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23repo-add: allow signing of the package databaseDan McGee
In order to be fully secure, we can't only sign packages. We also need to sign our repository metadata to prevent database falsification, dependency injection, etc. Add an '-s/--sign' option that allows this functionality, and will generate a .sig file side-by-side with the package database. While at it, fix the issue where a signature file would never be found because of 'cd' madness (this needs fixing in another commit). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Add PGPSIG field in repo-addGeoffroy Carrier
Use base64 encoding to store the value in the database if a .sig file exists for the package being added. Signed-off-by: Geoffroy Carrier <geoffroy.carrier@koon.fr> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28Fix some easy to find double translationsDan McGee
A lot of these were places that should have used the same message but didn't, or were very easy to convert to using the same message and letting some of the burden off of the translators. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22Merge branch 'epoch-work'Dan McGee
2011-01-22repo-add: only attempt to create deltas when askedAllan McRae
repo-add should only attempt to create the delta file when using the -d option. Also adjust a couple of tests to use the "double bracket" syntax. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21Remove epoch as an independent fieldDan McGee
Instead, go the same route we have always taken with version-release in libalpm and treat it all as one piece of information. Makepkg is the only script that knows about epoch as a distinct value; from there on out we will parse out the components as necessary. This makes the code a lot simpler as far as epoch handling goes. The downside here is that we are tossing some compatibility to the wind; packages using force will have to be rebuilt with an incremented epoch to keep their special status. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-13repo-add: fix misguided conditional correctionDan McGee
I tried to move things around here when testing and did a bit too much; the warning message always showed regardless of delta inclusion in the call. Fix it so we only warn if we have a filename, but the file couldn't be located. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11repo-add: Create/modify files databasesPyroPeter
Implements FS#11302. Dan: updated docs to not reference pkgfile. Signed-off-by: PyroPeter <abi1789@googlemail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11repo-add: use pushd/popdDan McGee
Rather than explicit cd calls, we can use the directory stack to our advantage. This also removes the need to store and restore $startdir, so kill the variable entirely. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13Make repo-add and makepkg epoch-awareDan McGee
Allow it to be a variable in the PKGBUILD as well as propagating it through to the built package and the package database. We leave some backward compatibility in place by placing the '%FORCE%' option in the database if the package contains an epoch; this will be used by older versions of pacman and more or less ignored by versions that use epoch. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13Fix bash shell location checkDan McGee
BASH is defined when you are actually using bash during configure, which sucks because it ends up being '/bin/sh', messing up all of our scripts. Change the name of the variable we use in configure, and also ensure we get a full path to the executable by using AC_PATH_PROGS rather than AC_CHECK_PROGS. Finally, change the variable name everywhere we use it. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11Use sysconfdir, localstatedir, BASH instead of hardcoded valuesNezmer
This applies to contrib/ files, our scripts, and the documentation. Dan: fix 'make clean' in contrib/ directory. Signed-off-by: Nezmer <git@nezmer.info> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11repo-add: more informative delta messagesXavier Chantry
- Print an error if database entry was not found and delta entry cannot be added - More informative line when delta entry is added (oldfile -> newfile) Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11repo-add: add delta generationXavier Chantry
This allows deltas to be generated at repo-add invocation time as opposed to just added to the database. It will generate the delta from the package version currently in the database. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-27repo-add: make --quiet output more quietAllan McRae
Fixes FS#20403. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-18repo-add: create relative DB symlinksDan McGee
As noted in FS#20498, if an absolute path is used for specifying the database when invoking repo-add, the symlink generated will point to the absolute path instead of being relative to the directory. Fix this for the two linking cases, but leave the copy untouched so that will still work. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-24repo-add: try symlink, then hardlink, then copy for DB fileDan McGee
We were seeing some issues when trying to create our new database alias using symlinks on certain filesystems (see FS#19907). Have a fallback method in place where we first try a symlink, then a hard link, then just copy the database if all else fails. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-27repo-add: symlink to db file to reponame.dbAllan McRae
This is a small step towards allowing pacman to handle databases with variable compression types. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15scripts: replace test builtin [ with shell keywords [[ and ((Cedric Staniewski
FS#16623 suggested this change for makepkg; this patch applies it to the remaining files in the scripts directory. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20makepkg, repo-add: replace external commands with bash substitutions where ↵Cedric Staniewski
possible This also removes the awk dependency from makepkg and repo-add. 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-10-11Fix stderr redirectionCedric Staniewski
When redirecting both stderr and stdout and using the 2>&1 construct, you have to redirect stdout first. Otherwise stderr will be redirected to the 'old' stdout and not to the new resource. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-29Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/dload.c
2009-09-23repo-add: clean up options parsingDan McGee
-f/--force has been dead for a while, so kill it off. In addition, the check for > 2 args is pretty useless when you do something like: repo-add -q -q or a more legit: repo-add -q /path/to/mine.db.tar.gz So instead make repo-add just return 1 when it doesn't do anything with the database which seems to make more sense. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-23repo-remove: create empty DB when all packages are removedDan McGee
Rather than creating no database at all, create an empty zipped tar archive in its place. This keeps the download side of repositories a bit more sane as a DB will always exist, and pacman handles this empty case just fine. For this to be fully transparent, we also need to make sure repo-add and repo-remove accept an empty "DB" as an argument, which in reality is a completely void of files .tar.{gz,bz2,xz} archive. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-03repo-add: clarify one messageXavier Chantry
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22makepkg: add pkgbase to .PKGINFO and database for split packagesAllan McRae
With split packages, the pkgbase variable provides a useful way to find out which packages were build from the same PKGBUILD. Add it to the packages .PKGINFO file and the repo database only when package splitting is used. Original-patch-by: Pierre Schmitz <pierre@archlinux.de> [Allan: restrict to including only with spilt packages and include after pkgname] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-23repo-add: use bsdtar optimization for better performanceDan McGee
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-05-23repo-add: fail early if repo can not be createdXavier Chantry
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-18Add support for the xz archive formatPierre Schmitz
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-18repo-add: fix -n tests which are applicable only to stringsCedric Staniewski
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15repo-add : rename gstmpdir to tmpdirXavier Chantry
What does gstmpdir mean? Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15repo-add : don't change the modification time on depends and descXavier Chantry
The modification time on depends and desc file were changed to match the modification time of the package file. I don't see why and we are actualling losing information here. If we want to know the date of the package file, we can just look inside the depends file. If we want to know when the entry was created, we should not alter the modification time of depends and desc. Besides, this had the non-obvious and undocumented side effect that the depends file was always created, even if it was empty. And pacman actually does require that. So I added a "touch depends" to always create the file. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15repo-add : new locking systemXavier Chantry
Weird things could happen if several repo-add were run concurrently on the same database. The introduced locking system will prevent this to happen. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15repo-add : fix package variables declarationXavier Chantry
- arch was missing - backup is not used by repo-add. However makepkg still needs to put it in PKGINFO because pacman uses it - startdir is no longer used after the new delta implementation - the declaration of group, depend, backup, etc is not needed because these variables are always declared before being used : declare $var="$val" case "$var" in group) _groups="$_groups$group\n" ;; - reorder the variables declaration to follow the same order than they are written to the depends and desc file, for making future checks easier Signed-off-by: Xavier Chantry <shiningxc@gmail.com>