Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » How to move packages from bazaar to github repo and UppHub
Re: How to move packages from bazaar to github repo and UppHub [message #56288 is a reply to message #56223] Wed, 17 February 2021 12:07 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Just a little followup inspiration (and backup), here is the simple code I have used to move all Libraries4U modules:

#include <Core/Core.h>

using namespace Upp;

void Cd(const char *dir)
{
	RLOG("cd " << dir);
	chdir(dir);
	RLOG("current dir: " << GetCurrentDirectory());
}

void BaseDir()
{
	Cd(GetHomeDirFile("xxx"));
}

void Syx(const char *cmd)
{
	RLOG(cmd);
	system(cmd);
}

JsonArray json;

void Do(String nest, String package = "", String examples = "")
{
	package = Nvl(package, nest);
	BaseDir();
	Syx("rm -rf " + nest);
	Syx("cp -r ultimatepp " + nest);
	Cd(nest);
	Syx("git filter-branch --prune-empty --subdirectory-filter bazaar/" + package + " master");
	Syx("mkdir -p " + package);
	Syx("git mv -k * " + package);
	Vector<String> x = Split(examples, ';');
	if(x.GetCount()) {
		Syx("mkdir examples");
		for(String p : x)
			Syx("cp -r ../ultimatepp/bazaar/" + p + " examples");
		Syx("git add examples");
	}
	Syx("git commit -m \"Reorganized for UppHub\"");
	
	String repo = "https://github.com/Libraries4U/" + nest + ".git";

	Syx("git branch -M main");
	Syx("git remote set-url origin " + repo);
	Syx("git push -u -f https://" + LoadFile(GetHomeDirFile("gitk")) + "@github.com/Libraries4U/" + nest + ".git");
	json << Json("name", nest)
	            ("packages", JsonArray() << package)
	            ("description", "")
	            ("repository", repo)
	            ("status", "stable")
	            ("category", "")
	            ("readme", "https://raw.githubusercontent.com/Libraries4U/" + nest + "/main/README.md")
	;
}

CONSOLE_APP_MAIN
{
	StdLogSetup(LOG_COUT|LOG_FILE);
	
	BaseDir();
	chdir("ultimatepp");
	Syx("git pull");
	Do("Functions4U", "", "Functions4U_Demo");
	Do("SysInfo", "", "SysInfo_demo_console;SysInfo_demo_gui");
	Do("Controls4U", "", "Controls4U_Demo");
	Do("STEM4U", "", "STEM4U_DemoTest");
	Do("matio", "plugin/matio");
	Do("sundials", "plugin/sundials");
	Do("GLCanvas", "", "GLCanvas_demo");
	Do("Surface");
	Do("OfficeAutomation", "", "OfficeAutomation_demo_console");
	Do("assimp", "plugin/assimp");
	
	RLOG("List:");
	RLOG(AsJSON(ParseJSON(~json), true));
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Library for Selenium WebDriver
Next Topic: SurfaceCtrl, 3D viewer of Multiple file format and Surface class
Goto Forum:
  


Current Time: Sun May 05 15:30:57 CEST 2024

Total time taken to generate the page: 0.01697 seconds