Task #3760
closedMove management/nfd-* to mgmt/nfd/
100%
Description
Move management/nfd-* files to mgmt/nfd/*.
This change should be made backwards-compatible by adding transitional headers in old location.
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - Status changed from New to In Progress
 - Assignee set to Junxiao Shi
 
      
      Updated by Junxiao Shi about 9 years ago
      
    
    https://gerrit.named-data.net/3166 patchset1 moves the files without backwards compatibility.
These are the commands used for all the changes:
mkdir src/mgmt/nfd
git mv src/management/* src/mgmt/nfd/
cd src/mgmt/nfd
for F in $(ls nfd-*); do git mv $F ${F/nfd-/}; done
sed -i 's/NDN_MANAGEMENT_NFD_/NDN_MGMT_NFD_/' *.hpp
sed -i 's/"nfd-/"/' *
sed -i 's|"\.\./|"../../|' *
sed -i 's|"\.\./\.\./mgmt/|"../|' *
cd ../../..
rmdir src/management
mkdir tests/unit-tests/mgmt/nfd
git mv tests/unit-tests/management/* tests/unit-tests/mgmt/nfd
cd tests/unit-tests/mgmt/nfd
for F in $(ls nfd-*); do git mv $F ${F/nfd-/}; done
sed -i 's/MANAGEMENT_NFD_/MGMT_NFD_/' *.hpp
sed -i 's/"nfd-/"/' *
sed -i 's|"\.\./|"../../|' *
cd ../../../..
rmdir tests/unit-tests/management
for F in $(grep -lr 'management/nfd-' src/ tests/); do sed -i 's|management/nfd-|mgmt/nfd/|' $F; done
cd tests/unit-tests/mgmt/nfd
for F in *.t.cpp; do gawk '
BEGIN {
  depth = 0
}
function beginTestSuite(name) {
  ++depth
  testSuites[depth] = name
  if (name == "Management") {
    print "BOOST_AUTO_TEST_SUITE(Mgmt)"
    print "BOOST_AUTO_TEST_SUITE(Nfd)"
  }
  else if (name ~ "ManagementNfd") {
    print "BOOST_AUTO_TEST_SUITE(Mgmt)"
    print "BOOST_AUTO_TEST_SUITE(Nfd)"
    print "BOOST_AUTO_TEST_SUITE(Test" substr(name, 14, length(name)) ")"
  }
  else {
    print $0
  }
}
$0 ~ "BOOST_AUTO_TEST_SUITE_END" {
  name = testSuites[depth]
  if (name == "Management") {
    print "BOOST_AUTO_TEST_SUITE_END() // Nfd"
    print "BOOST_AUTO_TEST_SUITE_END() // Mgmt"
  }
  else if (name ~ "ManagementNfd") {
    print "BOOST_AUTO_TEST_SUITE_END() // Test" substr(name, 14, length(name))
    print "BOOST_AUTO_TEST_SUITE_END() // Nfd"
    print "BOOST_AUTO_TEST_SUITE_END() // Mgmt"
  }
  else {
    print "BOOST_AUTO_TEST_SUITE_END() // " name
  }
  --depth
  next
}
$0 ~ "BOOST_AUTO_TEST_SUITE" {
  split($0, tokens, "(")
  split(tokens[2], tokens, ")")
  beginTestSuite(tokens[1])
  next
}
$0 ~ "BOOST_FIXTURE_TEST_SUITE" {
  split($0, tokens, "(")
  split(tokens[2], tokens, ",")
  beginTestSuite(tokens[1])
  next
}
{
  print
}
' $F > /tmp/1.txt; mv /tmp/1.txt $F; done
sed -i 's/TestNfd/Test/' *.t.cpp
cd ../../../..
In addition, a separate script is executed to update license boilerplate.
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - % Done changed from 0 to 40
 
https://gerrit.named-data.net/3166 patchset2 introduces compatibility headers, created by the following commands:
cd src/mgmt/nfd
mkdir ../../management
for F in *.hpp; do
  echo '/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
 * Copyright (c) 2013-2016 Regents of the University of California.
 *
 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
 *
 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 *
 * You should have received copies of the GNU General Public License and GNU Lesser
 * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
 */
/** \file
 *  \deprecated Use mgmt/nfd/'$F'
 */
#include "../mgmt/nfd/'$F'"' > ../../management/nfd-$F
done
cd ../../..
This can be merged without notice period, because the change is fully backwards compatible.
I did not introduce a KEEP_DEPRECATED macro because testing whether another project will compile without deprecated headers is as simple as deleting those compatibility headers.
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - % Done changed from 40 to 60
 
https://gerrit.named-data.net/3191 changes #include lines in NFD. It's prepared with the following command:
for F in $(grep -lr 'management/nfd-' core/ daemon/ rib/ tools/ tests/); do
  sed -i 's|<ndn-cxx/management/nfd-|<ndn-cxx/mgmt/nfd/|' $F
done
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - Status changed from In Progress to Code review
 - % Done changed from 60 to 100
 
NLSR https://gerrit.named-data.net/3196
These projects do not contain string ndn-cxx/management so they are unaffected: ndn-tools ndn-traffic-generator repo-ng ndn-group-encrypt ChronoChat ChronoSync ndns.
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - Status changed from Code review to Closed