[pacman-dev] [PATCH] makepkg: fix removing symbolic link
The path was not being stripped from $file before prefixing with $srcdir resulting in the attempted removal of a very weird filename. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index ed5cdef..edfa9e3 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -518,7 +518,7 @@ download_sources() { local file=$(get_filepath "$netfile" || true) if [[ -n "$file" ]]; then msg2 "$(gettext "Found %s")" "${file##*/}" - rm -f "$srcdir/$file" + rm -f "$srcdir/${file##*/}" ln -s "$file" "$srcdir/" continue fi -- 1.7.6
Using grp instead of group is a small saving at the cost of clarity. Rename the following functions: alpm_option_get_ignoregrps -> alpm_option_get_ignoregroups alpm_option_add_ignoregrp -> alpm_option_add_ignoregroup alpm_option_set_ignoregrps -> alpm_option_set_ignoregroups alpm_option_remove_ignoregrp -> alpm_option_remove_ignoregroup alpm_db_readgrp -> alpm_db_readgroup alpm_db_get_grpcache -> alpm_db_get_groupcache alpm_find_grp_pkgs -> alpm_find_group_pkgs Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/alpm.h | 14 +++++++------- lib/libalpm/db.c | 10 +++++----- lib/libalpm/db.h | 2 +- lib/libalpm/handle.c | 8 ++++---- lib/libalpm/sync.c | 4 ++-- src/pacman/conf.c | 2 +- src/pacman/query.c | 4 ++-- src/pacman/remove.c | 2 +- src/pacman/sync.c | 6 +++--- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 54a9ba4..33707dd 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -311,10 +311,10 @@ int alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg); * should be ignored by a sysupgrade. * @{ */ -alpm_list_t *alpm_option_get_ignoregrps(alpm_handle_t *handle); -int alpm_option_add_ignoregrp(alpm_handle_t *handle, const char *grp); -int alpm_option_set_ignoregrps(alpm_handle_t *handle, alpm_list_t *ignoregrps); -int alpm_option_remove_ignoregrp(alpm_handle_t *handle, const char *grp); +alpm_list_t *alpm_option_get_ignoregroups(alpm_handle_t *handle); +int alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp); +int alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps); +int alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp); /** @} */ /** Returns the targeted architecture. */ @@ -411,13 +411,13 @@ alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db); * @param name of the group * @return the groups entry on success, NULL on error */ -alpm_group_t *alpm_db_readgrp(alpm_db_t *db, const char *name); +alpm_group_t *alpm_db_readgroup(alpm_db_t *db, const char *name); /** Get the group cache of a package database. * @param db pointer to the package database to get the group from * @return the list of groups on success, NULL on error */ -alpm_list_t *alpm_db_get_grpcache(alpm_db_t *db); +alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db); /** Searches a database with regular expressions. * @param db pointer to the package database to search in @@ -700,7 +700,7 @@ int alpm_db_check_pgp_signature(alpm_db_t *db); * Groups */ -alpm_list_t *alpm_find_grp_pkgs(alpm_list_t *dbs, const char *name); +alpm_list_t *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name); /* * Sync diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 72fef62..ecb792c 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -239,7 +239,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db) } /** Get a group entry from a package database. */ -alpm_group_t SYMEXPORT *alpm_db_readgrp(alpm_db_t *db, const char *name) +alpm_group_t SYMEXPORT *alpm_db_readgroup(alpm_db_t *db, const char *name) { ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; @@ -250,12 +250,12 @@ alpm_group_t SYMEXPORT *alpm_db_readgrp(alpm_db_t *db, const char *name) } /** Get the group cache of a package database. */ -alpm_list_t SYMEXPORT *alpm_db_get_grpcache(alpm_db_t *db) +alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db) { ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; - return _alpm_db_get_grpcache(db); + return _alpm_db_get_groupcache(db); } /** Searches a database. */ @@ -646,7 +646,7 @@ void _alpm_db_free_grpcache(alpm_db_t *db) db->status &= ~DB_STATUS_GRPCACHE; } -alpm_list_t *_alpm_db_get_grpcache(alpm_db_t *db) +alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db) { if(db == NULL) { return NULL; @@ -671,7 +671,7 @@ alpm_group_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target) return NULL; } - for(i = _alpm_db_get_grpcache(db); i; i = i->next) { + for(i = _alpm_db_get_groupcache(db); i; i = i->next) { alpm_group_t *info = i->data; if(strcmp(info->name, target) == 0) { diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 10464b5..5bf05d8 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -103,7 +103,7 @@ int _alpm_db_ensure_pkgcache(alpm_db_t *db, alpm_dbinfrq_t infolevel); alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target); /* groups */ void _alpm_db_free_grpcache(alpm_db_t *db); -alpm_list_t *_alpm_db_get_grpcache(alpm_db_t *db); +alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db); alpm_group_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target); #endif /* _ALPM_DB_H */ diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index bb2ce50..62b2d9a 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -224,7 +224,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(alpm_handle_t *handle) return handle->ignorepkg; } -alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps(alpm_handle_t *handle) +alpm_list_t SYMEXPORT *alpm_option_get_ignoregroups(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->ignoregrp; @@ -521,14 +521,14 @@ int SYMEXPORT alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pk return 0; } -int SYMEXPORT alpm_option_add_ignoregrp(alpm_handle_t *handle, const char *grp) +int SYMEXPORT alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp) { CHECK_HANDLE(handle, return -1); handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp)); return 0; } -int SYMEXPORT alpm_option_set_ignoregrps(alpm_handle_t *handle, alpm_list_t *ignoregrps) +int SYMEXPORT alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps) { CHECK_HANDLE(handle, return -1); if(handle->ignoregrp) FREELIST(handle->ignoregrp); @@ -536,7 +536,7 @@ int SYMEXPORT alpm_option_set_ignoregrps(alpm_handle_t *handle, alpm_list_t *ign return 0; } -int SYMEXPORT alpm_option_remove_ignoregrp(alpm_handle_t *handle, const char *grp) +int SYMEXPORT alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp) { char *vdata = NULL; CHECK_HANDLE(handle, return -1); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 3775348..dcce18d 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -213,14 +213,14 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) * @pram name the name of the group * @return the list of alpm_pkg_t * (caller is responsible for alpm_list_free) */ -alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs, +alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name) { alpm_list_t *i, *j, *pkgs = NULL, *ignorelist = NULL; for(i = dbs; i; i = i->next) { alpm_db_t *db = i->data; - alpm_group_t *grp = alpm_db_readgrp(db, name); + alpm_group_t *grp = alpm_db_readgroup(db, name); if(!grp) continue; diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 368e71f..50b4988 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -502,7 +502,7 @@ static int setup_libalpm(void) alpm_option_set_usedelta(handle, config->usedelta); alpm_option_set_ignorepkgs(handle, config->ignorepkg); - alpm_option_set_ignoregrps(handle, config->ignoregrp); + alpm_option_set_ignoregroups(handle, config->ignoregrp); alpm_option_set_noupgrades(handle, config->noupgrade); alpm_option_set_noextracts(handle, config->noextract); diff --git a/src/pacman/query.c b/src/pacman/query.c index 0a420c7..826c226 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -302,7 +302,7 @@ static int query_group(alpm_list_t *targets) alpm_db_t *db_local = alpm_option_get_localdb(config->handle); if(targets == NULL) { - for(j = alpm_db_get_grpcache(db_local); j; j = alpm_list_next(j)) { + for(j = alpm_db_get_groupcache(db_local); j; j = alpm_list_next(j)) { alpm_group_t *grp = alpm_list_getdata(j); const alpm_list_t *p; @@ -315,7 +315,7 @@ static int query_group(alpm_list_t *targets) for(i = targets; i; i = alpm_list_next(i)) { alpm_group_t *grp; grpname = alpm_list_getdata(i); - grp = alpm_db_readgrp(db_local, grpname); + grp = alpm_db_readgroup(db_local, grpname); if(grp) { const alpm_list_t *p; for(p = grp->packages; p; p = alpm_list_next(p)) { diff --git a/src/pacman/remove.c b/src/pacman/remove.c index d48b038..4a23ab2 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -47,7 +47,7 @@ static int remove_target(const char *target) } /* fallback to group */ - alpm_group_t *grp = alpm_db_readgrp(db_local, target); + alpm_group_t *grp = alpm_db_readgroup(db_local, target); if(grp == NULL) { pm_fprintf(stderr, PM_LOG_ERROR, "'%s': target not found\n", target); return -1; diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 20be450..ce57d3c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -398,7 +398,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) const char *grpname = alpm_list_getdata(i); for(j = syncs; j; j = alpm_list_next(j)) { alpm_db_t *db = alpm_list_getdata(j); - alpm_group_t *grp = alpm_db_readgrp(db, grpname); + alpm_group_t *grp = alpm_db_readgroup(db, grpname); if(grp) { /* get names of packages in group */ @@ -417,7 +417,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) for(i = syncs; i; i = alpm_list_next(i)) { alpm_db_t *db = alpm_list_getdata(i); - for(j = alpm_db_get_grpcache(db); j; j = alpm_list_next(j)) { + for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) { alpm_group_t *grp = alpm_list_getdata(j); if(level > 1) { @@ -634,7 +634,7 @@ static int process_group(alpm_list_t *dbs, char *group) { int ret = 0; alpm_list_t *i; - alpm_list_t *pkgs = alpm_find_grp_pkgs(dbs, group); + alpm_list_t *pkgs = alpm_find_group_pkgs(dbs, group); int count = alpm_list_count(pkgs); if(!count) { -- 1.7.6
The following function renames take place for the same reasoning as the previous commit: _alpm_grp_new -> _alpm_group_new _alpm_grp_free -> _alpm_group_free _alpm_db_free_grpcache -> _alpm_db_free_groupcache _alpm_db_get_grpfromcache -> _alpm_db_get_groupfromcache Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/db.c | 18 +++++++++--------- lib/libalpm/db.h | 4 ++-- lib/libalpm/group.c | 4 ++-- lib/libalpm/group.h | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index ecb792c..f6f810c 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -246,7 +246,7 @@ alpm_group_t SYMEXPORT *alpm_db_readgroup(alpm_db_t *db, const char *name) ASSERT(name != NULL && strlen(name) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, NULL)); - return _alpm_db_get_grpfromcache(db, name); + return _alpm_db_get_groupfromcache(db, name); } /** Get the group cache of a package database. */ @@ -481,7 +481,7 @@ void _alpm_db_free_pkgcache(alpm_db_t *db) _alpm_pkghash_free(db->pkgcache); db->status &= ~DB_STATUS_PKGCACHE; - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); } alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db) @@ -530,7 +530,7 @@ int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg) alpm_pkg_get_name(newpkg), db->treename); db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg); - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); return 0; } @@ -556,7 +556,7 @@ int _alpm_db_remove_pkgfromcache(alpm_db_t *db, alpm_pkg_t *pkg) _alpm_pkg_free(data); - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); return 0; } @@ -613,9 +613,9 @@ static int load_grpcache(alpm_db_t *db) continue; } /* we didn't find the group, so create a new one with this name */ - grp = _alpm_grp_new(grpname); + grp = _alpm_group_new(grpname); if(!grp) { - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); return -1; } grp->packages = alpm_list_add(grp->packages, pkg); @@ -627,7 +627,7 @@ static int load_grpcache(alpm_db_t *db) return 0; } -void _alpm_db_free_grpcache(alpm_db_t *db) +void _alpm_db_free_groupcache(alpm_db_t *db) { alpm_list_t *lg; @@ -639,7 +639,7 @@ void _alpm_db_free_grpcache(alpm_db_t *db) "freeing group cache for repository '%s'\n", db->treename); for(lg = db->grpcache; lg; lg = lg->next) { - _alpm_grp_free(lg->data); + _alpm_group_free(lg->data); lg->data = NULL; } FREELIST(db->grpcache); @@ -663,7 +663,7 @@ alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db) return db->grpcache; } -alpm_group_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target) +alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target) { alpm_list_t *i; diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 5bf05d8..7055abd 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -102,9 +102,9 @@ alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db); int _alpm_db_ensure_pkgcache(alpm_db_t *db, alpm_dbinfrq_t infolevel); alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target); /* groups */ -void _alpm_db_free_grpcache(alpm_db_t *db); +void _alpm_db_free_groupcache(alpm_db_t *db); alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db); -alpm_group_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target); +alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target); #endif /* _ALPM_DB_H */ diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c index aefa7be..47458df 100644 --- a/lib/libalpm/group.c +++ b/lib/libalpm/group.c @@ -30,7 +30,7 @@ #include "log.h" #include "alpm.h" -alpm_group_t *_alpm_grp_new(const char *name) +alpm_group_t *_alpm_group_new(const char *name) { alpm_group_t* grp; @@ -40,7 +40,7 @@ alpm_group_t *_alpm_grp_new(const char *name) return grp; } -void _alpm_grp_free(alpm_group_t *grp) +void _alpm_group_free(alpm_group_t *grp) { if(grp == NULL) { return; diff --git a/lib/libalpm/group.h b/lib/libalpm/group.h index ad38c76..078c9af 100644 --- a/lib/libalpm/group.h +++ b/lib/libalpm/group.h @@ -22,8 +22,8 @@ #include "alpm.h" -alpm_group_t *_alpm_grp_new(const char *name); -void _alpm_grp_free(alpm_group_t *grp); +alpm_group_t *_alpm_group_new(const char *name); +void _alpm_group_free(alpm_group_t *grp); #endif /* _ALPM_GROUP_H */ -- 1.7.6
This matches the naming in pacman.conf. Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/handle.c | 12 ++++++------ lib/libalpm/handle.h | 2 +- lib/libalpm/package.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 62b2d9a..8486851 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -84,7 +84,7 @@ void _alpm_handle_free(alpm_handle_t *handle) FREELIST(handle->noupgrade); FREELIST(handle->noextract); FREELIST(handle->ignorepkg); - FREELIST(handle->ignoregrp); + FREELIST(handle->ignoregroup); FREE(handle); } @@ -227,7 +227,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(alpm_handle_t *handle) alpm_list_t SYMEXPORT *alpm_option_get_ignoregroups(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); - return handle->ignoregrp; + return handle->ignoregroup; } const char SYMEXPORT *alpm_option_get_arch(alpm_handle_t *handle) @@ -524,15 +524,15 @@ int SYMEXPORT alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pk int SYMEXPORT alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp) { CHECK_HANDLE(handle, return -1); - handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp)); + handle->ignoregroup = alpm_list_add(handle->ignoregroup, strdup(grp)); return 0; } int SYMEXPORT alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps) { CHECK_HANDLE(handle, return -1); - if(handle->ignoregrp) FREELIST(handle->ignoregrp); - handle->ignoregrp = alpm_list_strdup(ignoregrps); + if(handle->ignoregroup) FREELIST(handle->ignoregroup); + handle->ignoregroup = alpm_list_strdup(ignoregrps); return 0; } @@ -540,7 +540,7 @@ int SYMEXPORT alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char * { char *vdata = NULL; CHECK_HANDLE(handle, return -1); - handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata); + handle->ignoregroup = alpm_list_remove_str(handle->ignoregroup, grp, &vdata); if(vdata != NULL) { FREE(vdata); return 1; diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 4b36619..ae8c7c8 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -62,7 +62,7 @@ struct __alpm_handle_t { alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */ alpm_list_t *noextract; /* List of files NOT to extract */ alpm_list_t *ignorepkg; /* List of packages to ignore */ - alpm_list_t *ignoregrp; /* List of groups to ignore */ + alpm_list_t *ignoregroup; /* List of groups to ignore */ /* options */ int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */ diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index efdf1be..31f0732 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -598,7 +598,7 @@ alpm_pkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle) /** Test if a package should be ignored. * * Checks if the package is ignored via IgnorePkg, or if the package is - * in a group ignored via IgnoreGrp. + * in a group ignored via IgnoreGroup. * * @param handle the context handle * @param pkg the package to test @@ -615,7 +615,7 @@ int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg) } /* next see if the package is in a group that is ignored */ - for(groups = handle->ignoregrp; groups; groups = alpm_list_next(groups)) { + for(groups = handle->ignoregroup; groups; groups = alpm_list_next(groups)) { char *grp = (char *)alpm_list_getdata(groups); if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) { return 1; -- 1.7.6
On Wed 29 June 2011 at 16:05 +1000, Allan McRae wrote:
The path was not being stripped from $file before prefixing with $srcdir resulting in the attempted removal of a very weird filename.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Rémy Oudompheng <remy@archlinux.org> This is indeed annoying. -- Rémy.
participants (2)
-
Allan McRae
-
Rémy Oudompheng