PERFORCE change 181622 for review
Julien Laffaye
jlaffaye at FreeBSD.org
Fri Jul 30 22:12:37 UTC 2010
http://p4web.freebsd.org/@@181622?ac=10
Change 181622 by jlaffaye at jlaffaye-chulak on 2010/07/30 22:12:23
- Add support for complete package in pkg_add(1).
- Use a const for the complete package file identifier.
- Fix a bug if a pkg-message file exists.
Affected files ...
.. //depot/projects/soc2010/pkg_complete/lib/libpkg/pkg.h#10 edit
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/Makefile#3 edit
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/add.h#5 edit
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/complete.c#1 add
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#11 edit
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#12 edit
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/complete/perform.c#7 edit
Differences ...
==== //depot/projects/soc2010/pkg_complete/lib/libpkg/pkg.h#10 (text+ko) ====
@@ -89,6 +89,7 @@
#define REQUIRED_BY_FNAME "+REQUIRED_BY"
#define DISPLAY_FNAME "+DISPLAY"
#define MTREE_FNAME "+MTREE_DIRS"
+#define PKG_COMPLETE_FNAME "+PKG_COMPLETE"
#define CMD_CHAR '@' /* prefix for extended PLIST cmd */
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/Makefile#3 (text+ko) ====
@@ -8,6 +8,7 @@
perform.c \
futil.c \
extract.c \
+ complete.c
WARNS?= 3
WFORMAT?= 1
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/add.h#5 (text+ko) ====
@@ -23,8 +23,16 @@
#ifndef _INST_ADD_H_INCLUDE
#define _INST_ADD_H_INCLUDE
+#include <archive.h>
+
typedef enum { NORMAL, MASTER, SLAVE } add_mode_t;
+struct complete_data {
+ char buf[8192];
+ struct archive *src;
+ const char *fname;
+};
+
extern char *Prefix;
extern Boolean PrefixRecursive;
extern Boolean NoInstall;
@@ -45,5 +53,6 @@
int extract_package(struct archive *, Package *, const char *);
int extract_plist(struct archive *, struct archive_entry *, Package *);
int pkg_do(const char *);
+int pkg_do_complete(struct archive *);
#endif /* _INST_ADD_H_INCLUDE */
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#11 (text+ko) ====
@@ -625,7 +625,7 @@
FILE *fp;
char buf[BUFSIZ];
- snprintf(buf, sizeof buf, "%s/%s", db_dir_tmp, p->name);
+ snprintf(buf, sizeof buf, "%s/%s", db_dir, p->name);
fp = fopen(buf, "r");
if (fp) {
putc('\n', stdout);
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#12 (text+ko) ====
@@ -77,7 +77,6 @@
/*
* TODO:
* Deal with master/slave modes.
- * add support for complete packages
*/
if (isURL(fname)) {
if ((fd = fetch_archive(fname, KeepPackage)) == -1) {
@@ -113,10 +112,10 @@
}
retcode = extract_package(a, &pkg, fname);
free_plist(&pkg);
- } else if (strcmp(pathname, "+PKG_COMPLETE") == 0) {
+ } else if (strcmp(pathname, PKG_COMPLETE_FNAME) == 0) {
if (Verbose)
- printf("'%s' is a complete package...\n", fname);
- /* TODO: add support */
+ printf("The file '%s' is a complete package...\n", fname);
+ retcode = pkg_do_complete(a);
} else {
warnx("Unknown package type!");
retcode = 1;
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/complete/perform.c#7 (text+ko) ====
@@ -59,7 +59,7 @@
* The existence of this file in the package archive can be tested
* to determine if the package is a complete or regular package.
*/
- archive_entry_set_pathname(entry, "+PKG_COMPLETE");
+ archive_entry_set_pathname(entry, PKG_COMPLETE_FNAME);
archive_entry_set_filetype(entry, AE_IFREG);
archive_entry_set_size(entry, 0);
archive_write_header(a, entry);
More information about the p4-projects
mailing list