diff options
author | sobomax <sobomax@FreeBSD.org> | 2001-10-10 08:21:41 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2001-10-10 08:21:41 +0000 |
commit | 5ef9bb01d5f61e4f52a539ac2ceb0ab6f60cac11 (patch) | |
tree | f9075d260c6d242b36af96fc1bd51e6ead2a7632 /usr.sbin/pkg_install/create | |
parent | 3ecc09960218d1a88e9cd4b7428a640ca3cef599 (diff) | |
download | FreeBSD-src-5ef9bb01d5f61e4f52a539ac2ceb0ab6f60cac11.zip FreeBSD-src-5ef9bb01d5f61e4f52a539ac2ceb0ab6f60cac11.tar.gz |
- Introduce a notion of `packing list format version'. This allows making
non-backward compatible changes in the format of packing list and handle
them gracefully;
- fix a longstanding issue with symlinks handling. Instead of recording
checksum for the file symlink points to, record checksum for the value
returned by readlink(2). For backward compatibility increase packing list
format minor version number and provide a fallback to a previous behaviour,
if package in question was created with older version of pkg_* tools;
Submitted by: Alec Wolman <wolman@cs.washington.edu>, sobomax
- don't record MD5 checksum for device nodes, fifo's and other non-regular
files.
Submitted by: nbm
MFC in: 2 weeks
Diffstat (limited to 'usr.sbin/pkg_install/create')
-rw-r--r-- | usr.sbin/pkg_install/create/perform.c | 7 | ||||
-rw-r--r-- | usr.sbin/pkg_install/create/pl.c | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index cd1f8a5..8265e26 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -163,6 +163,13 @@ pkg_perform(char **pkgs) if (find_plist(&plist, PLIST_NAME) == NULL) add_plist_top(&plist, PLIST_NAME, basename(pkg)); + if (asprintf(&cp, "PKG_FORMAT_REVISION:%d.%d", PLIST_FMT_VER_MAJOR, + PLIST_FMT_VER_MINOR) == -1) { + errx(2, "%s: asprintf() failed", __FUNCTION__); + } + add_plist_top(&plist, PLIST_COMMENT, cp); + free(cp); + /* * We're just here for to dump out a revised plist for the FreeBSD ports * hack. It's not a real create in progress. diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c index 028b49c..a12ce62 100644 --- a/usr.sbin/pkg_install/create/pl.c +++ b/usr.sbin/pkg_install/create/pl.c @@ -50,8 +50,20 @@ check_list(const char *home, Package *pkg) there = p->name; break; case PLIST_FILE: + cp = NULL; sprintf(name, "%s/%s", there ? there : where, p->name); - if ((cp = MD5File(name, buf)) != NULL) { + if (issymlink(name)) { + int len; + char lnk[FILENAME_MAX]; + + if ((len = readlink(name, lnk, FILENAME_MAX)) > 0) + cp = MD5Data((unsigned char *)lnk, len, buf); + } else if (isfile(name)) { + /* Don't record MD5 checksum for device nodes and such */ + cp = MD5File(name, buf); + } + + if (cp != NULL) { PackingList tmp = new_plist_entry(); tmp->name = copy_string(strconcat("MD5:", cp)); |