tupkgupdate: expand all tabs

90% of them were already expanded. Adjust the mode line accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
Dan McGee 2008-11-11 19:37:19 -06:00 committed by Loui Chang
parent 21840941eb
commit 7a1169431a

View file

@ -45,11 +45,11 @@ class PackageDatabase:
self.dbname = dbname self.dbname = dbname
self.connection = MySQLdb.connect(host=host, user=user, passwd=password, db=dbname) self.connection = MySQLdb.connect(host=host, user=user, passwd=password, db=dbname)
def cursor(self): def cursor(self):
try: try:
self.connection.ping() self.connection.ping()
except MySQLdb.OperationalError: except MySQLdb.OperationalError:
self.connection = MySQLdb.connect(host=self.host, user=self.user, passwd=self.password, db=self.dbname) self.connection = MySQLdb.connect(host=self.host, user=self.user, passwd=self.password, db=self.dbname)
return self.connection.cursor() return self.connection.cursor()
def lookup(self, packagename): def lookup(self, packagename):
warning("DB: Looking up package: " + packagename) warning("DB: Looking up package: " + packagename)
q = self.cursor() q = self.cursor()
@ -94,7 +94,7 @@ class PackageDatabase:
os.path.join(repo_dir, os.path.basename(package.new.file))) + "', " + os.path.join(repo_dir, os.path.basename(package.new.file))) + "', " +
"Description = '" + MySQLdb.escape_string(str(package.desc)) + "', " + "Description = '" + MySQLdb.escape_string(str(package.desc)) + "', " +
"DummyPkg = 0, " + "DummyPkg = 0, " +
"SubmittedTS = UNIX_TIMESTAMP(), " + "SubmittedTS = UNIX_TIMESTAMP(), " +
"URL = '" + MySQLdb.escape_string(str(package.url)) + "' " + "URL = '" + MySQLdb.escape_string(str(package.url)) + "' " +
"WHERE ID = " + str(id)) "WHERE ID = " + str(id))
else: else:
@ -116,7 +116,7 @@ class PackageDatabase:
row = q.fetchone() row = q.fetchone()
if (row[0] != 3): if (row[0] != 3):
q = self.cursor() q = self.cursor()
q.execute("UPDATE Packages SET LocationID = 3, MaintainerUID = null WHERE ID = " + str(id)) q.execute("UPDATE Packages SET LocationID = 3, MaintainerUID = null WHERE ID = " + str(id))
def remove(self, id, locationId): def remove(self, id, locationId):
warning("DB: Removing package with id: " + str(id)) warning("DB: Removing package with id: " + str(id))
q = self.cursor() q = self.cursor()
@ -212,12 +212,12 @@ def areFilesIdentical(file_a, file_b):
############################################################ ############################################################
def infoFromPackageFile(filename): def infoFromPackageFile(filename):
pkg = os.path.basename(filename) pkg = os.path.basename(filename)
m = re.compile("(?P<pkgname>.*)-(?P<pkgver>.*)-(?P<pkgrel>.*).pkg.tar.gz").search(pkg) m = re.compile("(?P<pkgname>.*)-(?P<pkgver>.*)-(?P<pkgrel>.*).pkg.tar.gz").search(pkg)
if not m: if not m:
raise Exception("Non-standard filename") raise Exception("Non-standard filename")
else: else:
return m.group('pkgname'), m.group('pkgver') + "-" + m.group('pkgrel') return m.group('pkgname'), m.group('pkgver') + "-" + m.group('pkgrel')
def infoFromPkgbuildFile(filename): def infoFromPkgbuildFile(filename):
# first grab the category based on the file path # first grab the category based on the file path
@ -306,23 +306,23 @@ def runGensync(repo, pkgbuild):
return execute(command) return execute(command)
def runRepoAdd(repo, package): def runRepoAdd(repo, package):
global havefakeroot global havefakeroot
targetDB = os.path.join(repo, "community.db.tar.gz") targetDB = os.path.join(repo, "community.db.tar.gz")
destfile = os.path.join(repo, os.path.basename(package.new.file)) destfile = os.path.join(repo, os.path.basename(package.new.file))
if havefakeroot: if havefakeroot:
command = "fakeroot repo-add '" + targetDB + "' '" + destfile + "'" command = "fakeroot repo-add '" + targetDB + "' '" + destfile + "'"
else: else:
command = "repo-add '" + targetDB + "' '" + destfile + "'" command = "repo-add '" + targetDB + "' '" + destfile + "'"
return execute(command) return execute(command)
def runRepoRemove(repo, pkgname): def runRepoRemove(repo, pkgname):
global havefakeroot global havefakeroot
targetDB = os.path.join(repo, "community.db.tar.gz") targetDB = os.path.join(repo, "community.db.tar.gz")
if havefakeroot: if havefakeroot:
command = "fakeroot repo-remove '" + targetDB + "' '"+ pkgname + "'" command = "fakeroot repo-remove '" + targetDB + "' '"+ pkgname + "'"
else: else:
command = "repo-remove '" + targetDB + "' '" + pkgname +"'" command = "repo-remove '" + targetDB + "' '" + pkgname +"'"
return execute(command) return execute(command)
############################################################ ############################################################
# Functions for error handling # Functions for error handling
@ -360,9 +360,9 @@ if (len(args_proper) < 3):
# Make sure we can use fakeroot, warn if not # Make sure we can use fakeroot, warn if not
havefakeroot = False havefakeroot = False
if os.access('/usr/bin/fakeroot', os.X_OK): if os.access('/usr/bin/fakeroot', os.X_OK):
havefakeroot = True havefakeroot = True
else: else:
warning("Not using fakeroot for repo db generation") warning("Not using fakeroot for repo db generation")
repo_dir, pkgbuild_dir, build_dir = args_proper repo_dir, pkgbuild_dir, build_dir = args_proper
@ -509,11 +509,11 @@ for package in packages.values():
if (switches.get("--paranoid") == True and package.new.file != None): if (switches.get("--paranoid") == True and package.new.file != None):
if not (areFilesIdentical(package.old.file, package.new.file)): if not (areFilesIdentical(package.old.file, package.new.file)):
warning("New package file with identical version '" + warning("New package file with identical version '" +
package.new.file + "' is different than the old one:") package.new.file + "' is different than the old one:")
if (switches.get("--delete") == True): if (switches.get("--delete") == True):
warning(" Deleting the new file.") warning(" Deleting the new file.")
delete.append(package.new.file) delete.append(package.new.file)
else: else:
warning(" Ignoring the new file.") warning(" Ignoring the new file.")
continue continue
@ -570,14 +570,14 @@ if (switches.get("--delete") == True):
# Run updatesync where it is needed # Run updatesync where it is needed
for package in dbremove: for package in dbremove:
retval = runRepoRemove(repo_dir, package.name) retval = runRepoRemove(repo_dir, package.name)
if (retval != 0): if (retval != 0):
error("repo-remove returned an error!") error("repo-remove returned an error!")
sys.exit(-1) sys.exit(-1)
for package in dbmodify: for package in dbmodify:
retval = runRepoAdd(repo_dir, package) retval = runRepoAdd(repo_dir, package)
if (retval != 0): if (retval != 0):
error("repo-add returned an error!") error("repo-add returned an error!")
sys.exit(-1) sys.exit(-1)
# vim: ft=python ts=2 sw=2 noet # vim: ft=python ts=2 sw=2 et