FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 02-26-2009, 07:06 PM
Xavier Chantry
 
Default repo-add: fail early if repo can not be created

Before this commit, the repo creation could fail after all packages have
been added to the database. Now this will be detected before adding
anything.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
---
scripts/repo-add.sh.in | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index b12188c..a967506 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -326,9 +326,21 @@ for arg in "$@"; do
fi
msg "$(gettext "Extracting database to a temporary location...")"
bsdtar -xf "$REPO_DB_FILE" -C "$gstmpdir"
- elif [ "$cmd" == "repo-remove" ]; then
- error "$(gettext "Repository file '%s' was not found.")" "$REPO_DB_FILE"
- exit 1
+ else
+ case "$cmd" in
+ repo-remove)
+ error "$(gettext "Repository file '%s' was not found.")" "$REPO_DB_FILE"
+ exit 1
+ ;;
+ repo-add)
+ # check if the file can be created (write permission, directory existence, etc)
+ if ! touch "$REPO_DB_FILE"; then
+ error "$(gettext "Repository file '%s' could not be created.")" "$REPO_DB_FILE"
+ exit 1
+ fi
+ rm -f "$REPO_DB_FILE"
+ ;;
+ esac
fi
else
if [ "$cmd" == "repo-add" ]; then
--
1.6.1.3

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://www.archlinux.org/mailman/listinfo/pacman-dev
 
Old 02-26-2009, 11:56 PM
Allan McRae
 
Default repo-add: fail early if repo can not be created

Xavier Chantry wrote:

Before this commit, the repo creation could fail after all packages have
been added to the database. Now this will be detected before adding
anything.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>



Patch looks good. Minor stylistic comments below


---
scripts/repo-add.sh.in | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index b12188c..a967506 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -326,9 +326,21 @@ for arg in "$@"; do
fi
msg "$(gettext "Extracting database to a temporary location...")"
bsdtar -xf "$REPO_DB_FILE" -C "$gstmpdir"
- elif [ "$cmd" == "repo-remove" ]; then
- error "$(gettext "Repository file '%s' was not found.")" "$REPO_DB_FILE"
- exit 1
+ else
+ case "$cmd" in
+ repo-remove)


indent the lines within this block some more:

+ error "$(gettext "Repository file '%s' was not found.")" "$REPO_DB_FILE"
+ exit 1
+ ;;
+ repo-add)


and these

+ # check if the file can be created (write permission, directory existence, etc)
+ if ! touch "$REPO_DB_FILE"; then
+ error "$(gettext "Repository file '%s' could not be created.")" "$REPO_DB_FILE"
+ exit 1
+ fi
+ rm -f "$REPO_DB_FILE"
+ ;;
+ esac
fi
else
if [ "$cmd" == "repo-add" ]; then



Allan



_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://www.archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 07:14 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org