fpkg-cvs Mailing List for FreePKG
Status: Alpha
Brought to you by:
jlea
This list is closed, nobody may subscribe to it.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Jeremy L. <jl...@us...> - 2004-05-04 22:46:35
|
jlea 04/05/04 15:46:24 Modified: htdocs index.html Log: Fix a mis-conception on my part. Apologies. Revision Changes Path 1.2 +2 -2 www/htdocs/index.html Index: index.html =================================================================== RCS file: /cvsroot/fpkg/www/htdocs/index.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- index.html 26 Apr 2004 09:56:09 -0000 1.1 +++ index.html 4 May 2004 22:46:24 -0000 1.2 @@ -46,7 +46,7 @@ and that their checksums are OK. Also, create and complain if we are going to overwrite existing files.</LI> <LI><B>which(1)</B> like functionality, to tell you which package installed - a particular file (partially MERGED by sobomax - without attribution)</LI> + a particular file.</LI> <LI>Automatic determination of which packages to upgrade. The procedure will be to upgrade any packages which we have plist conflicts with, and have either the same name or origin. Also, implement automatic @@ -114,7 +114,7 @@ WIDTH="88" HEIGHT="31" BORDER="0" ALT="SourceForge.net Logo" /></A> <P><FONT SIZE="small"> -Updated: $Id: index.html,v 1.1 2004/04/26 09:56:09 jlea Exp $<BR> +Updated: $Id: index.html,v 1.2 2004/05/04 22:46:24 jlea Exp $<BR> <A HREF="mailto:fpk...@li...">Comments</A><BR> </FONT> |
From: Jeremy L. <jl...@us...> - 2004-05-04 09:43:15
|
jlea 04/05/04 02:43:08 Modified: htdocs bsd.port.mk-fpkg.patch Log: 20040504 diff to bsd.port.mk Revision Changes Path 1.3 +34 -25 www/htdocs/bsd.port.mk-fpkg.patch Index: bsd.port.mk-fpkg.patch =================================================================== RCS file: /cvsroot/fpkg/www/htdocs/bsd.port.mk-fpkg.patch,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- bsd.port.mk-fpkg.patch 29 Apr 2004 14:17:23 -0000 1.2 +++ bsd.port.mk-fpkg.patch 4 May 2004 09:43:08 -0000 1.3 @@ -4,7 +4,7 @@ retrieving revision 1.488 diff -u -r1.488 bsd.port.mk --- bsd.port.mk 19 Apr 2004 23:39:52 -0000 1.488 -+++ bsd.port.mk 29 Apr 2004 14:12:02 -0000 ++++ bsd.port.mk 3 May 2004 10:11:06 -0000 @@ -764,13 +764,11 @@ # to turn them off (default: ${ECHO_CMD}). # PATCH_DEBUG - If set, print out more information about the patches as @@ -36,7 +36,7 @@ .endif PLIST_SUB+= XAWVER=${XAWVER} -@@ -1779,12 +1775,11 @@ +@@ -1779,12 +1775,10 @@ PKGORIGIN?= ${PKGCATEGORY}/${PORTDIRNAME} .endif @@ -49,12 +49,11 @@ +.if exists(/root/bin/fpkg) +PKG_CREATE?= /root/bin/fpkg_create +PKG_ADD?= /root/bin/fpkg_add -+PKG_INFO?= /root/bin/fpkg_info +PKG_CMD?= /root/bin/fpkg .elif ${OSVERSION} < 460102 && ${PKGORIGIN} != "sysutils/pkg_install" BUILD_DEPENDS+= ${LOCALBASE}/sbin/pkg_info:${PORTSDIR}/sysutils/pkg_install PKG_CMD?= ${LOCALBASE}/sbin/pkg_create -@@ -1803,13 +1798,13 @@ +@@ -1803,13 +1797,13 @@ # Does the pkg_create tool support conflict checking? # XXX Slow? .if !defined(PKGINSTALLVER) @@ -70,7 +69,7 @@ .if !defined(NO_MTREE) PKG_ARGS+= -m ${MTREE_FILE} .endif -@@ -1819,6 +1814,23 @@ +@@ -1819,6 +1813,23 @@ .if defined(CONFLICTS) && !defined(DISABLE_CONFLICTS) PKG_ARGS+= -C "${CONFLICTS}" .endif @@ -94,7 +93,7 @@ .endif .if defined(PKG_NOCOMPRESS) PKG_SUFX?= .tar -@@ -1829,8 +1841,6 @@ +@@ -1829,8 +1840,6 @@ PKG_SUFX?= .tgz .endif .endif @@ -103,7 +102,7 @@ MOTIFLIB?= -L${X11BASE}/lib -lXm -lXp -@@ -2337,7 +2347,7 @@ +@@ -2337,7 +2346,7 @@ CONFIGURE_LOG?= config.log # A default message to print if do-configure fails. @@ -112,7 +111,16 @@ .if defined(GNU_CONFIGURE) # Maximum command line length -@@ -3148,20 +3158,7 @@ +@@ -3087,7 +3096,7 @@ + found=`${CAT} ${WRKDIR}/.CONFLICTS | ${SED} -e s'|${PKG_DBDIR}/||g' | ${TR} '\012' ' '`; \ + conflicting=0; \ + for entry in $${found}; do \ +- prfx=`${PKG_INFO} -q -p $${entry} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \ ++ prfx=`${PKG_CMD} -q info -p $${entry} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \ + if [ "x${PREFIX}" = "x$${prfx}" ]; then \ + conflicting=1;\ + conflicts_with="$${conflicts_with} $${entry}";\ +@@ -3148,20 +3157,7 @@ fi; \ fi @__softMAKEFLAGS='${__softMAKEFLAGS:S/'/'\''/g}'; \ @@ -134,7 +142,7 @@ if [ -d ${PACKAGES} ]; then \ cd ${.CURDIR} && eval ${MAKE} $${__softMAKEFLAGS} package-links; \ fi; \ -@@ -3230,34 +3227,16 @@ +@@ -3230,34 +3226,16 @@ .if !target(check-already-installed) check-already-installed: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) @@ -167,7 +175,7 @@ - exit 1; \ - fi + @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed" -+ @if ${PKG_INFO} -e ${PKGNAME}; then \ ++ @if ${PKG_CMD} -e ${PKGNAME}; then \ + ${ECHO_CMD} "===> ${PKGNAME} is already installed"; \ + ${ECHO_CMD} " You may wish to \`\`make deinstall'' and install this port again"; \ + ${ECHO_CMD} " by \`\`make reinstall'' to upgrade it properly."; \ @@ -179,7 +187,7 @@ .else @${DO_NADA} .endif -@@ -3487,9 +3466,9 @@ +@@ -3487,9 +3465,9 @@ _BUILD_SEQ= build-message pre-build pre-build-script do-build \ post-build post-build-script _INSTALL_DEP= build @@ -191,7 +199,7 @@ _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ pre-su-install-script do-install post-install add-plist-info \ post-install-script add-plist-docs compress-man run-ldconfig fake-pkg \ -@@ -3658,22 +3637,8 @@ +@@ -3658,22 +3636,8 @@ @${ECHO_MSG} "===> Returning to user credentials" .else @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" @@ -216,7 +224,7 @@ @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif .endif -@@ -3691,15 +3656,8 @@ +@@ -3691,15 +3655,8 @@ @${ECHO_MSG} "===> Returning to user credentials" .else @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" @@ -234,33 +242,34 @@ @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif .endif -@@ -4221,7 +4179,7 @@ +@@ -4221,7 +4178,7 @@ else \ (cd $$dir; \ tmp=`${MAKE} -V PKGNAME`; \ - if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \ -+ if ! ${PKG_INFO} -e $${tmp}; then \ ++ if ! ${PKG_CMD} -e $${tmp}; then \ ${MAKE} fetch; \ fi ); \ fi; \ -@@ -4249,7 +4207,7 @@ +@@ -4249,7 +4206,7 @@ else \ (cd $$dir; \ tmp=`${MAKE} -V PKGNAME`; \ - if [ ! -d ${PKG_DBDIR}/$${tmp} ]; then \ -+ if ! ${PKG_INFO} -e $${tmp}; then \ ++ if ! ${PKG_CMD} -e $${tmp}; then \ ${MAKE} fetch-list; \ fi ); \ fi; \ -@@ -4305,6 +4263,7 @@ - @${PACKAGE-DEPENDS-LIST} - .endif +@@ -4307,7 +4264,7 @@ -+# XXX: (reg) This needs a new feature to check origin? PACKAGE-DEPENDS-LIST?= \ if [ "${CHILD_DEPENDS}" ]; then \ - installed=$$(${PKG_INFO} -qO ${PKGORIGIN} 2>/dev/null || \ -@@ -4341,11 +4300,45 @@ +- installed=$$(${PKG_INFO} -qO ${PKGORIGIN} 2>/dev/null || \ ++ installed=$$(${PKG_CMD} -qo list ${PKGORIGIN}:${PKGNAME} 2>/dev/null || \ + ${TRUE}); \ + if [ "$$installed" ]; then \ + break; \ +@@ -4341,11 +4298,45 @@ # Print out package names. @@ -310,7 +319,7 @@ .endif # Build packages for port and dependencies -@@ -4620,50 +4613,8 @@ +@@ -4620,50 +4611,8 @@ .if !target(fake-pkg) fake-pkg: .if !defined(NO_PKG_REGISTER) @@ -359,7 +368,7 @@ - ${RM} -f /tmp/${PKGNAME}-required-by; \ - fi + @${ECHO_MSG} "===> Registering installation for ${PKGNAME}" -+ @${PKG_CREATE} ${PKG_ARGS} -O ${PKGNAME} | ${PKG_ADD} ${PKG_FORCE_ARG} -O ++ @${PKG_CREATE} ${PKG_ARGS} -O ${PKGNAME} | ${PKG_ADD} -v ${PKG_FORCE_ARG} -O .else @${DO_NADA} .endif |
From: Jeremy L. <jl...@us...> - 2004-05-03 11:42:02
|
jlea 04/05/03 04:41:56 Modified: lib depend.c entry.c filedb.c lib.h list.h manager.c match.c package.c which.c Log: Get in-place upgrading working. Remove support for @options extract-in-place, and other minor cleanups. Revision Changes Path 1.5 +3 -4 freepkg/lib/depend.c Index: depend.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/depend.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- depend.c 30 Apr 2004 12:48:49 -0000 1.4 +++ depend.c 3 May 2004 11:41:55 -0000 1.5 @@ -181,7 +181,7 @@ */ PLIST_FOREACH(w, &wl) { if (scan_which_entry(w) == NULL) { - verify_which(&wl); + verify_filedb(); break; } } @@ -274,15 +274,14 @@ error_code delete_name_entry(name_list *nl, const char *pkg) { - name_entry *n, *tmp = NULL; + name_entry *n, *tmp; if (nl == NULL || NULLSTR(pkg)) return FAIL; - PLIST_FOREACH(n, nl) { + PLIST_REMEACH(n, nl, tmp) { if (strcmp(n->name, pkg) == 0) { PLIST_REMOVE(nl, n, tmp); free(n); - n = tmp; } } return SUCCESS; 1.4 +57 -54 freepkg/lib/entry.c Index: entry.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/entry.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- entry.c 30 Apr 2004 09:53:18 -0000 1.3 +++ entry.c 3 May 2004 11:41:55 -0000 1.4 @@ -102,11 +102,16 @@ * Never leave a dangling dbdir, but don't commit any outstanding * changes. */ - if (pe->status != PKG_REGISTERED && pe->status != PKG_CHANGED) { + if (pe->status < PKG_REGISTERED) { remove_dir(pe->dbdir); pe->dbdir[0] = '\0'; pe->status = PKG_UNKNOWN; } + if (pe->status > PKG_REGISTERED && isdir(pe->dbdir)) { + msg_warn("Ooops, leaving package database in a mess!"); + pe->dbdir[0] = '\0'; + pe->status = PKG_UNKNOWN; + } } /* @@ -350,7 +355,9 @@ return FAIL; break; + case PKG_UPGRADE: case PKG_DELETE: + case PKG_DELETED: msg_error(2, "package entry cannot be scaned during delete"); return FAIL; } @@ -389,7 +396,7 @@ * Extract a package, if it's not already extracted. */ error_code -extract_pkg_entry(pkg_entry *pe, boolean inplace) +extract_pkg_entry(pkg_entry *pe) { plist_entry *p; @@ -412,37 +419,11 @@ /* It's already been extracted */ if (pe->status > PKG_SPECIAL) return SUCCESS; - /* Extract directly rather than moving? Oh goodie! */ - if (inplace) { - msg_verbose("Doing in-place extraction for %s\n", pe->url); - if ((p = find_plist_entry(&pe->pkg->plist, PLIST_CWD, NULL)) != NULL) { - /* If this is a direct extract and we didn't want it, stop now. */ - if (PkgMgr.fake) - return SUCCESS; - if (!isdir(p->name)) { - msg_verbose("Desired prefix of %s does not exist, creating..\n", p->name); - make_hierarchy(p->name, NULL, NULL, NULL); - if (enter_dir(p->name) == FAIL) { - warn("unable to change directory to `%s'", p->name); - return FAIL; - } - } - } else { - msg_warn("no prefix specified in `%s' - this is a bad package!", pe->url); - return FAIL; - } - /* Finally unpack the whole mess */ - if (unpack_package(pe->url, NULL)) { - msg_warn("unable to extract `%s'!", pe->url); - return FAIL; - } - } else { - if (enter_dir(pe->tmpdir) == FAIL) - return FAIL; - if (unpack_package(pe->url, NULL) == FAIL) { - msg_warn("unable to extract `%s'!", pe->url); - return FAIL; - } + if (enter_dir(pe->tmpdir) == FAIL) + return FAIL; + if (unpack_package(pe->url, NULL) == FAIL) { + msg_warn("unable to extract `%s'!", pe->url); + return FAIL; } pe->status = PKG_EXTRACTED; return SUCCESS; @@ -456,7 +437,7 @@ { char *cp; plist_entry *p; - boolean inplace; + match_list ml = { PLIST_HEAD_INITIALIZER }; if (pe == NULL) return FAIL; @@ -468,18 +449,25 @@ return SUCCESS; if (scan_pkg_entry(pe) == FAIL) return FAIL; - inplace = (pe->pkg->options & PKG_OPTION_INPLACE ? TRUE : FALSE); - if (extract_pkg_entry(pe, inplace) == FAIL) + if (extract_pkg_entry(pe) == FAIL) return FAIL; - /* See if we're already registered */ + /* See if we're already registered. XXX: (jlea) Delay for upgrade? */ if (pkg_mgr_check(pe->pkg->name) && !PkgMgr.force) { msg_warn("package `%s' already recorded as installed", pe->pkg->name); return FAIL; } - if (conflict_package(pe->pkg) == TRUE && !PkgMgr.force) + if (check_package(pe->pkg, &ml) == TRUE) { + msg_warn("Package failed pre-install checks. Failing..."); + return FAIL; + } + if (depend_package(pe->pkg, pe->url) == FAIL) { + msg_warn("Unable to install required package depends. Failing..."); return FAIL; - if (depend_package(pe->pkg, pe->url) == FAIL) + } + if (upgrade_pkg_entry(&ml, pe) == FAIL) { + msg_warn("Unable to upgrade existing packages. Failing..."); return FAIL; + } pe->status = PKG_INSTALL; if (install_package(pe->pkg) == FAIL) return FAIL; @@ -543,6 +531,7 @@ /* If something changed, we can't have a NULL pkg. */ if (pe->pkg == NULL) return FAIL; + /* Make sure we're in the right directory */ if (scan_pkg_entry(pe) == FAIL) return FAIL; if (write_package(pe->pkg) == FAIL) @@ -552,27 +541,36 @@ } /* - * Upgrade one packge entry to another. + * Upgrade all of the packages which either have the same origin or have + * conflicting files and the same pkgroot name. */ error_code -upgrade_pkg_entry(pkg_entry *from, pkg_entry *to) +upgrade_pkg_entry(match_list *ml, pkg_entry *pe) { + match_entry *m; - if (from == NULL || to == NULL) - return FAIL; - if (from->status != PKG_REGISTERED) - return FAIL; - if (scan_pkg_entry(from) == FAIL - || scan_pkg_entry(to) == FAIL) - return FAIL; - if (to->status < PKG_SPECIAL || to->status > PKG_EXTRACTED) - return FAIL; - if (upgrade_package(from->pkg, to->pkg) == FAIL) + if (ml == NULL || pe == NULL) return FAIL; - if (delete_pkg_entry(from) == FAIL) + if (pe->status < PKG_SPECIAL || pe->status > PKG_EXTRACTED) return FAIL; - if (install_pkg_entry(to) == FAIL) + if (scan_pkg_entry(pe) == FAIL) return FAIL; + while (!PLIST_EMPTY(ml)) { + PLIST_REMOVE_HEAD(ml, m); + if (m->pe->status != PKG_REGISTERED) + return FAIL; + if (scan_pkg_entry(m->pe) == FAIL) + return FAIL; + pe->status = PKG_UPGRADE; + msg_verbose("Upgrading package %s\n", m->pe->pkg->name); + if (upgrade_package(m->pe->pkg, pe->pkg) == FAIL) + return FAIL; + if (delete_pkg_entry(m->pe) == FAIL) + return FAIL; + free(m); + } + /* Hope this is right... We need to push and pop... */ + enter_dir(pe->tmpdir); return SUCCESS; } @@ -645,6 +643,7 @@ { plist_entry *p; name_entry *n; + pkg_entry *tmp = NULL; if (pe == NULL) return FAIL; @@ -685,6 +684,10 @@ return FAIL; } } + pe->status = PKG_DELETED; + cleanup_pkg_entry(pe); + PLIST_REMOVE(&PkgMgr, pe, tmp); + free(pe); return SUCCESS; } @@ -774,7 +777,7 @@ /* XXX: (jlea) This should used pkg_mgr_add_master() */ if (fetch_pkg_entry(pe) == FAIL) return FAIL; - if (extract_pkg_entry(pe, FALSE) == FAIL) + if (extract_pkg_entry(pe) == FAIL) return FAIL; pe->status = PKG_TEMP; /* We can't size packages that are not installed */ 1.2 +74 -1 freepkg/lib/filedb.c Index: filedb.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/filedb.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- filedb.c 26 Apr 2004 00:05:47 -0000 1.1 +++ filedb.c 3 May 2004 11:41:55 -0000 1.2 @@ -66,6 +66,7 @@ static const char *get_filedb(const char *); static error_code put_filedb(const char *, const char *); static error_code remove_filedb(const char *); +static error_code verify_scan(pkg_entry *); /* * Open the database. If we fail, or if requested, we try to rebuild and @@ -177,7 +178,8 @@ return NULL; while (1) { if ((cp = get_filedb(w->file)) != NULL) { - if ((pe = find_pkg_entry(cp)) != NULL) + if ((pe = find_pkg_entry(cp)) != NULL + && pe->status == PKG_REGISTERED) break; /* Stale DB! */ open_filedb(TRUE); @@ -192,6 +194,77 @@ } /* + * Check our list of files against a package's plist, to see if we have a + * match. Then check to see if the DB agrees. Blow it away if it lies... + */ +error_code +verify_scan(pkg_entry *pe) +{ + plist_entry *p; + which_entry w; + char *dir = "."; + char tmp[PATH_MAX]; + + if (pe == NULL) + return FAIL; + if (pe->status != PKG_REGISTERED) + return FAIL; + if (scan_pkg_entry(pe) == FAIL) + return FAIL; + w.type = WHICH_FILE; + PLIST_FOREACH(p, &pe->pkg->plist) { + switch(p->type) { + case PLIST_CWD: + dir = p->name; + break; + case PLIST_FILE: + if (p->ignore) + break; + snprintf(tmp, PATH_MAX, "%s/%s", dir, p->name); + if (!isfile(tmp)) + break; + realpath(tmp, w.file); + if (scan_which_entry(&w) != pe) { + if (open_filedb(TRUE) == FAIL + || (scan_which_entry(&w) != pe)) { + msg_error(2, "Failed to fix database!"); + return FAIL; + } else + return SUCCESS; + } + break; + default: + break; + } + } + return SUCCESS; +} + +/* + * Check a the DB results of a scan against the installed packages. + */ +error_code +verify_filedb() +{ + pkg_entry *pe; + char cwd[PATH_MAX]; + + if (!getcwd(cwd, PATH_MAX)) + strlcpy(cwd, PkgMgr.wrkdir, PATH_MAX); + PLIST_FOREACH(pe, &PkgMgr) { + if (pe->status == PKG_REGISTERED) { + if (verify_scan(pe) == FAIL) { + enter_dir(cwd); + return FAIL; + } + cleanup_pkg_entry(pe); + } + } + enter_dir(cwd); + return SUCCESS; +} + +/* * Store value "file" with key "pkgname" in database. We just return an * error if the key already exists. This should never happen, because we * always check first. 1.5 +6 -5 freepkg/lib/lib.h Index: lib.h =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/lib.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- lib.h 30 Apr 2004 12:48:49 -0000 1.4 +++ lib.h 3 May 2004 11:41:55 -0000 1.5 @@ -294,7 +294,9 @@ PKG_INSTALLED, /* We've installed, but it's not registered yet */ PKG_REGISTERED, /* We've got it installed */ PKG_CHANGED, /* Someone changed it's depends */ + PKG_UPGRADE, /* We're trying to upgrade it */ PKG_DELETE, /* We're trying to delete it */ + PKG_DELETED, /* We've successfully deleted it */ } pkg_status_t; /* @@ -438,14 +440,13 @@ error_code add_package_filedb(package *); error_code remove_package_filedb(package *); pkg_entry * scan_which_entry(which_entry *); +error_code verify_filedb(); /* which.c */ which_entry * new_which_entry(void); void free_which(which_list *); which_entry * add_which_entry(which_list *, enum which_t, char *); error_code add_which_plist(which_list *, char *); -error_code verify_scan(which_list *, pkg_entry *); -error_code verify_which(which_list *); /* depend.c */ depend_entry * new_depend_entry(void); @@ -514,7 +515,7 @@ error_code extract_package(package *); error_code install_package(package *); error_code register_package(package *, char *); -boolean conflict_package(package *); +boolean check_package(package *, match_list *); error_code depend_package(package *, char*); error_code undepend_package(package *); error_code delete_package(package *); @@ -531,7 +532,7 @@ error_code match_pkg_entry(match_list *, const char *); error_code match_pkg_regex(match_list *, const char *); error_code fetch_pkg_entry(pkg_entry *); -error_code extract_pkg_entry(pkg_entry *, boolean); +error_code extract_pkg_entry(pkg_entry *); error_code scan_pkg_entry(pkg_entry *); error_code install_pkg_entry(pkg_entry *); error_code register_pkg_entry(pkg_entry *); @@ -541,7 +542,7 @@ error_code delete_pkg_entry(pkg_entry *); pkg_entry * create_pkg_entry(pkg_info *, char *); error_code package_pkg_entry(pkg_entry *, char *); -error_code upgrade_pkg_entry(pkg_entry *, pkg_entry *); +error_code upgrade_pkg_entry(match_list *, pkg_entry *); error_code show_pkg_entry(pkg_entry *, unsigned int); error_code version_pkg_entry(pkg_entry *); 1.2 +7 -0 freepkg/lib/list.h Index: list.h =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/list.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- list.h 26 Apr 2004 00:05:51 -0000 1.1 +++ list.h 3 May 2004 11:41:55 -0000 1.2 @@ -58,6 +58,13 @@ (var); \ (var) = ((var) ? PLIST_NEXT((var)) : NULL)) +#define PLIST_REMEACH(var, head, tmp) \ + for ((var) = PLIST_FIRST((head)), (tmp) = NULL; \ + (var); \ + (var) = ((tmp) != NULL ? \ + (tmp) == PLIST_FIRST((head)) ? (tmp) : PLIST_NEXT((tmp)) \ + : (var) != NULL ? PLIST_NEXT((var)) : NULL), (tmp) = NULL ) + #define PLIST_INIT(head) do { \ PLIST_FIRST((head)) = NULL; \ PLIST_LAST((head)) = NULL; \ 1.4 +13 -3 freepkg/lib/manager.c Index: manager.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/manager.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- manager.c 30 Apr 2004 09:53:18 -0000 1.3 +++ manager.c 3 May 2004 11:41:55 -0000 1.4 @@ -302,7 +302,8 @@ pkg_mgr_origin(match_list *ml, const char *pkgarg) { pkg_entry *pe; - char pkgroot[PATH_MAX], pkgorig[PATH_MAX], tmp[PATH_MAX], *cp; + char pkgroot[PATH_MAX], pkgorig[PATH_MAX]; + char cwd[PATH_MAX], tmp[PATH_MAX], *cp; boolean matched = FALSE; if (ml == NULL || NULLSTR(pkgarg)) @@ -313,13 +314,21 @@ *cp = '\0'; else pkgroot[0] = '\0'; + if (NULLSTR(pkgorig)) + return FAIL; + if (!getcwd(cwd, PATH_MAX)) + strlcpy(cwd, PkgMgr.wrkdir, PATH_MAX); PLIST_FOREACH(pe, &PkgMgr) { + if (pe->status != PKG_REGISTERED) + continue; if (NULLSTR(pe->dbdir) || (!NULLSTR(pkgroot) && pkgroot_of(tmp, pe->dbdir, PATH_MAX) != NULL && strpcmp(pkgroot, tmp) != 0)) continue; - if (scan_pkg_entry(pe) == FAIL) + if (scan_pkg_entry(pe) == FAIL) { + enter_dir(cwd); return FAIL; + } if (!NULLSTR(pe->pkg->origin) && (strcmp(pe->pkg->origin, pkgorig) == 0 || fnmatch(pkgorig, pe->pkg->origin, 0) == 0)) { @@ -328,6 +337,7 @@ } cleanup_pkg_entry(pe); } + enter_dir(cwd); return (matched ? SUCCESS : FAIL); } @@ -431,7 +441,7 @@ strlcpy(pe->url, pkgarg, PATH_MAX); if (fetch_pkg_entry(pe) == FAIL) return NULL; - if (extract_pkg_entry(pe, FALSE) == FAIL) + if (extract_pkg_entry(pe) == FAIL) return NULL; pe->status = PKG_LEAVE; return copy_string(pe->tmpdir); 1.3 +1 -2 freepkg/lib/match.c Index: match.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/match.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- match.c 30 Apr 2004 09:53:18 -0000 1.2 +++ match.c 3 May 2004 11:41:55 -0000 1.3 @@ -110,11 +110,10 @@ return NULL; if ((nm = new_match_entry()) == NULL) return NULL; - PLIST_FOREACH(m, ml) { + PLIST_REMEACH(m, ml, tmp) { if (m->pe == pe) { PLIST_REMOVE(ml, m, tmp); free(m); - m = tmp; } } nm->pe = pe; 1.5 +91 -16 freepkg/lib/package.c Index: package.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/package.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- package.c 30 Apr 2004 12:48:49 -0000 1.4 +++ package.c 3 May 2004 11:41:55 -0000 1.5 @@ -860,10 +860,11 @@ } } - /* Now finally extract the entire show if we're not going direct */ - if (!(pkg->options & PKG_OPTION_INPLACE) && !PkgMgr.fake) + /* Now finally extract the entire show */ + if (!PkgMgr.fake) extract_package(pkg); + /* XXX: (jlea) Shouldn't this be before the extract? */ if (!PkgMgr.fake && isnode(MTREE_FNAME)) { msg_verbose("Running mtree for %s..\n", pkg->name); p = find_plist_entry(&pkg->plist, PLIST_CWD, NULL); @@ -941,28 +942,99 @@ } /* - * Check to see if any packages which conflict with this package are - * installed. + * Check a package before installation. This is a three stage process: + * 1. Check to see if any installed packages match the globbing patterns + * in our conlficts list. + * 2. Next we match a list of possible upgradable packages, which we will + * use later. This includes any packages with the same name as the new + * package. + * 3. While we are doing this we check our extracted packages MD5s, to make + * sure that the package is OK. */ boolean -conflict_package(package *pkg) +check_package(package *pkg, match_list *ml) { name_entry *n; - match_list ml = { PLIST_HEAD_INITIALIZER }; match_entry *m; + pkg_entry *pe; + plist_entry *p; + which_list wl = { PLIST_HEAD_INITIALIZER }; + which_entry *w, *wtmp; + char tmp[PATH_MAX], tmp2[PATH_MAX], *dir = "."; - if (pkg == NULL) + if (pkg == NULL || ml == NULL) return FALSE; + free_match(ml); PLIST_FOREACH(n, &pkg->conflicts) - match_pkg_entry(&ml, n->name); - if (PLIST_EMPTY(&ml)) - return FALSE; - PLIST_FOREACH(m, &ml) { - msg_warn("This package conflicts with '%s', which is already installed.%s\n", - basename_of(m->pe->dbdir), - (!PkgMgr.force ? "" : " (but I'll overwrite it)")); + match_pkg_entry(ml, n->name); + if (!PLIST_EMPTY(ml)) { + PLIST_FOREACH(m, ml) { + msg_warn("This package conflicts with '%s', which is already " + "installed.%s", basename_of(m->pe->dbdir), + (!PkgMgr.force ? "" : " (but I'll overwrite it)")); + } + if (!PkgMgr.force) + return TRUE; } - return TRUE; + PLIST_FOREACH(p, &pkg->plist) { + switch(p->type) { + case PLIST_CWD: + dir = p->name; + break; + case PLIST_FILE: + if (!NULLSTR(p->md5) && !check_md5(p->name, p->md5)) { + msg_warn("The file '%s' does not match the checksum " + "given in the package! This package might be corrupt, " + "or be trojaned! It is suggested that you do NOT force " + "installation unless you are sure!", p->name); + if (!PkgMgr.force) { + free_which(&wl); + return TRUE; + } + } + if (p->ignore) + break; + snprintf(tmp, PATH_MAX, "%s/%s", dir, p->name); + add_which_entry(&wl, WHICH_FILE, tmp); + break; + default: + break; + } + } + /* Convert the list of conflicting files into a list of packages */ + pkgroot_of(tmp, pkg->name, PATH_MAX); + PLIST_REMEACH(w, &wl, wtmp) { + if ((pe = scan_which_entry(w)) == NULL) + continue; + pkgroot_of(tmp2, pe->dbdir, PATH_MAX); + if (strpcmp(tmp, tmp2) == 0) { + PLIST_REMOVE(&wl, w, wtmp); + free(w); + add_match_entry(ml, pe); + } + } + /* If there are files left, then we can't upgrade! */ + if (!PLIST_EMPTY(&wl)) { + msg_warn("This package %s over-write the following " + "installed files:", (!PkgMgr.force ? "would" : "will")); + PLIST_FOREACH(w, &wl) { + pe = scan_which_entry(w); + msg_warn("%s (installed by %s)", w->file, + (pe == NULL ? "unknown" : basename_of(pe->dbdir))); + } + free_which(&wl); + if (!PkgMgr.force) + return TRUE; + } + /* Now add packages with the same origin */ + snprintf(tmp2, PATH_MAX, "%s:%s", pkg->origin, tmp); + pkg_mgr_origin(ml, tmp2); + if (PkgMgr.verbose && !PLIST_EMPTY(ml)) { + msg_verbose("Attempting to upgrade the following installed packages:\n"); + PLIST_FOREACH(m, ml) + msg_verbose("%s\n", basename_of(m->pe->dbdir)); + } + return FALSE; } /* @@ -1088,7 +1160,6 @@ if (from == NULL || to == NULL) return FAIL; - /* XXX: (jlea) Should we have state checks here? */ /* XXX: (jlea) We should compare pkgroot_of() the names, and bail if they are not the same? We should also compare prefix! */ /* @@ -1202,6 +1273,10 @@ strlcpy(d->file, to->origin, PATH_MAX); delete_name_entry(&from->requires, m->pe->pkg->name); add_name_entry(&to->requires, m->pe->pkg->name); + m->pe->status = PKG_CHANGED; + if (write_pkg_entry(m->pe) == FAIL) + return FAIL; + cleanup_pkg_entry(m->pe); } free_match(&ml); free_name(&nl); 1.3 +0 -72 freepkg/lib/which.c Index: which.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/which.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- which.c 29 Apr 2004 14:14:08 -0000 1.2 +++ which.c 3 May 2004 11:41:55 -0000 1.3 @@ -165,75 +165,3 @@ fclose(fp); return SUCCESS; } - -/* - * Check our list of files against a package's plist, to see if we have a - * match. Then check to see if the DB agrees. Blow it away if it lies... - */ -error_code -verify_scan(which_list *wl, pkg_entry *pe) -{ - pkg_entry *db; - plist_entry *p; - which_entry *w; - char *dir = "."; - char tmp[PATH_MAX], rp[PATH_MAX], cwd[PATH_MAX]; - - if (wl == NULL || pe == NULL) - return FAIL; - if (pe->status != PKG_REGISTERED) - return FAIL; - if (scan_pkg_entry(pe) == FAIL) - return FAIL; - if (!getcwd(cwd, PATH_MAX)) - strlcpy(cwd, PkgMgr.wrkdir, PATH_MAX); - PLIST_FOREACH(p, &pe->pkg->plist) { - switch(p->type) { - case PLIST_CWD: - dir = p->name; - break; - case PLIST_FILE: - if (p->ignore) - break; - snprintf(tmp, PATH_MAX, "%s/%s", dir, p->name); - if (!isfile(tmp)) - break; - realpath(tmp, rp); - PLIST_FOREACH(w, wl) { - if (strcmp(rp, w->file) == 0 - && (db = scan_which_entry(w)) != pe - && (open_filedb(TRUE) == FAIL - || (db = scan_which_entry(w)) != pe)) { - msg_error(2, "Failed to fix database!"); - enter_dir(cwd); - return FAIL; - } - } - break; - default: - break; - } - } - enter_dir(cwd); - return SUCCESS; -} - -/* - * Check a the DB results of a scan against the installed packages. - */ -error_code -verify_which(which_list *wl) -{ - pkg_entry *pe; - - if (wl == NULL) - return FAIL; - PLIST_FOREACH(pe, &PkgMgr) { - if (pe->status == PKG_REGISTERED) { - if (verify_scan(wl, pe) == FAIL) - return FAIL; - cleanup_pkg_entry(pe); - } - } - return SUCCESS; -} |
From: Jeremy L. <jl...@us...> - 2004-04-30 12:48:56
|
jlea 04/04/30 05:48:49 Modified: lib depend.c lib.h package.c plist.c Log: Rewrite upgrade_package(), so that it actually stands a chance of working! Revision Changes Path 1.4 +3 -3 freepkg/lib/depend.c Index: depend.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/depend.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- depend.c 30 Apr 2004 09:53:18 -0000 1.3 +++ depend.c 30 Apr 2004 12:48:49 -0000 1.4 @@ -150,16 +150,16 @@ if (dl == NULL) return FAIL; PLIST_FOREACH(d, dl) { - if (d->w != NULL) - free(d->w); - d->w = NULL; if (!NULLSTR(d->pkg) && pkg_mgr_check(d->pkg)) { d->found = TRUE; continue; } else d->found = FALSE; + if (d->w != NULL) + free(d->w); switch (d->type) { case DEPEND_PKG: + d->w = NULL; break; case DEPEND_LIB: d->w = add_which_entry(&wl, WHICH_LIBRARY, d->file); 1.4 +1 -1 freepkg/lib/lib.h Index: lib.h =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/lib.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- lib.h 30 Apr 2004 09:53:18 -0000 1.3 +++ lib.h 30 Apr 2004 12:48:49 -0000 1.4 @@ -472,7 +472,7 @@ error_code delete_plist_entry(plist *, plist_entry *); plist_t read_plist_entry(char *, char **); error_code write_plist_entry(FILE *, plist_t, const char *); -error_code move_plist_entry(plist *, plist_entry *, plist *); +plist_entry * move_plist_entry(plist *, plist_entry *, plist *); /* show.c */ #define PKG_SHOW_NONE 0x0000 1.4 +126 -7 freepkg/lib/package.c Index: package.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/package.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- package.c 30 Apr 2004 09:53:18 -0000 1.3 +++ package.c 30 Apr 2004 12:48:49 -0000 1.4 @@ -1068,24 +1068,143 @@ } /* - * Upgrade one package with another. This just involves moving files from - * one list to the other. The deletion and addition are taken care of - * in upgrade_pkg_entry(). + * Upgrade one package with another. This involves two steps. The first is + * to move the dependencies, and the second is moving files from one list to + * the other. The deletion and addition are taken care of in + * upgrade_pkg_entry(). */ error_code upgrade_package(package *from, package *to) { + name_list nl = { PLIST_HEAD_INITIALIZER }; + name_entry *n; + match_list ml = { PLIST_HEAD_INITIALIZER }; + match_entry *m; + depend_entry *d; + pkg_entry *pe; plist_entry *p; + char *dir = "."; + char tmp[PATH_MAX], rp[PATH_MAX]; if (from == NULL || to == NULL) return FAIL; - PLIST_FOREACH(p, &from->plist) { - if (p->type == PLIST_FILE && p->name && strstr(p->name, ".so.") != NULL) { - if (move_plist_entry(&from->plist, p, &to->plist)) + /* XXX: (jlea) Should we have state checks here? */ + /* XXX: (jlea) We should compare pkgroot_of() the names, and bail if + they are not the same? We should also compare prefix! */ + /* + * Step 1: Make a name_list full of the files which other packages + * are using as LIB/RUNDEPs. Build a match_list at the same time, since + * we're going to need to go over the list of packages again. + */ + PLIST_FOREACH(n, &from->requires) { + if ((pe = find_pkg_entry(n->name)) == NULL) + continue; + if (scan_pkg_entry(pe) == FAIL) + return FAIL; + check_depend(&pe->pkg->depends); + PLIST_FOREACH(d, &pe->pkg->depends) { + if (strcmp(d->pkg, from->name) == 0) + break; + } + /* Ooops, these packages are confused! */ + if (d == NULL) { + msg_warn("Invalid dependancy between '%s' and '%s'", + n->name, from->name); + return FAIL; + } + add_match_entry(&ml, pe); + if (d->w != NULL && !NULLSTR(d->w->file)) { + if (add_name_entry(&nl, d->w->file) == NULL) return FAIL; - p->merged = TRUE; } } + /* + * Step 2: Check the to package to make sure it installs those files. + * XXX: (jlea) We do this to often... Build a function which returns a + * name_list of all of the files in a plist! + */ + PLIST_FOREACH(p, &to->plist) { + switch(p->type) { + case PLIST_CWD: + dir = p->name; + break; + case PLIST_FILE: + if (p->ignore) + break; + snprintf(tmp, PATH_MAX, "%s/%s", dir, p->name); + if (!isfile(tmp)) + break; + realpath(tmp, rp); + delete_name_entry(&nl, rp); + break; + default: + break; + } + } + if (!PLIST_EMPTY(&nl)) { + msg_note("The new package does not contain the following files," + "which are needed to statify some dependencies:\n"); + PLIST_FOREACH(n, &nl) + msg_note("%s\n", n->name); + /* + * XXX: (jlea) We should figure out which ones from the match_list, + * so that we can do recursive upgrades. + */ + free(&ml); + free(&nl); + return FAIL; + } + /* + * We could move the names across at this point, if we wanted. But this + * means that old files, which might have security issues are left + * behind... + */ +/* + PLIST_FOREACH(p, &from->plist) { + switch(p->type) { + case PLIST_CWD: + dir = p->name; + break; + case PLIST_FILE: + if (p->ignore) + break; + snprintf(tmp, PATH_MAX, "%s/%s", dir, p->name); + if (!isfile(tmp)) + break; + realpath(tmp, rp); + PLIST_FOREACH(n, &nl) { + if (strcmp(tp, n->name) == 0) { + if ((p = move_plist_entry(&from->plist, + p, &to->plist)) == NULL) + return FAIL; + } + } + break; + default: + break; + } + } +*/ + /* + * Step 3: Now that we know we have all of the files, go through the + * list again, this time changing the requires entries over from 'from' + * to 'to'. + */ + PLIST_FOREACH(m, &ml) { + PLIST_FOREACH(d, &m->pe->pkg->depends) { + if (strcmp(d->pkg, from->name) == 0) + break; + } + if (d == NULL) + return FAIL; /* Can't happen */ + strlcpy(d->pkg, to->name, PATH_MAX); + if (d->type == DEPEND_PKG) + strlcpy(d->file, to->origin, PATH_MAX); + delete_name_entry(&from->requires, m->pe->pkg->name); + add_name_entry(&to->requires, m->pe->pkg->name); + } + free_match(&ml); + free_name(&nl); return SUCCESS; } 1.2 +9 -6 freepkg/lib/plist.c Index: plist.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/plist.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- plist.c 26 Apr 2004 00:06:11 -0000 1.1 +++ plist.c 30 Apr 2004 12:48:49 -0000 1.2 @@ -355,7 +355,7 @@ * Move a plist entry from one plist to another, trying to keep the list * ordered. */ -error_code +plist_entry * move_plist_entry(plist *from, plist_entry *move, plist *to) { plist_entry *p, *l = NULL; @@ -363,7 +363,7 @@ PLIST_REMOVE(from, move, l); /* l will be NULL if we didn't find the element 'move' in 'from'. */ if (l == NULL) - return FAIL; + return NULL; /* * Don't insert if there is an existing entry which is the same. */ @@ -371,25 +371,28 @@ if (p->type == move->type && ((p->name == NULL && move->name == NULL) || (p->name != NULL && move->name != NULL - && strcmp(p->name, move->name) == 0))) - return SUCCESS; + && strcmp(p->name, move->name) == 0))) { + free(move); + return l; + } } /* * We try to insert after the first entry that is the same as the * element we were after in the last list. */ + move->merged = TRUE; PLIST_FOREACH(p, to) { if (p->type == l->type && ((p->name == NULL && l->name == NULL) || (p->name != NULL && l->name != NULL && strcmp(p->name, l->name) == 0))) { PLIST_INSERT_AFTER(to, p, move); - return SUCCESS; + return l; } } /* * Finally, just stick it at the end... */ PLIST_INSERT_TAIL(to, move); - return SUCCESS; + return l; } |
From: Jeremy L. <jl...@us...> - 2004-04-30 09:53:25
|
jlea 04/04/30 02:53:18 Modified: fpkg main.c info main.c lib depend.c entry.c lib.h manager.c match.c msg.c package.c show.c Log: Recursive deletes, list mode instead of show_index() and other fixes. Revision Changes Path 1.3 +34 -18 freepkg/fpkg/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/fpkg/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- main.c 29 Apr 2004 13:25:30 -0000 1.2 +++ main.c 30 Apr 2004 09:53:18 -0000 1.3 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$Id: main.c,v 1.2 2004/04/29 13:25:30 jlea Exp $"); +__FBSDID("$Id: main.c,v 1.3 2004/04/30 09:53:18 jlea Exp $"); #include <sys/param.h> #include <sys/file.h> @@ -61,7 +61,7 @@ match_list ml = { PLIST_HEAD_INITIALIZER }; which_list wl = { PLIST_HEAD_INITIALIZER }; which_entry *w; - enum { DELETE, INFO, VERSION, WHICH } mode; + enum { DELETE, LIST, INFO, VERSION, WHICH } mode; signal(SIGINT, cleanup); signal(SIGHUP, cleanup); @@ -95,7 +95,7 @@ PkgMgr.verbose = TRUE; break; case 'i': - PkgMgr.interactive = INTERACT_USER; + PkgMgr.interactive = TRUE; break; case 'o': origin = TRUE; @@ -126,22 +126,24 @@ /* Process our command */ /* XXX: (jlea) Add abbrev. */ - if (!strcmp(*argv, "delete")) { + if (!strcmp(*argv, "delete")) mode = DELETE; - } else if (!strcmp(*argv, "info")) { + else if (!strcmp(*argv, "list")) + mode = LIST; + else if (!strcmp(*argv, "info")) mode = INFO; - if (!quiet) - PkgMgr.verbose = TRUE; - } else if (!strcmp(*argv, "version")) { + else if (!strcmp(*argv, "version")) mode = VERSION; - } else if (!strcmp(*argv, "which")) { + else if (!strcmp(*argv, "which")) mode = WHICH; - } else + else usage(); + if (!quiet && (mode == LIST || mode == INFO)) + PkgMgr.verbose = TRUE; switch(mode) { case DELETE: - while ((ch = getopt(argc, argv, "dD")) != -1) { + while ((ch = getopt(argc, argv, "dDrR")) != -1) { switch (ch) { case 'D': PkgMgr.noinstall = TRUE; @@ -149,6 +151,12 @@ case 'd': PkgMgr.cleandirs = TRUE; break; + case 'r': + PkgMgr.recurse = TRUE; + break; + case 'R': + PkgMgr.orphans = TRUE; + break; default: usage(); break; @@ -157,9 +165,15 @@ argc -= optind; argv += optind; break; + + case LIST: + argc -= optind; + argv += optind; + all = (*argv == NULL); + break; case INFO: - while ((ch = getopt(argc, argv, "cdDfgiIkl:LmoprRsv")) != -1) { + while ((ch = getopt(argc, argv, "cdDfgikl:LmoprRsv")) != -1) { switch (ch) { case 'c': flags |= PKG_SHOW_COMMENT; @@ -179,9 +193,6 @@ case 'i': flags |= PKG_SHOW_INSTALL; break; - case 'I': - flags |= PKG_SHOW_INDEX; - break; case 'k': flags |= PKG_SHOW_DEINSTALL; break; @@ -311,6 +322,10 @@ if ((err = pkg_mgr_delete(&ml)) != 0) msg_warn("%d package deletion(s) failed", err); break; + case LIST: + if ((err = pkg_mgr_list(&ml)) != 0) + msg_warn("%d package(s) failed", err); + break; case INFO: if (!flags) flags = PKG_SHOW_COMMENT | PKG_SHOW_DESC | PKG_SHOW_REQBY; @@ -344,9 +359,10 @@ " fpkg -e [package]\n" " fpkg -V\n" "commands: delete [-dD] [packages]\n" -" info [-l mask] -[I index] [packages]\n" -" version [-l mask] -[I index] [packages]\n" -" which [-F file] -[L lib] [-P plist]\n" +" list [packages]\n" +" info [-cdDfgikLmoprRsv] [-l prefix] [packages]\n" +" version [-l mask] [-I index] [packages]\n" +" which [-F file] [-L lib] [-P plist]\n" ); exit(1); } 1.4 +27 -37 freepkg/info/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/info/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- main.c 29 Apr 2004 14:14:08 -0000 1.3 +++ main.c 30 Apr 2004 09:53:18 -0000 1.4 @@ -47,10 +47,10 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.3 2004/04/29 14:14:08 jlea Exp $"; + "$Id: main.c,v 1.4 2004/04/30 09:53:18 jlea Exp $"; #endif -static char Options[] = "acdDe:fghiIkl:LmopqrRst:v"; +static char Options[] = "acdDe:fghiIkl:LmoOpqrRst:v"; static void usage(void); void cleanup(int); @@ -60,7 +60,7 @@ { int ch, err = 0; unsigned int flags = PKG_SHOW_NONE; - boolean all = FALSE; + boolean all = FALSE, index = FALSE, origin = FALSE; match_list ml = { PLIST_HEAD_INITIALIZER }; signal(SIGINT, cleanup); @@ -68,98 +68,78 @@ pkg_mgr_init(); PkgMgr.verbose = TRUE; - if (argc == 1) { - all = TRUE; - flags = PKG_SHOW_INDEX; - } + if (argc == 1) + all = index = TRUE; else while ((ch = getopt(argc, argv, Options)) != -1) { switch(ch) { case 'a': all = TRUE; break; - case 'v': /* Reasonable definition of 'everything' */ flags = PKG_SHOW_COMMENT | PKG_SHOW_DESC | PKG_SHOW_PLIST | PKG_SHOW_INSTALL | PKG_SHOW_DEINSTALL | PKG_SHOW_REQUIRE | PKG_SHOW_DISPLAY | PKG_SHOW_MTREE; break; - case 'I': - flags |= PKG_SHOW_INDEX; + index = TRUE; break; - case 'p': flags |= PKG_SHOW_PREFIX; break; - case 'c': flags |= PKG_SHOW_COMMENT; break; - case 'd': flags |= PKG_SHOW_DESC; break; - case 'D': flags |= PKG_SHOW_DISPLAY; break; - case 'f': flags |= PKG_SHOW_PLIST; break; - case 'g': flags |= PKG_SHOW_CHKSUM; break; - case 'i': flags |= PKG_SHOW_INSTALL; break; - case 'k': flags |= PKG_SHOW_DEINSTALL; break; - case 'r': flags |= PKG_SHOW_REQUIRE; break; - case 'R': flags |= PKG_SHOW_REQBY; break; - case 'L': flags |= PKG_SHOW_FILES; break; - case 'm': flags |= PKG_SHOW_MTREE; break; - case 's': flags |= PKG_SHOW_SIZE; break; - case 'o': flags |= PKG_SHOW_ORIGIN; break; - + case 'O': + origin = TRUE; + break; case 'l': PkgMgr.infoprefix = optarg; break; - case 'q': PkgMgr.verbose = FALSE; break; - case 't': strlcpy(PkgMgr.mktmp_template, optarg, PATH_MAX); break; - case 'e': pkg_mgr_start(); return (pkg_mgr_check(optarg) ? 0 : 1); - case 'h': case '?': default: @@ -176,21 +156,32 @@ pkg_mgr_start(); /* Set some reasonable defaults */ /* If no packages, yelp */ + if (!argc && index) + all = TRUE; if (!argc && !all) { - msg_warn("missing package name(s)"), usage(); + msg_warn("missing package name(s)"); + usage(); } /* Get all the remaining package names, if any */ if (all) { pkg_mgr_match(&ml, "*"); } else { - while (*argv) - pkg_mgr_match(&ml, *argv++); + while (*argv) { + if (origin) + pkg_mgr_origin(&ml, *argv++); + else + pkg_mgr_match(&ml, *argv++); + } } - if PLIST_EMPTY(&ml) { + if PLIST_EMPTY(&ml) msg_warn("no matching packages found"); + if (index) { + if ((err = pkg_mgr_list(&ml)) != 0) + msg_warn("%d package(s) failed", err); + } else { + if ((err = pkg_mgr_show(&ml, flags)) != 0) + msg_warn("%d package(s) failed", err); } - if ((err = pkg_mgr_show(&ml, flags)) != 0) - msg_warn("%d package(s) failed", err); free_match(&ml); return err; @@ -199,10 +190,9 @@ static void usage() { - fprintf(stderr, "%s\n%s\n%s\n%s\n", + fprintf(stderr, "%s\n%s\n%s\n", "usage: fpkg_info [-cdDfiIkLmoOpqrRsSvW] [-e package] [-l prefix]", " [-t template] [pkg-name ...]", - " fpkg_info [-W file] [-S shlib] [-O]", " fpkg_info -a [flags]"); exit(1); } 1.3 +10 -5 freepkg/lib/depend.c Index: depend.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/depend.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- depend.c 29 Apr 2004 13:25:31 -0000 1.2 +++ depend.c 30 Apr 2004 09:53:18 -0000 1.3 @@ -150,9 +150,16 @@ if (dl == NULL) return FAIL; PLIST_FOREACH(d, dl) { + if (d->w != NULL) + free(d->w); + d->w = NULL; + if (!NULLSTR(d->pkg) && pkg_mgr_check(d->pkg)) { + d->found = TRUE; + continue; + } else + d->found = FALSE; switch (d->type) { case DEPEND_PKG: - d->w = NULL; break; case DEPEND_LIB: d->w = add_which_entry(&wl, WHICH_LIBRARY, d->file); @@ -182,10 +189,8 @@ * Now that we have a good list, go through the work of checking it. */ PLIST_FOREACH(d, dl) { - if (!NULLSTR(d->pkg) && pkg_mgr_check(d->pkg)) { - d->found = TRUE; - break; - } + if (d->found) + continue; if (d->w != NULL) pe = scan_which_entry(d->w); else if (!NULLSTR(d->file)) 1.3 +94 -3 freepkg/lib/entry.c Index: entry.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/entry.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- entry.c 29 Apr 2004 13:25:31 -0000 1.2 +++ entry.c 30 Apr 2004 09:53:18 -0000 1.3 @@ -513,6 +513,7 @@ return FAIL; if (scan_pkg_entry(pe) == FAIL) return FAIL; + /* XXX: (jlea) This should be part of PkgMgr */ if (getuid() != 0) msg_warn("not running as root - trying to record install anyway"); msg_verbose("Attempting to record package into %s/.\n", pe->dbdir); @@ -521,7 +522,6 @@ pe->dbdir); return FAIL; } - msg_verbose("Attempting to record package into %s/.\n", pe->dbdir); if (register_package(pe->pkg, pe->dbdir) == FAIL) return FAIL; if (add_package_filedb(pe->pkg) == FAIL) @@ -577,12 +577,74 @@ } /* + * Build a list of all of the packages which require the package in + * question. + */ +error_code +requires_pkg_entry(match_list *ml, pkg_entry *pe) +{ + name_entry *n; + pkg_entry *rp; + + if (ml == NULL || pe == NULL) + return FAIL; + if (pe->status != PKG_REGISTERED || NULLSTR(pe->dbdir)) + return FAIL; + if (scan_pkg_entry(pe) == FAIL) + return FAIL; + PLIST_FOREACH(n, &pe->pkg->requires) { + if ((rp = find_pkg_entry(n->name)) == NULL) + return FAIL; + if (add_match_head(ml, rp) == NULL) + return FAIL; + } + return SUCCESS; +} + +/* + * Build a list of all of the packages which would be 'orphaned' if this + * package was deleted. These are ports which would no longer be required + * by any other port. + */ +error_code +orphaned_pkg_entry(match_list *ml, pkg_entry *pe) +{ + depend_entry *d; + name_entry *n; + pkg_entry *dp; + + if (ml == NULL || pe == NULL) + return FAIL; + if (pe->status != PKG_REGISTERED || NULLSTR(pe->dbdir)) + return FAIL; + if (scan_pkg_entry(pe) == FAIL) + return FAIL; + check_depend(&pe->pkg->depends); + PLIST_FOREACH(d, &pe->pkg->depends) { + if (!d->found) + continue; + if ((dp = find_pkg_entry(d->pkg)) == NULL) + return FAIL; + if (dp->status != PKG_REGISTERED || scan_pkg_entry(dp) == FAIL) + return FAIL; + n = PLIST_FIRST(&dp->pkg->requires); + if (n == PLIST_LAST(&dp->pkg->requires) + && strcmp(n->name, basename_of(pe->dbdir)) == 0) { + if (add_match_entry(ml, dp) == NULL) + return FAIL; + } + } + return SUCCESS; +} + +/* * Delete a package entry. */ error_code delete_pkg_entry(pkg_entry *pe) { plist_entry *p; + name_entry *n; if (pe == NULL) return FAIL; @@ -599,11 +661,18 @@ if (strcmp(p->name,PkgMgr.prefix_override) != 0) return FAIL; } + if (!PLIST_EMPTY(&pe->pkg->requires)) { + msg_note("package `%s' is required by these other packages\n" + "and may not be deinstalled%s:\n", + pe->pkg->name, PkgMgr.force ? " (but I'll delete it anyway)" : "" ); + PLIST_FOREACH(n, &pe->pkg->requires) + msg_note("%s\n", n->name); + if (!PkgMgr.force) + return FAIL; + } if (!msg_prompt(TRUE, "Do you really want to delete `%s'", pe->pkg->name)) return FAIL; - if (required_package(pe->pkg) && !PkgMgr.force) - return FAIL; pe->status = PKG_DELETE; if (remove_package_filedb(pe->pkg) == FAIL && !PkgMgr.force) return FAIL; @@ -695,6 +764,28 @@ } /* + * Output pretty information about a package entry. + */ +error_code +show_pkg_entry(pkg_entry *pe, unsigned int flags) +{ + + if (pe->status == PKG_UNKNOWN) { + /* XXX: (jlea) This should used pkg_mgr_add_master() */ + if (fetch_pkg_entry(pe) == FAIL) + return FAIL; + if (extract_pkg_entry(pe, FALSE) == FAIL) + return FAIL; + pe->status = PKG_TEMP; + /* We can't size packages that are not installed */ + flags &= ~PKG_SHOW_SIZE; + } + if (scan_pkg_entry(pe) == FAIL) + return FAIL; + return show_package(pe->pkg, flags); +} + +/* * Try to work out the version of a package entry compared to the latest * version. */ 1.3 +16 -18 freepkg/lib/lib.h Index: lib.h =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/lib.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- lib.h 29 Apr 2004 13:25:31 -0000 1.2 +++ lib.h 30 Apr 2004 09:53:18 -0000 1.3 @@ -338,11 +338,6 @@ * whatever operation it was asked to perform, but might call these * functions if there was an error. */ -enum _interact_t { - INTERACT_NONE, INTERACT_YES, INTERACT_NO, INTERACT_USER -}; -typedef enum _interact_t interact_t; - struct _pkg_mgr { char wrkdir[PATH_MAX]; char dbdir[PATH_MAX]; @@ -355,7 +350,9 @@ boolean norecord; boolean cleandirs; boolean dereference; - interact_t interactive; + boolean recurse; + boolean orphans; + boolean interactive; char * excludefrom; char * infoprefix; @@ -464,6 +461,7 @@ match_entry * new_match_entry(void); void free_match(match_list *); match_entry * add_match_entry(match_list *, pkg_entry *); +match_entry * add_match_head(match_list *, pkg_entry *); /* plist.c */ plist_entry * new_plist_entry(void); @@ -485,28 +483,25 @@ #define PKG_SHOW_DEINSTALL 0x0010 #define PKG_SHOW_REQUIRE 0x0020 #define PKG_SHOW_PREFIX 0x0040 -#define PKG_SHOW_INDEX 0x0080 -#define PKG_SHOW_FILES 0x0100 -#define PKG_SHOW_DISPLAY 0x0200 -#define PKG_SHOW_REQBY 0x0400 -#define PKG_SHOW_MTREE 0x0800 -#define PKG_SHOW_SIZE 0x1000 -#define PKG_SHOW_ORIGIN 0x2000 -#define PKG_SHOW_CHKSUM 0x4000 -#define PKG_SHOW_CONFLICTS 0x8000 +#define PKG_SHOW_FILES 0x0080 +#define PKG_SHOW_DISPLAY 0x0100 +#define PKG_SHOW_REQBY 0x0200 +#define PKG_SHOW_MTREE 0x0400 +#define PKG_SHOW_SIZE 0x0800 +#define PKG_SHOW_ORIGIN 0x1000 +#define PKG_SHOW_CHKSUM 0x2000 +#define PKG_SHOW_CONFLICTS 0x4000 error_code show_file(char *, char *); error_code show_plist(char *, package *, plist_t); error_code show_files(char *, package *); error_code show_depend(char *, depend_list *); -error_code show_index(char *, char *); error_code show_size(char *, package *); error_code show_chksum(char *, package *); error_code show_origin(char *, package *); error_code show_conflicts(char *, package *); error_code show_version(const char *, const char *, const char *); error_code show_package(package *, unsigned int); -error_code show_pkg_entry(pkg_entry *, unsigned int); /* package.c */ package * new_package(void); @@ -522,7 +517,6 @@ boolean conflict_package(package *); error_code depend_package(package *, char*); error_code undepend_package(package *); -boolean required_package(package *); error_code delete_package(package *); error_code make_package(package *, char *); error_code upgrade_package(package *, package *); @@ -542,10 +536,13 @@ error_code install_pkg_entry(pkg_entry *); error_code register_pkg_entry(pkg_entry *); error_code write_pkg_entry(pkg_entry *); +error_code requires_pkg_entry(match_list *, pkg_entry *); +error_code orphaned_pkg_entry(match_list *, pkg_entry *); error_code delete_pkg_entry(pkg_entry *); pkg_entry * create_pkg_entry(pkg_info *, char *); error_code package_pkg_entry(pkg_entry *, char *); error_code upgrade_pkg_entry(pkg_entry *, pkg_entry *); +error_code show_pkg_entry(pkg_entry *, unsigned int); error_code version_pkg_entry(pkg_entry *); /* manager.c */ @@ -566,6 +563,7 @@ char * pkg_mgr_create_port(pkg_info *, char *); error_code pkg_mgr_create_backup(char *, char *); error_count pkg_mgr_show(match_list *, unsigned int); +error_count pkg_mgr_list(match_list *); error_code pkg_mgr_which(which_list *); error_count pkg_mgr_version(match_list *); 1.3 +54 -10 freepkg/lib/manager.c Index: manager.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/manager.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- manager.c 29 Apr 2004 13:25:31 -0000 1.2 +++ manager.c 30 Apr 2004 09:53:18 -0000 1.3 @@ -83,7 +83,9 @@ PkgMgr.norecord = FALSE; PkgMgr.cleandirs = FALSE; PkgMgr.dereference = FALSE; - PkgMgr.interactive = INTERACT_NONE; + PkgMgr.recurse = FALSE; + PkgMgr.orphans = FALSE; + PkgMgr.interactive = FALSE; PkgMgr.msg = &vprintf; PkgMgr.warn = &vwarnx; PkgMgr.err = &verrx; @@ -475,8 +477,7 @@ } /* - * Delete all installed packages in the match_list. We stop after the first - * failure. + * Delete all installed packages in the match_list. */ error_count pkg_mgr_delete(match_list *ml) @@ -488,11 +489,24 @@ return FAIL; while (!PLIST_EMPTY(ml)) { m = PLIST_FIRST(ml); - if (delete_pkg_entry(m->pe) == FAIL) { - /* XXX: (jlea) Add recursive removal here! */ - err_cnt++; - break; + if (m->pe->status != PKG_REGISTERED || NULLSTR(m->pe->dbdir)) + return FAIL; + if (scan_pkg_entry(m->pe) == FAIL) + return FAIL; + if (PkgMgr.recurse) { + if (requires_pkg_entry(ml, m->pe) == FAIL) + return FAIL; } + /* If we added new packages in the recurse, start again... */ + if (m != PLIST_FIRST(ml)) + continue; + if (PkgMgr.orphans) { + if (orphaned_pkg_entry(ml, m->pe) == FAIL) + return FAIL; + } + if (delete_pkg_entry(m->pe) == FAIL) + err_cnt++; + /* XXX: (jlea) Should we exit after 1 error? */ PLIST_REMOVE_HEAD(ml, m); free(m); } @@ -557,7 +571,7 @@ /* * Show information about all the matching packages, fetching and extracting - * it if it is a URL. XXX: (jlea) This should be in show.c + * it if it is a URL. */ error_count pkg_mgr_show(match_list *ml, unsigned int flags) @@ -577,8 +591,38 @@ } /* - * Show information about a which list. XXX: (jlea) This should be in show.c? - * Split this into one check and one show? Use the matchlist as a hint? + * Show information about all the matching packages, fetching and extracting + * it if it is a URL. + */ +error_count +pkg_mgr_list(match_list *ml) +{ + error_count err_cnt = 0; + char *cp, tmp[PATH_MAX]; + match_entry *m; + + if (ml == NULL) + return FAIL; + PLIST_FOREACH(m, ml) { + if (m->pe->status != PKG_REGISTERED) + continue; + if (PkgMgr.verbose) { + snprintf(tmp, PATH_MAX, "%s/%s", m->pe->dbdir, COMMENT_FNAME); + if ((cp = read_file(tmp)) == NULL) + err_cnt++; + else { + msg_note("%-19.19s %-59.59s\n", basename_of(m->pe->dbdir), cp); + free(cp); + } + } else + msg_note("%s\n", basename_of(m->pe->dbdir)); + } + return err_cnt; +} + +/* + * Show information about a which list. XXX: (jlea) Split this into one + * check and one show? */ error_count pkg_mgr_which(which_list *wl) 1.2 +24 -0 freepkg/lib/match.c Index: match.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/match.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- match.c 26 Apr 2004 00:05:24 -0000 1.1 +++ match.c 30 Apr 2004 09:53:18 -0000 1.2 @@ -97,3 +97,27 @@ PLIST_INSERT_TAIL(ml, m); return m; } + +/* + * Add an item to a match list. We remove duplicates already in the list. + */ +match_entry * +add_match_head(match_list *ml, pkg_entry *pe) +{ + match_entry *nm, *m, *tmp; + + if (ml == NULL || pe == NULL) + return NULL; + if ((nm = new_match_entry()) == NULL) + return NULL; + PLIST_FOREACH(m, ml) { + if (m->pe == pe) { + PLIST_REMOVE(ml, m, tmp); + free(m); + m = tmp; + } + } + nm->pe = pe; + PLIST_INSERT_HEAD(ml, nm); + return nm; +} 1.2 +1 -13 freepkg/lib/msg.c Index: msg.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/msg.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- msg.c 26 Apr 2004 00:05:57 -0000 1.1 +++ msg.c 30 Apr 2004 09:53:18 -0000 1.2 @@ -142,20 +142,8 @@ if (fmt == NULL) return FALSE; va_start(args, fmt); - switch (PkgMgr.interactive) { - case INTERACT_NONE: - break; - case INTERACT_YES: - resp = TRUE; - break; - case INTERACT_NO: - resp = FALSE; - break; - case INTERACT_USER: - if (PkgMgr.prompt != NULL) + if (PkgMgr.interactive && PkgMgr.prompt != NULL) resp = PkgMgr.prompt(resp, fmt, args); - break; - } va_end(args); return resp; } 1.3 +2 -23 freepkg/lib/package.c Index: package.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/package.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- package.c 29 Apr 2004 13:25:31 -0000 1.2 +++ package.c 30 Apr 2004 09:53:18 -0000 1.3 @@ -1090,24 +1090,6 @@ } /* - * Checks is a package is required. - */ -boolean -required_package(package *pkg) -{ - name_entry *n; - - if (pkg == NULL || PLIST_EMPTY(&pkg->requires)) - return FALSE; - msg_warn("package `%s' is required by these other packages\n" - "and may not be deinstalled%s:", - pkg->name, PkgMgr.force ? " (but I'll delete it anyway)" : "" ); - PLIST_FOREACH(n, &pkg->requires) - msg_warn("%s\n", n->name); - return TRUE; -} - -/* * Delete the results of a package installation. */ error_code @@ -1337,12 +1319,11 @@ * We take the package name we are passed and first slurp in the CONTENTS * file, getting name and origin, then we look for it's corresponding * Makefile. If that fails we pull in the INDEX, and check there. - * XXX: (jlea) This should be in show.c */ error_code version_package(package *pkg) { - char tmp[PATH_MAX], tmp2[PATH_MAX], *latest = NULL; + char tmp[PATH_MAX], *latest = NULL; index_entry *ie; /* @@ -1373,9 +1354,7 @@ /* Chop off the versions and compare. */ if (pkgroot_of(tmp, ie->name, PATH_MAX) == NULL) msg_error(2, "The INDEX does not appear to be valid!"); - if (pkgroot_of(tmp2, pkg->name, PATH_MAX) == NULL) - msg_warn("%s is not a valid package!", pkg->name); - if (strcmp(tmp, tmp2) == 0) { + if (strpcmp(tmp, pkg->name) == 0) { if (latest != NULL) { /* Multiple matches */ snprintf(tmp, PATH_MAX, "%s|%s", latest, ie->name); 1.4 +2 -60 freepkg/lib/show.c Index: show.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/show.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- show.c 29 Apr 2004 14:14:08 -0000 1.3 +++ show.c 30 Apr 2004 09:53:18 -0000 1.4 @@ -69,22 +69,6 @@ } /* - * Show the index entry for a package (pkgname and +COMMENT). - */ -error_code -show_index(char *pkgname, char *fname) -{ - char *cp; - - if (NULLSTR(pkgname) || NULLSTR(fname)) - return FAIL; - if ((cp = read_file(fname)) == NULL) - return FAIL; - printf("%s%-19.19s %-59.59s\n", PkgMgr.infoprefix, pkgname, cp); - return SUCCESS; -} - -/* * Show a packing list item type. If type is -1, show all. */ error_code @@ -397,7 +381,7 @@ /* * Do the work of comparing and outputing. Ugly, but well that's what - * You get when you try to match perl output in C ;-). + * you get when you try to match perl output in C ;-). */ error_code show_version(const char *installed, const char *latest, const char *source) @@ -477,10 +461,6 @@ if (pkg == NULL) return FAIL; - if (flags & PKG_SHOW_INDEX) { - msg_warn("invalid show types for package"); - return TRUE; - } /* Start showing the package contents */ msg_verbose("%sInformation for %s:\n\n", PkgMgr.infoprefix, pkg->name); @@ -522,43 +502,5 @@ if (err_cnt != 0) return FAIL; - return FALSE; -} - -/* - * Output pretty information about a package entry. - */ -error_code -show_pkg_entry(pkg_entry *pe, unsigned int flags) -{ - char tmp[PATH_MAX]; - - /* - * Index is a special info types that has to override all others to make - * any sense. It only applies to registered pacakges. - */ - /* XXX: (jlea) This needs work! */ - if (pe->status == PKG_UNKNOWN) { - /* XXX: (jlea) This should used pkg_mgr_add_master() */ - if (fetch_pkg_entry(pe) == FAIL) - return FAIL; - if (extract_pkg_entry(pe, FALSE) == FAIL) - return FAIL; - pe->status = PKG_TEMP; - /* We can't size packages that are not installed */ - flags &= ~PKG_SHOW_SIZE; - } - if (flags & PKG_SHOW_INDEX) { - if (pe->status != PKG_REGISTERED) - return FAIL; - if (enter_dir(pe->dbdir) == FAIL) - return FAIL; - pkgname_of(tmp, pe->dbdir, PATH_MAX); - if (show_index(tmp, COMMENT_FNAME) == FAIL) - return FAIL; - return SUCCESS; - } - if (scan_pkg_entry(pe) == FAIL) - return FAIL; - return show_package(pe->pkg, flags); + return SUCCESS; } |
From: Jeremy L. <jl...@us...> - 2004-04-29 14:17:30
|
jlea 04/04/29 07:17:23 Modified: htdocs bsd.port.mk-fpkg.patch Log: Update the bsd.port.mk patch slightly. Revision Changes Path 1.2 +78 -127 www/htdocs/bsd.port.mk-fpkg.patch Index: bsd.port.mk-fpkg.patch =================================================================== RCS file: /cvsroot/fpkg/www/htdocs/bsd.port.mk-fpkg.patch,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- bsd.port.mk-fpkg.patch 26 Apr 2004 09:56:11 -0000 1.1 +++ bsd.port.mk-fpkg.patch 29 Apr 2004 14:17:23 -0000 1.2 @@ -4,7 +4,7 @@ retrieving revision 1.488 diff -u -r1.488 bsd.port.mk --- bsd.port.mk 19 Apr 2004 23:39:52 -0000 1.488 -+++ bsd.port.mk 22 Apr 2004 06:52:47 -0000 ++++ bsd.port.mk 29 Apr 2004 14:12:02 -0000 @@ -764,13 +764,11 @@ # to turn them off (default: ${ECHO_CMD}). # PATCH_DEBUG - If set, print out more information about the patches as @@ -47,9 +47,9 @@ -PKG_INFO?= ${LOCALBASE}/sbin/pkg_info -PKG_VERSION?= ${LOCALBASE}/sbin/pkg_version +.if exists(/root/bin/fpkg) -+PKG_CREATE?= /root/bin/pkg_create -+PKG_ADD?= /root/bin/pkg_add -+PKG_INFO?= /root/bin/pkg_info ++PKG_CREATE?= /root/bin/fpkg_create ++PKG_ADD?= /root/bin/fpkg_add ++PKG_INFO?= /root/bin/fpkg_info +PKG_CMD?= /root/bin/fpkg .elif ${OSVERSION} < 460102 && ${PKGORIGIN} != "sysutils/pkg_install" BUILD_DEPENDS+= ${LOCALBASE}/sbin/pkg_info:${PORTSDIR}/sysutils/pkg_install @@ -66,23 +66,35 @@ .endif .if !defined(PKG_ARGS) -PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | sort -u`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS} -+PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} `cd ${.CURDIR} && ${MAKE} package-depends-args` ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS} ++PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} `cd ${.CURDIR} && ${MAKE} package-depends-args` ${EXTRA_PKG_ARGS} .if !defined(NO_MTREE) PKG_ARGS+= -m ${MTREE_FILE} .endif -@@ -1820,6 +1815,11 @@ +@@ -1819,6 +1814,23 @@ + .if defined(CONFLICTS) && !defined(DISABLE_CONFLICTS) PKG_ARGS+= -C "${CONFLICTS}" .endif - .endif ++.if exists(${PKGINSTALL}) ++PKG_ARGS+= -i ${PKGINSTALL} ++.endif ++.if exists(${PKGDEINSTALL}) ++PKG_ARGS+= -k ${PKGDEINSTALL} ++.endif ++.if exists(${PKGREQ}) ++PKG_ARGS+= -r ${PKGREQ} ++.endif ++.if exists(${PKGMESSAGE}) ++PKG_ARGS+= -D ${PKGMESSAGE} ++.endif ++.endif +.if defined(FORCE_PKG_REGISTER) +PKG_FORCE_ARG= -f +.else +PKG_FORCE_ARG= -+.endif + .endif .if defined(PKG_NOCOMPRESS) PKG_SUFX?= .tar - .else -@@ -1829,8 +1829,6 @@ +@@ -1829,8 +1841,6 @@ PKG_SUFX?= .tgz .endif .endif @@ -91,7 +103,7 @@ MOTIFLIB?= -L${X11BASE}/lib -lXm -lXp -@@ -2337,7 +2335,7 @@ +@@ -2337,7 +2347,7 @@ CONFIGURE_LOG?= config.log # A default message to print if do-configure fails. @@ -100,60 +112,29 @@ .if defined(GNU_CONFIGURE) # Maximum command line length -@@ -3071,43 +3069,6 @@ - .endif - .endif - --# Check conflicts -- --.if !target(check-conflicts) --check-conflicts: --.if defined(CONFLICTS) && !defined(DISABLE_CONFLICTS) -- @${RM} -f ${WRKDIR}/.CONFLICTS --.for conflict in ${CONFLICTS} -- @found="`${LS} -d ${PKG_DBDIR}/${conflict} 2>/dev/null || ${TRUE}`"; \ -- if [ X"$$found" != X"" ]; then \ -- ${ECHO_CMD} "$$found" >> ${WRKDIR}/.CONFLICTS; \ -- fi --.endfor -- @if [ -s ${WRKDIR}/.CONFLICTS ]; then \ -- found=`${CAT} ${WRKDIR}/.CONFLICTS | ${SED} -e s'|${PKG_DBDIR}/||g' | ${TR} '\012' ' '`; \ -- conflicting=0; \ -- for entry in $${found}; do \ -- prfx=`${PKG_INFO} -q -p $${entry} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \ -- if [ "x${PREFIX}" = "x$${prfx}" ]; then \ -- conflicting=1;\ -- conflicts_with="$${conflicts_with} $${entry}";\ -- fi;\ -- done; \ -- ${ECHO_MSG}; \ -- if [ "x$${conflicting}" = "x1" ] ; then \ -- ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \ -- for entry in $${conflicts_with} ; do \ -- ${ECHO_MSG} " $${entry}";\ -- done;\ -- ${ECHO_MSG} " They install files into the same place."; \ -- ${ECHO_MSG} " Please remove them first with pkg_delete(1)."; \ -- ${RM} -f ${WRKDIR}/.CONFLICTS; \ -- exit 1; \ -- fi ;\ -- fi --.endif # CONFLICTS --.endif -- - # Install - - .if !target(do-install) -@@ -3161,7 +3122,7 @@ - if [ -f ${PKGMESSAGE} ]; then \ - _LATE_PKG_ARGS="$${_LATE_PKG_ARGS} -D ${PKGMESSAGE}"; \ - fi; \ +@@ -3148,20 +3158,7 @@ + fi; \ + fi + @__softMAKEFLAGS='${__softMAKEFLAGS:S/'/'\''/g}'; \ +- _LATE_PKG_ARGS=""; \ +- if [ -f ${PKGINSTALL} ]; then \ +- _LATE_PKG_ARGS="$${_LATE_PKG_ARGS} -i ${PKGINSTALL}"; \ +- fi; \ +- if [ -f ${PKGDEINSTALL} ]; then \ +- _LATE_PKG_ARGS="$${_LATE_PKG_ARGS} -k ${PKGDEINSTALL}"; \ +- fi; \ +- if [ -f ${PKGREQ} ]; then \ +- _LATE_PKG_ARGS="$${_LATE_PKG_ARGS} -r ${PKGREQ}"; \ +- fi; \ +- if [ -f ${PKGMESSAGE} ]; then \ +- _LATE_PKG_ARGS="$${_LATE_PKG_ARGS} -D ${PKGMESSAGE}"; \ +- fi; \ - if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \ + if ${PKG_CREATE} ${PKG_ARGS} ${PKGFILE}; then \ if [ -d ${PACKAGES} ]; then \ cd ${.CURDIR} && eval ${MAKE} $${__softMAKEFLAGS} package-links; \ fi; \ -@@ -3230,34 +3191,16 @@ +@@ -3230,34 +3227,16 @@ .if !target(check-already-installed) check-already-installed: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) @@ -198,7 +179,7 @@ .else @${DO_NADA} .endif -@@ -3487,9 +3430,9 @@ +@@ -3487,9 +3466,9 @@ _BUILD_SEQ= build-message pre-build pre-build-script do-build \ post-build post-build-script _INSTALL_DEP= build @@ -210,7 +191,7 @@ _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ pre-su-install-script do-install post-install add-plist-info \ post-install-script add-plist-docs compress-man run-ldconfig fake-pkg \ -@@ -3658,22 +3601,8 @@ +@@ -3658,22 +3637,8 @@ @${ECHO_MSG} "===> Returning to user credentials" .else @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" @@ -235,7 +216,7 @@ @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif .endif -@@ -3691,15 +3620,8 @@ +@@ -3691,15 +3656,8 @@ @${ECHO_MSG} "===> Returning to user credentials" .else @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" @@ -253,7 +234,7 @@ @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif .endif -@@ -4221,7 +4143,7 @@ +@@ -4221,7 +4179,7 @@ else \ (cd $$dir; \ tmp=`${MAKE} -V PKGNAME`; \ @@ -262,7 +243,7 @@ ${MAKE} fetch; \ fi ); \ fi; \ -@@ -4249,7 +4171,7 @@ +@@ -4249,7 +4207,7 @@ else \ (cd $$dir; \ tmp=`${MAKE} -V PKGNAME`; \ @@ -271,75 +252,45 @@ ${MAKE} fetch-list; \ fi ); \ fi; \ -@@ -4300,52 +4222,45 @@ - # Package (recursive runtime) dependency list. Print out both directory names - # and package names. +@@ -4305,6 +4263,7 @@ + @${PACKAGE-DEPENDS-LIST} + .endif + ++# XXX: (reg) This needs a new feature to check origin? + PACKAGE-DEPENDS-LIST?= \ + if [ "${CHILD_DEPENDS}" ]; then \ + installed=$$(${PKG_INFO} -qO ${PKGORIGIN} 2>/dev/null || \ +@@ -4341,11 +4300,45 @@ --package-depends-list: --.if defined(CHILD_DEPENDS) || defined(LIB_DEPENDS) || defined(RUN_DEPENDS) || defined(DEPENDS) -- @${PACKAGE-DEPENDS-LIST} --.endif -- --PACKAGE-DEPENDS-LIST?= \ -- if [ "${CHILD_DEPENDS}" ]; then \ -- installed=$$(${PKG_INFO} -qO ${PKGORIGIN} 2>/dev/null || \ -- ${TRUE}); \ -- if [ "$$installed" ]; then \ -- break; \ -- fi; \ -- if [ -z "$$installed" ]; then \ -- installed="${PKGNAME}"; \ -- fi; \ -- for pkgname in $$installed; do \ -- ${ECHO_CMD} "$$pkgname ${.CURDIR} ${PKGORIGIN}"; \ -- done; \ -- fi; \ -- checked="${PARENT_CHECKED}"; \ -- for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${SED} -e 'y/ /\n/' | ${CUT} -f 2 -d ':') $$(${ECHO_CMD} ${DEPENDS} | ${SED} -e 'y/ /\n/' | ${CUT} -f 1 -d ':'); do \ -- dir=$$(${REALPATH} $$dir); \ -- if [ -d $$dir ]; then \ -- if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \ -- childout=$$(cd $$dir; ${MAKE} CHILD_DEPENDS=yes PARENT_CHECKED="$$checked" package-depends-list); \ -- set -- $$childout; \ -- childdir=""; \ -- while [ $$\# != 0 ]; do \ -- childdir="$$childdir $$2"; \ -- ${ECHO_CMD} "$$1 $$2 $$3"; \ -- shift 3; \ -- done; \ -- checked="$$dir $$childdir $$checked"; \ -- fi; \ -- else \ -- ${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \ -- fi; \ -- done -- # Print out package names. -+# XXX: (reg) Add ${DEPENDS} - package-depends: +-package-depends: -.if ${OSVERSION} >= 460102 || exists(${LOCALBASE}/sbin/pkg_info) - @${PACKAGE-DEPENDS-LIST} | ${AWK} '{print $$1":"$$3}' -+ @for i in ${LIB_DEPENDS}; do \ -+ pkgdep="$$pkgdep -L `${ECHO} $$i | ${SED} -e 's/:.*//'`"; \ -+ done; \ -+ for i in ${RUN_DEPENDS}; do \ -+ pkgdep="$$pkgdep -F `${ECHO} $$i | ${SED} -e 's/:.*//'`"; \ -+ done; \ -+ if [ "$$pkgdep" != "" ]; then \ -+ ${PKG_CMD} which $$pkgdep; \ -+ fi | sort -u -+ -+# XXX: (reg) Add ${DEPENDS} +package-depends-args: ++.if defined(LIB_DEPENDS) + @for i in ${LIB_DEPENDS}; do \ -+ pkgdep=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ -+ ${ECHO} "-L $$pkgdep"; \ -+ done; \ -+ for i in ${RUN_DEPENDS}; do \ -+ pkgdep=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ -+ ${ECHO} "-R $$pkgdep"; \ ++ pkgdep=`${ECHO_CMD} $$i | ${SED} -e 's/:.*//'`; \ ++ ${ECHO_CMD} "-L $$pkgdep"; \ + done | sort -u ++.endif ++.if defined(RUN_DEPENDS) ++ @for i in ${RUN_DEPENDS}; do \ ++ pkgdep=`${ECHO_CMD} $$i | ${SED} -e 's/:.*//'`; \ ++ ${ECHO_CMD} "-R $$pkgdep"; \ ++ done | sort -u ++.endif ++.if defined(DEPENDS) ++ @for dir in $$(${ECHO_CMD} ${DEPENDS} | ${SED} -e 'y/ /\n/' | ${CUT} -f 1 -d ':' | sort -u); do \ ++ if [ -d $$dir ]; then \ ++ pkgdep=`cd $$dir; ${MAKE} -V PKGNAME`; \ ++ pkgorg=`cd $$dir; ${MAKE} -V PKGORIGIN`; \ ++ ${ECHO_CMD} "-P $$pkgdep:$$pkgorg"; \ ++ else \ ++ ${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \ ++ fi; \ ++ done | sort -u ++.endif + +.if !target(check-plist-conflicts) +check-plist-conflicts: @@ -359,7 +310,7 @@ .endif # Build packages for port and dependencies -@@ -4620,50 +4535,8 @@ +@@ -4620,50 +4613,8 @@ .if !target(fake-pkg) fake-pkg: .if !defined(NO_PKG_REGISTER) |
From: Jeremy L. <jl...@us...> - 2004-04-29 14:14:16
|
jlea 04/04/29 07:14:09 Modified: add fpkg_add.1 main.c create fpkg_create.1 main.c delete fpkg_delete.1 main.c fpkg fpkg.1 info fpkg_info.1 main.c lib show.c which.c version fpkg_version.1 Log: More renaming to FreePKG/fpkg. Revision Changes Path 1.2 +24 -22 freepkg/add/fpkg_add.1 Index: fpkg_add.1 =================================================================== RCS file: /cvsroot/fpkg/freepkg/add/fpkg_add.1,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fpkg_add.1 29 Apr 2004 13:25:27 -0000 1.1 +++ fpkg_add.1 29 Apr 2004 14:14:06 -0000 1.2 @@ -1,6 +1,5 @@ .\" -.\" FreeBSD install - a package for the installation and maintainance -.\" of non-core utilities. +.\" FreePKG - A utility for managing 3rd party software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -11,17 +10,19 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" -.\" Jordan K. Hubbard +.\" Jeremy D. Lea .\" +.\" Based on FreeBSD's pkg_install +.\" by Jordan K. Hubbard and John Kohl .\" -.\" @(#)pkg_add.1 -.\" $FreeBSD: src/usr.sbin/pkg_install/add/pkg_add.1,v 1.35.2.15 2003/08/11 01:13:43 kris Exp $ +.\" @(#)fpkg_add.1 +.\" $Id: fpkg_add.1,v 1.2 2004/04/29 14:14:06 jlea Exp $ .\" .Dd November 25, 1994 -.Dt PKG_ADD 1 +.Dt FPKG_ADD 1 .Os .Sh NAME -.Nm pkg_add +.Nm fpkg_add .Nd a utility for installing software package distributions .Sh SYNOPSIS .Nm @@ -34,7 +35,7 @@ .Nm command is used to extract packages that have been previously created with the -.Xr pkg_create 1 +.Xr fpkg_create 1 command. .Sh WARNING .Bf -emphasis @@ -61,7 +62,7 @@ and .Cm @unexec directives, and/or use the -.Xr pkg_info 1 +.Xr fpkg_info 1 command to examine the package file. .Ef .Sh OPTIONS @@ -219,14 +220,14 @@ A check is made to determine if the package conflicts (from .Cm @conflicts directives, see -.Xr pkg_create 1 ) +.Xr fpkg_create 1 ) with an already-installed package. If it is, installation is terminated. .It Scan all the package dependencies (from .Cm @pkgdep directives, see -.Xr pkg_create 1 ) +.Xr fpkg_create 1 ) are read from the packing list. If any of these required packages is not currently installed, an attempt is made to find and install it; @@ -250,7 +251,7 @@ If the package contains a .Ar require file (see -.Xr pkg_create 1 ) , +.Xr fpkg_create 1 ) , then execute it with the following arguments: .Bd -ragged -offset indent -compact .Ar pkg-name @@ -288,7 +289,7 @@ and .Fl I flags to -.Xr pkg_create 1 ) . +.Xr fpkg_create 1 ) . .It If .Cm @option extract-in-place @@ -300,7 +301,7 @@ If the package contains an .Ar mtreefile file (see -.Xr pkg_create 1 ) , +.Xr fpkg_create 1 ) , then mtree is invoked as: .Bd -ragged -offset indent -compact .Cm mtree @@ -345,7 +346,7 @@ and .Fl I flags to -.Xr pkg_create 1 ) . +.Xr fpkg_create 1 ) . .Pp Reasoning behind passing keywords such as .Ar POST-INSTALL @@ -364,7 +365,7 @@ script, description, and display files are copied into .Pa /var/db/pkg/<pkg-name> for subsequent possible use by -.Xr pkg_delete 1 . +.Xr fpkg_delete 1 . Any package dependencies are recorded in the other packages' .Pa /var/db/pkg/<other-pkg>/+REQUIRED_BY file @@ -384,7 +385,7 @@ is installed, even if the user might change it with the .Fl p flag to -.Cm pkg_add . +.Cm fpkg_add . .Sh ENVIRONMENT The value of the .Ev PKG_PATH @@ -466,11 +467,12 @@ Default location of the installed package database. .El .Sh SEE ALSO -.Xr pkg_create 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 , -.Xr pkg_update 1 , -.Xr pkg_version 1 , +.Xr fpkg 1 , +.Xr fpkg_create 1 , +.Xr fpkg_delete 1 , +.Xr fpkg_info 1 , +.Xr fpkg_update 1 , +.Xr fpkg_version 1 , .Xr mktemp 3 , .Xr sysconf 3 , .Xr mtree 8 1.3 +5 -19 freepkg/add/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/add/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- main.c 29 Apr 2004 13:25:27 -0000 1.2 +++ main.c 29 Apr 2004 14:14:06 -0000 1.3 @@ -33,7 +33,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.2 2004/04/29 13:25:27 jlea Exp $"; + "$Id: main.c,v 1.3 2004/04/29 14:14:06 jlea Exp $"; #endif #include <sys/param.h> @@ -74,48 +74,37 @@ case 'v': PkgMgr.verbose = TRUE; break; - case 'p': strlcpy(PkgMgr.prefix_override, optarg, PATH_MAX); break; - case 'I': PkgMgr.noinstall = TRUE; break; - case 'R': PkgMgr.norecord = TRUE; break; - case 'f': PkgMgr.force = TRUE; break; - case 'n': PkgMgr.fake = TRUE; PkgMgr.verbose = TRUE; break; - case 'r': remote = TRUE; break; - case 't': strlcpy(PkgMgr.mktmp_template, optarg, PATH_MAX); break; - case 'S': mode = SLAVE; break; - case 'M': mode = MASTER; break; - case 'O': mode = PORT; break; - case 'h': case '?': default: @@ -134,7 +123,7 @@ usage(); } else if (read_line(tmp, PATH_MAX, stdin) == NULL) { - msg_warn("pkg_add in PORT mode not passed a directory"); + msg_warn("fpkg_add in PORT mode not passed a directory"); return FAIL; } if (pkg_mgr_add_port(tmp)) { @@ -142,14 +131,13 @@ return FAIL; } break; - case SLAVE: if (argc) { msg_warn("cannot supply package name(s) in slave mode"); usage(); } else if (read_line(tmp, PATH_MAX, stdin) == NULL) { - msg_warn("pkg_add in SLAVE mode not passed a directory"); + msg_warn("fpkg_add in SLAVE mode not passed a directory"); return FAIL; } if (pkg_mgr_add_slave(tmp)) { @@ -157,7 +145,6 @@ return FAIL; } break; - case MASTER: if (argc != 1) { msg_warn("only one package name must be specified with master mode"); @@ -170,7 +157,6 @@ printf("%s\n", cp); free(cp); break; - case NORMAL: /* If no packages, yelp */ if (!argc) { @@ -196,8 +182,8 @@ usage() { fprintf(stderr, "%s\n%s\n", - "usage: pkg_add [-vInrfRMSO] [-t template] [-p prefix]", - " pkg-name [pkg-name ...]"); +"usage: fpkg_add [-vInrfRMSO] [-t template] [-p prefix]", +" pkg-name [pkg-name ...]"); exit(1); } 1.2 +17 -21 freepkg/create/fpkg_create.1 Index: fpkg_create.1 =================================================================== RCS file: /cvsroot/fpkg/freepkg/create/fpkg_create.1,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fpkg_create.1 29 Apr 2004 13:25:28 -0000 1.1 +++ fpkg_create.1 29 Apr 2004 14:14:06 -0000 1.2 @@ -1,6 +1,5 @@ .\" -.\" FreeBSD install - a package for the installation and maintainance -.\" of non-core utilities. +.\" FreePKG - A utility for managing 3rd party software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -11,23 +10,20 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" -.\" Jordan K. Hubbard +.\" Jeremy D. Lea .\" +.\" Based on FreeBSD's pkg_install +.\" by Jordan K. Hubbard and John Kohl .\" -.\" @(#)pkg_create.1 -.\" $FreeBSD: src/usr.sbin/pkg_install/create/pkg_create.1,v 1.35.2.18 2003/09/03 08:23:56 roam Exp $ +.\" @(#)fpkg_create.1 +.\" $Id: fpkg_create.1,v 1.2 2004/04/29 14:14:06 jlea Exp $ .\" -.\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords, -.\" added dependency tracking, etc. -.\" -.\" [jkh] Took John's changes back and made some additional extensions for -.\" better integration with FreeBSD's new ports collection. .\" .Dd April 21, 1995 -.Dt PKG_CREATE 1 +.Dt FPKG_CREATE 1 .Os .Sh NAME -.Nm pkg_create +.Nm fpkg_create .Nd a utility for creating software package distributions .Sh SYNOPSIS .Nm @@ -108,7 +104,7 @@ Go into a `packing list Only' mode. This is a custom hack for the .Fx .Em "Ports Collection" -and is used to do `fake pkg_add' operations when a port is installed. +and is used to do `fake fpkg_add' operations when a port is installed. In such cases, it is necessary to know what the final, adjusted packing list will look like. .It Fl v @@ -409,14 +405,14 @@ Set internal package options, the only two currently supported ones being .Ar extract-in-place , -which tells the pkg_add command not to extract the package's tarball +which tells the fpkg_add command not to extract the package's tarball into a staging area but rather directly into the target hierarchy (this is typically meant to be used only by distributions or other special package types), and .Ar preserve , -which tells pkg_add to move any existing files out of the way, +which tells fpkg_add to move any existing files out of the way, preserving the previous contents (which are also resurrected on -pkg_delete, so caveat emptor). +fpkg_delete, so caveat emptor). .It Cm @owner Ar user Set default ownership for all subsequently extracted files to .Ar user . @@ -531,11 +527,11 @@ is unsuitable. .El .Sh SEE ALSO -.Xr pkg_add 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 , -.Xr pkg_update 1 , -.Xr pkg_version 1 , +.Xr fpkg 1 , +.Xr fpkg_add 1 , +.Xr fpkg_delete 1 , +.Xr fpkg_info 1 , +.Xr fpkg_version 1 , .Xr sysconf 3 .Sh HISTORY The 1.3 +6 -8 freepkg/create/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/create/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- main.c 29 Apr 2004 13:25:28 -0000 1.2 +++ main.c 29 Apr 2004 14:14:06 -0000 1.3 @@ -164,7 +164,6 @@ printf("%s\n", cp); free(cp); break; - case BACKUP: if (*argv && isdir(*argv)) strlcpy(tmp, *argv++, PATH_MAX); @@ -185,7 +184,6 @@ return err; } break; - case NORMAL: if (argc != 1) { msg_warn("only one package name can be specified for creatation"); @@ -206,12 +204,12 @@ usage() { fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: pkg_create [-YNOBhv] [-P pkgs] [-p prefix] [-f contents] [-i iscript]", -" [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ", -" [-t template] [-X excludefile] [-D displayfile] ", -" [-L libdep:pkg] [-R rundep:pkg] [-m mtreefile] ", -" [-o origin] -c comment -d description -f packlist ", -" pkg-name"); +"usage: fpkg_create [-YNOBhv] [-P pkgs] [-p prefix] [-f contents] [-i iscript]", +" [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ", +" [-t template] [-X excludefile] [-D displayfile] ", +" [-L libdep:pkg] [-R rundep:pkg] [-m mtreefile] ", +" [-o origin] -c comment -d description -f packlist ", +" pkg-name"); exit(1); } 1.2 +20 -18 freepkg/delete/fpkg_delete.1 Index: fpkg_delete.1 =================================================================== RCS file: /cvsroot/fpkg/freepkg/delete/fpkg_delete.1,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fpkg_delete.1 29 Apr 2004 13:25:29 -0000 1.1 +++ fpkg_delete.1 29 Apr 2004 14:14:07 -0000 1.2 @@ -1,6 +1,5 @@ .\" -.\" FreeBSD install - a package for the installation and maintainance -.\" of non-core utilities. +.\" FreePKG - A utility for managing 3rd party software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -11,17 +10,19 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" -.\" Jordan K. Hubbard +.\" Jeremy D. Lea .\" +.\" Based on FreeBSD's pkg_install +.\" by Jordan K. Hubbard and John Kohl .\" -.\" @(#)pkg_delete.1 -.\" $FreeBSD: src/usr.sbin/pkg_install/delete/pkg_delete.1,v 1.16.2.9 2002/06/21 16:42:18 charnier Exp $ +.\" @(#)fpkg_delete.1 +.\" $Id: fpkg_delete.1,v 1.2 2004/04/29 14:14:07 jlea Exp $ .\" .Dd November 25, 1994 -.Dt PKG_DELETE 1 +.Dt FPKG_DELETE 1 .Os .Sh NAME -.Nm pkg_delete +.Nm fpkg_delete .Nd a utility for deleting previously installed software package distributions .Sh SYNOPSIS .Nm @@ -36,7 +37,7 @@ .Nm command is used to delete packages that have been previously installed with the -.Xr pkg_add 1 +.Xr fpkg_add 1 command. .Sh WARNING .Bf -emphasis @@ -63,7 +64,7 @@ and .Cm @unexec directives, and/or use the -.Xr pkg_info 1 +.Xr fpkg_info 1 command to examine the installed package control files. .Ef .Sh OPTIONS @@ -90,7 +91,7 @@ as the directory in which to delete files from any installed packages which do not explicitly set theirs. For most packages, the prefix will be set automatically to the installed location by -.Xr pkg_add 1 . +.Xr fpkg_add 1 . .It Fl d Remove empty directories created by file cleanup. By default, only files/directories explicitly listed in a package's contents (either as @@ -146,7 +147,7 @@ If the package contains a .Ar require file (see -.Xr pkg_create 1 ) , +.Xr fpkg_create 1 ) , then this is executed first as .Bd -ragged -offset indent -compact .Cm require @@ -193,7 +194,7 @@ and .Fl K flags to -.Xr pkg_create 1 ) . +.Xr fpkg_create 1 ) . .Pp If a .Cm post-deinstall @@ -227,7 +228,7 @@ and .Fl K flags to -.Xr pkg_create 1 ) . +.Xr fpkg_create 1 ) . .Pp Reasoning behind passing keywords such as .Ar DEINSTALL @@ -251,7 +252,7 @@ option when running .Nm or -.Cm pkg_add . +.Cm fpkg_add . .Sh ENVIRONMENT The environment variable .Ev PKG_DBDIR @@ -262,10 +263,11 @@ Default location of the installed package database. .El .Sh SEE ALSO -.Xr pkg_add 1 , -.Xr pkg_create 1 , -.Xr pkg_info 1 , -.Xr pkg_version 1 , +.Xr fpkg 1 , +.Xr fpkg_add 1 , +.Xr fpkg_create 1 , +.Xr fpkg_info 1 , +.Xr fpkg_version 1 , .Xr mktemp 3 , .Xr mtree 8 .Sh AUTHORS 1.3 +2 -2 freepkg/delete/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/delete/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- main.c 29 Apr 2004 13:25:29 -0000 1.2 +++ main.c 29 Apr 2004 14:14:07 -0000 1.3 @@ -33,7 +33,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.2 2004/04/29 13:25:29 jlea Exp $"; + "$Id: main.c,v 1.3 2004/04/29 14:14:07 jlea Exp $"; #endif #include <sys/types.h> @@ -118,7 +118,7 @@ static void usage() { - fprintf(stderr, "usage: pkg_delete [-vDdnf] [-p prefix] pkg-name ...\n"); + fprintf(stderr, "usage: fpkg_delete [-vDdnf] [-p prefix] pkg-name ...\n"); exit(1); } 1.2 +9 -8 freepkg/fpkg/fpkg.1 Index: fpkg.1 =================================================================== RCS file: /cvsroot/fpkg/freepkg/fpkg/fpkg.1,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fpkg.1 26 Apr 2004 00:05:19 -0000 1.1 +++ fpkg.1 29 Apr 2004 14:14:07 -0000 1.2 @@ -1,5 +1,5 @@ .\" -.\" XXX: (jlea) insert final project name. +.\" FreePKG - A utility for managing 3rd party software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -13,10 +13,10 @@ .\" Jeremy D. Lea .\" .\" Based on FreeBSD's pkg_install -.\" by Jordan K. Hubbard +.\" by Jordan K. Hubbard and John Kohl .\" -.\" @(#)pkg_info.1 -.\" $Id: fpkg.1,v 1.1 2004/04/26 00:05:19 jlea Exp $ +.\" @(#)fpkg.1 +.\" $Id: fpkg.1,v 1.2 2004/04/29 14:14:07 jlea Exp $ .\" .Dd Apr 15, 2004 .Dt FREEPKG 1 @@ -116,10 +116,11 @@ .Ed .El .Sh SEE ALSO -.Xr pkg_add 1 , -.Xr pkg_create 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 , +.Xr fpkg_add 1 , +.Xr fpkg_create 1 , +.Xr fpkg_delete 1 , +.Xr fpkg_info 1 , +.Xr fpkg_version 1 , .Xr mktemp 3 , .Xr mtree 8 .Sh AUTHORS 1.2 +15 -13 freepkg/info/fpkg_info.1 Index: fpkg_info.1 =================================================================== RCS file: /cvsroot/fpkg/freepkg/info/fpkg_info.1,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fpkg_info.1 29 Apr 2004 13:25:30 -0000 1.1 +++ fpkg_info.1 29 Apr 2004 14:14:08 -0000 1.2 @@ -1,6 +1,5 @@ .\" -.\" FreeBSD install - a package for the installation and maintenance -.\" of non-core utilities. +.\" FreePKG - A utility for managing 3rd party software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -11,17 +10,19 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" -.\" Jordan K. Hubbard +.\" Jeremy D. Lea .\" +.\" Based on FreeBSD's pkg_install +.\" by Jordan K. Hubbard and John Kohl .\" -.\" @(#)pkg_info.1 -.\" $FreeBSD: src/usr.sbin/pkg_install/info/pkg_info.1,v 1.24.2.15 2004/04/06 03:49:11 cperciva Exp $ +.\" @(#)fpkg_info.1 +.\" $Id: fpkg_info.1,v 1.2 2004/04/29 14:14:08 jlea Exp $ .\" .Dd February 8, 2001 -.Dt PKG_INFO 1 +.Dt FPKG_INFO 1 .Os .Sh NAME -.Nm pkg_info +.Nm fpkg_info .Nd a utility for displaying information on software packages .Sh SYNOPSIS .Nm @@ -42,10 +43,10 @@ .Nm command is used to dump out information for packages, either packed up in files with the -.Xr pkg_create 1 +.Xr fpkg_create 1 command or already installed on the system with the -.Xr pkg_add 1 +.Xr fpkg_add 1 command. .Sh OPTIONS The following command line options are supported: @@ -211,10 +212,11 @@ Default location of the installed package database. .El .Sh SEE ALSO -.Xr pkg_add 1 , -.Xr pkg_create 1 , -.Xr pkg_delete 1 , -.Xr pkg_version 1 , +.Xr fpkg 1 , +.Xr fpkg_add 1 , +.Xr fpkg_create 1 , +.Xr fpkg_delete 1 , +.Xr fpkg_version 1 , .Xr mktemp 3 , .Xr mtree 8 .Sh AUTHORS 1.3 +5 -5 freepkg/info/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/info/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- main.c 29 Apr 2004 13:25:30 -0000 1.2 +++ main.c 29 Apr 2004 14:14:08 -0000 1.3 @@ -47,7 +47,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.2 2004/04/29 13:25:30 jlea Exp $"; + "$Id: main.c,v 1.3 2004/04/29 14:14:08 jlea Exp $"; #endif static char Options[] = "acdDe:fghiIkl:LmopqrRst:v"; @@ -200,10 +200,10 @@ usage() { fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: pkg_info [-cdDfiIkLmoOpqrRsSvW] [-e package] [-l prefix]", - " [-t template] [pkg-name ...]", - " pkg_info [-W file] [-S shlib] [-O]", - " pkg_info -a [flags]"); + "usage: fpkg_info [-cdDfiIkLmoOpqrRsSvW] [-e package] [-l prefix]", + " [-t template] [pkg-name ...]", + " fpkg_info [-W file] [-S shlib] [-O]", + " fpkg_info -a [flags]"); exit(1); } 1.3 +1 -1 freepkg/lib/show.c Index: show.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/show.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- show.c 29 Apr 2004 13:25:31 -0000 1.2 +++ show.c 29 Apr 2004 14:14:08 -0000 1.3 @@ -539,7 +539,7 @@ */ /* XXX: (jlea) This needs work! */ if (pe->status == PKG_UNKNOWN) { - /* XXX: (jlea) This should used pkg_add_master() */ + /* XXX: (jlea) This should used pkg_mgr_add_master() */ if (fetch_pkg_entry(pe) == FAIL) return FAIL; if (extract_pkg_entry(pe, FALSE) == FAIL) 1.2 +1 -1 freepkg/lib/which.c Index: which.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/lib/which.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- which.c 26 Apr 2004 00:05:47 -0000 1.1 +++ which.c 29 Apr 2004 14:14:08 -0000 1.2 @@ -130,7 +130,7 @@ /* * Add a whole pkg-plist to the which list. This is done with the raw list, * rather than a processed one so that we can use it to scan for installed - * files before a pkg_create(1). + * files before a fpkg_create(1). */ error_code add_which_plist(which_list *wl, char *contents) 1.2 +18 -25 freepkg/version/fpkg_version.1 Index: fpkg_version.1 =================================================================== RCS file: /cvsroot/fpkg/freepkg/version/fpkg_version.1,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fpkg_version.1 29 Apr 2004 13:25:32 -0000 1.1 +++ fpkg_version.1 29 Apr 2004 14:14:09 -0000 1.2 @@ -1,7 +1,5 @@ .\" -.\" Copyright 1998 Bruce A. Mah -.\" -.\" All rights reserved. +.\" FreePKG - A utility for managing 3rd party software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -12,23 +10,17 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" Jeremy D. Lea +.\" +.\" Based on FreeBSD's pkg_version +.\" Copyright 1998 Bruce A. Mah .\" -.\" $FreeBSD: src/usr.sbin/pkg_install/version/pkg_version.1,v 1.5.2.14 2002/06/21 16:42:26 charnier Exp $ +.\" $Id: fpkg_version.1,v 1.2 2004/04/29 14:14:09 jlea Exp $ .Dd July 17, 1998 -.Dt PKG_VERSION 1 +.Dt FPKG_VERSION 1 .Os .Sh NAME -.Nm pkg_version +.Nm fpkg_version .Nd summarize installed versions of packages .Sh SYNOPSIS .Nm @@ -44,7 +36,7 @@ .Nm command is used to produce a report of non-base software packages installed using the -.Xr pkg_add 1 +.Xr fpkg_add 1 command. .Pp Each package's version number is checked against one of two sources to @@ -179,10 +171,11 @@ .El .Sh SEE ALSO .Xr fetch 1 , -.Xr pkg_add 1 , -.Xr pkg_create 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 +.Xr fpkg 1 , +.Xr fpkg_add 1 , +.Xr fpkg_create 1 , +.Xr fpkg_delete 1 , +.Xr fpkg_info 1 .Sh FILES .Bl -tag -width /usr/ports/INDEX -compact .It Pa /usr/ports/INDEX @@ -194,12 +187,12 @@ command, which checks the installed packages against the local ports index file: .Pp -.Dl % pkg_version -v +.Dl % fpkg_version -v .Pp The command below generates a report against the version numbers in the on-line ports collection: .Pp -.Dl % pkg_version ftp://ftp.FreeBSD.org/pub/FreeBSD/branches/-current/ports/INDEX +.Dl % fpkg_version ftp://ftp.FreeBSD.org/pub/FreeBSD/branches/-current/ports/INDEX .Pp The command below generates a file of commands to run to update the installed files. @@ -214,7 +207,7 @@ Blindly running the output of this command may leave a system in an unusable state. .Pp -.Dl % pkg_version -c > do_update +.Dl % fpkg_version -c > do_update .Pp The following command compares two package version strings: .Pp @@ -239,4 +232,4 @@ .Pp Commands output assumes you install new software using the ports system, rather than using -.Xr pkg_add 1 . +.Xr fpkg_add 1 . |
From: Jeremy L. <jl...@us...> - 2004-04-29 13:25:39
|
jlea 04/04/29 06:25:33 Modified: . Makefile Makefile.inc add Makefile main.c create Makefile main.c delete Makefile main.c fpkg Makefile main.c info Makefile main.c lib Makefile depend.c entry.c file.c lib.h manager.c package.c show.c Added: add fpkg_add.1 create fpkg_create.1 delete fpkg_delete.1 info fpkg_info.1 version Makefile fpkg_version.1 main.c test-pkg_version.sh Removed: add pkg_add.1 create pkg_create.1 delete pkg_delete.1 fpkg test-pkg_version.sh info pkg_info.1 Log: Move over to new FreePKG/fpkg name. Cleaning and fixing. Revision Changes Path 1.2 +2 -2 freepkg/Makefile Index: Makefile =================================================================== RCS file: /cvsroot/fpkg/freepkg/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 26 Apr 2004 00:05:14 -0000 1.1 +++ Makefile 29 Apr 2004 13:25:27 -0000 1.2 @@ -1,5 +1,5 @@ -# $Id: Makefile,v 1.1 2004/04/26 00:05:14 jlea Exp $ +# $Id: Makefile,v 1.2 2004/04/29 13:25:27 jlea Exp $ -SUBDIR=lib add create delete info fpkg +SUBDIR=lib add create delete info version fpkg .include <bsd.subdir.mk> 1.2 +3 -3 freepkg/Makefile.inc Index: Makefile.inc =================================================================== RCS file: /cvsroot/fpkg/freepkg/Makefile.inc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile.inc 26 Apr 2004 00:05:14 -0000 1.1 +++ Makefile.inc 29 Apr 2004 13:25:27 -0000 1.2 @@ -1,9 +1,9 @@ -# $Id: Makefile.inc,v 1.1 2004/04/26 00:05:14 jlea Exp $ +# $Id: Makefile.inc,v 1.2 2004/04/29 13:25:27 jlea Exp $ .if exists(${.OBJDIR}/../lib) -LIBINSTALL= ${.OBJDIR}/../lib/libinstall.a +LIBFPKG= ${.OBJDIR}/../lib/libfpkg.a .else -LIBINSTALL= ${.CURDIR}/../lib/libinstall.a +LIBDPKG= ${.CURDIR}/../lib/libfpkg.a .endif BINDIR?= /root/bin 1.2 +4 -4 freepkg/add/Makefile Index: Makefile =================================================================== RCS file: /cvsroot/fpkg/freepkg/add/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 26 Apr 2004 00:06:22 -0000 1.1 +++ Makefile 29 Apr 2004 13:25:27 -0000 1.2 @@ -1,13 +1,13 @@ -# $Id: Makefile,v 1.1 2004/04/26 00:06:22 jlea Exp $ +# $Id: Makefile,v 1.2 2004/04/29 13:25:27 jlea Exp $ -PROG= pkg_add +PROG= fpkg_add SRCS= main.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib WARNS?= 2 -DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} -LDADD= ${LIBINSTALL} -lfetch -lmd +DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD} +LDADD= ${LIBFPKG} -lfetch -lmd .include <bsd.prog.mk> 1.2 +27 -15 freepkg/add/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/add/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.c 26 Apr 2004 00:06:27 -0000 1.1 +++ main.c 29 Apr 2004 13:25:27 -0000 1.2 @@ -1,29 +1,41 @@ -#ifndef lint -static const char rcsid[] = - "$Id: main.c,v 1.1 2004/04/26 00:06:27 jlea Exp $"; -#endif - /* - * - * FreeBSD install - a package for the installation and maintainance - * of non-core utilities. + * FreePKG - A utility for managing 3rd party software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * Jordan K. Hubbard - * 18 July 1993 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * This is the add module. + * Jeremy D. Lea + * 22 April 2004. * + * Based on pkg_install, by: + * Jordan K. Hubbard + * 18 July 1993 + * + * This is the add module. */ +#ifndef lint +static const char rcsid[] = + "$Id: main.c,v 1.2 2004/04/29 13:25:27 jlea Exp $"; +#endif + #include <sys/param.h> #include <sys/file.h> #include <sys/stat.h> @@ -167,7 +179,7 @@ } while (*argv) { if (remote) - err += pkg_mgr_add_latest(*argv); + err += pkg_mgr_add(pkg_mgr_latest(*argv)); else err += pkg_mgr_add(*argv); argv++; 1.1 freepkg/add/fpkg_add.1 .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" Jordan K. Hubbard .\" .\" .\" @(#)pkg_add.1 .\" $FreeBSD: src/usr.sbin/pkg_install/add/pkg_add.1,v 1.35.2.15 2003/08/11 01:13:43 kris Exp $ .\" .Dd November 25, 1994 .Dt PKG_ADD 1 .Os .Sh NAME .Nm pkg_add .Nd a utility for installing software package distributions .Sh SYNOPSIS .Nm .Op Fl vInfrRMS .Op Fl t Ar template .Op Fl p Ar prefix .Ar pkg-name Op Ar pkg-name ... .Sh DESCRIPTION The .Nm command is used to extract packages that have been previously created with the .Xr pkg_create 1 command. .Sh WARNING .Bf -emphasis Since the .Nm command may execute scripts or programs contained within a package file, your system may be susceptible to .Dq Em trojan horses or other subtle attacks from miscreants who create dangerous package files. .Pp You are advised to verify the competence and identity of those who provide installable package files. For extra protection, use the .Fl M flag to extract the package file, and inspect its contents and scripts to ensure it poses no danger to your system's integrity. Pay particular attention to any +INSTALL, +POST-INSTALL, +DEINSTALL, +POST-DEINSTALL, +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS file for .Cm @cwd , .Cm @mode (check for setuid), .Cm @dirrm , .Cm @exec , and .Cm @unexec directives, and/or use the .Xr pkg_info 1 command to examine the package file. .Ef .Sh OPTIONS The following command line arguments are supported: .Bl -tag -width indent .It Ar pkg-name Op Ar pkg-name ... The named packages are installed. A package name of - will cause .Nm to read from stdin. If the packages are not found in the current working directory, .Nm will search them in each directory named by .Ev PKG_PATH . .It Fl v Turn on verbose output. .It Fl I If a installation scripts (pre-install or post-install) exist for a given package, do not execute them. .It Fl n Don't actually install a package, just report the steps that would be taken if it was. .It Fl R Do not record the installation of a package. This means that you cannot deinstall it later, so only use this option if you know what you are doing! .It Fl r Use the remote fetching feature. This will determine the appropriate objformat and release and then fetch and install the package. .It Fl f Force installation to proceed even if prerequisite packages are not installed or the requirements script fails. Although .Nm will still try to find and auto-install missing prerequisite packages, a failure to find one will not be fatal. .It Fl p Ar prefix Set .Ar prefix as the directory in which to extract files from a package. If a package has set its default directory, it will be overridden by this flag. Note that only the first .Cm @cwd directive will be replaced, since .Nm has no way of knowing which directory settings are relative and which are absolute. It is rare in any case to see more than one directory transition made, but when such does happen and you wish to have control over *all* directory transitions, then you may then wish to look into the use of .Cm MASTER and .Cm SLAVE modes (see the .Fl M and .Fl S options). .It Fl t Ar template Use .Ar template as the input to .Xr mktemp 3 when creating a .Dq staging area . By default, this is the string .Pa /var/tmp/instmp.XXXXXX , but it may be necessary to override it in the situation where space in your .Pa /var/tmp directory is limited. Be sure to leave some number of `X' characters for .Xr mktemp 3 to fill in with a unique ID. .Pp You can get a performance boost by setting the staging area .Ar template to reside on the same disk partition as target directories for package file installation; often this is .Pa /usr . .It Fl M Run in .Cm MASTER mode. This is a very specialized mode for running .Nm and is meant to be run in conjunction with .Cm SLAVE mode. When run in this mode, .Nm does no work beyond extracting the package into a temporary staging area (see the .Fl t option), reading in the packing list, and then dumping it (prefaced by the current staging area) to stdout where it may be filtered by a program such as .Xr sed 1 . When used in conjunction with .Cm SLAVE mode, it allows you to make radical changes to the package structure before acting on its contents. .It Fl S Run in .Cm SLAVE mode. This is a very specialized mode for running .Nm and is meant to be run in conjunction with .Cm MASTER mode. When run in this mode, .Nm expects the release contents to be already extracted and waiting in the staging area, the location of which is read as a string from stdin. The complete packing list is also read from stdin, and the contents then acted on as normal. .El .Pp One or more .Ar pkg-name arguments may be specified, each being either a file containing the package (these usually end with a .Dq .tgz suffix) or a URL pointing at a file available on an ftp site. Thus you may extract files directly from their anonymous ftp locations (e.g.\& .Nm .Li ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/shells/bash-1.14.7.tgz ) . Note: If you wish to use .Bf -emphasis passive mode .Ef ftp in such transfers, set the variable .Bf -emphasis FTP_PASSIVE_MODE .Ef to some value in your environment. Otherwise, the more standard ACTIVE mode may be used. If .Nm consistently fails to fetch a package from a site known to work, it may be because you have a firewall that demands the usage of .Bf -emphasis passive mode .Ef ftp. .Sh TECHNICAL DETAILS The .Nm utility extracts each package's "packing list" into a special staging directory in /tmp (or $PKG_TMPDIR if set), parses it, and then runs through the following sequence to fully extract the contents of the package: .Bl -enum .It A check is made to determine if the package is already recorded as installed. If it is, installation is terminated. .It A check is made to determine if the package conflicts (from .Cm @conflicts directives, see .Xr pkg_create 1 ) with an already-installed package. If it is, installation is terminated. .It Scan all the package dependencies (from .Cm @pkgdep directives, see .Xr pkg_create 1 ) are read from the packing list. If any of these required packages is not currently installed, an attempt is made to find and install it; if the missing package cannot be found or installed, the installation is terminated. .It Search for any .Cm @option directives which control how the package is added to the system. At the time of this writing, the only currently implemented option is .Cm @option extract-in-place which will cause the package to be extracted directly into its prefix directory without moving through a staging area in .Pa /tmp . .It If .Cm @option extract-in-place is enabled, the package is now extracted directly into its final location, otherwise it is extracted into the staging area. .It If the package contains a .Ar require file (see .Xr pkg_create 1 ) , then execute it with the following arguments: .Bd -ragged -offset indent -compact .Ar pkg-name .Ar INSTALL .Ed where .Ar pkg-name is the name of the package in question and the .Ar INSTALL keyword denotes this as an installation requirements check (useful if you want to have one script serving multiple functions). .It If a .Ar pre-install script exists for the package, it is then executed with the following arguments: .Bd -ragged -offset indent -compact .Cm script .Ar pkg-name .Ar PRE-INSTALL .Ed .Pp where .Ar pkg-name is the name of the package in question and .Ar PRE-INSTALL is a keyword denoting this as the preinstallation phase. .Pp .Sy Note : The .Ar PRE-INSTALL keyword will not appear if separate scripts for pre-install and post-install are given during package creation time (using the .Fl i and .Fl I flags to .Xr pkg_create 1 ) . .It If .Cm @option extract-in-place is not used, then the packing list (this is the .Pa +CONTENTS file) is now used as a guide for moving (or copying, as necessary) files from the staging area into their final locations. .It If the package contains an .Ar mtreefile file (see .Xr pkg_create 1 ) , then mtree is invoked as: .Bd -ragged -offset indent -compact .Cm mtree .Fl u .Fl f .Ar mtreefile .Fl d .Fl e .Fl p .Pa prefix .Ed where .Pa prefix is either the prefix specified with the .Fl p flag or, if no .Fl p flag was specified, the name of the first directory named by a .Cm @cwd directive within this package. .It If a .Ar post-install script exists for the package, it is then executed as .Bd -ragged -offset indent -compact .Cm script .Ar pkg-name .Ar POST-INSTALL .Ed where .Ar pkg-name is the name of the package in question and .Ar POST-INSTALL is a keyword denoting this as the post-installation phase. .Pp .Sy Note : The .Ar POST-INSTALL keyword will not appear if separate scripts for pre-install and post-install are given during package creation time (using the .Fl i and .Fl I flags to .Xr pkg_create 1 ) . .Pp Reasoning behind passing keywords such as .Ar POST-INSTALL and .Ar PRE-INSTALL is that this allows you to write a single .Ar install script that does both .Dq before and after actions. But, separating the functionality is more advantageous and easier from a maintenance viewpoint. .It After installation is complete, a copy of the packing list, .Ar deinstall script, description, and display files are copied into .Pa /var/db/pkg/<pkg-name> for subsequent possible use by .Xr pkg_delete 1 . Any package dependencies are recorded in the other packages' .Pa /var/db/pkg/<other-pkg>/+REQUIRED_BY file (if the environment variable PKG_DBDIR is set, this overrides the .Pa /var/db/pkg/ path shown above). .It Finally, the staging area is deleted and the program terminates. .El .Pp All the scripts are called with the environment variable .Ev PKG_PREFIX set to the installation prefix (see the .Fl p option above). This allows a package author to write a script that reliably performs some action on the directory where the package is installed, even if the user might change it with the .Fl p flag to .Cm pkg_add . .Sh ENVIRONMENT The value of the .Ev PKG_PATH is used if a given package can't be found. The environment variable should be a series of entries separated by colons. Each entry consists of a directory name. The current directory may be indicated implicitly by an empty directory name, or explicitly by a single period. .Pp The environment variable .Ev PKG_DBDIR specifies an alternative location for the installed package database, default location is .Pa /var/db/pkg . .Pp The environment variables .Ev PKG_TMPDIR and .Ev TMPDIR , in that order, are taken to name temporary directories where .Nm will attempt to create its staging area in. If these variables are not present or if the directories named lack sufficient space, then .Nm will use the first of .Pa /var/tmp , .Pa /tmp or .Pa /usr/tmp with sufficient space. .Pp The environment variable .Ev PACKAGEROOT specifies an alternate location for .Nm to fetch from. The fetch URL is built using this environment variable and the automatic directory logic that .Nm uses when the .Fl r option is invoked. An example setting would be .Qq Li ftp://ftp3.FreeBSD.org . .Pp The environment variable .Ev PACKAGESITE specifies an alternate location for .Nm to fetch from. This variable subverts the automatic directory logic that .Nm uses when the .Fl r option is invoked. Thus it should be a complete URL to the remote package file(s). .Sh FILES .Bl -tag -width /var/db/pkg -compact .It Pa /var/tmp Temporary directory for creating the staging area, if environmental variables .Ev PKG_TMPDIR or .Ev TMPDIR do not point to a suitable directory. .It Pa /tmp Next choice if .Pa /var/tmp does not exist or has insufficient space. .It Pa /usr/tmp Last choice if .Pa /var/tmp and .Pa /tmp are not suitable for creating the staging area. .It Pa /var/db/pkg Default location of the installed package database. .El .Sh SEE ALSO .Xr pkg_create 1 , .Xr pkg_delete 1 , .Xr pkg_info 1 , .Xr pkg_update 1 , .Xr pkg_version 1 , .Xr mktemp 3 , .Xr sysconf 3 , .Xr mtree 8 .Sh AUTHORS .An Jordan Hubbard .Sh CONTRIBUTORS .An John Kohl Aq jt...@ra... .Sh BUGS Hard links between files in a distribution are only preserved if either (1) the staging area is on the same file system as the target directory of all the links to the file, or (2) all the links to the file are bracketed by .Cm @cwd directives in the contents file, .Em and the link names are extracted with a single .Cm tar command (not split between invocations due to exec argument-space limitations--this depends on the value returned by .Fn sysconf _SC_ARG_MAX ) . .Pp Sure to be others. 1.2 +4 -4 freepkg/create/Makefile Index: Makefile =================================================================== RCS file: /cvsroot/fpkg/freepkg/create/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 26 Apr 2004 00:06:27 -0000 1.1 +++ Makefile 29 Apr 2004 13:25:28 -0000 1.2 @@ -1,13 +1,13 @@ -# $Id: Makefile,v 1.1 2004/04/26 00:06:27 jlea Exp $ +# $Id: Makefile,v 1.2 2004/04/29 13:25:28 jlea Exp $ -PROG= pkg_create +PROG= fpkg_create SRCS= main.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib WARNS?= 2 -DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} -LDADD= ${LIBINSTALL} -lfetch -lmd +DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD} +LDADD= ${LIBFPKG} -lfetch -lmd .include <bsd.prog.mk> 1.2 +27 -14 freepkg/create/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/create/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.c 26 Apr 2004 00:06:32 -0000 1.1 +++ main.c 29 Apr 2004 13:25:28 -0000 1.2 @@ -1,17 +1,34 @@ -#ifndef lint -static const char rcsid[] = - "$Id: main.c,v 1.1 2004/04/26 00:06:32 jlea Exp $"; -#endif - /* - * FreeBSD install - a package for the installation and maintainance - * of non-core utilities. + * FreePKG - A utility for managing 3rd party software. * - * Jordan K. Hubbard - * 18 July 1993 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * This is the create module. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Jeremy D. Lea + * 22 April 2004. + * + * Based on pkg_install, by: + * Jordan K. Hubbard + * 18 July 1993 * + * This is the create module. */ #include <sys/param.h> @@ -116,15 +133,11 @@ case 'L': if ((cp = strchr(optarg, ':')) != NULL) *cp++ = '\0'; - else - cp = NULL; add_depend_entry(&pi.dl, DEPEND_LIB, optarg, cp); break; case 'R': if ((cp = strchr(optarg, ':')) != NULL) *cp++ = '\0'; - else - cp = NULL; add_depend_entry(&pi.dl, DEPEND_RUN, optarg, cp); break; case '?': 1.1 freepkg/create/fpkg_create.1 .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" Jordan K. Hubbard .\" .\" .\" @(#)pkg_create.1 .\" $FreeBSD: src/usr.sbin/pkg_install/create/pkg_create.1,v 1.35.2.18 2003/09/03 08:23:56 roam Exp $ .\" .\" hacked up by John Kohl for NetBSD--fixed a few bugs, extended keywords, .\" added dependency tracking, etc. .\" .\" [jkh] Took John's changes back and made some additional extensions for .\" better integration with FreeBSD's new ports collection. .\" .Dd April 21, 1995 .Dt PKG_CREATE 1 .Os .Sh NAME .Nm pkg_create .Nd a utility for creating software package distributions .Sh SYNOPSIS .Nm .Op Fl YNOhjvyz .Op Fl C Ar conflicts .Op Fl P Ar pkgs .Op Fl p Ar prefix .Op Fl f Ar contents .Op Fl i Ar iscript .Op Fl I Ar piscript .Op Fl k Ar dscript .Op Fl K Ar pdscript .Op Fl r Ar rscript .Op Fl s Ar srcdir .Op Fl t Ar template .Op Fl X Ar excludefile .Op Fl D Ar displayfile .Op Fl m Ar mtreefile .Op Fl o Ar originpath .Fl c Ar comment .Fl d Ar description .Fl f Ar packlist .Ar pkg-filename .Nm .Op Fl YNhvy .Fl b Ar pkg-name .Op Ar pkg-filename .Sh DESCRIPTION The .Nm command is used to create packages that will subsequently be fed to one of the package extraction/info utilities. The input description and command line arguments for the creation of a package are not really meant to be human-generated, though it is easy enough to do so. It is more expected that you will use a front-end tool for the job rather than muddling through it yourself. Nonetheless, a short description of the input syntax is included in this document. .Sh OPTIONS The following command line options are supported: .Bl -tag -width indent .It Fl f Ar packinglist Fetch .Dq packing list for package from the file .Ar packinglist or .Cm stdin if .Ar packinglist is a .Cm - (dash). .It Fl c Xo .Oo Fl Oc Ns Ar desc .Xc Fetch package .Dq one line description from file .Ar desc or, if preceded by .Cm - , the argument itself. This string should also give some idea of which version of the product (if any) the package represents. .It Fl d Xo .Oo Fl Oc Ns Ar desc .Xc Fetch long description for package from file .Ar desc or, if preceded by .Cm - , the argument itself. .It Fl Y Assume a default answer of `Yes' for any questions asked. .It Fl N Assume a default answer of `No' for any questions asked. .It Fl O Go into a `packing list Only' mode. This is a custom hack for the .Fx .Em "Ports Collection" and is used to do `fake pkg_add' operations when a port is installed. In such cases, it is necessary to know what the final, adjusted packing list will look like. .It Fl v Turn on verbose output. .It Fl h Force tar to follow symbolic links, so that the files they point to are dumped, rather than the links themselves. .It Fl i Ar iscript Set .Ar iscript to be the pre-install procedure for the package. This can be any executable program (or shell script). It will be invoked automatically when the package is later installed. It will be passed the package's name as the first argument. .Pp .Sy Note : if the .Fl I option is not given, this script will serve as both the pre-install and the post-install script for the package, differentiating between the functionality by passing the keywords .Ar PRE-INSTALL and .Ar POST-INSTALL respectively, after the package's name. .It Fl I Ar piscript Set .Ar piscript to be the post-install procedure for the package. This can be any executable program (or shell script). It will be invoked automatically when the package is later installed. It will be passed the package's name as the first argument. .It Fl C Ar conflicts Set the initial package conflict list to .Ar conflicts . This is assumed to be a whitespace separated list of package names and is meant as a convenient shorthand for specifying multiple .Cm @conflicts directives in the packing list (see PACKING LIST DETAILS section below). .It Fl P Ar pkgs Set the initial package dependency list to .Ar pkgs . This is assumed to be a whitespace separated list of package names and is meant as a convenient shorthand for specifying multiple .Cm @pkgdep directives in the packing list (see .Sx "PACKING LIST DETAILS" section below). Each argument from the .Ar pkgs list could be in the form .Ar pkgname Ns Op : Ns Ar pkgorigin , where optional .Ar pkgorigin element denotes origin of each dependency from the list and it is recorded into the packing list along with the .Ar pkgname using .Cm @comment directive. .It Fl p Ar prefix Set .Ar prefix as the initial directory .Dq base to start from in selecting files for the package. .It Fl k Ar dscript Set .Ar dscript to be the de-install procedure for the package. This can be any executable program (or shell script). It will be invoked automatically when the package is later (if ever) de-installed. It will be passed the package's name as the first argument. .Pp .Sy Note : if the .Fl K option is not given, this script will serve as both the de-install and the post-deinstall script for the package, differentiating between the functionality by passing the keywords .Ar DEINSTALL and .Ar POST-DEINSTALL respectively, along with the package's name. .It Fl K Ar pdscript Set .Ar pdscript to be the post-deinstall procedure for the package. This can be any executable program (or shell script). It will be invoked automatically when the package is later de-installed. It will be passed the package's name as the first argument. .It Fl r Ar rscript Set .Ar rscript to be the .Dq requirements procedure for the package. This can be any executable program (or shell script). It will be invoked automatically at installation/deinstallation time to determine whether or not installation/deinstallation should proceed. To differentiate between installation and deinstallation, the keywords .Ar INSTALL and .Ar DEINSTALL are passed respectively, along with the package's name. .It Fl s Ar srcdir .Ar srcdir will override the value of .Cm @cwd during package creation. .It Fl t Ar template Use .Ar template as the input to .Xr mktemp 3 . By default, this is the string .Pa /tmp/instmp.XXXXXX , but it may be necessary to override it in the situation where space in your .Pa /tmp directory is limited. Be sure to leave some number of `X' characters for .Xr mktemp 3 to fill in with a unique ID. .It Fl X Ar excludefile Pass .Ar excludefile as a .Fl exclude-from argument to .Cm tar when creating final package. See .Cm tar man page (or run .Cm tar with .Fl -help flag) for further information on using this flag. .It Fl D Ar displayfile Display the file (by concatenating it to stdout) after installing the package. Useful for things like legal notices on almost-free software, etc. .It Fl m Ar mtreefile Run .Xr mtree 8 with input from mtreefile before the package is installed. Mtree is invoked as .Cm mtree .Fl u .Fl f .Ar mtreefile .Fl d .Fl e .Fl p .Pa prefix , where .Pa prefix is the name of the first directory named by a .Cm @cwd directive. .It Fl o Ar originpath Record an .Ar originpath , as location of the port from which package has been created in the .Fx .Em "Ports Collection" . It should be in the form .Pa MASTERCATEGORY/PORTDIR . .It Fl j Use .Xr bzip2 1 utility to compress package tarball instead of .Xr gzip 1 . Please note that this option is a NO-OP if the format of the resulting archive is explicitly specified by the recognizable suffix of .Ar pkg-filename . Currently .Nm recognizes the following suffixes: .Pa .tbz , .tgz and .Pa .tar . .It Fl y Compatibility synonym for .Fl j . .It Fl z Use .Xr gzip 1 utility to compress package tarball. .It Fl b Ar pkg-name Create package file from a locally installed package named .Ar pkg-name . If the .Ar pkg-filename is not specified, then resulting archive will be created in the current directory and named .Ar pkg-name with an appropriate extraction suffix applied. .El .Sh PACKING LIST DETAILS The .Dq packing list format (see .Fl f ) is fairly simple, being nothing more than a single column of filenames to include in the package. However, since absolute pathnames are generally a bad idea for a package that could be installed potentially anywhere, there is another method of specifying where things are supposed to go and, optionally, what ownership and mode information they should be installed with. This is done by embedding specialized command sequences in the packing list. Briefly described, these sequences are: .Bl -tag -width indent -compact .It Cm @cwd Ar directory Set the internal directory pointer to point to .Ar directory . All subsequent filenames will be assumed relative to this directory. Note: .Cm @cd is also an alias for this command. .It Cm @srcdir Ar directory Set the internal directory pointer for _creation only_ to .Ar directory . That is to say that it overrides .Cm @cwd for package creation but not extraction. .It Cm @exec Ar command Execute .Ar command as part of the unpacking process. If .Ar command contains any of the following sequences somewhere in it, they will be expanded inline. For the following examples, assume that .Cm @cwd is set to .Pa /usr/local and the last extracted file was .Pa bin/emacs . .Bl -tag -width indent -compact .It Cm "%F" Expands to the last filename extracted (as specified), in the example case .Pa bin/emacs .It Cm "\&%D" Expand to the current directory prefix, as set with .Cm @cwd , in the example case .Pa /usr/local . .It Cm "\&%B" Expand to the .Dq basename of the fully qualified filename, that is the current directory prefix, plus the last filespec, minus the trailing filename. In the example case, that would be .Pa /usr/local/bin . .It Cm "%f" Expand to the filename part of the fully qualified name, or the converse of .Cm \&%B , being in the example case, .Pa emacs . .El .It Cm @unexec Ar command Execute .Ar command as part of the deinstallation process. Expansion of special .Cm % sequences is the same as for .Cm @exec . This command is not executed during the package add, as .Cm @exec is, but rather when the package is deleted. This is useful for deleting links and other ancillary files that were created as a result of adding the package, but not directly known to the package's table of contents (and hence not automatically removable). The advantage of using .Cm @unexec over a deinstallation script is that you can use the .Dq special sequence expansion to get at files regardless of where they've been potentially redirected (see .Fl p ) . .It Cm @mode Ar mode Set default permission for all subsequently extracted files to .Ar mode . Format is the same as that used by the .Cm chmod command (well, considering that it's later handed off to it, that's no surprise). Use without an arg to set back to default (extraction) permissions. .It Cm @option Ar option Set internal package options, the only two currently supported ones being .Ar extract-in-place , which tells the pkg_add command not to extract the package's tarball into a staging area but rather directly into the target hierarchy (this is typically meant to be used only by distributions or other special package types), and .Ar preserve , which tells pkg_add to move any existing files out of the way, preserving the previous contents (which are also resurrected on pkg_delete, so caveat emptor). .It Cm @owner Ar user Set default ownership for all subsequently extracted files to .Ar user . Use without an arg to set back to default (extraction) ownership. .It Cm @group Ar group Set default group ownership for all subsequently extracted files to .Ar group . Use without an arg to set back to default (extraction) group ownership. .It Cm @comment Ar string Imbed a comment in the packing list. Useful in trying to document some particularly hairy sequence that may trip someone up later. .It Cm @ignore Used internally to tell extraction to ignore the next file (don't copy it anywhere), as it's used for some special purpose. .It Cm @ignore_inst Similar to .Cm @ignore , but the ignoring of the next file is delayed one evaluation cycle. This makes it possible to use this directive in the .Ar packinglist file, so you can pack a specialized datafile in with a distribution for your install script (or something) yet have the installer ignore it. .It Cm @name Ar name Set the name of the package. This is mandatory and is usually put at the top. This name is potentially different from the name of the file it came in, and is used when keeping track of the package for later deinstallation. Note that .Nm will derive this field from the package name and add it automatically if none is given. .It Cm @dirrm Ar name Declare directory .Pa name to be deleted at deinstall time. By default, directories created by a package installation are not deleted when the package is deinstalled; this provides an explicit directory cleanup method. This directive should appear at the end of the package list. If more than one .Cm @dirrm directives are used, the directories are removed in the order specified. The .Pa name directory will not be removed unless it is empty. .It Cm @mtree Ar name Declare .Pa name as an .Xr mtree 8 input file to be used at install time (see .Fl m above). Only the first .Cm @mtree directive is honored. .It Cm @display Ar name Declare .Pa name as the file to be displayed at install time (see .Fl D above). .It Cm @pkgdep Ar pkgname Declare a dependency on the .Ar pkgname package. The .Ar pkgname package must be installed before this package may be installed, and this package must be deinstalled before the .Ar pkgname package is deinstalled. Multiple .Cm @pkgdep directives may be used if the package depends on multiple other packages. .It Cm @conflicts Ar pkgcflname Declare a conflict with the .Ar pkgcflname package, as the two packages contain references to the same files, and so cannot co-exist on the same system. .El .Sh ENVIRONMENT The environment variable .Ev PKG_TMPDIR names the directory where .Nm will attempt to create its temporary files. If .Ev PKG_TMPDIR is not set, the directory named by the contents of .Ev TMPDIR will be used. If neither of .Ev PKG_TMPDIR and .Ev TMPDIR are set, the builtin defaults are used. .Sh FILES .Bl -tag -width /usr/tmp -compact .It Pa /var/tmp Temporary directory if environmental variables .Ev PKG_TMPDIR and .Ev TMPDIR are not set. .It Pa /tmp The next choice if .Pa /var/tmp does not exist. .It Pa /usr/tmp The last choice if .Pa /tmp is unsuitable. .El .Sh SEE ALSO .Xr pkg_add 1 , .Xr pkg_delete 1 , .Xr pkg_info 1 , .Xr pkg_update 1 , .Xr pkg_version 1 , .Xr sysconf 3 .Sh HISTORY The .Nm command first appeared in .Fx . .Sh AUTHORS .An Jordan Hubbard .Sh CONTRIBUTORS .An John Kohl Aq jt...@ra... .Sh BUGS Hard links between files in a distribution must be bracketed by .Cm @cwd directives in order to be preserved as hard links when the package is extracted. They additionally must not end up being split between .Cm tar invocations due to exec argument-space limitations (this depends on the value returned by .Fn sysconf _SC_ARG_MAX ) . .Pp Sure to be others. 1.2 +4 -4 freepkg/delete/Makefile Index: Makefile =================================================================== RCS file: /cvsroot/fpkg/freepkg/delete/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 26 Apr 2004 00:05:14 -0000 1.1 +++ Makefile 29 Apr 2004 13:25:29 -0000 1.2 @@ -1,13 +1,13 @@ -# $Id: Makefile,v 1.1 2004/04/26 00:05:14 jlea Exp $ +# $Id: Makefile,v 1.2 2004/04/29 13:25:29 jlea Exp $ -PROG= pkg_delete +PROG= fpkg_delete SRCS= main.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib WARNS?= 2 -DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} -LDADD= ${LIBINSTALL} -lfetch -lmd +DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD} +LDADD= ${LIBFPKG} -lfetch -lmd .include <bsd.prog.mk> 1.2 +26 -14 freepkg/delete/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/delete/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.c 26 Apr 2004 00:05:14 -0000 1.1 +++ main.c 29 Apr 2004 13:25:29 -0000 1.2 @@ -1,29 +1,41 @@ -#ifndef lint -static const char rcsid[] = - "$Id: main.c,v 1.1 2004/04/26 00:05:14 jlea Exp $"; -#endif - /* - * - * FreeBSD install - a package for the installation and maintainance - * of non-core utilities. + * FreePKG - A utility for managing 3rd party software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * Jordan K. Hubbard - * 18 July 1993 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * This is the delete module. + * Jeremy D. Lea + * 22 April 2004. * + * Based on pkg_install, by: + * Jordan K. Hubbard + * 18 July 1993 + * + * This is the delete module. */ +#ifndef lint +static const char rcsid[] = + "$Id: main.c,v 1.2 2004/04/29 13:25:29 jlea Exp $"; +#endif + #include <sys/types.h> #include <sys/stat.h> #include <err.h> 1.1 freepkg/delete/fpkg_delete.1 .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" Jordan K. Hubbard .\" .\" .\" @(#)pkg_delete.1 .\" $FreeBSD: src/usr.sbin/pkg_install/delete/pkg_delete.1,v 1.16.2.9 2002/06/21 16:42:18 charnier Exp $ .\" .Dd November 25, 1994 .Dt PKG_DELETE 1 .Os .Sh NAME .Nm pkg_delete .Nd a utility for deleting previously installed software package distributions .Sh SYNOPSIS .Nm .Op Fl dDfGinrvx .Op Fl p Ar prefix .Ar pkg-name ... .Nm .Fl a .Op Ar flags .Sh DESCRIPTION The .Nm command is used to delete packages that have been previously installed with the .Xr pkg_add 1 command. .Sh WARNING .Bf -emphasis Since the .Nm command may execute scripts or programs provided by a package file, your system may be susceptible to .Dq Em trojan horses or other subtle attacks from miscreants who create dangerous package files. .Pp You are advised to verify the competence and identity of those who provide installable package files. For extra protection, examine all the package control files in the package record directory .Pa ( /var/db/pkg/<pkg-name>/ ) . Pay particular attention to any +INSTALL, +POST-INSTALL, +DEINSTALL, +POST-DEINSTALL, +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS file for .Cm @cwd , .Cm @mode (check for setuid), .Cm @dirrm , .Cm @exec , and .Cm @unexec directives, and/or use the .Xr pkg_info 1 command to examine the installed package control files. .Ef .Sh OPTIONS The following command line options are supported: .Bl -tag -width indent .It Ar pkg-name ... The named packages are deinstalled. .It Fl a Unconditionally delete all currently installed packages. .It Fl i Request confirmation before attempting to delete each package, regardless whether or not the standard input device is a terminal. .It Fl v Turn on verbose output. .It Fl D If a deinstallation script exists for a given package, do not execute it. .It Fl n Don't actually deinstall a package, just report the steps that would be taken if it were. .It Fl p Ar prefix Set .Ar prefix as the directory in which to delete files from any installed packages which do not explicitly set theirs. For most packages, the prefix will be set automatically to the installed location by .Xr pkg_add 1 . .It Fl d Remove empty directories created by file cleanup. By default, only files/directories explicitly listed in a package's contents (either as normal files/directories or with the .Cm @dirrm directive) will be removed at deinstallation time. This option tells .Nm to also remove any directories that were emptied as a result of removing the package. .It Fl f Force removal of the package, even if a dependency is recorded or the deinstall or require script fails. .It Fl G Do not try to expand shell glob patterns in the .Ar pkg-name when selecting packages to be deleted (by default .Nm automatically expands shell glob patterns in the .Ar pkg-name ) . .It Fl x Treat the .Ar pkg-name as a regular expression and delete all packages whose names match that regular expression. Multiple regular expressions could be provided, in that case .Nm deletes all packages that match at least one regular expression from the list. .It Fl r Recursive removal. In addition to specified packages, delete all packages that depend on those packages as well. .El .Sh TECHNICAL DETAILS The .Nm utility does pretty much what it says. It examines installed package records in .Pa /var/db/pkg/<pkg-name> , deletes the package contents, and finally removes the package records. If the environment variable .Ev PKG_DBDIR is set, this overrides the .Pa /var/db/pkg/ path shown above. .Pp If a package is required by other installed packages, .Nm will list those dependent packages and refuse to delete the package (unless the .Fl f option is given). .Pp If the package contains a .Ar require file (see .Xr pkg_create 1 ) , then this is executed first as .Bd -ragged -offset indent -compact .Cm require .Ar <pkg-name> .Ar DEINSTALL .Ed (where .Ar pkg-name is the name of the package in question and .Ar DEINSTALL is a keyword denoting that this is a deinstallation) to see whether or not deinstallation should continue. A non-zero exit status means no, unless the .Fl f option is specified. .Pp If a .Cm deinstall script exists for the package, it is executed before any files are removed. It is this script's responsibility to clean up any additional messy details around the package's installation, since all .Nm knows how to do is delete the files created in the original distribution. The .Nm deinstall script is called as: .Bd -ragged -offset indent -compact .Cm script .Ar <pkg-name> .Ar DEINSTALL .Ed where .Ar pkg-name is the name of the package in question and .Ar DEINSTALL is a keyword denoting this as the pre-deinstallation phase. .Pp .Sy Note : The .Ar DEINSTALL keyword will not appear if separate scripts for deinstall and post-deinstall are given during package creation time (using the .Fl k and .Fl K flags to .Xr pkg_create 1 ) . .Pp If a .Cm post-deinstall script exists for the package, it is executed .Cm after all files are removed. It is this script's responsibility to clean up any additional messy details around the package's installation, and leave the system (hopefully) in the same state that it was prior to the installation of the package. .Pp The .Nm post-deinstall script is called as: .Bd -ragged -offset indent -compact .Cm script .Ar <pkg-name> .Ar POST-DEINSTALL .Ed where .Ar pkg-name is the name of the package in question and .Ar POST-DEINSTALL is a keyword denoting this as the post-deinstallation phase. .Pp .Sy Note : The .Ar POST-DEINSTALL keyword will not appear if separate scripts for deinstall and post-deinstall are given during package creation time (using the .Fl k and .Fl K flags to .Xr pkg_create 1 ) . .Pp Reasoning behind passing keywords such as .Ar DEINSTALL and .Ar POST-DEINSTALL is that it lets you potentially write only one program/script that handles all aspects of installation and deletion. .Pp But experience has proved that this is a lot more difficult to maintain and is not as advantageous as having separate scripts that handle each aspect of installation and deinstallation. .Pp All scripts are called with the environment variable .Ev PKG_PREFIX set to the installation prefix (see the .Fl p option above). This allows a package author to write a script that reliably performs some action on the directory where the package is installed, even if the user might have changed it by specifying the .Fl p option when running .Nm or .Cm pkg_add . .Sh ENVIRONMENT The environment variable .Ev PKG_DBDIR specifies an alternative location for the installed package database. .Sh FILES .Bl -tag -width /var/db/pkg -compact .It Pa /var/db/pkg Default location of the installed package database. .El .Sh SEE ALSO .Xr pkg_add 1 , .Xr pkg_create 1 , .Xr pkg_info 1 , .Xr pkg_version 1 , .Xr mktemp 3 , .Xr mtree 8 .Sh AUTHORS .An Jordan Hubbard .Sh CONTRIBUTORS .An John Kohl Aq jt...@ra... .Sh BUGS Sure to be some. 1.2 +3 -3 freepkg/fpkg/Makefile Index: Makefile =================================================================== RCS file: /cvsroot/fpkg/freepkg/fpkg/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 26 Apr 2004 00:05:14 -0000 1.1 +++ Makefile 29 Apr 2004 13:25:30 -0000 1.2 @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 2004/04/26 00:05:14 jlea Exp $ +# $Id: Makefile,v 1.2 2004/04/29 13:25:30 jlea Exp $ PROG= fpkg SRCS= main.c @@ -7,7 +7,7 @@ WARNS?= 2 -DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} -LDADD= ${LIBINSTALL} -lfetch -lmd +DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD} +LDADD= ${LIBFPKG} -lfetch -lmd .include <bsd.prog.mk> 1.2 +111 -20 freepkg/fpkg/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/fpkg/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.c 26 Apr 2004 00:05:19 -0000 1.1 +++ main.c 29 Apr 2004 13:25:30 -0000 1.2 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$Id: main.c,v 1.1 2004/04/26 00:05:19 jlea Exp $"); +__FBSDID("$Id: main.c,v 1.2 2004/04/29 13:25:30 jlea Exp $"); #include <sys/param.h> #include <sys/file.h> @@ -55,32 +55,34 @@ main(int argc, char **argv) { int ch, err = 0; - boolean all = FALSE, origin = FALSE; + boolean all = FALSE, origin = FALSE, quiet = FALSE; + unsigned int flags = PKG_SHOW_NONE; char *cp; match_list ml = { PLIST_HEAD_INITIALIZER }; which_list wl = { PLIST_HEAD_INITIALIZER }; which_entry *w; - enum { - DELETE, - VERSION, - WHICH - } mode; + enum { DELETE, INFO, VERSION, WHICH } mode; signal(SIGINT, cleanup); signal(SIGHUP, cleanup); + pkg_mgr_init(); if (argc == 2 && !strcmp(argv[1], "-V")) { printf("%s (%s-%s)\n",PKG_INSTALL_VERSION,MIN_PKG_FORMAT,PKG_FORMAT); return 0; } + /* XXX: (jlea) Ooops, conflict... */ if (argc == 4 && !strcmp(argv[1], "-t")) { err = version_cmp(argv[2], argv[3]); printf(err > 0 ? ">\n" : (err < 0 ? "<\n" : "=\n")); return 0; } - - pkg_mgr_init(); - while ((ch = getopt(argc, argv, "afhinop:tv")) != -1) { + if (argc == 3 && !strcmp(argv[1], "-e")) { + pkg_mgr_start(); + return (pkg_mgr_check(optarg) ? 0 : 1); + } + + while ((ch = getopt(argc, argv, "afhinop:qt:v")) != -1) { switch (ch) { case 'a': all = TRUE; @@ -101,10 +103,15 @@ case 'p': strlcpy(PkgMgr.prefix_override, optarg, PATH_MAX); break; + case 'q': + quiet = TRUE; + break; case 'v': PkgMgr.verbose = TRUE; break; case 't': + strlcpy(PkgMgr.mktmp_template, optarg, PATH_MAX); + break; case 'h': default: usage(); @@ -119,13 +126,17 @@ /* Process our command */ /* XXX: (jlea) Add abbrev. */ - if (!strcmp(*argv, "delete")) + if (!strcmp(*argv, "delete")) { mode = DELETE; - else if (!strcmp(*argv, "version")) + } else if (!strcmp(*argv, "info")) { + mode = INFO; + if (!quiet) + PkgMgr.verbose = TRUE; + } else if (!strcmp(*argv, "version")) { mode = VERSION; - else if (!strcmp(*argv, "which")) + } else if (!strcmp(*argv, "which")) { mode = WHICH; - else + } else usage(); switch(mode) { @@ -147,6 +158,74 @@ argv += optind; break; + case INFO: + while ((ch = getopt(argc, argv, "cdDfgiIkl:LmoprRsv")) != -1) { + switch (ch) { + case 'c': + flags |= PKG_SHOW_COMMENT; + break; + case 'd': + flags |= PKG_SHOW_DESC; + break; + case 'D': + flags |= PKG_SHOW_DISPLAY; + break; + case 'f': + flags |= PKG_SHOW_PLIST; + break; + case 'g': + flags |= PKG_SHOW_CHKSUM; + break; + case 'i': + flags |= PKG_SHOW_INSTALL; + break; + case 'I': + flags |= PKG_SHOW_INDEX; + break; + case 'k': + flags |= PKG_SHOW_DEINSTALL; + break; + case 'l': + PkgMgr.infoprefix = optarg; + break; + case 'L': + flags |= PKG_SHOW_FILES; + break; + case 'm': + flags |= PKG_SHOW_MTREE; + break; + case 'o': + flags |= PKG_SHOW_ORIGIN; + break; + case 'p': + flags |= PKG_SHOW_PREFIX; + break; + case 'r': + flags |= PKG_SHOW_REQUIRE; + break; + case 'R': + flags |= PKG_SHOW_REQBY; + break; + case 's': + flags |= PKG_SHOW_SIZE; + break; + case 'v': + /* Reasonable definition of 'everything' */ + flags = PKG_SHOW_COMMENT | PKG_SHOW_DESC | + PKG_SHOW_PLIST | PKG_SHOW_INSTALL | + PKG_SHOW_DEINSTALL | PKG_SHOW_REQUIRE | + PKG_SHOW_DISPLAY | PKG_SHOW_MTREE; + break; + default: + usage(); + break; + } + } + argc -= optind; + argv += optind; + all = (*argv == NULL); + break; + case VERSION: while ((ch = getopt(argc, argv, "I:l:")) != -1) { switch (ch) { @@ -232,13 +311,19 @@ if ((err = pkg_mgr_delete(&ml)) != 0) msg_warn("%d package deletion(s) failed", err); break; + case INFO: + if (!flags) + flags = PKG_SHOW_COMMENT | PKG_SHOW_DESC | PKG_SHOW_REQBY; + if ((err = pkg_mgr_show(&ml, flags)) != 0) + msg_warn("%d package(s) failed", err); + break; case VERSION: if ((err = pkg_mgr_version(&ml)) != 0) msg_warn("%d package(s) failed", err); break; case WHICH: if ((err = pkg_mgr_which(&wl)) != 0) - msg_verbose("%d files not installed by packages", err); + msg_verbose("%d files not installed by packages.\n", err); /* Return 1 if some files where found... */ err = (PLIST_EMPTY(&wl) ? 0 : 1); break; @@ -249,14 +334,20 @@ return err; } + static void usage() { - fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: pkg_admin [-fhnv] [-p prefix] command [options]", - " pkg_admin -t v1 v2", - "commands: delete [-dD] package [package] [...]", - " version [-l mask] -[I index] [packages]"); + fprintf(stderr, +"usage: fpkg [-afhinoqv] [-p prefix] [-t template] command [options]\n" +" fpkg -t v1 v2\n" +" fpkg -e [package]\n" +" fpkg -V\n" +"commands: delete [-dD] [packages]\n" +" info [-l mask] -[I index] [packages]\n" +" version [-l mask] -[I index] [packages]\n" +" which [-F file] -[L lib] [-P plist]\n" + ); exit(1); } 1.2 +4 -4 freepkg/info/Makefile Index: Makefile =================================================================== RCS file: /cvsroot/fpkg/freepkg/info/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 26 Apr 2004 00:06:22 -0000 1.1 +++ Makefile 29 Apr 2004 13:25:30 -0000 1.2 @@ -1,13 +1,13 @@ -# $Id: Makefile,v 1.1 2004/04/26 00:06:22 jlea Exp $ +# $Id: Makefile,v 1.2 2004/04/29 13:25:30 jlea Exp $ -PROG= pkg_info +PROG= fpkg_info SRCS= main.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib WARNS?= 2 -DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} -LDADD= ${LIBINSTALL} -lfetch -lmd +DPADD= ${LIBFPKG} ${LIBFETCH} ${LIBMD} +LDADD= ${LIBFPKG} -lfetch -lmd .include <bsd.prog.mk> 1.2 +22 -10 freepkg/info/main.c Index: main.c =================================================================== RCS file: /cvsroot/fpkg/freepkg/info/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.c 26 Apr 2004 00:06:22 -0000 1.1 +++ main.c 29 Apr 2004 13:25:30 -0000 1.2 @@ -1,22 +1,34 @@ /* - * - * FreeBSD install - a package for the installation and maintainance - * of non-core utilities. + * FreePKG - A utility for managing 3rd party software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * Jordan K. Hubbard - * 18 July 1993 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + ... [truncated message content] |
From: Jeremy L. <jl...@us...> - 2004-04-29 13:05:27
|
jlea 04/04/29 06:05:18 freepkg/version - New directory |
From: Jeremy L. <jl...@us...> - 2004-04-26 09:56:17
|
jlea 04/04/26 02:56:11 Log: Initial import of WWW site Status: Vendor Tag: JLEA Release Tags: v0 N www/htdocs/index.html N www/htdocs/bsd.port.mk-fpkg.patch No conflicts created by this import |
From: Jeremy L. <jl...@us...> - 2004-04-26 00:06:40
|
jlea 04/04/25 17:06:33 Log: Initial import Status: Vendor Tag: JLEA Release Tags: start N freepkg/Makefile N freepkg/Makefile.inc N freepkg/README N freepkg/delete/Makefile N freepkg/delete/main.c N freepkg/delete/pkg_delete.1 N freepkg/fpkg/Makefile N freepkg/fpkg/test-pkg_version.sh N freepkg/fpkg/main.c N freepkg/fpkg/fpkg.1 N freepkg/lib/lib.h N freepkg/lib/match.c N freepkg/lib/depend.c N freepkg/lib/entry.c N freepkg/lib/exec.c N freepkg/lib/file.c N freepkg/lib/filedb.c N freepkg/lib/which.c N freepkg/lib/manager.c N freepkg/lib/list.h N freepkg/lib/str.c N freepkg/lib/msg.c N freepkg/lib/package.c N freepkg/lib/plist.c N freepkg/lib/show.c N freepkg/lib/Makefile N freepkg/info/Makefile N freepkg/info/main.c N freepkg/info/pkg_info.1 N freepkg/add/Makefile N freepkg/add/pkg_add.1 N freepkg/add/main.c N freepkg/create/Makefile N freepkg/create/main.c N freepkg/create/pkg_create.1 No conflicts created by this import |