summaryrefslogtreecommitdiff
path: root/scripts/repo-add.sh.in
Commit message (Collapse)AuthorAge
* repo-add: improve delta file detection on removalAllan McRae2015-02-12
| | | | | | | This allows use to remove a package with the name "foo.delta" from the repos. Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: only backup database signature if database was backed upAllan McRae2015-02-12
| | | | | | Ensures the backed update database and its signature are always consistent. Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: unify checking gpg keysAllan McRae2015-02-12
| | | | | | | Move the PGP key checking into the check_gpg function. This also results in error messages being in colour. Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: clarify invalid repo extension messageAllan McRae2015-02-12
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: improve removing old packagesAllan McRae2015-02-12
| | | | | | | | | | | The -R/--remove option left the old package in place when delta packages were to be generated. It was also removed before we ensure the generation of the entry for the new package was generated without error. Remove the old package at the end of database entry and delta generation. Also improve the help message to clarify it is the old package that is removed. Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright notices for 2015Allan McRae2015-02-01
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: declare pkgbase as localAllan McRae2014-03-27
|
* Remove ts and sw from vim modeline when noet is setFlorian Pritz2014-01-28
| | | | | | | | | | | | Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
* Update copyright years for 2014Allan McRae2014-01-06
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add; add option to remove existing package files from diskPhillip Smith2013-06-06
| | | | | | | | | | | When maintaining a custom repo, often it is undesirable to retain older versions of packages. This patch adds the --remove option to remove the current package file and it's signature from disk before adding the new one to the database. Documentation is also updated. This is an optional flag and default behaviour (leaving ondisk files alone) is not changed. Signed-off-by: Phillip Smith <fukawi2@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: Update copyright yearAllan McRae2013-03-15
| | | | | | Also adjust translations. Signed-off-by: Allan McRae <allan@archlinux.org>
* scripts: Add color to repo-addWilliam Giokas2013-03-08
| | | | | Signed-off-by: William Giokas <1007380@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Add a -n option to repo-add to only add new packagesDanny George2013-01-03
| | | | | | | | | Packages are already in the pkg db were given a warning, and then readded anyway. With -n specified, the warning is printed, but skips readding it. Signed-off-by: Danny George <dangets@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: quote filename for consistent output styleAllan McRae2012-11-27
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: add checkdepends informationAllan McRae2012-06-25
| | | | | | | Similar to the case for makedepends, it is useful to be able to access this information without parsing a PKGBUILD. Signed-off-by: Allan McRae <allan@archlinux.org>
* repo-add: add makedepends informationAllan McRae2012-05-20
| | | | | | | | | This is useful for tools that automatically rebuild packages and thus require to generate a build order. These entries are skipped by pacman. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* pkgdelta/repo-add: quoting fixesFlorian Pritz2012-04-29
| | | | | | Finish the job on master; most of these were applied to maint already. Signed-off-by: Florian Pritz <bluewind@xinu.at>
* Merge branch 'maint'Dan McGee2012-04-24
|\ | | | | | | | | Conflicts: scripts/repo-add.sh.in
| * pkgdelta/repo-add: quoting fixesFlorian Pritz2012-04-20
| | | | | | | | | | | | | | | | This removes some unnecessary quotes and adds quotes in a few places to hopefully work correctly if the tempdir has spaces. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
* | repo-remove: remove deltas file if it becomes emptyFlorian Pritz2012-04-07
| | | | | | | | | | Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2012-03-08
|\| | | | | | | | | Conflicts: lib/libalpm/be_package.c
| * Do not dereference symlinks when calculating sizeAllan McRae2012-03-05
| | | | | | | | | | | | | | | | | | | | Passing the "-L" flag to stat means we get the size of the file being pointed to for symlinks instead of the size of the symlink. Keep "-L" usage in repo-add as we want the actual size of the package/delta/signature there. Signed-off-by: Allan McRae <allan@archlinux.org>
* | Merge branch 'maint'Dan McGee2012-01-30
|\| | | | | | | | | Conflicts: scripts/makepkg.sh.in
| * scripts: always use printf with embedded gettextDave Reisner2012-01-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2012-01-23
|\| | | | | | | | | | | Conflicts: lib/libalpm/diskspace.c src/pacman/util.h
| * Update copyright on changed files since beginning of yearDan McGee2012-01-18
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * repo-add: clean up help messagesDan McGee2012-01-18
| | | | | | | | | | | | | | | | 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>
* | scripts/*: Declare several constant variables read-onlyLukas Fleischer2011-12-07
| | | | | | | | | | | | | | | | Be more semantically accurate and avoid accidental overwriting of some configuration variables that are considered to be constant. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-12-07
|\|
| * repo-add: enforce maximum .sig file sizeDan McGee2011-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | repo-add: Remove .tmp. prefix from outputAllan McRae2011-11-20
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* | repo-add: ensure database and signature files are always viewed in wholeDan McGee2011-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses a short but sweet race condition currently existing in repo-add and repo-remove. We do the smart thing and zip the database to a location in a temporary directory and not over the original database directly. However, we then proceed to move this file directly from the temporary directory to our final location, which is more than likely a cross-filesystem move (/tmp on tmpfs) and thus non-atomic. Instead, zip the file to the same directory, prefixing the filename with '.tmp.'. We then move the file into place. This move is guaranteed to be atomic, so any reader of the database file will get either the old version, the new version, or ENOENT. We also perform a hardlink if possible instead of a move when shifting the old database out of the way to '.old'; this ensures there is no chance of a database file not existing during the whole process. Only one small race condition should now be present- when the database has been fully moved into place and the signature has not, you may see a mismatch. There seems to be no good way to address this, and it existed before this patch. A final note- if someone had locked-down permissions on the directory that the database files are in (e.g., could only write to foo.db.tar.gz, foo.db, foo.db.tar.gz.old, foo.db.old, and the lock file), this would break. Signed-off-by: Dan McGee <dan@archlinux.org>
* | repo-add: ensure path to LOCKFILE is always absoluteDan McGee2011-11-20
| | | | | | | | | | | | | | | | Given our semi-frequent use of pushd/popd, if we are in any directory but the original and the database path given was relative, we won't unlock the database file when cleaning up after an error. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-10-13
|\| | | | | | | | | Conflicts: src/pacman/util.c
| * scripts/*.sh.in: Fix signal handler error messagesLukas Fleischer2011-10-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * repo-add: Avoid race condition in signal handlersLukas Fleischer2011-10-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | scripts/*.sh.in: Honor TMPDIR environment variableLukas Fleischer2011-10-13
|/ | | | | | | | | | | | Replace "/tmp" with "${TMPDIR:-/tmp}" to allow for overriding the hardcoded path. Since we only use "/tmp" in conjunction with mktemp(1), we could also have used "--tmpdir", which is GNU-ish, however (and the BSD counterpart "-t" has been deprecated in GNU mktemp). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
* repo-add: fix creation of signature symlinkAllan McRae2011-08-16
| | | | | | | | | 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>
* repo-add: reorganize output messages for clarityDan McGee2011-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* repo-add: indicate whether package signature is foundAllan McRae2011-08-15
| | | | | | | | | | 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>
* Update several translation stringsDan McGee2011-08-08
| | | | | | | * Fix typos/capitalization * Make sure large blocks of text are translated in one unit Signed-off-by: Dan McGee <dan@archlinux.org>
* scripts/repo-add: show usage when no DB file specifiedDave Reisner2011-07-28
| | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* repo-add: do not print full path of signature fileAllan McRae2011-07-18
| | | | | | | | 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>
* repo-add: always remove repo signature symlinkAllan McRae2011-07-18
| | | | | | | | 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>
* Add 'compress' compression format as an available optionDan McGee2011-07-14
| | | | | | | | 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>
* repo-add: backup old database signature tooAllan McRae2011-07-05
| | | | | | | | | 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>
* fix vim syntax highlighting of .sh filesFlorian Pritz2011-06-30
| | | | | | | | | | 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>
* repo-add.sh.in: avoid being clever with repo repackingDave Reisner2011-06-30
| | | | | | | | | 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>
* repo-add: fix db creation one last timeDan McGee2011-06-30
| | | | | | | | | | | | | | | | | | | | 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>
* repo-add: remove extra exit callDan McGee2011-06-27
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>