FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 03-10-2010, 12:14 PM
Martin Sivak
 
Default Pick up system's clock settings on upgrade. (#570299)

Hi,

It looks OK, but I would name it differently (maybe restoreSetupTime?) as the funtion does no upgrade, it is just reading values.
Of course, this will need community testing to get all the corner cases right.

And as we discussed yesterday, this patch is not doing the second part.. What if the timezone files changed in the new version? Should we use the old file from user's system to set the time or the new one with the same name? And should we then install the old version or the new one into destination /etc?

Martin

----- "Ales Kozumplik" <akozumpl@redhat.com> wrote:

> Including timezone and UTC through /etc/adjtime.
> ---
> dispatch.py | 2 ++
> upgrade.py | 41 ++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 42 insertions(+), 1 deletions(-)
>
> diff --git a/dispatch.py b/dispatch.py
> index 5bcaab9..a4029d9 100644
> --- a/dispatch.py
> +++ b/dispatch.py
> @@ -36,6 +36,7 @@ from storage.partitioning import doAutoPartition
> from bootloader import writeBootloader, bootloaderSetupChoices
> from flags import flags
> from upgrade import upgradeMountFilesystems
> +from upgrade import upgradeSetupTime
> from upgrade import upgradeSwapSuggestion, upgradeMigrateFind
> from upgrade import findRootParts, queryUpgradeContinue
> from installmethod import doMethodComplete
> @@ -83,6 +84,7 @@ installSteps = [
> ("autopartitionexecute", doAutoPartition, ),
> ("partition", ),
> ("upgrademount", upgradeMountFilesystems, ),
> + ("upgradesetuptime", upgradeSetupTime, ),
> ("upgradecontinue", queryUpgradeContinue, ),
> ("upgradeswapsuggestion", upgradeSwapSuggestion, ),
> ("addswap", ),
> diff --git a/upgrade.py b/upgrade.py
> index 438407a..bff2ad0 100644
> --- a/upgrade.py
> +++ b/upgrade.py
> @@ -107,7 +107,45 @@ def upgradeMigrateFind(anaconda):
> anaconda.dispatch.skipStep("upgrademigratefs")
> else:
> anaconda.dispatch.skipStep("upgrademigratefs", skip = 0)
> -
> +
> +def copyFromSysimage(rootPath, filename):
> + """Mirrors filename from the sysimage on the ramdisk."""
> + sysfile = os.path.normpath("%s/%s" % (rootPath, filename))
> + if os.access(sysfile, os.R_OK):
> + try:
> + # remove our copy if we have one (think liveinstall)
> + os.remove(filename)
> + except OSError:
> + pass
> + try:
> + shutil.copyfile(sysfile, filename)
> + except OSError as e:
> + log.error("Error copying %s to sysimage: %s" %(sysfile,
> e.strerror))
> + return False
> + else:
> + log.error("Error copying %s to sysimage, file not
> accessible." % sysfile)
> + return False
> + return True
> +
> +def upgradeSetupTime(anaconda):
> + """Load time setup for upgrade install.
> +
> + This is pretty much what packages.setupTimezone() does in
> reverse.
> + """
> + if anaconda.dir == DISPATCH_BACK:
> + return
> + if os.environ.has_key("TZ"):
> + del os.environ["TZ"]
> + copyFromSysimage(anaconda.rootPath, '/etc/localtime')
> + copyFromSysimage(anaconda.rootPath, '/etc/adjtime')
> + if iutil.isS390():
> + return
> + args = [ "--hctosys" ]
> + try:
> + iutil.execWithRedirect("/usr/sbin/hwclock", args,stdout =
> "/dev/tty5",
> + stderr = "/dev/tty5")
> + except RuntimeError:
> + log.error("Failed to set the clock.")
>
> # returns None if no more swap is needed
> def upgradeSwapSuggestion(anaconda):
> @@ -271,6 +309,7 @@ def setSteps(anaconda):
> "findrootparts",
> "findinstall",
> "upgrademount",
> + "upgradesetuptime",
> "upgrademigfind",
> "upgrademigratefs",
> "enablefilesystems",
> --
> 1.6.6
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-10-2010, 01:38 PM
Chris Lumens
 
Default Pick up system's clock settings on upgrade. (#570299)

> diff --git a/dispatch.py b/dispatch.py
> index 5bcaab9..a4029d9 100644
> --- a/dispatch.py
> +++ b/dispatch.py
> @@ -36,6 +36,7 @@ from storage.partitioning import doAutoPartition
> from bootloader import writeBootloader, bootloaderSetupChoices
> from flags import flags
> from upgrade import upgradeMountFilesystems
> +from upgrade import upgradeSetupTime
> from upgrade import upgradeSwapSuggestion, upgradeMigrateFind
> from upgrade import findRootParts, queryUpgradeContinue
> from installmethod import doMethodComplete
> @@ -83,6 +84,7 @@ installSteps = [
> ("autopartitionexecute", doAutoPartition, ),
> ("partition", ),
> ("upgrademount", upgradeMountFilesystems, ),
> + ("upgradesetuptime", upgradeSetupTime, ),
> ("upgradecontinue", queryUpgradeContinue, ),
> ("upgradeswapsuggestion", upgradeSwapSuggestion, ),
> ("addswap", ),

All the dispatch stuff looks fine.

> +def upgradeSetupTime(anaconda):
> + """Load time setup for upgrade install.
> +
> + This is pretty much what packages.setupTimezone() does in reverse.
> + """
> + if anaconda.dir == DISPATCH_BACK:
> + return
> + if os.environ.has_key("TZ"):
> + del os.environ["TZ"]
> + copyFromSysimage(anaconda.rootPath, '/etc/localtime')
> + copyFromSysimage(anaconda.rootPath, '/etc/adjtime')
> + if iutil.isS390():
> + return
> + args = [ "--hctosys" ]
> + try:
> + iutil.execWithRedirect("/usr/sbin/hwclock", args,stdout = "/dev/tty5",
> + stderr = "/dev/tty5")
> + except RuntimeError:
> + log.error("Failed to set the clock.")

It'd be nice if you broke this up logically with some blank lines.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-10-2010, 05:45 PM
"Brian C. Lane"
 
Default Pick up system's clock settings on upgrade. (#570299)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/10/2010 05:14 AM, Martin Sivak wrote:
> Hi,
>
> It looks OK, but I would name it differently (maybe
> restoreSetupTime?) as the funtion does no upgrade, it is just reading
> values. Of course, this will need community testing to get all the
> corner cases right.
>
> And as we discussed yesterday, this patch is not doing the second
> part.. What if the timezone files changed in the new version? Should
> we use the old file from user's system to set the time or the new one
> with the same name? And should we then install the old version or the
> new one into destination /etc?
>

glibc is supposed to update the /etc/localtime file when there is a
tzdata change so I think just copying the user's current one and letting
the glibc rpm handle updating it will work.

- --
Brian C. Lane <bcl@redhat.com>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS5fotRF+jBaO/jp/AQJBzAf/eaJzjuqhzGyOUumCNDfm5vYpTMs8VWae
PoQs5oLndeUNgORNJZJZeHQa/U0YtaZgB8yi/cg5EUWc34YFl0iknUojsfRKuGAS
er8XtyIm0PGUUUZW0rMDC2eTPElKetDArW8bKvgQVlOFcRxQg7 6jhk6OU8Z2rRt1
f0xQqwW0YjcCiR1jzAuWXCHIhqIk5+jubtI97Y5DWWoagXTxhx PiukQ2svl0roR5
TB6Tb9VRPHyAoAyIIf74gBD3adtE39hXF62kVyFLK54QN4Cqu3 h6FfqEYwF//Sqy
tkmTj9U7h+9CeucdPQDjBM06QpC5uq7X6SNyDNMnWcJnjCzuFF NhxQ==
=zL5z
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-11-2010, 07:43 AM
Ales Kozumplik
 
Default Pick up system's clock settings on upgrade. (#570299)

On 03/10/2010 03:38 PM, Chris Lumens wrote:

+def upgradeSetupTime(anaconda):
+ """Load time setup for upgrade install.
+
+ This is pretty much what packages.setupTimezone() does in reverse.
+ """
+ if anaconda.dir == DISPATCH_BACK:
+ return
+ if os.environ.has_key("TZ"):
+ del os.environ["TZ"]
+ copyFromSysimage(anaconda.rootPath, '/etc/localtime')
+ copyFromSysimage(anaconda.rootPath, '/etc/adjtime')
+ if iutil.isS390():
+ return
+ args = [ "--hctosys" ]
+ try:
+ iutil.execWithRedirect("/usr/sbin/hwclock", args,stdout = "/dev/tty5",
+ stderr = "/dev/tty5")
+ except RuntimeError:
+ log.error("Failed to set the clock.")


It'd be nice if you broke this up logically with some blank lines.

- Chris


I pushed the change already, with lot more documentation comments for
the function though, should be easy to follow. Will insert more blank
lines the next time.


Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 08:15 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org