diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-08-24 13:54:04 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-08-24 13:54:04 +0300 |
commit | 692945f29e2f99baac2378adb542bf131d2ce4f7 (patch) | |
tree | 5e15dac3df553347f41620b0804dc76ba3e8c016 | |
parent | 64a1351844d527f7c9a43afaefc373c2d07b7152 (diff) | |
download | rpm-692945f29e2f99baac2378adb542bf131d2ce4f7.tar.gz rpm-692945f29e2f99baac2378adb542bf131d2ce4f7.tar.bz2 rpm-692945f29e2f99baac2378adb542bf131d2ce4f7.zip |
Eliminate buildHost() and getBuildTime() from librpmbuild API
- Neither is needed anywhere outside pack.c, bury there and make static
-rw-r--r-- | build/names.c | 27 | ||||
-rw-r--r-- | build/pack.c | 29 | ||||
-rw-r--r-- | build/rpmbuild.h | 12 |
3 files changed, 29 insertions, 39 deletions
diff --git a/build/names.c b/build/names.c index aea9acf67..6dd78d485 100644 --- a/build/names.c +++ b/build/names.c @@ -177,30 +177,3 @@ gid_t getGidS(const char *gname) return gids[gid_used++]; } -rpm_time_t * getBuildTime(void) -{ - static rpm_time_t buildTime[1]; - - if (buildTime[0] == 0) - buildTime[0] = (int32_t) time(NULL); - return buildTime; -} - -const char * buildHost(void) -{ - static char hostname[1024]; - static int oneshot = 0; - struct hostent *hbn; - - if (! oneshot) { - (void) gethostname(hostname, sizeof(hostname)); - hbn = gethostbyname(hostname); - if (hbn) - strcpy(hostname, hbn->h_name); - else - rpmlog(RPMLOG_WARNING, - _("Could not canonicalize hostname: %s\n"), hostname); - oneshot = 1; - } - return(hostname); -} diff --git a/build/pack.c b/build/pack.c index a4fcddf38..26d31fbcf 100644 --- a/build/pack.c +++ b/build/pack.c @@ -6,6 +6,8 @@ #include "system.h" #include <errno.h> +#include <netdb.h> +#include <time.h> #include <rpm/rpmlib.h> /* RPMSIGTAG*, rpmReadPackageFile */ #include <rpm/rpmts.h> @@ -147,6 +149,33 @@ exit: return sb; } +static rpm_time_t * getBuildTime(void) +{ + static rpm_time_t buildTime[1]; + + if (buildTime[0] == 0) + buildTime[0] = (int32_t) time(NULL); + return buildTime; +} + +static const char * buildHost(void) +{ + static char hostname[1024]; + static int oneshot = 0; + struct hostent *hbn; + + if (! oneshot) { + (void) gethostname(hostname, sizeof(hostname)); + hbn = gethostbyname(hostname); + if (hbn) + strcpy(hostname, hbn->h_name); + else + rpmlog(RPMLOG_WARNING, + _("Could not canonicalize hostname: %s\n"), hostname); + oneshot = 1; + } + return(hostname); +} /** */ static int addFileToTag(rpmSpec spec, const char * file, Header h, rpmTag tag) diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 62c72c77e..7f020fffd 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -135,18 +135,6 @@ const char * getGnameS(const char * gname); gid_t getGidS(const char * gname); /** \ingroup rpmbuild - * Return build hostname. - * @return build hostname - */ -const char * buildHost(void) ; - -/** \ingroup rpmbuild - * Return build time stamp. - * @return build time stamp - */ -rpm_time_t * getBuildTime(void) ; - -/** \ingroup rpmbuild * Read next line from spec file. * @param spec spec file control structure * @param strip truncate comments? |