From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: cnf/repo.postsync.d/, /
Date: Sun, 7 Dec 2014 05:42:17 +0000 (UTC) [thread overview]
Message-ID: <1417930762.ddf87266433247e1ec9aa90b8ffab99a240be7e4.dol-sen@gentoo> (raw)
commit: ddf87266433247e1ec9aa90b8ffab99a240be7e4
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 5 16:12:17 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Dec 7 05:39:22 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ddf87266
Install a verbose example repo.postsync.d script
Brian Dolbec <dolsen <AT> gentoo.org>: Move the example to repo.postsync.d.
Remove the final hook run else section for the new independant repo.postsync.d directory.
Reword comments for the changes.
---
cnf/repo.postsync.d/example | 51 +++++++++++++++++++++++++++++++++++++++++++++
setup.py | 1 +
2 files changed, 52 insertions(+)
diff --git a/cnf/repo.postsync.d/example b/cnf/repo.postsync.d/example
new file mode 100644
index 0000000..533bf71
--- /dev/null
+++ b/cnf/repo.postsync.d/example
@@ -0,0 +1,51 @@
+#!/bin/sh
+# Example /etc/portage/repo.postsync.d script. Make it executable (chmod +x) for
+# Portage to process it.
+#
+# With portage-2.2.16 and newer, all repo.postsync.d hooks will be called multiple
+# times after syncing each repository.
+#
+# Older versions of Portage support syncing only one repository.
+# In those versions, the postsync.d hooks will be called only once,
+# and they will not be passed any parameters.
+
+# On a repo.postsync.d hook call, positional parameters contain
+# information about the just-synced repository.
+
+# Your hook can control it's actions depending on any of the three
+# parameters passed in to it.
+#
+# They are as follows:
+#
+# The repository name.
+repository_name=${1}
+# The URI to which the repository was synced.
+sync_uri=${2}
+# The path to the repository.
+repository_path=${3}
+
+# Portage assumes that a hook succeeded if it exits with 0 code. If no
+# explicit exit is done, the exit code is the exit code of last spawned
+# command. Since our script is a bit more complex, we want to control
+# the exit code explicitly.
+ret=0
+
+if [ -n "${repository_name}" ]; then
+ # Repository name was provided, so we're in a post-repository hook.
+ echo "* In post-repository hook for ${repository_name}"
+ echo "** synced from remote repository ${sync_uri}"
+ echo "** synced into ${repository_path}"
+
+ # Gentoo comes with pregenerated cache but the other repositories
+ # usually don't. Generate them to improve performance.
+ if [ "${repository_name}" != "gentoo" ]; then
+ if ! egencache --update --repo="${repository_name}" --jobs=4
+ then
+ echo "!!! egencache failed!"
+ ret=1
+ fi
+ fi
+fi
+
+# Return explicit status.
+exit "${ret}"
diff --git a/setup.py b/setup.py
index 4388a99..440cbba 100755
--- a/setup.py
+++ b/setup.py
@@ -629,6 +629,7 @@ setup(
['$portage_setsdir', ['cnf/sets/portage.conf']],
['$docdir', ['NEWS', 'RELEASE-NOTES']],
['$portage_base/bin', ['bin/deprecated-path']],
+ ['$sysconfdir/portage/repo.postsync.d', ['cnf/repo.postsync.d/example']],
],
cmdclass = {
reply other threads:[~2014-12-07 5:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1417930762.ddf87266433247e1ec9aa90b8ffab99a240be7e4.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox