Hello,
I'm looking at two bug reports:
<https://bugs.archlinux.org/task/15308> and
<https://bugs.archlinux.org/task/19327>.
The latter is a duplicate of the former.
Apparently, URLpath is incorrect for several packages in the Packages
table.  Would someone with access to the AUR database mind running the
attached Python script?  It'll produce a file named bad_pkgs.txt, which
I want to see.

-- Chris

#!/usr/bin/python2
import getpass
import MySQLdb

def has_wrong_path(package):
  id, pkgname, urlpath = package
  basename = '%s.tar.gz' % pkgname
  expected_urlpath = '/packages/%s/%s' % (pkgname, basename)
  if urlpath and urlpath != expected_urlpath:
    return True
  return False

QUERY = 'SELECT ID, Name, URLPath from Packages'
username = raw_input('MySQL username: ')
password = getpass.getpass()
dbconnection = MySQLdb.connect(db='AUR', user=username, passwd=password)
cursor = dbconnection.cursor()
cursor.execute(QUERY)

with open('bad_pkgs.txt', 'w') as bad_pkg_list:
  bad_pkg_list.write('ID Name URLPath\n')
  for package in cursor:
    if has_wrong_path(package):
      bad_pkg_list.write('%d %s %s\n' % package)

cursor.close()
dbconnection.close()

Reply via email to