Public bug reported:

[ Impact ]

"repo sync" in noble produces a deprecation warning for utcnow().  It's
just a warning but still ugly and ordinary users might be more
concerned, unaware of how serious or unserious the warning really is.
It might entice quite a few users to go for newer, randomly downloaded
software which I find to be a worrying trend as it bypasses the safety
measurements in place for distro software repositories.

$ repo sync
/usr/bin/repo:681: DeprecationWarning: datetime.datetime.utcnow() is deprecated 
and scheduled for removal in a future version. Use timezone-aware objects to 
represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  now = datetime.datetime.utcnow()

As you can see, the warning already gives instructions how to deal with
the problem, so that is what I will suggest with this SRU.  Replace
datetime.datetime.utcnow() with datetime.datetime.now(datetime.UTC) in
line 681 of the repo script.

Oracular already has a later upstream release where this problem was
already fixed.

[ Test Plan ]

 * spin up a noble instance
 * mkdir /tmp/tmp;cd /tmp/tmp;repo sync
 * notice the warning from the unpatched script

[ Where problems could occur ]

datetime.datetime.now(datetime.UTC) is the explicitly suggested fix to
deal with this deprecation.  datetime.datetime.utcnow() and
datetime.datetime.now(datetime.UTC) are similar but not 100% identical
in their output.  But line 682 which is the line right after the
affected code then applies strftime('%Y%m%dT%H%M%SZ') which eliminates
any difference in output from the previous line.  There will be no
difference going forward and the now variable is not used anywhere else.

[ Other Info ]

datetime.datetime.utcnow() is also used in git_trace2_event_log.py and
git_config.py from the source tree but they don't appear to be shipped
in the binary package.

** Affects: repo (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: noble patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2115168

Title:
  [SRU] utcnow() is deprecated in noble

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/repo/+bug/2115168/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to