aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2003-10-20 03:09:33 +0000
committerJason Woodward2003-10-20 03:09:33 +0000
commita66d250a6e12d150fb7e3e0089efe0815bf45d97 (patch)
tree1171f02298688489922c96febc19d3b350d71edf
parent32acbc9d3318754a4fc1bb56407d165ef5a1c308 (diff)
downloadslapt-get-a66d250a6e12d150fb7e3e0089efe0815bf45d97.tar.gz
added --dist-upgrade for slackware release upgrades
-rw-r--r--ChangeLog1
-rw-r--r--FAQ36
-rw-r--r--doc/slapt-get.86
-rw-r--r--src/action.c110
-rw-r--r--src/main.h1
5 files changed, 70 insertions, 84 deletions
diff --git a/ChangeLog b/ChangeLog
index 42ad9a9..121a3f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* transaction report now shows how much will be downloaded
and how much disk space will be used.
* --update now shows url for each source download
+ * added --dist-upgrade for slackware release upgrades
0.9.6c Oct 15, 2003
* patch data is now fetched from patches/PACKAGES.TXT instead of
diff --git a/FAQ b/FAQ
index 351bf62..8ce517e 100644
--- a/FAQ
+++ b/FAQ
@@ -18,7 +18,7 @@ Frequenty Asked Questions:
15. What about Dropline support?
16. How can I generate an exclude list for an entire disk set?
17. How do I use a local file source?
-18. How can I make sure I have every package from the base installed?
+18. How can I download every package in a disk set?
@@ -86,7 +86,7 @@ Frequenty Asked Questions:
Yes.
Change your source location within /etc/slapt-getrc to point to the newer
- release directory. --update your local package data cache, then --upgrade
+ release directory. --update your local package cache, then --dist-upgrade
to the newer release. You will also want to disable any third party package
sources while upgrading to a newer release so you do not mix and match
packages.
@@ -103,11 +103,14 @@ Frequenty Asked Questions:
place. You can break a working system if you do not follow the
suggestions in UPGRADE.TXT.
- Now you simply --update to retrieve the package data for that release. This means
- doing the following:
+ Now you simply --dist-update to retrieve the package data for that release.
+ This means doing the following:
+
+ ### upgrade your local package cache
+ $ slapt-get --update
### make sure you have all the packages for the upgrade locally
- $ slapt-get --download-only --upgrade
+ $ slapt-get --download-only --dist-upgrade
### switch to single user mode
$ telinit 1
@@ -119,12 +122,7 @@ Frequenty Asked Questions:
$ slapt-get --install sed
### then, let slapt-get upgrade the rest
- $ slapt-get --upgrade
-
- ### to make sure you install every package in the base
- ### system, (see FAQ #18) use this:
- slapt-get --search '^\.\/slackware\/a$'|awk '{print $1}'| \
- xargs -r slapt-get --install
+ $ slapt-get --dist-upgrade
Then follow the rest of the directions in UPGRADE.TXT.
@@ -401,18 +399,14 @@ Frequenty Asked Questions:
-e "s/ZXbXZ/$totaluncomp_m/g" > $final_target && rm $target
### END SCRIPT
-18. How can I make sure I have every package from the base installed?
+18. How can I download every package in a disk set?
- If you just upgraded your Slackware install to a newer version, you may want
- to make sure that you have all the required base packages installed. You can
- use the --search option and supply a directory (as shown from --show pkg_name).
+ You can search the package location field, which specifies which directory
+ the package resides in, on the mirror.
- Most mirrors use ./slackware/a as the directory for the base. Thus to
- upgrade:
+ Most mirrors use ./slackware/{disk set} as the directory for the set. Thus
+ to install every package from xap:
- ./slapt-get --search '^\.\/slackware\/a$'|awk '{print $1}'| \
+ ./slapt-get --search '^\.\/slackware\/xap$'|awk '{print $1}'| \
xargs -r ./slapt-get --install
- You can do the same thing to install a whole disk set... just change the
- expression to point to whichever disk set you want.
-
diff --git a/doc/slapt-get.8 b/doc/slapt-get.8
index d695c18..b0dcb3f 100644
--- a/doc/slapt-get.8
+++ b/doc/slapt-get.8
@@ -50,6 +50,9 @@ slapt-get \- frontend to pkgtools
.B --upgrade
]
[
+.B --dist-upgrade
+]
+[
.B --install
]
[
@@ -112,6 +115,9 @@ Retrieves package data from MIRROR location.
.B --upgrade
Upgrade installed packages if newer versions are available.
.TP
+.B --dist-upgrade
+This is DANGEROUS. Upgrade to newer Slackware release. This is the same as --upgrade, with the addition of checking to make sure that all the base packages, from the base disk set, are also installed. Prior to running dist-upgrade, make sure that the package cache is updated and the crucial packages (glibc-solibs, sed, and pkgtools) are upgraded. See UPGRADE.TXT on your local Slackware mirror.
+.TP
.B --install [package(s)]
Install specified package(s).
.TP
diff --git a/src/action.c b/src/action.c
index ce8de87..9a8b4cd 100644
--- a/src/action.c
+++ b/src/action.c
@@ -147,64 +147,25 @@ void pkg_action_remove(const rc_config *global_config,const pkg_action_args_t *a
/* search for a pkg (support extended POSIX regex) */
void pkg_action_search(const char *pattern){
+ int i;
struct pkg_list *pkgs = NULL;
- int iterator;
- sg_regex search_regex;
- search_regex.nmatch = MAX_REGEX_PARTS;
-
- /* compile our regex */
- search_regex.reg_return = regcomp(&search_regex.regex, pattern, REG_EXTENDED|REG_NEWLINE);
- if( search_regex.reg_return != 0 ){
- size_t regerror_size;
- char errbuf[1024];
- size_t errbuf_size = 1024;
- fprintf(stderr, "Failed to compile regex\n");
-
- regerror_size = regerror(search_regex.reg_return, &search_regex.regex,errbuf,errbuf_size);
- if( regerror_size != 0 ){
- printf("Regex Error: %s\n",errbuf);
- }
- exit(1);
- }
+ struct pkg_list *matches = NULL;
/* read in pkg data */
pkgs = get_available_pkgs();
-
- for(iterator = 0; iterator < pkgs->pkg_count; iterator++ ){
- if(
- /* search pkg name */
- ( regexec(
- &search_regex.regex,
- pkgs->pkgs[iterator]->name,
- search_regex.nmatch,
- search_regex.pmatch,
- 0
- ) == 0)
- ||
- /* search pkg description */
- ( regexec(
- &search_regex.regex,
- pkgs->pkgs[iterator]->description,
- search_regex.nmatch,
- search_regex.pmatch,
- 0
- ) == 0)
- ||
- /* search pkg location */
- ( regexec(
- &search_regex.regex,
- pkgs->pkgs[iterator]->location,
- search_regex.nmatch,
- search_regex.pmatch,
- 0
- ) == 0)
- ){
- char *short_description = gen_short_pkg_description(pkgs->pkgs[iterator]);
- printf("%s - %s\n",pkgs->pkgs[iterator]->name,short_description);
- free(short_description);
- }
+ matches = malloc( sizeof *matches );
+ matches->pkgs = malloc( sizeof *matches->pkgs * pkgs->pkg_count );
+ matches->pkg_count = 0;
+
+ search_pkg_list(pkgs,matches,pattern);
+ for(i = 0; i < matches->pkg_count; i++){
+ char *short_description = gen_short_pkg_description(matches->pkgs[i]);
+ printf("%s - %s\n",matches->pkgs[i]->name,short_description);
+ free(short_description);
}
- regfree(&search_regex.regex);
+
+ free(matches->pkgs);
+ free(matches);
free_pkg_list(pkgs);
}/* end search */
@@ -327,10 +288,12 @@ void pkg_action_update(const rc_config *global_config){
/* upgrade all installed pkgs with available updates */
void pkg_action_upgrade_all(const rc_config *global_config){
- int iterator;
+ int i;
struct pkg_list *installed_pkgs;
struct pkg_list *all_pkgs;
+ struct pkg_list *matches;
pkg_info_t *update_pkg;
+ pkg_info_t *installed_pkg;
transaction tran;
printf("Reading Package Lists... ");
@@ -339,12 +302,12 @@ void pkg_action_upgrade_all(const rc_config *global_config){
printf("Done\n");
init_transaction(&tran);
- for(iterator = 0; iterator < installed_pkgs->pkg_count;iterator++){
+ for(i = 0; i < installed_pkgs->pkg_count;i++){
/* see if we have an available update for the pkg */
update_pkg = get_newest_pkg(
all_pkgs->pkgs,
- installed_pkgs->pkgs[iterator]->name,
+ installed_pkgs->pkgs[i]->name,
all_pkgs->pkg_count
);
if( update_pkg != NULL ){
@@ -354,18 +317,39 @@ void pkg_action_upgrade_all(const rc_config *global_config){
continue;
}
- /* if the update has a newer version */
- if( (cmp_pkg_versions(installed_pkgs->pkgs[iterator]->version,update_pkg->version)) < 0 ){
-
- /* attempt to upgrade */
- add_upgrade_to_transaction(&tran,installed_pkgs->pkgs[iterator],update_pkg);
-
- } /* end version check */
+ /* if the update has a newer version, attempt to upgrade */
+ if( (cmp_pkg_versions(installed_pkgs->pkgs[i]->version,update_pkg->version)) < 0 )
+ add_upgrade_to_transaction(&tran,installed_pkgs->pkgs[i],update_pkg);
}/* end upgrade pkg found */
}/* end for */
+ if( global_config->dist_upgrade == 1 ){
+ printf("dist upgrade code here\n");
+
+ matches = malloc( sizeof *matches );
+ matches->pkgs = malloc( sizeof *matches->pkgs * all_pkgs->pkg_count );
+ matches->pkg_count = 0;
+
+ search_pkg_list(all_pkgs,matches,SLACK_BASE_SET_REGEX);
+ for(i = 0; i < matches->pkg_count; i++){
+
+ installed_pkg = get_newest_pkg(
+ installed_pkgs->pkgs,
+ matches->pkgs[i]->name,
+ installed_pkgs->pkg_count
+ );
+ /* add to install list if not already installed */
+ if( installed_pkg == NULL )
+ add_install_to_transaction(&tran,installed_pkg);
+
+ }
+
+ free(matches->pkgs);
+ free(matches);
+ }
+
handle_transaction(global_config,&tran);
free_pkg_list(installed_pkgs);
diff --git a/src/main.h b/src/main.h
index e1be5d2..92ad8b9 100644
--- a/src/main.h
+++ b/src/main.h
@@ -74,4 +74,5 @@ enum action {
#define INSTALL_CMD "/sbin/installpkg "
#define UPGRADE_CMD "/sbin/upgradepkg --reinstall "
#define CHECKSUM_FILE "CHECKSUMS.md5"
+#define SLACK_BASE_SET_REGEX "^./slackware/a$"