Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Get the OS Major version we're being compiled under from the __FreeBSD__ or __DragonFly__ macro built into cc. Default to using the ports INDEX as during our compilation, but warn when that does not match the runtime OS major version -- ie. we're in the middle of an OS upgrade.
Matthew Seaman committed 12 years ago
commit 2fbd698d6c29a6587026058a35dbccf9e695461d
parent 859bbf1
2 files changed +12 -4
modified libpkg/pkg.h.in
@@ -4,7 +4,7 @@
 * Copyright (c) 2011 Will Andrews <will@FreeBSD.org>
 * Copyright (c) 2011 Philippe Pepiot <phil@philpep.org>
 * Copyright (c) 2011-2012 Marin Atanasov Nikolov <dnaeon@gmail.com>
-
 * Copyright (c) 2013 Matthew Seaman <matthew@FreeBSD.org>
+
 * Copyright (c) 2013-2104 Matthew Seaman <matthew@FreeBSD.org>
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,15 @@

#define PKG_PORTVERSION "@VERSION@"

+
/* The OS major version at the time of compilation */
+
#ifdef __FreeBSD__
+
#define OSMAJOR	__FreeBSD__
+
#endif
+

+
#ifdef __DragonFly__
+
#define OSMAJOR	__DragonFly__
+
#endif
+

struct pkg;
struct pkg_dep;
struct pkg_conflict;
modified libpkg/pkg_config.c
@@ -1,6 +1,7 @@
/*-
 * Copyright (c) 2011-2014 Baptiste Daroussin <bapt@FreeBSD.org>
 * Copyright (c) 2011-2012 Julien Laffaye <jlaffaye@FreeBSD.org>
+
 * Copyright (c) 2014 Matthew Seaman <matthew@FreeBSD.org>
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
@@ -55,8 +56,7 @@
#define DEFAULT_VULNXML_URL "http://www.vuxml.org/freebsd/vuln.xml.bz2"
#endif

-
#if defined(OSMAJOR)
-
/* Oh ye gods of ANSI C, why is this so flipping arcane? */
+
#ifdef	OSMAJOR
#define STRINGIFY(X)	TEXT(X)
#define TEXT(X)		#X
#define INDEXFILE	"INDEX-" STRINGIFY(OSMAJOR)
@@ -620,7 +620,6 @@ pkg_compiled_for_same_os_major(void)
	osmajor = (int) strtol(u.release, NULL, 10);

	return (osmajor == OSMAJOR);
-

#else
	return (true);		/* Can't tell, so assume yes  */
#endif