Compare commits
2 Commits
487060e496
...
f7be351e22
Author | SHA1 | Date |
---|---|---|
John McQuah | f7be351e22 | |
John McQuah | ffe29e224e |
7
INSTALL
7
INSTALL
|
@ -1,6 +1,7 @@
|
||||||
Installing prt-get
|
Installing prt-get
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Installing prt-get is just a matter of
|
Installing prt-get is just a matter of
|
||||||
./configure
|
meson setup bld --prefix=/usr
|
||||||
make
|
cd bld && meson compile
|
||||||
make install
|
meson install
|
||||||
|
|
|
@ -778,11 +778,14 @@ return many identical lines; these are suppressed by the -3 flag to
|
||||||
\fBcomm(1)\fP.
|
\fBcomm(1)\fP.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B for L in /var/log/pkgmk/*.log; do P=${L%.log}; P=${P##*/}; prt\-get isinst $P >/dev/null || rm $L; done
|
.B for L in /var/log/pkgbuild/*.log; do P=${L%__*}; P=${P##*/}; VR=${L##*__}; VR=${VR%.log}; if ! prt\-get isinst $P >/dev/null; then mv $L /var/log/uninstalled; elif [ \(dq$(prt\-get current $P)\(dq != \(dq$VR\(dq ]; then mv $L /var/log/oldbuild/; fi; done
|
||||||
(based on a feature request by samsep10l) a command you can put into root's
|
(based on a feature request by samsep10l) a command you can put into a script
|
||||||
crontab in order to mimic Slackware's tidy directory listings (logs are only
|
called by root's crontab, in order to mimic Slackware's tidy directory listings
|
||||||
kept for the packages that are actually installed). Modify as needed depending
|
(the main logdir only contains build logs of the latest installed packages;
|
||||||
on the format string and the log directory specified in \fBprt\-get.conf(5)\fP.
|
other logs are moved to a separate directory). This particular command relies
|
||||||
|
on declaring \(dqlogfile /var/log/pkgbuild/%n__%v-%r.log\(dq and \(dqwritelog
|
||||||
|
enabled\(dq in \fBprt\-get.conf(5)\fP. Logs saved with a different filename
|
||||||
|
pattern will require slight adjustments to the command.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B prt\-get printf \(dq%p\et%u\en\(dq | awk '($1 ~ /\e/myrepo$/) { print $2 }'
|
.B prt\-get printf \(dq%p\et%u\en\(dq | awk '($1 ~ /\e/myrepo$/) { print $2 }'
|
||||||
|
|
|
@ -128,13 +128,33 @@ replaced with the port's path, e.g. for port gcc in core, %p would be
|
||||||
and %n would be
|
and %n would be
|
||||||
.B gcc.
|
.B gcc.
|
||||||
This allows you to have separate log files per port.
|
This allows you to have separate log files per port.
|
||||||
|
Separate log files for each version and release can be achieved
|
||||||
|
using the placeholders %v and %r, respectively. But if you want to use the
|
||||||
|
feature of deleting a build log when the package is removed, it is best to
|
||||||
|
avoid %p, %v, and %r when specifying \fBlogfile\fP (as explained below).
|
||||||
|
|
||||||
|
.B rmlog_on_uninst
|
||||||
|
which can be set to 'yes' or 'no'; when set to yes, uninstalling a
|
||||||
|
package will also try to delete its build log. Replacements in the template
|
||||||
|
\fBlogfile\fP will be made using the \fIcurrent values\fP from the database
|
||||||
|
of installed packages, and from the active repositories. If log files exist
|
||||||
|
with different values of %p, %v, or %r than what the database and repositories
|
||||||
|
provide (e.g., you ran \fBpkgmk(8),pkgadd(8)\fP manually and hence updated the
|
||||||
|
database without using \fBprt\-get(8)\fP, or you kept a package installed
|
||||||
|
after it had been dropped from the repositories), then those logs will not be
|
||||||
|
deleted.
|
||||||
|
With a template like \(dq%p/.buildlogs/%n-%v-%r.log\(dq, uninstalling a package
|
||||||
|
after having it on your system through many versions, or after it has been
|
||||||
|
moved from opt to contrib, might leave behind all the build logs except the
|
||||||
|
latest. See the EXAMPLES section of \fBprt\-get(8)\fP for alternative ways to
|
||||||
|
tidy up your directory of build logs.
|
||||||
|
|
||||||
.B readme
|
.B readme
|
||||||
can be set to 'disabled', to suppress the notification after
|
can be set to 'disabled', to suppress the notification after
|
||||||
installing a port with a README file; 'compact', to collect all the READMEs
|
installing a port with a README file; 'compact', to collect all the READMEs
|
||||||
into one post-transaction output; or 'verbose', to print separate
|
into one post-transaction output; or 'verbose', to print separate
|
||||||
information about each port with a README file. See
|
information about each port with a README file. See
|
||||||
.B prt-get(8)
|
.B prt\-get(8)
|
||||||
and especially the readme command how to read those README files using
|
and especially the readme command how to read those README files using
|
||||||
prt-get.
|
prt-get.
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,11 @@ prtdir /usr/ports/opt
|
||||||
### log options:
|
### log options:
|
||||||
# writelog enabled # (enabled|disabled)
|
# writelog enabled # (enabled|disabled)
|
||||||
# logmode overwrite # (append|overwrite)
|
# logmode overwrite # (append|overwrite)
|
||||||
# rm_on_success no # (yes|no)
|
# rmlog_on_success no # (yes|no)
|
||||||
|
# rmlog_on_uninst no # (yes|no)
|
||||||
logfile /var/log/pkgbuild/%n.log
|
logfile /var/log/pkgbuild/%n.log
|
||||||
# path, %p=path to port dir, %n=port name
|
# %n=port name, %v=version, %r=release
|
||||||
# %v=version, %r=release
|
# %p=path to repository
|
||||||
|
|
||||||
### print README information:
|
### print README information:
|
||||||
# readme verbose # (verbose|compact|disabled)
|
# readme verbose # (verbose|compact|disabled)
|
||||||
|
|
|
@ -30,6 +30,7 @@ Configuration::Configuration( const std::string& configFile,
|
||||||
m_writeLog( false ),
|
m_writeLog( false ),
|
||||||
m_appendLog( false ),
|
m_appendLog( false ),
|
||||||
m_removeLogOnSuccess( false ),
|
m_removeLogOnSuccess( false ),
|
||||||
|
m_removeLogOnUninst( false ),
|
||||||
m_readmeMode( VERBOSE_README ),
|
m_readmeMode( VERBOSE_README ),
|
||||||
m_runScripts( false ),
|
m_runScripts( false ),
|
||||||
m_preferHigher( false ),
|
m_preferHigher( false ),
|
||||||
|
@ -85,6 +86,11 @@ bool Configuration::removeLogOnSuccess() const
|
||||||
return m_removeLogOnSuccess;
|
return m_removeLogOnSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Configuration::removeLogOnUninst() const
|
||||||
|
{
|
||||||
|
return m_removeLogOnUninst;
|
||||||
|
}
|
||||||
|
|
||||||
string Configuration::logFilePattern() const
|
string Configuration::logFilePattern() const
|
||||||
{
|
{
|
||||||
return m_logFilePattern;
|
return m_logFilePattern;
|
||||||
|
@ -191,6 +197,13 @@ void Configuration::parseLine(const string& line, bool prepend)
|
||||||
} else if ( s == "no" ) {
|
} else if ( s == "no" ) {
|
||||||
m_removeLogOnSuccess = false;
|
m_removeLogOnSuccess = false;
|
||||||
}
|
}
|
||||||
|
} else if ( startsWithNoCase( s, "rmlog_on_uninst" ) ) {
|
||||||
|
s = stripWhiteSpace( s.replace( 0, 15, "" ) );
|
||||||
|
if ( s == "yes" ) {
|
||||||
|
m_removeLogOnUninst = true;
|
||||||
|
} else if ( s == "no" ) {
|
||||||
|
m_removeLogOnUninst = false;
|
||||||
|
}
|
||||||
} else if ( startsWithNoCase( s, "readme" ) ) {
|
} else if ( startsWithNoCase( s, "readme" ) ) {
|
||||||
s = stripWhiteSpace( s.replace( 0, 6, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 6, "" ) );
|
||||||
if ( s == "compact" ) {
|
if ( s == "compact" ) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
bool writeLog() const;
|
bool writeLog() const;
|
||||||
bool appendLog() const;
|
bool appendLog() const;
|
||||||
bool removeLogOnSuccess() const;
|
bool removeLogOnSuccess() const;
|
||||||
|
bool removeLogOnUninst() const;
|
||||||
std::string logFilePattern() const;
|
std::string logFilePattern() const;
|
||||||
|
|
||||||
const std::list< std::pair<std::string, std::string> >& rootList() const;
|
const std::list< std::pair<std::string, std::string> >& rootList() const;
|
||||||
|
@ -71,6 +72,7 @@ private:
|
||||||
bool m_writeLog;
|
bool m_writeLog;
|
||||||
bool m_appendLog;
|
bool m_appendLog;
|
||||||
bool m_removeLogOnSuccess;
|
bool m_removeLogOnSuccess;
|
||||||
|
bool m_removeLogOnUninst;
|
||||||
|
|
||||||
ReadmeMode m_readmeMode;
|
ReadmeMode m_readmeMode;
|
||||||
|
|
||||||
|
|
|
@ -1927,12 +1927,17 @@ void PrtGet::remove()
|
||||||
{
|
{
|
||||||
assertMinArgCount(1);
|
assertMinArgCount(1);
|
||||||
|
|
||||||
|
bool needRepo = false;
|
||||||
list<string> removed;
|
list<string> removed;
|
||||||
list<string> failed;
|
list<string> failed;
|
||||||
list<string> notInstalled;
|
list<string> notInstalled;
|
||||||
|
|
||||||
if ( m_parser->isTest() ) {
|
if ( m_parser->isTest() ) {
|
||||||
cout << "*** " << m_appName << ": test mode" << endl;
|
cout << "*** " << m_appName << ": test mode" << endl;
|
||||||
|
} else if ( m_config->removeLogOnUninst()
|
||||||
|
&& m_config->logFilePattern().find("%p") != string::npos ) {
|
||||||
|
needRepo = true;
|
||||||
|
initRepo();
|
||||||
}
|
}
|
||||||
|
|
||||||
string command = InstallTransaction::PKGRM_DEFAULT_COMMAND;
|
string command = InstallTransaction::PKGRM_DEFAULT_COMMAND;
|
||||||
|
@ -1944,20 +1949,48 @@ void PrtGet::remove()
|
||||||
list<char*>::const_iterator it = args.begin();
|
list<char*>::const_iterator it = args.begin();
|
||||||
for ( ; it != args.end(); ++it ) {
|
for ( ; it != args.end(); ++it ) {
|
||||||
if (m_pkgDB->isInstalled(*it)) {
|
if (m_pkgDB->isInstalled(*it)) {
|
||||||
// TODO: prettify
|
string rm_args = "";
|
||||||
string args = "";
|
|
||||||
if (m_parser->installRoot() != "") {
|
if (m_parser->installRoot() != "") {
|
||||||
args = "-r " + m_parser->installRoot() + " ";
|
rm_args = "-r " + m_parser->installRoot() + " ";
|
||||||
}
|
}
|
||||||
args += (m_parser->pkgrmArgs() + " " + *it);
|
rm_args += (m_parser->pkgrmArgs() + " " + *it);
|
||||||
|
|
||||||
Process proc(command, args);
|
Process proc(command, rm_args);
|
||||||
if (m_parser->isTest() || proc.executeShell() == 0) {
|
if (m_parser->isTest() || proc.executeShell() == 0) {
|
||||||
removed.push_back(*it);
|
removed.push_back(*it);
|
||||||
if (m_locker.isLocked(*it)) {
|
if (m_locker.isLocked(*it)) {
|
||||||
m_locker.unlock(*it);
|
m_locker.unlock(*it);
|
||||||
m_locker.store();
|
m_locker.store();
|
||||||
}
|
}
|
||||||
|
if (m_config->removeLogOnUninst() && !m_parser->isTest()) {
|
||||||
|
string rm_logFile = m_config->logFilePattern();
|
||||||
|
bool doneSubs=false;
|
||||||
|
const string pkgname = *it;
|
||||||
|
StringHelper::replaceAll( rm_logFile, "%n", pkgname );
|
||||||
|
const string rm_ver = m_pkgDB->getPackageVersion( pkgname );
|
||||||
|
size_t pos = rm_ver.find_last_of('-');
|
||||||
|
if (pos != string::npos) {
|
||||||
|
const string rm_v = rm_ver.substr(0,pos);
|
||||||
|
const string rm_r = rm_ver.substr(pos+1);
|
||||||
|
StringHelper::replaceAll( rm_logFile, "%v", rm_v );
|
||||||
|
StringHelper::replaceAll( rm_logFile, "%r", rm_r );
|
||||||
|
}
|
||||||
|
if (! needRepo) {
|
||||||
|
doneSubs=true;
|
||||||
|
} else if (m_repo->getPackage( pkgname )) {
|
||||||
|
StringHelper::replaceAll( rm_logFile, "%p",
|
||||||
|
m_repo->getPackage( pkgname )->path() );
|
||||||
|
doneSubs=true;
|
||||||
|
} else {
|
||||||
|
cout << "Warning: unable to determine the logfile for "
|
||||||
|
+ pkgname + "; log removal aborted." << endl;
|
||||||
|
}
|
||||||
|
struct stat slF;
|
||||||
|
if ( doneSubs && stat(rm_logFile.c_str(), &slF)==0
|
||||||
|
&& (slF.st_mode & S_IFMT)==S_IFREG ) {
|
||||||
|
unlink( rm_logFile.c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
failed.push_back(*it);
|
failed.push_back(*it);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue