[releng] Add helper script to retire packages
by Till Maas
commit 5ea1e5250b9635d40598222cd1ef219ed1bea5e9
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 23:26:55 2014 +0200
Add helper script to retire packages
scripts/fedretire | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/scripts/fedretire b/scripts/fedretire
new file mode 100755
index 0000000..c277f77
--- /dev/null
+++ b/scripts/fedretire
@@ -0,0 +1,78 @@
+#!/usr/bin/python -tt
+# vim: fileencoding=utf8
+# SPDX-License-Identifier: GPL-2.0+
+# {{{ License header: GPLv2+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+# }}}
+
+import argparse
+import os
+import shutil
+import subprocess
+import tempfile
+
+
+def retire(pkg, branch, reason, dryrun=False):
+ tempdir = tempfile.mkdtemp(pkg, branch)
+ try:
+ cmd = ["fedpkg", "clone", pkg]
+ if dryrun:
+ print(cmd)
+ else:
+ subprocess.check_call(cmd, cwd=tempdir)
+ pkgdir = os.path.join(tempdir, pkg)
+
+ cmd = ["fedpkg", "switch-branch", branch]
+ if dryrun:
+ print(cmd)
+ else:
+ subprocess.check_call(cmd, cwd=pkgdir)
+
+ cmd = ["fedpkg", "retire", reason]
+ if dryrun:
+ print(cmd)
+ else:
+ subprocess.check_call(cmd, cwd=pkgdir)
+ finally:
+ shutil.rmtree(tempdir)
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description="Helper to retire packages")
+ parser.add_argument("--branch", default="master",
+ choices=["master", "f21", "epel7", "el6", "el5"])
+ parser.add_argument("--reasonfile", default=None)
+ parser.add_argument("--reason", default=None)
+ parser.add_argument("pkg", nargs="+")
+ args = parser.parse_args()
+
+ if args.reasonfile is None and args.reason is None:
+ reasonfile = tempfile.NamedTemporaryFile(delete=False)
+ filename = reasonfile.name
+ childpid = os.fork()
+ if childpid == 0:
+ os.execlp("vim", "vim", filename)
+ else:
+ os.waitpid(childpid, 0)
+ reason = reasonfile.read()
+ os.unlink(filename)
+ elif args.reasonfile is not None:
+ with open(args.reasonfile, "rb") as reasonfile:
+ reason = reasonfile.read()
+ else:
+ reason = args.reason
+ if reason[-1] != "\n":
+ reason += "\n"
+
+ for pkg in args.pkg:
+ retire(pkg, args.branch, reason, dryrun=False)
8 years, 11 months
[releng] find_unblocked_orphans: Highlight unshipped packages
by Till Maas
commit b750c92a780bdb0198c92e9d01f344b09b33b1aa
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 23:23:39 2014 +0200
find_unblocked_orphans: Highlight unshipped packages
scripts/find_unblocked_orphans.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index 688b30f..02807c8 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -315,6 +315,7 @@ class DepChecker(object):
self.pkgdbinfo_queue = Queue()
self.pkgdb_cache = "orphans-pkgdb-{}.pickle".format(release)
self.pkgdb_dict = get_cache(self.pkgdb_cache, default={})
+ self.not_in_repo = []
def create_mapping(self):
src_by_bin = {} # Dict of source pkg objects by binary package objects
@@ -368,6 +369,7 @@ class DepChecker(object):
# If we don't have a package in the repo, there is nothing to do
sys.stderr.write(
"Package {0} not found in repo\n".format(srpmname))
+ self.not_in_repo.append(srpmname)
rpms = []
# provides of all packages built from ``srpmname``
@@ -587,9 +589,10 @@ def maintainer_info(affected_people):
return info
-def package_info(unblocked, dep_map, pkgdb_dict, orphans=None, failed=None,
+def package_info(unblocked, dep_map, depchecker, orphans=None, failed=None,
week_limit=6):
info = ""
+ pkgdb_dict = depchecker.pkgdb_dict
table, affected_people = maintainer_table(unblocked, pkgdb_dict)
info += table
@@ -671,6 +674,10 @@ def package_info(unblocked, dep_map, pkgdb_dict, orphans=None, failed=None,
ftbfs_not_breaking_deps)
info += "\n\n"
+ if depchecker.not_in_repo:
+ info += wrap_and_format("Not found in repo",
+ sorted(depchecker.not_in_repo))
+
addresses = ["{0}(a)fedoraproject.org".format(p)
for p in affected_people.keys() if p != ORPHAN_UID]
return info, addresses
@@ -716,7 +723,7 @@ def main():
# TODO: add app args to either depsolve or not
dep_map = depchecker.recursive_deps(unblocked)
sys.stderr.write('done\n')
- info, addresses = package_info(unblocked, dep_map, depchecker.pkgdb_dict,
+ info, addresses = package_info(unblocked, dep_map, depchecker,
orphans=orphans, failed=failed)
text += "\n"
text += info
8 years, 11 months
[releng] find_unblocked_orphans: Show stale dependent packages
by Till Maas
commit 853bf9c5eb91e41a9e68e7737869e073a865db84
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 14:19:45 2014 +0200
find_unblocked_orphans: Show stale dependent packages
scripts/find_unblocked_orphans.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index 5807c6a..688b30f 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -649,6 +649,15 @@ def package_info(unblocked, dep_map, pkgdb_dict, orphans=None, failed=None,
if breaking:
info += wrap_and_format("Depending packages", sorted(breaking))
+ if orphans:
+ stale_breaking = set()
+ for package in orphans_breaking_deps_stale:
+ stale_breaking = stale_breaking.union(
+ set(dep_map[package].keys()))
+ info += wrap_and_format(
+ "Packages depending on packages orphaned for more than "
+ "{} weeks".format(week_limit), sorted(stale_breaking))
+
if failed:
info += "\nFTBFS: " + " ".join(failed)
info += "\n"
8 years, 11 months
[releng] find_unblocked_orphans: Mention retirement deadline
by Till Maas
commit b34df01a35c3e61eb56734cd563611cf646a577f
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 12:51:22 2014 +0200
find_unblocked_orphans: Mention retirement deadline
scripts/find_unblocked_orphans.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index 7a41d0c..5807c6a 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -99,14 +99,15 @@ According to https://fedoraproject.org/wiki/Schedule branching will
occur not earlier than 2014-07-08. The packages will be retired shortly before.
"""
-HEADER = """The following packages are orphaned and might be retired
-eventually, unless someone adopts them. If you know for sure that the package
-should be retired, please do so now with a proper reason:
+HEADER = """The following packages are orphaned and will be retired when they
+are orphaned for six weeks, unless someone adopts them. If you know for sure
+that the package should be retired, please do so now with a proper reason:
https://fedoraproject.org/wiki/How_to_remove_a_package_at_end_of_life
Note: If you received this mail directly you (co)maintain one of the affected
packages or a package that depends on one. Please adopt the affected package or
-retire your depending package to avoid broken dependencies.
+retire your depending package to avoid broken dependencies, otherwise your
+package will be retired when the affected package gets retired.
"""
FOOTER = """-- \nThe script creating this output is run and developed by Fedora
8 years, 11 months
[releng] find_unblocked_orphans: Rename age column
by Till Maas
commit 2489d4fcb0ba556066b5de6afd57d554e10f75fc
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 12:41:42 2014 +0200
find_unblocked_orphans: Rename age column
scripts/find_unblocked_orphans.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index e2889e4..7a41d0c 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -528,7 +528,7 @@ def maintainer_table(packages, pkgdb_dict):
if with_table:
table = texttable.Texttable(max_width=80)
- table.header(["Package", "(co)maintainers", "age"])
+ table.header(["Package", "(co)maintainers", "Status Change"])
table.set_cols_align(["l", "l", "l"])
table.set_deco(table.HEADER)
else:
@@ -542,8 +542,8 @@ def maintainer_table(packages, pkgdb_dict):
p = ', '.join(people)
status_change = pkginfo.status_change
age = pkginfo.age
- agestr = "{} ({} weeks)".format(status_change.strftime("%Y-%m-%d"),
- age.days / 7)
+ agestr = "{} ({} weeks ago)".format(status_change.strftime("%Y-%m-%d"),
+ age.days / 7)
if with_table:
table.add_row([package_name, p, agestr])
8 years, 11 months
[releng] find_unblocked_orphans: Show stale packages
by Till Maas
commit d70220425e61126fd9e5cef3c7459e9a1fa8b793
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 12:28:17 2014 +0200
find_unblocked_orphans: Show stale packages
scripts/find_unblocked_orphans.py | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index d8eb073..e2889e4 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -586,10 +586,11 @@ def maintainer_info(affected_people):
return info
-def package_info(packages, dep_map, pkgdb_dict, orphans=None, failed=None):
+def package_info(unblocked, dep_map, pkgdb_dict, orphans=None, failed=None,
+ week_limit=6):
info = ""
- table, affected_people = maintainer_table(packages, pkgdb_dict)
+ table, affected_people = maintainer_table(unblocked, pkgdb_dict)
info += table
info += "\n\nThe following packages require above mentioned packages:\n"
info += dependency_info(dep_map, affected_people, pkgdb_dict)
@@ -617,12 +618,29 @@ def package_info(packages, dep_map, pkgdb_dict, orphans=None, failed=None):
info += wrap_and_format("Orphans (dependend on)",
orphans_breaking_deps)
+ orphans_breaking_deps_stale = [
+ o for o in orphans_breaking_deps if
+ (pkgdb_dict[o].age.days / 7) >= week_limit]
+
+ info += wrap_and_format(
+ "Orphans for at least {} weeks (dependend on)".format(week_limit),
+ orphans_breaking_deps_stale)
+
orphans_not_breaking_deps = [o for o in orphans if
o not in dep_map or not dep_map[o]]
info += wrap_and_format("Orphans (not depended on)",
orphans_not_breaking_deps)
+ orphans_not_breaking_deps_stale = [
+ o for o in orphans_not_breaking_deps if
+ (pkgdb_dict[o].age.days / 7) >= week_limit]
+
+ info += wrap_and_format(
+ "Orphans for at least {} weeks (not dependend on)".format(
+ week_limit),
+ orphans_not_breaking_deps_stale)
+
breaking = set()
for package, deps in dep_map.items():
breaking = breaking.union(set(deps.keys()))
8 years, 11 months
[releng] find_unblocked_orphans: Limit to unblocked pkgs
by Till Maas
commit 8656f465b5769ce5f64e3d0969d4c99182fc44a8
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 12:27:18 2014 +0200
find_unblocked_orphans: Limit to unblocked pkgs
- Limit short reports to unblocked pkgs
scripts/find_unblocked_orphans.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index b128e00..d8eb073 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -609,6 +609,7 @@ def package_info(packages, dep_map, pkgdb_dict, orphans=None, failed=None):
return wrappedtext
if orphans:
+ orphans = [o for o in orphans if o in unblocked]
info += wrap_and_format("Orphans", orphans)
orphans_breaking_deps = [o for o in orphans if
8 years, 11 months
[releng] find_unblocked_orphans: Check packages after sorting
by Till Maas
commit e5ba69594362e20662763337285d77e04e307d3f
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 12:25:37 2014 +0200
find_unblocked_orphans: Check packages after sorting
scripts/find_unblocked_orphans.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index bfd8f24..b128e00 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -447,7 +447,7 @@ class DepChecker(object):
# dict for all dependent packages for each to-be-removed package
dep_map = OrderedDict()
- for name in packages:
+ for name in sorted(packages):
sys.stderr.write("Checking: {0}\n".format(name))
ignore = rpm_pkg_names
dep_map[name] = OrderedDict()
8 years, 11 months
[releng] find_unblocked_orphans: Display orphan's age
by Till Maas
commit 666e88334c73683b8a5dacca26a1bd8fc9548537
Author: Till Maas <opensource(a)till.name>
Date: Sat Oct 18 11:34:57 2014 +0200
find_unblocked_orphans: Display orphan's age
scripts/find_unblocked_orphans.py | 40 +++++++++++++++++++++++++++---------
1 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/scripts/find_unblocked_orphans.py b/scripts/find_unblocked_orphans.py
index bf94aea..bfd8f24 100755
--- a/scripts/find_unblocked_orphans.py
+++ b/scripts/find_unblocked_orphans.py
@@ -30,9 +30,9 @@ import yum
try:
import texttable
- with_texttable = True
+ with_table = True
except ImportError:
- with_texttable = False
+ with_table = False
EPEL5_RELEASE = dict(
@@ -220,6 +220,21 @@ class PKGDBInfo(object):
else:
return []
+ @property
+ def age(self):
+ now = datetime.datetime.utcnow()
+ age = now - self.status_change
+ return age
+
+ @property
+ def status_change(self):
+ status_change = self.pkginfo["status_change"]
+ status_change = datetime.datetime.utcfromtimestamp(status_change)
+ return status_change
+
+ def __getitem__(self, *args, **kwargs):
+ return self.pkginfo.__getitem__(*args, **kwargs)
+
def setup_yum(repo=RAWHIDE_RELEASE["repo"],
source_repo=RAWHIDE_RELEASE["source_repo"]):
@@ -511,26 +526,31 @@ class DepChecker(object):
def maintainer_table(packages, pkgdb_dict):
affected_people = {}
- if with_texttable:
+ if with_table:
table = texttable.Texttable(max_width=80)
- table.header(["Package", "(co)maintainers"])
- table.set_cols_align(["l", "l"])
+ table.header(["Package", "(co)maintainers", "age"])
+ table.set_cols_align(["l", "l", "l"])
table.set_deco(table.HEADER)
else:
table = ""
for package_name in packages:
- people = pkgdb_dict[package_name].get_people()
+ pkginfo = pkgdb_dict[package_name]
+ people = pkginfo.get_people()
for p in people:
affected_people.setdefault(p, set()).add(package_name)
p = ', '.join(people)
+ status_change = pkginfo.status_change
+ age = pkginfo.age
+ agestr = "{} ({} weeks)".format(status_change.strftime("%Y-%m-%d"),
+ age.days / 7)
- if with_texttable:
- table.add_row([package_name, p])
+ if with_table:
+ table.add_row([package_name, p, agestr])
else:
- table += "{0} {1}\n".format(package_name, p)
+ table += "{} {} {}\n".format(package_name, p, agestr)
- if with_texttable:
+ if with_table:
table = table.draw()
return table, affected_people
8 years, 11 months