SET(LIBZYPP_MAJOR "17")
SET(LIBZYPP_COMPATMINOR "2")
SET(LIBZYPP_MINOR "5")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_PATCH "2")
#
-# LAST RELEASED: 17.5.1 (2)
+# LAST RELEASED: 17.5.2 (2)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
-------------------------------------------------------------------
+Thu Jul 19 12:57:21 CEST 2018 - ma@suse.de
+
+- Prevent the system from sleeping during a commit
+ (fixes openSUSE/zypper#135)
+- RepoManager: Explicitly request repo2solv to generate application
+ pseudo packages.
+- version 17.5.2 (2)
+
+-------------------------------------------------------------------
Wed Jul 18 10:55:49 CEST 2018 - ma@suse.de
- libzypp-devel should not require cmake (bsc#1101349)
ServiceInfo.cc
Signature.cc
SrcPackage.cc
+ ShutdownLock.cc
SysContent.cc
Target.cc
TmpPath.cc
- void ExternalProgram::start_program( const char *const *argv,
+ void ExternalProgram::start_program(const char *const *argv,
const Environment & environment,
Stderr_Disposition stderr_disp,
int stderr_fd,
bool default_locale,
- const char * root )
+ const char * root , bool switch_pgid)
{
pid = -1;
_exitStatus = 0;
}
else
{
+ if ( switch_pgid )
+ setpgid( 0, 0);
renumber_fd (to_external[0], 0); // set new stdin
::close(from_external[0]); // Belongs to father process
#include <string>
#include <vector>
+#include "zypp/APIConfig.h"
#include "zypp/base/ExternalDataSource.h"
#include "zypp/Pathname.h"
/** Remember execution errors like failed fork/exec. */
std::string _execError;
+ protected:
+
void start_program (const char *const *argv, const Environment & environment,
Stderr_Disposition stderr_disp = Normal_Stderr,
int stderr_fd = -1, bool default_locale = false,
- const char* root = NULL);
+ const char* root = NULL, bool switch_pgid = false);
};
std::string _buffer;
};
+ /** ExternalProgram extended to change the progress group ID after forking.
+ * \see \ref ExternalProgram
+ */
+ class ZYPP_LOCAL ExternalProgramWithSeperatePgid : public ExternalProgram
+ {
+ public:
+ ExternalProgramWithSeperatePgid (const char *const *argv,
+ Stderr_Disposition stderr_disp = Normal_Stderr,
+ int stderr_fd = -1, bool default_locale = false,
+ const Pathname& root = "") : ExternalProgram()
+ {
+ start_program( argv, Environment(), stderr_disp, stderr_fd, default_locale, root.c_str(), true );
+ }
+
+ };
+
} // namespace zypp
#endif // ZYPP_EXTERNALPROGRAM_H
cmd.push_back( "-o" );
cmd.push_back( solvfile.asString() );
cmd.push_back( "-X" ); // autogenerate pattern from pattern-package
+ cmd.push_back( "-A" ); // autogenerate application pseudo packages
if ( repokind == RepoType::RPMPLAINDIR )
{
--- /dev/null
+#include "ShutdownLock_p.h"
+
+#include "zypp/ExternalProgram.h"
+#include <iostream>
+
+zypp::ShutdownLock::ShutdownLock(const std::string &reason)
+{
+ try {
+
+ std::string whyStr = str::form("--why=%s", reason.c_str());
+
+ const char* argv[] =
+ {
+ "/usr/bin/systemd-inhibit",
+ "--what=sleep:shutdown:idle",
+ "--who=zypp",
+ "--mode=block",
+ whyStr.c_str(),
+ "/usr/bin/cat",
+ NULL
+ };
+ _prog = shared_ptr<ExternalProgramWithSeperatePgid>( new ExternalProgramWithSeperatePgid( argv, ExternalProgram::Discard_Stderr ) );
+ } catch (...) {
+ }
+}
+
+zypp::ShutdownLock::~ShutdownLock()
+{
+ if (_prog) {
+ _prog->kill();
+ }
+}
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ShutdownLock_p.h
+ *
+*/
+
+#ifndef ZYPP_SHUTDOWNLOCK_P_H_INCLUDED
+#define ZYPP_SHUTDOWNLOCK_P_H_INCLUDED
+
+#include <string>
+
+#include "zypp/APIConfig.h"
+#include "zypp/base/PtrTypes.h"
+
+namespace zypp
+{
+
+class ExternalProgramWithSeperatePgid;
+
+/**
+ * Attempts to create a lock to prevent the system
+ * from going into hibernate/shutdown. The lock is automatically
+ * released when the object is destroyed.
+ */
+class ZYPP_LOCAL ShutdownLock
+{
+public:
+ ShutdownLock( const std::string &reason );
+ ~ShutdownLock();
+
+private:
+ shared_ptr<ExternalProgramWithSeperatePgid> _prog;
+
+};
+
+}
+
+
+#endif
#include "zypp/RepoStatus.h"
#include "zypp/ExternalProgram.h"
#include "zypp/Repository.h"
+#include "zypp/ShutdownLock_p.h"
#include "zypp/ResFilters.h"
#include "zypp/HistoryLog.h"
{
// ----------------------------------------------------------------- //
ZYppCommitPolicy policy_r( policy_rX );
+ ShutdownLock lck("Zypp commit running.");
// Fake outstanding YCP fix: Honour restriction to media 1
// at installation, but install all remaining packages if post-boot.
Selectable::picklist_size_type Selectable::picklistPos( const sat::Solvable & solv_r ) const
{
- picklist_size_type idx = picklist_size_type(-1);
+ picklist_size_type idx = picklist_size_type(0);
for ( const auto & pi : picklist() )
{
if ( pi == solv_r )
- return ++idx;
+ return idx;
+ ++idx;
}
return picklistNoPos;
}