From: Jeroen Roovers <jer@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Proposed change to savedconfig.eclass
Date: Wed, 24 Feb 2010 18:03:16 +0100 [thread overview]
Message-ID: <20100224180316.660d2c98@epia.jer-c2.orkz.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]
Hello developers,
this has annoyed me for a long time.
restore_config() dies when it cannot find a saved config file, while
later on in any ebuild that uses savedconfig.eclass, it will save the
config file anyhow. That means it will not use an edited saved config
file during the first emerge, which is to be expected and should not be
fatal.
The current forces you to emerge the same ebuild twice using _different_
USE flags to achieve anything:
1. USE="-savedconfig" emerge cat/foo
2. $EDITOR /etc/portage/savedconfig/cat/foo
3. USE="savedconfig" emerge cat/foo
This is quite illogical.
With the patch applied it should be enough to set USE=savedconfig
globally, run `emerge foo', edit the saved config file(s) and run
`emerge foo' again, without having to change the USE flag:
0. euse -E savedconfig # Set USE=savedconfig globally
1. emerge cat/foo
2. $EDITOR /etc/portage/savedconfig/cat/foo
3. emerge cat/foo
4. Profit!
The attached patch actually accomplishes two things:
1) It removes some old code[1] in an elif that apparently never gets
executed (or we would have seen bash syntax bugs filed loooong ago).
2) It makes restore_config non-fatal on the first emerge with
USE=savedconfig.
If no one objects, I will look forward to committing the patch in a
week or two.
Regards,
jer
[1] Already present in the first commit.
[-- Attachment #2: savedconfig.eclass-donotdie.patch --]
[-- Type: text/x-patch, Size: 1248 bytes --]
Index: savedconfig.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v
retrieving revision 1.12
diff -u -B -r1.12 savedconfig.eclass
--- savedconfig.eclass 30 Oct 2009 16:46:41 -0000 1.12
+++ savedconfig.eclass 24 Feb 2010 16:52:07 -0000
@@ -111,16 +111,14 @@
pushd "${found}" > /dev/null
treecopy . "${dest}" || die "Failed to restore ${found} to $1"
popd > /dev/null
- elif [[ -a {found} ]]; then
- die "do not know how to handle non-file/directory ${found}"
else
# maybe the user is screwing around with perms they shouldnt #289168
if [[ ! -r ${base} ]] ; then
eerror "Unable to read ${base} -- perms are screwed ?"
die "fix your system"
fi
- eerror "No saved config to restore - please remove USE=savedconfig or"
- eerror "provide a configuration file in ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}"
- die "config file needed when USE=savedconfig is specified"
+ ewarn "No saved config to restore - please remove USE=savedconfig or"
+ ewarn "provide a configuration file in ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}"
+ ewarn "Your config file(s) will not be used this time"
fi
}
next reply other threads:[~2010-02-24 17:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-24 17:03 Jeroen Roovers [this message]
2010-02-24 17:16 ` [gentoo-dev] Proposed change to savedconfig.eclass "Paweł Hajdan, Jr."
2010-03-08 4:56 ` Mike Frysinger
2010-02-25 15:23 ` Daniel Black
2010-03-07 2:39 ` Mike Frysinger
2010-03-08 4:34 ` Jeroen Roovers
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=20100224180316.660d2c98@epia.jer-c2.orkz.net \
--to=jer@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