2005-11-09 16:43:05 -05:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// FILE: package.h
|
|
|
|
// AUTHOR: Johannes Winkelmann, jw@tks6.net
|
|
|
|
// COPYRIGHT: (c) 2002 by Johannes Winkelmann
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _PACKAGE_H_
|
|
|
|
#define _PACKAGE_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
struct PackageData;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class Package
|
|
|
|
\brief representation of a package
|
|
|
|
|
|
|
|
Representation of a package from the crux ports tree
|
|
|
|
*/
|
|
|
|
class Package
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Package( const std::string& name,
|
|
|
|
const std::string& path );
|
|
|
|
|
|
|
|
Package( const std::string& name,
|
|
|
|
const std::string& path,
|
|
|
|
const std::string& version,
|
|
|
|
const std::string& release,
|
|
|
|
const std::string& description,
|
|
|
|
const std::string& dependencies,
|
|
|
|
const std::string& url,
|
2023-03-10 10:03:11 -05:00
|
|
|
const std::string& optionals,
|
2005-11-09 16:43:05 -05:00
|
|
|
const std::string& maintainer,
|
|
|
|
const std::string& hasReadme,
|
|
|
|
const std::string& hasPreInstall,
|
|
|
|
const std::string& hasPostInstall );
|
|
|
|
|
|
|
|
~Package();
|
|
|
|
|
|
|
|
const std::string& name() const;
|
|
|
|
const std::string& path() const;
|
|
|
|
const std::string& version() const;
|
|
|
|
const std::string& release() const;
|
|
|
|
const std::string& description() const;
|
|
|
|
const std::string& dependencies() const;
|
|
|
|
const std::string& url() const;
|
2023-03-10 10:03:11 -05:00
|
|
|
const std::string& optionals() const;
|
2005-11-09 16:43:05 -05:00
|
|
|
const std::string& maintainer() const;
|
2023-06-19 14:44:03 -04:00
|
|
|
bool hasReadme() const;
|
|
|
|
bool hasPreInstall() const;
|
|
|
|
bool hasPostInstall() const;
|
2006-09-03 12:12:55 -04:00
|
|
|
|
|
|
|
std::string versionReleaseString() const;
|
2005-11-09 16:43:05 -05:00
|
|
|
|
|
|
|
void setDependencies( const std::string& dependencies );
|
2023-03-10 10:03:11 -05:00
|
|
|
void setOptionals( const std::string& optionals );
|
2005-11-09 16:43:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
void load() const;
|
2006-09-03 12:12:55 -04:00
|
|
|
|
|
|
|
static void expandShellCommands(std::string& input,
|
2005-11-09 16:43:05 -05:00
|
|
|
const time_t& timeNow,
|
|
|
|
const struct utsname unameBuf);
|
|
|
|
|
|
|
|
mutable PackageData* m_data;
|
|
|
|
mutable bool m_loaded;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PackageData
|
|
|
|
{
|
|
|
|
PackageData( const std::string& name_,
|
|
|
|
const std::string& path_,
|
|
|
|
const std::string& version_="",
|
|
|
|
const std::string& release_="",
|
|
|
|
const std::string& description_="",
|
|
|
|
const std::string& dependencies_="",
|
|
|
|
const std::string& url_="",
|
2023-03-10 10:03:11 -05:00
|
|
|
const std::string& optionals_="",
|
2005-11-09 16:43:05 -05:00
|
|
|
const std::string& maintainer="",
|
|
|
|
const std::string& hasReadme_="",
|
|
|
|
const std::string& hasPreInstall_="",
|
|
|
|
const std::string& hasPostInstall_="");
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
std::string path;
|
|
|
|
std::string version;
|
|
|
|
std::string release;
|
|
|
|
std::string description;
|
|
|
|
std::string depends;
|
|
|
|
std::string url;
|
2023-03-10 10:03:11 -05:00
|
|
|
std::string optionals;
|
2005-11-09 16:43:05 -05:00
|
|
|
std::string maintainer;
|
|
|
|
|
2006-09-03 12:12:55 -04:00
|
|
|
std::string versionReleaseString;
|
|
|
|
|
2005-11-09 16:43:05 -05:00
|
|
|
bool hasReadme;
|
|
|
|
bool hasPreInstall;
|
|
|
|
bool hasPostInstall;
|
2006-09-03 12:12:55 -04:00
|
|
|
|
|
|
|
void generateVersionReleaseString();
|
2005-11-09 16:43:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _PACKAGE_H_ */
|