[pacman-dev] [PATCH] Remove DBEXT usage
With commit 5dffef78, the repo database always has a symlink of the form reponame.db. Use that filename and let libarchive determine the compression type. Signed-off-by: Allan McRae <allan@archlinux.org> --- Definitely not for the 3.4 release configure.ac | 9 --------- lib/libalpm/be_files.c | 8 ++++---- scripts/Makefile.am | 1 - scripts/rankmirrors.sh.in | 2 +- test/pacman/pmdb.py | 2 +- test/pacman/pmtest.py | 2 +- test/pacman/util.py | 1 - 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 3e11f8c..37881e6 100644 --- a/configure.ac +++ b/configure.ac @@ -83,11 +83,6 @@ AC_ARG_WITH(src-ext, AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]), [SRCEXT=$withval], [SRCEXT=.src.tar.gz]) -# Help line for database extension -AC_ARG_WITH(db-ext, - AS_HELP_STRING([--with-db-ext=ext], [set the file extension used by the database]), - [DBEXT=$withval], [DBEXT=.db.tar.gz]) - # Help line for buildscript filename AC_ARG_WITH(buildscript, AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]), @@ -337,9 +332,6 @@ AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packa # Set source package file extension AC_SUBST(SRCEXT) AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages]) -# Set database file extension -AC_SUBST(DBEXT) -AC_DEFINE_UNQUOTED([DBEXT], "$DBEXT", [The file extension used by pacman databases]) # Set makepkg build script name AC_SUBST(BUILDSCRIPT) AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg]) @@ -391,7 +383,6 @@ ${PACKAGE_NAME}: root working directory : ${ROOTDIR} package extension : ${PKGEXT} source pkg extension : ${SRCEXT} - database extension : ${DBEXT} build script name : ${BUILDSCRIPT} Compilation options: diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 877bc50..c26bef2 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -231,9 +231,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db) RET_ERR(PM_ERR_DB_NOT_FOUND, -1); } - len = strlen(db->treename) + strlen(DBEXT) + 1; + len = strlen(db->treename) + 4; MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1)); - sprintf(dbfile, "%s" DBEXT, db->treename); + sprintf(dbfile, "%s.db", db->treename); dbpath = alpm_option_get_dbpath(); @@ -253,9 +253,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db) syncdbpath = _alpm_db_path(db); /* form the path to the db location */ - len = strlen(dbpath) + strlen(db->treename) + strlen(DBEXT) + 1; + len = strlen(dbpath) + strlen(db->treename) + 4; MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1)); - sprintf(dbfilepath, "%s%s" DBEXT, dbpath, db->treename); + sprintf(dbfilepath, "%s%s.db", dbpath, db->treename); if(force) { /* if forcing update, remove the old dir and extract the db */ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 330acb9..0197d9e 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -38,7 +38,6 @@ edit = sed \ -e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \ -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ - -e 's|@DBEXT[@]|$(DBEXT)|g' \ -e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \ -e 's|@SIZECMD[@]|$(SIZECMD)|g' \ -e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \ diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index 9b4e973..28c3a7c 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -85,7 +85,7 @@ getfetchurl() { if [[ -z $reponame || $reponame = $replacedurl ]]; then echo "fail" else - local fetchurl="${replacedurl}/$reponame@DBEXT@" + local fetchurl="${replacedurl}/$reponame.db" echo "$fetchurl" fi } diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index 8cb1b83..41bd738 100755 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -344,7 +344,7 @@ def gensync(self, path): # Generate database archive mkdir(path) - archive = os.path.join(path, "%s%s" % (self.treename, PM_EXT_DB)) + archive = os.path.join(path, "%s.db" % (self.treename)) tar = tarfile.open(archive, "w:gz") for root, dirs, files in os.walk('.'): for d in dirs: diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index f2b9676..b1d778e 100755 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -149,7 +149,7 @@ def generate(self): vprint(" Creating sync database archives") for key, value in self.db.iteritems(): if key == "local": continue - archive = value.treename + PM_EXT_DB + archive = value.treename + ".db" vprint("\t" + os.path.join(SYNCREPO, archive)) value.gensync(os.path.join(syncdir, value.treename)) diff --git a/test/pacman/util.py b/test/pacman/util.py index e01a3b8..657230e 100755 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -28,7 +28,6 @@ PM_LOCK = "var/lib/pacman/db.lck" PM_CACHEDIR = "var/cache/pacman/pkg" PM_EXT_PKG = ".pkg.tar.gz" -PM_EXT_DB = ".db.tar.gz" PM_PACNEW = ".pacnew" PM_PACORIG = ".pacorig" PM_PACSAVE = ".pacsave" -- 1.7.1
On Fri 04 Jun 2010 00:24 +1000, Allan McRae wrote:
With commit 5dffef78, the repo database always has a symlink of the form reponame.db. Use that filename and let libarchive determine the compression type.
Hmm. I was wondering why couldn't pacman be programmed to understand a compressed repo db with the file extension. If pacman can do it with packages, then it shouldn't be too hard, should it? I think I'd prefer keeping the extensions.
On Thu, Jun 3, 2010 at 10:00 AM, Loui Chang <louipc.ist@gmail.com> wrote:
On Fri 04 Jun 2010 00:24 +1000, Allan McRae wrote:
With commit 5dffef78, the repo database always has a symlink of the form reponame.db. Use that filename and let libarchive determine the compression type.
Hmm. I was wondering why couldn't pacman be programmed to understand a compressed repo db with the file extension. If pacman can do it with packages, then it shouldn't be too hard, should it? I think I'd prefer keeping the extensions.
I'm not sure what you are trying to say here. This addresses the problem of transforming [myrepo] Server = http://example.com/foo/bar/baz into "I need to fetch http://example.com/foo/bar/baz/myrepo.db" -Dan
On Thu 03 Jun 2010 10:02 -0500, Dan McGee wrote:
On Thu, Jun 3, 2010 at 10:00 AM, Loui Chang <louipc.ist@gmail.com> wrote:
On Fri 04 Jun 2010 00:24 +1000, Allan McRae wrote:
With commit 5dffef78, the repo database always has a symlink of the form reponame.db. Use that filename and let libarchive determine the compression type.
Hmm. I was wondering why couldn't pacman be programmed to understand a compressed repo db with the file extension. If pacman can do it with packages, then it shouldn't be too hard, should it? I think I'd prefer keeping the extensions.
I'm not sure what you are trying to say here.
This addresses the problem of transforming
[myrepo] Server = http://example.com/foo/bar/baz
into
"I need to fetch http://example.com/foo/bar/baz/myrepo.db"
Aah right. I was confused about this. Thanks for the clarification.
On Thu, Jun 3, 2010 at 9:24 AM, Allan McRae <allan@archlinux.org> wrote:
With commit 5dffef78, the repo database always has a symlink of the form reponame.db. Use that filename and let libarchive determine the compression type.
Signed-off-by: Allan McRae <allan@archlinux.org> ---
Definitely not for the 3.4 release
This does look like good work, and it should land in 3.5.0 and not earlier to give repos time to adjust as necessary. Thanks, Allan.
configure.ac | 9 --------- lib/libalpm/be_files.c | 8 ++++---- scripts/Makefile.am | 1 - scripts/rankmirrors.sh.in | 2 +- test/pacman/pmdb.py | 2 +- test/pacman/pmtest.py | 2 +- test/pacman/util.py | 1 - 7 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/configure.ac b/configure.ac index 3e11f8c..37881e6 100644 --- a/configure.ac +++ b/configure.ac @@ -83,11 +83,6 @@ AC_ARG_WITH(src-ext, AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]), [SRCEXT=$withval], [SRCEXT=.src.tar.gz])
-# Help line for database extension -AC_ARG_WITH(db-ext, - AS_HELP_STRING([--with-db-ext=ext], [set the file extension used by the database]), - [DBEXT=$withval], [DBEXT=.db.tar.gz]) - # Help line for buildscript filename AC_ARG_WITH(buildscript, AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]), @@ -337,9 +332,6 @@ AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packa # Set source package file extension AC_SUBST(SRCEXT) AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages]) -# Set database file extension -AC_SUBST(DBEXT) -AC_DEFINE_UNQUOTED([DBEXT], "$DBEXT", [The file extension used by pacman databases]) # Set makepkg build script name AC_SUBST(BUILDSCRIPT) AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg]) @@ -391,7 +383,6 @@ ${PACKAGE_NAME}: root working directory : ${ROOTDIR} package extension : ${PKGEXT} source pkg extension : ${SRCEXT} - database extension : ${DBEXT} build script name : ${BUILDSCRIPT}
Compilation options: diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 877bc50..c26bef2 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -231,9 +231,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db) RET_ERR(PM_ERR_DB_NOT_FOUND, -1); }
- len = strlen(db->treename) + strlen(DBEXT) + 1; + len = strlen(db->treename) + 4; MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1)); - sprintf(dbfile, "%s" DBEXT, db->treename); + sprintf(dbfile, "%s.db", db->treename);
dbpath = alpm_option_get_dbpath();
@@ -253,9 +253,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db) syncdbpath = _alpm_db_path(db);
/* form the path to the db location */ - len = strlen(dbpath) + strlen(db->treename) + strlen(DBEXT) + 1; + len = strlen(dbpath) + strlen(db->treename) + 4; MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1)); - sprintf(dbfilepath, "%s%s" DBEXT, dbpath, db->treename); + sprintf(dbfilepath, "%s%s.db", dbpath, db->treename);
if(force) { /* if forcing update, remove the old dir and extract the db */ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 330acb9..0197d9e 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -38,7 +38,6 @@ edit = sed \ -e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \ -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ - -e 's|@DBEXT[@]|$(DBEXT)|g' \ -e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \ -e 's|@SIZECMD[@]|$(SIZECMD)|g' \ -e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \ diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index 9b4e973..28c3a7c 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -85,7 +85,7 @@ getfetchurl() { if [[ -z $reponame || $reponame = $replacedurl ]]; then echo "fail" else - local fetchurl="${replacedurl}/$reponame@DBEXT@" + local fetchurl="${replacedurl}/$reponame.db" echo "$fetchurl" fi } diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index 8cb1b83..41bd738 100755 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -344,7 +344,7 @@ def gensync(self, path):
# Generate database archive mkdir(path) - archive = os.path.join(path, "%s%s" % (self.treename, PM_EXT_DB)) + archive = os.path.join(path, "%s.db" % (self.treename)) tar = tarfile.open(archive, "w:gz") for root, dirs, files in os.walk('.'): for d in dirs: diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index f2b9676..b1d778e 100755 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -149,7 +149,7 @@ def generate(self): vprint(" Creating sync database archives") for key, value in self.db.iteritems(): if key == "local": continue - archive = value.treename + PM_EXT_DB + archive = value.treename + ".db" vprint("\t" + os.path.join(SYNCREPO, archive)) value.gensync(os.path.join(syncdir, value.treename))
diff --git a/test/pacman/util.py b/test/pacman/util.py index e01a3b8..657230e 100755 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -28,7 +28,6 @@ PM_LOCK = "var/lib/pacman/db.lck" PM_CACHEDIR = "var/cache/pacman/pkg" PM_EXT_PKG = ".pkg.tar.gz" -PM_EXT_DB = ".db.tar.gz" PM_PACNEW = ".pacnew" PM_PACORIG = ".pacorig" PM_PACSAVE = ".pacsave" -- 1.7.1
participants (3)
-
Allan McRae
-
Dan McGee
-
Loui Chang