public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Proposed change to savedconfig.eclass
@ 2010-02-24 17:03 Jeroen Roovers
  2010-02-24 17:16 ` "Paweł Hajdan, Jr."
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jeroen Roovers @ 2010-02-24 17:03 UTC (permalink / raw
  To: gentoo-dev

[-- 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
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-08  4:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-24 17:03 [gentoo-dev] Proposed change to savedconfig.eclass Jeroen Roovers
2010-02-24 17:16 ` "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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox