summaryrefslogtreecommitdiffstats
path: root/scripts/repo-add.sh.in
AgeCommit message (Collapse)AuthorFilesLines
2012-01-30scripts: always use printf with embedded gettextDave Reisner1-22/+22
This addresses two problems: 1) echo's behavior is inconsistent when dealing with flags, and can potentially be problematic. $ echo -n $ echo -- -n -- -n 2) Always using the end of options markers prevents translated strings from throwing errors, as shown in FS#28069. The remaining "inconsistencies" are because printf is being used in a guaranteed safe manner, e.g. printf '%s\n' "$(gettext "--this can never break")" Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18Update copyright on changed files since beginning of yearDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-18repo-add: clean up help messagesDan McGee1-6/+14
Use consistent blank lines across all commands, get rid of the translated double newlines which only serve to confuse translators, and fix -h/--help for that extra special third command this script offers. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-05repo-add: enforce maximum .sig file sizeDan McGee1-7/+12
This prevents user error in adding a file generated via `gpg --sign` rather than `--detach-sign`, for example. The same 16KiB limit is used we use in our pacman download code. The section is moved above the checksum generation to avoid presenting info messages to the user if the signature isn't valid. Addresses a shortcoming pointed out in FS#27453. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13scripts/*.sh.in: Fix signal handler error messagesLukas Fleischer1-2/+4
This includes some fixes to the messages that are displayed when a signal is caught in makepkg or repo-add: * Instead of always showing "==> ERROR: TERM signal caught. Exiting...", replace "TERM" by whatever signal is actually caught. * Fix a typo in the SIGERR error message in repo-add ("occurred" instead of "occured"). Francois already fixed this for makepkg in 1e51b81c. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13repo-add: Avoid race condition in signal handlersLukas Fleischer1-2/+8
There is a small chance that a user sends SIGINT (or any other signal that is trapped) when we're already in clean_up() which used to lead to trap_exit() being executed and the remaining code in clean_up() being skipped due to the bash signal/trap handler blocking EXIT (since its handler is already being executed, even if it's interrupted). In practice, this behaviour caused unexpected results (primarily because pressing ^C at the wrong time left a lock file behind): $ ./repo-add extra.db.tar.gz foobar ==> Extracting database to a temporary location... ^C ==> ERROR: Aborted by user! Exiting... $ ./repo-add extra.db.tar.gz foobar ==> Extracting database to a temporary location... ==> ERROR: File 'foobar' not found. ==> No packages modified, nothing to do. ^C ==> ERROR: Aborted by user! Exiting... $ ./repo-add extra.db.tar.gz foobar ==> ERROR: Failed to acquire lockfile: extra.db.tar.gz.lck. ==> ERROR: Held by process 18522 Fix this and reduce the chance of race conditions in signal handlers by: * Unhooking all traps in both clean_up() and trap_exit(). * Call clean_up() explicitly in trap_exit() to make sure we remove the lock file and the temporary directory even if we send SIGINT when clean_up() is already being executed but didn't reach the unhook code yet. Also, add an optional parameter to clean_up() to allow for setting an explicit exit code when we call clean_up() from trap_exit(). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16repo-add: fix creation of signature symlinkAllan McRae1-1/+1
When creating a repo outside the current directory, the signature symlink was not created. Reported-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15repo-add: reorganize output messages for clarityDan McGee1-17/+17
The use of warning once we had already started adding a package was confusing as it broke the standard indent pattern. It was especially bad if adding multiple packages as it wasn't clear what sub-messages applied to which package being added. This should be an output change only from: ==> Adding package '/tmp/sync/netcfg-2.6.7-1-any.pkg.tar.xz' -> Computing checksums... -> Adding package signature... ==> WARNING: An entry for 'netcfg-2.6.7-1' already existed -> Removing existing entry 'netcfg-2.6.7-1'... -> Creating 'desc' db entry... -> Creating 'depends' db entry... to: ==> Adding package '/tmp/sync/netcfg-2.6.7-1-any.pkg.tar.xz' ==> WARNING: An entry for 'netcfg-2.6.7-1' already existed -> Computing checksums... -> Adding package signature... -> Removing existing entry 'netcfg-2.6.7-1'... -> Creating 'desc' db entry... -> Creating 'depends' db entry... Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-15repo-add: indicate whether package signature is foundAllan McRae1-0/+1
When adding a package to a repo, it is useful to be able to see that repo-add has indeed found the signature file. [Dan: update text to be more in line with other messages] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08Update several translation stringsDan McGee1-1/+1
* Fix typos/capitalization * Make sure large blocks of text are translated in one unit Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-28scripts/repo-add: show usage when no DB file specifiedDave Reisner1-1/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-18repo-add: do not print full path of signature fileAllan McRae1-1/+1
The full path to the signature file when it is created is in a temporary directory so only print the filename. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-18repo-add: always remove repo signature symlinkAllan McRae1-2/+1
This prevents a dangling symlink being left behind if the repo goes from being signed to unsigned. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-14Add 'compress' compression format as an available optionDan McGee1-0/+1
This adds the '.tar.Z' option to both repo-add and makepkg for no other reason than "why not", and because bsdtar supports it natively with the '-Z' flag. Also update the documentation accordingly. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05repo-add: backup old database signature tooAllan McRae1-1/+5
If you are keeping a copy of the old database, you probably want to keep a copy of its signature too. Also, delete the previously backed-up database signature if no new one is being copied. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30fix vim syntax highlighting of .sh filesFlorian Pritz1-1/+1
vim recognises what type of shell script it's dealing with by looking at the shebang. If detection fails it falls back to sh which doesn't support some bash features. Adding a normal, possibly broken, shebang which gets fixed by the Makefile allows vim to detect bash syntax. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30repo-add.sh.in: avoid being clever with repo repackingDave Reisner1-2/+7
Revert to the old behavior that 6f5a90 attempted to simplify and go with the original proposed solution of using "ugly" bash to detect empty directories. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-30repo-add: fix db creation one last timeDan McGee1-9/+11
We fubar-ed this pretty good. 1. The whole old/new move shuffle was totally busted if you used a relative path to your database, as we would just build the database in place. 2. Our prior temp directory layout had the database files extracted directly into it. When we tried to create a xxx.db.tar.gz file in this same directory, due to the fact that we were no longer using a shell wildcard, we tried to include the db in ourself, which is a big failure. Fix all this by extracting to tree/ so we can have a clean top-level temp directory. 3. Fix the inclusion of the './' directory entry; ensure the regex prunes both leading paths of '.' as well as './'. Where is that test suite again? Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27repo-add: remove extra exit callDan McGee1-1/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-27Merge remote-tracking branch 'dave/repo-add'Dan McGee1-85/+113
2011-06-27repo-add: add new command, repo-elephantDave Reisner1-0/+21
_ _ / \__/ \_____ / / \ \ `\ ) \''/ ( |\ `\__)/__/'_\ / ` //_|_|~|_|_| ^""'"' ""'"' Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27repo-add: enforce file extensionsDave Reisner1-9/+20
Allow one of 4 archive extensions: .tar{,.gz,.xz,.bz2} for each of the 2 valid repo extensions: .db and .files. Check for this via 'verify_repo_extension' directly after option parsing to assert that this extension is present, and again after files have been added to get the proper archive option for bsdtar. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27repo-add: move command invocation out of arg parsing loopDave Reisner1-11/+14
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27repo-add: refactor repacking of repo fileDave Reisner1-8/+2
Dump the whole conditional and filter the contents of the directory to create an empty or non-empty archive. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-27Remove -f option from ln for POSIX complianceEric Bélanger1-4/+6
Fixes FS#24893. 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>
2011-06-24repo-add: use format_entry for all desc/depends fieldsDave Reisner1-22/+24
This ranks high on the code readability scale. The same function formats all of our data and writes to the metadata file at once. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24repo-add: store multi-value fields as arraysDave Reisner1-24/+26
Fields like groups and depends should be stored as arrays. This requires rewriting our write_list_entry function to accomodate our new data type. This new function will not write to a file, but rather only format it. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24repo-add: bashify reading of .PKGINFO fileDave Reisner1-14/+9
grep and sed aren't needed here, and this removes the truly ugly manipulation of IFS. The process substituion could just as well be a herestring, but it breaks vim's syntax highlighting. Style over substance, mang. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-23Merge branch 'po-split'Dan McGee1-1/+1
2011-06-23repo-add: fix path designation regressionDave Reisner1-2/+11
b899099 made path checking a bit more strict than I had intended, and would actually forbid creation of a repo in $PWD if only the filename was specified. readlink would be the fun and easy solution here, but it's avoided due to portability issues, making the validation process a bit more verbose. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23po/: split into scripts/po/ and src/pacman/po/Dan McGee1-1/+1
This is the first step at separating the pacman message catalog and the scripts message catalog. Makefiles, configure.ac, and other such files are adjusted accordingly, as well as renaming files. The TEXTDOMAIN of scripts is also adjusted. Note that no actual pot or po files get changed here; these will get pruned in a future commit so each catalog contains only the necessary messages. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-22repo-add: style cleanupDave Reisner1-16/+8
Unify function braces to be top right opening, bottom left closing. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20repo-add: show better error when path to repo does not existDave Reisner1-0/+6
Previously, the error message when trying to add to a repo where a parent directory didn't exist was: ==> ERROR: Failed to acquire lockfile: /path/to/noexist/repo.tar.gz.lck This sucks. Make an explicit check to ensure that the path to the repo really does exist, and throw a meaningful error message when it can't be found. Dan: reuse an existing (translated) error message. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20repo-add: allow creating a database with no compressionDan McGee1-4/+5
A plain '.tar' ending should be allowed. This corresponds to how we handle this extension in makepkg. Also fix up the other extension checks, which were missing a leading '.' character. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-20repo-add: use bash equivalents of basename/dirnameDave Reisner1-6/+6
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-15scripts: refactor output formatting functionsAllan McRae1-21/+1
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 McGee1-1/+1
Conflicts: src/pacman/callback.c
2011-06-02repo-add: anchor exclusion pattern when generating filelistDan McGee1-1/+1
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 McRae1-4/+2
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24repo-add: check for gpg earlyAllan McRae1-9/+14
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 McRae1-1/+11
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é Falqueto1-11/+27
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 McRae1-3/+3
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 Kohler1-18/+25
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 Kohler1-1/+2
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 Reisner1-2/+2
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 Kohler1-14/+17
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 McGee1-5/+9
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 McRae1-0/+5
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23repo-add: Fix up usage with GPG optionsDan McGee1-2/+3
Signed-off-by: Dan McGee <dan@archlinux.org>