diff options
author | Dan McGee <dan@archlinux.org> | 2008-11-11 19:37:20 -0600 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2008-11-12 06:59:12 -0500 |
commit | 3c8442d70c006c99b06cd3995303c7ecca76b461 (patch) | |
tree | 9e12a2779b6da2c53585c5cba19f3dd415852b57 /tupkg | |
parent | 7a1169431a568dc66cb84af225a4b1c5f03a8a71 (diff) | |
download | aurweb-3c8442d70c006c99b06cd3995303c7ecca76b461.tar.xz |
tupkgupdate: add config_use_db check to allow skipping of DB operations
This should prevent us from needing to completely duplicate the tupkgupdate
script for x86_64, where we currently skip the DB updates step.
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'tupkg')
-rwxr-xr-x | tupkg/update/tupkgupdate | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/tupkg/update/tupkgupdate b/tupkg/update/tupkgupdate index 4318ad5..5ceb726 100755 --- a/tupkg/update/tupkgupdate +++ b/tupkg/update/tupkgupdate @@ -17,6 +17,7 @@ if not os.path.isfile(conffile): config = ConfigParser.ConfigParser() config.read(conffile) +config_use_db = config.has_section('mysql') ############################################################ @@ -366,11 +367,12 @@ else: repo_dir, pkgbuild_dir, build_dir = args_proper -# Open the database so we find out now if we can't! -db = PackageDatabase(config.get('mysql', 'host'), - config.get('mysql', 'username'), - config.get('mysql', 'password'), - config.get('mysql', 'db')) +# Open the database if we need it so we find out now if we can't! +if config_use_db: + db = PackageDatabase(config.get('mysql', 'host'), + config.get('mysql', 'username'), + config.get('mysql', 'password'), + config.get('mysql', 'db')) # Set up the lists and tables packages = dict() @@ -531,21 +533,22 @@ if (had_error == 1): # PASS 3: EXECUTION # -# First, do all the database updates -for package in dbremove: - id = db.lookup(package.name) - # Note: this could remove a package from unsupported; probably want to restrict to locationId and/or non-dummy - if (id != None): - db.clearOldInfo(id) - db.remove(id, 3) - -for package in dbmodify: - warning("DB: Package in dbmodify: " + package.name) - id = db.lookup(package.name) - if (id == None): - db.insert(package, 3) - else: - db.update(id, package, 3) +if config_use_db: + # First, do all the database updates if asked for + for package in dbremove: + id = db.lookup(package.name) + # Note: this could remove a package from unsupported; probably want to restrict to locationId and/or non-dummy + if (id != None): + db.clearOldInfo(id) + db.remove(id, 3) + + for package in dbmodify: + warning("DB: Package in dbmodify: " + package.name) + id = db.lookup(package.name) + if (id == None): + db.insert(package, 3) + else: + db.update(id, package, 3) # Copy for file in copy: |